OLD | NEW |
(Empty) | |
| 1 var backgroundPage = chrome.extension.getBackgroundPage(); |
| 2 var require = backgroundPage.require; |
| 3 var Prefs = require("prefs").Prefs; |
| 4 var Utils = require("utils").Utils; |
| 5 |
| 6 function init() |
| 7 { |
| 8 // Set up page title |
| 9 var titleId = (backgroundPage.isFirstRun ? "firstRun_title_install" : "firstRu
n_title_update"); |
| 10 var pageTitle = chrome.i18n.getMessage(titleId); |
| 11 document.title = document.getElementById("title").textContent = pageTitle; |
| 12 |
| 13 // Set up URLs |
| 14 var versionID = chrome.app.getDetails().version.split(".").slice(0, 2).join(""
); |
| 15 setLinks("improvementsFeature", "https://adblockplus.org/releases/adblock-plus
-" + versionID + "-for-google-chrome-released"); |
| 16 setLinks("acceptableAdsExplanation", getDocLink("acceptable_ads"), |
| 17 getDocLink("acceptable_ads", "criteria"), backgroundPage.openOptions)
; |
| 18 } |
| 19 window.addEventListener("load", init, false); |
| 20 |
| 21 function setLinks(id) |
| 22 { |
| 23 var element = document.getElementById(id); |
| 24 if (!element) |
| 25 return; |
| 26 |
| 27 var links = element.getElementsByTagName("a"); |
| 28 for (var i = 0; i < links.length; i++) |
| 29 { |
| 30 if (typeof arguments[i + 1] == "string") |
| 31 { |
| 32 links[i].href = arguments[i + 1]; |
| 33 links[i].setAttribute("target", "_blank"); |
| 34 } |
| 35 else if (typeof arguments[i + 1] == "function") |
| 36 { |
| 37 links[i].href = "javascript:void(0);"; |
| 38 links[i].addEventListener("click", arguments[i + 1], false); |
| 39 } |
| 40 } |
| 41 } |
| 42 |
| 43 function getDocLink(page, anchor) |
| 44 { |
| 45 return Prefs.documentation_link |
| 46 .replace(/%LINK%/g, page) |
| 47 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : ""
); |
| 48 } |
OLD | NEW |