misc fixes
This commit is contained in:
parent
07d14ec5a3
commit
fbee6400dc
|
@ -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 => {
|
||||
|
|
|
@ -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 = "\
|
||||
<a href='${this.url}' \
|
||||
<a href='${this.url}' target='_blank' \
|
||||
style='display: block; border: 2px solid #222222; border-radius: 4px; margin-top: 12px; color:#222222; padding: 8px;'> \
|
||||
<p style='margin: 0; font-size: 14px; font-weight: bold;'>${this.name} →</p> \
|
||||
<p style='margin: 0; font-size: 12px;'>${this.desc}</p> \
|
||||
|
@ -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]));
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue