diff --git a/build.sh b/build.sh index a9bee3f..d05445e 100755 --- a/build.sh +++ b/build.sh @@ -1,10 +1,10 @@ -#!/bin/bash - -mkdir -p build; rm -rf build/* -mkdir -p dist; rm -rf dist/* -cp -r src build/firefox -cp -r src build/chrome -node mixin.js firefox/manifest.json build/firefox/manifest.json -cd build/chrome; zip -r ../../dist/chrome.zip *; cd ../.. -cd build/firefox; zip -r ../../dist/firefox.xpi *; cd ../.. +#!/bin/bash + +mkdir -p build; rm -rf build/* +mkdir -p dist; rm -rf dist/* +cp -r src build/firefox +cp -r src build/chrome +node mixin.js firefox/manifest.json build/firefox/manifest.json +cd build/chrome; zip -r ../../dist/chrome.zip *; cd ../.. +cd build/firefox; zip -r ../../dist/firefox.xpi *; cd ../.. rm -rf build \ No newline at end of file diff --git a/src/manifest.json b/src/manifest.json index 6ac1f69..7e7df09 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extensionName__", "description": "__MSG_extensionDescription__", - "version": "3.3.7", + "version": "3.4.0", "homepage_url": "https://tosdr.org", "background": { "scripts": [ diff --git a/src/popup/js/popup.js b/src/popup/js/popup.js index b555ddb..3854239 100644 --- a/src/popup/js/popup.js +++ b/src/popup/js/popup.js @@ -1,135 +1,153 @@ -/* global window, $, jQuery, getLiveServiceDetails, getRatingText, -getTweetText, browser, FALLBACK_SHIELDS, log */ -/* eslint-disable indent */ - -function escapeHTML(unsafe) { - return (`${unsafe}`) - .replace(/&(?!amp;)/g, '&') - .replace(/<(?!lt;)/g, '<') - .replace(/>(?!gt;)/g, '>') - .replace(/"(?!quot;)/g, '"') - .replace(/'(?!#039;)/g, '''); -} - -jQuery(() => { - function tosdrPoint(service, dataPoint) { - let badge; - let icon; - // let sign; - if (dataPoint) { - if (dataPoint.tosdr.point === 'good') { - badge = 'badge-success'; - icon = 'thumbs-up'; - // sign = '+'; - } else if (dataPoint.tosdr.point === 'bad') { - badge = 'badge-warning'; - icon = 'thumbs-down'; - // sign = '-'; - } else if (dataPoint.tosdr.point === 'blocker') { - badge = 'badge-important'; - icon = 'times'; - // sign = '×'; - } else if (dataPoint.tosdr.point === 'neutral') { - badge = 'badge-secondary'; - icon = 'asterisk'; - // sign = '→'; - } else { - badge = ''; - icon = 'question'; - // sign = '?'; - } - const pointText = dataPoint.description || ''; - - // Extract links from text - const taggedText = pointText.split(/(<\/?\w+(?:(?:\s+\w+(?:\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>)/gim); - $(`#popup-point-${service.id}-${dataPoint.id}`) - .append($('
')); - if (taggedText.length > 1) { - taggedText.forEach((t) => { - $(`#popup-point-${service.id}-${dataPoint.id} p`).append(t); - }); - } else { - $(`#popup-point-${service.id}-${dataPoint.id} p`).text(pointText); - } - } - } - const serviceUrl = window.location.hash.substr(1); - function updatePopup() { - $('.loading').show(); - getLiveServiceDetails(serviceUrl).then((service) => { - log('service', service); - browser.storage.local.get('settings').then((items) => { - $('#service_url').attr('href', `https://tosdr.org/en/service/${service.id}`); - $('#service_class').addClass(service.class); - if (service.class !== false) { - $('#service_class').text(`Grade ${service.class}`); - $('#ratingText').text(getRatingText(service.class)); - } else { - $('#service_class').text('No Grade Yet'); - $('#service_class').remove(); - $('#ratingText').text(getRatingText(service.class)); - } - - // Points - service.points.forEach((p) => { - $('.tosdr-points').append($('
')); + if (taggedText.length > 1) { + taggedText.forEach((t) => { + $(`#popup-point-${service.id}-${dataPoint.id} p`).append(t); + }); + } else { + $(`#popup-point-${service.id}-${dataPoint.id} p`).text(pointText); + } + } + } + const serviceUrl = window.location.hash.substr(1); + function updatePopup() { + $('.loading').show(); + getLiveServiceDetails(serviceUrl).then((service) => { + log('service', service); + browser.storage.local.get('settings').then((items) => { + $('#service_url').attr('href', `https://tosdr.org/en/service/${service.id}`); + $('#service_class').addClass(service.class); + if (service.class !== false) { + $('#service_class').text(`Grade ${service.class}`); + $('#ratingText').text(getRatingText(service.class)); + } else { + $('#service_class').text('No Grade Yet'); + $('#service_class').remove(); + $('#ratingText').text(getRatingText(service.class)); + } + + // Points + service.points.forEach((p) => { + $('.tosdr-points').append($('