| Index: html/static/js/firstRun.js |
| =================================================================== |
| --- a/html/static/js/firstRun.js |
| +++ b/html/static/js/firstRun.js |
| @@ -104,20 +104,19 @@ |
| // Map message ID to HTML element ID |
| var mapping = { |
| "title-main": "first-run-title-install", |
| - "i18n-features-heading": "first-run-features-heading", |
| - "i18n-feature-betterSurfing": "first-run-feature-betterSurfing", |
| - "i18n-feature-videoAds": "first-run-feature-videoAds", |
| "share-text1": "first-run-share1", |
| "share-text2": "first-run-share2", |
| "share-donate": "first-run-share2-donate", |
| - "share2-connection": "first-run-share2-or" |
| + "share2-connection": "first-run-share2-or", |
| + "aa-title": "first-run-aa-title", |
| + "aa-text": "first-run-aa-text" |
| }; |
| document.title = AdblockPlus.getMessage("first-run", "first-run-title-install"); |
| for (var i in mapping) |
| { |
| var element = document.getElementById(i); |
| - element.innerText = AdblockPlus.getMessage("first-run", mapping[i]); |
| + element.innerHTML = AdblockPlus.getMessage("first-run", mapping[i]); |
|
Felix Dahlke
2014/07/24 08:04:22
This would introduce an XSS vulnerability, I'm afr
|
| } |
| } |
| @@ -131,9 +130,35 @@ |
| initTranslations(); |
| initSocialLinks(variant); |
| + setLinks("aa-text", getDocLink("acceptable_ads_criteria"), "index.html"); |
| var donateLink = document.getElementById("share-donate"); |
| donateLink.href = getDocLink("donate") + "&variant=" + variant; |
| } |
| +function setLinks(id) |
| +{ |
| + var element = document.getElementById(id); |
| + if (!element) |
| + { |
| + return; |
| + } |
| + |
| + var links = element.getElementsByTagName("a"); |
| + |
| + for (var i = 0; i < links.length; i++) |
|
Felix Dahlke
2014/07/24 08:04:22
Please also check that |i < arguments.length - 1|
|
| + { |
| + if (typeof arguments[i + 1] == "string") |
|
Felix Dahlke
2014/07/24 08:04:22
It'd be cleaner to put arguments[i + 1] in a tempo
|
| + { |
| + links[i].href = arguments[i + 1]; |
| + links[i].setAttribute("target", "_blank"); |
| + } |
| + else if (typeof arguments[i + 1] == "function") |
| + { |
| + links[i].href = "javascript:void(0);"; |
| + links[i].addEventListener("click", arguments[i + 1], false); |
| + } |
| + } |
| +} |
| + |
| window.addEventListener("load", init); |