Index: options.js |
=================================================================== |
--- a/options.js |
+++ b/options.js |
@@ -33,6 +33,7 @@ |
var FilterNotifier = require("filterNotifier").FilterNotifier; |
var Prefs = require("prefs").Prefs; |
var Synchronizer = require("synchronizer").Synchronizer; |
+var Utils = require("utils").Utils; |
// Loads options from localStorage and sets UI elements accordingly |
function loadOptions() |
@@ -42,7 +43,9 @@ |
// Set links |
$("#acceptableAdsLink").attr("href", Prefs.subscriptions_exceptionsurl); |
- $("#acceptableAdsDocs").attr("href", Prefs.documentation_link.replace(/%LINK%/g, "acceptable_ads").replace(/%LANG%/g, require("utils").Utils.appLocale)); |
+ $("#acceptableAdsDocs").attr("href", Utils.getDocLink("acceptable_ads")); |
+ setLinks("filter-must-follow-syntax", "https://adblockplus.org/en/filters"); |
Wladimir Palant
2013/07/16 10:39:27
The link ID indeed exists already - "filterdoc".
|
+ setLinks("found-a-bug", "https://adblockplus.org/forum/viewforum.php?f=10"); |
// Add event listeners |
window.addEventListener("unload", unloadOptions, false); |
@@ -174,7 +177,7 @@ |
homepage: element.getAttribute("homepage") |
}; |
- var prefix = require("utils").Utils.checkLocalePrefixMatch(element.getAttribute("prefixes")); |
+ var prefix = Utils.checkLocalePrefixMatch(element.getAttribute("prefixes")); |
if (prefix) |
{ |
option.style.fontWeight = "bold"; |
@@ -616,3 +619,25 @@ |
document.getElementById("filterLists").appendChild(element); |
} |
+ |
+function setLinks(id) |
+{ |
+ var element = document.getElementById(id); |
+ if (!element) |
+ return; |
+ |
+ var links = element.getElementsByTagName("a"); |
+ for (var i = 0; i < links.length; i++) |
+ { |
+ if (typeof arguments[i + 1] == "string") |
+ { |
+ 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); |
+ } |
+ } |
+} |