diff --git a/background.js b/background.js index cdebb8d..bf5f0c2 100644 --- a/background.js +++ b/background.js @@ -19,7 +19,7 @@ function onStartup(){ var listUrl = result.betterSourceURL || DEFAULT_LIST_URL // Uncomment this when testing list changes locally - // listUrl = "/defaultlist.json" + listUrl = "/defaultlist.json" fetch(listUrl) .then(response => response.json()) .then(data => { diff --git a/contentscript.js b/contentscript.js index d95dc2b..58149b8 100644 --- a/contentscript.js +++ b/contentscript.js @@ -2,15 +2,9 @@ /* -IN PROGRESS: - -- List of alternatives should be loaded from a user-specified external source. Can be modified via options.html/options.js - TODO - - Pop-up should be formatted to look better. - - Pop-up should be dismissable (per URL / per domain). + - Pop-up should be dismissable (per URL / per domain). - Once dismissed, popup should not be shown on the same url/domain. Use cookies or localStorage for this. - - Since we're replacing innerHTML, we should protect against XSS attacks. - Fix and test the options UI - Test and fix for Chrome, Brave & Firefox @@ -20,7 +14,7 @@ const fillTemplate = function(templateString, templateVars){ } const altTemplate = "\ - \

${this.name} →

\

${this.desc}

\ @@ -50,6 +44,7 @@ function createRecommendedAlt(recommendedAlternative) { let alternativeCTA = document.createElement("a"); alternativeCTA.innerHTML = recommendedAlternative.name + " →"; alternativeCTA.setAttribute("href", recommendedAlternative.url); + alternativeCTA.setAttribute("target", "_blank"); alternativeCTA.setAttribute("style", "display: inline-block; padding: 12px 24px; background-color: #222222; color: #ffffff; border-radius: 4px;"); recommendedAlt.appendChild(betterBrandText); @@ -64,7 +59,8 @@ function showBetter(alternatives) { let betterdiv = document.createElement("div"); betterdiv.setAttribute("style", "background-color: #ffcc49; position: fixed; bottom: 10px; right: 10px; width: 300px; \ - box-shadow: 0px 10px 30px #222222; padding: 12px; text-align: center; font-size: 20px;") + box-shadow: 0px 10px 30px #222222; padding: 12px; text-align: center; font-size: 20px; \ + z-index: 20000;") betterdiv.appendChild(createRecommendedAlt(alternatives[0])); diff --git a/defaultlist.json b/defaultlist.json index 5a55816..65927d6 100644 --- a/defaultlist.json +++ b/defaultlist.json @@ -3,12 +3,12 @@ "urlPattern": "https?:\/\/(www.)?google.com\/chrome", "alternatives": [ { - "url": "https://mozilla.com", + "url": "https://getfirefox.com", "name": "Mozilla Firefox", "desc": "Firefox is open source, backed by the Mozilla Foundation" }, { - "url": "https://brave.org", + "url": "https://brave.com", "name": "Brave Browser", "desc": "Brave is open source, new-generation browser." } @@ -23,5 +23,15 @@ "desc": "An open network for secure, decentralized communication" } ] + }, + { + "urlPattern": "https:\/\/twitter.com\/i\/flow\/signup", + "alternatives": [ + { + "url": "https://https://fediverse.party/", + "name": "Fediverse", + "desc": "Decentralized like email" + } + ] } ] \ No newline at end of file