| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 | 318 |
| 319 function onDOMLoaded() | 319 function onDOMLoaded() |
| 320 { | 320 { |
| 321 var recommendationTemplate = document.querySelector("#recommend-list-table t emplate"); | 321 var recommendationTemplate = document.querySelector("#recommend-list-table t emplate"); |
| 322 var popularText = ext.i18n.getMessage("options_popular"); | 322 var popularText = ext.i18n.getMessage("options_popular"); |
| 323 recommendationTemplate.content.querySelector(".popular").textContent = popul arText; | 323 recommendationTemplate.content.querySelector(".popular").textContent = popul arText; |
| 324 var languagesTemplate = document.querySelector("#all-lang-table template"); | 324 var languagesTemplate = document.querySelector("#all-lang-table template"); |
| 325 var buttonText = ext.i18n.getMessage("options_button_add"); | 325 var buttonText = ext.i18n.getMessage("options_button_add"); |
| 326 languagesTemplate.content.querySelector(".button-add span").textContent = bu ttonText; | 326 languagesTemplate.content.querySelector(".button-add span").textContent = bu ttonText; |
| 327 | 327 |
| 328 updateShareLink(); | |
| 329 populateLists(); | 328 populateLists(); |
| 330 | 329 |
| 331 var tabList = document.querySelectorAll("#main-navigation-tabs li"); | 330 var tabList = document.querySelectorAll("#main-navigation-tabs li"); |
| 332 for (var i = 0; i < tabList.length; i++) | 331 for (var i = 0; i < tabList.length; i++) |
| 333 { | 332 { |
| 334 tabList[i].addEventListener("click", function(e) | 333 tabList[i].addEventListener("click", function(e) |
| 335 { | 334 { |
| 336 document.body.dataset.tab = e.currentTarget.dataset.show; | 335 document.body.dataset.tab = e.currentTarget.dataset.show; |
| 337 }, false); | 336 }, false); |
| 338 } | 337 } |
| 339 | 338 |
| 340 function onFindLanguageKeyUp() | 339 function onFindLanguageKeyUp() |
| 341 { | 340 { |
| 342 var searchStyle = E("search-style"); | 341 var searchStyle = E("search-style"); |
| 343 if (!this.value) | 342 if (!this.value) |
| 344 searchStyle.innerHTML = ""; | 343 searchStyle.innerHTML = ""; |
| 345 else | 344 else |
| 346 searchStyle.innerHTML = "#all-lang-table li:not([data-search*=\"" + this .value.toLowerCase() + "\"]) { display: none; }"; | 345 searchStyle.innerHTML = "#all-lang-table li:not([data-search*=\"" + this .value.toLowerCase() + "\"]) { display: none; }"; |
| 347 } | 346 } |
| 348 | 347 |
| 349 // Update version number in navigation sidebar | 348 // Initialize navigation sidebar |
| 350 ext.backgroundPage.sendMessage( | 349 ext.backgroundPage.sendMessage( |
| 351 { | 350 { |
| 352 method: "app.get", | 351 type: "app.get", |
| 353 what: "addonVersion" | 352 what: "addonVersion" |
| 354 }, | 353 }, |
| 355 function(addonVersion) | 354 function(addonVersion) |
| 356 { | 355 { |
| 357 E("abp-version").textContent = addonVersion; | 356 E("abp-version").textContent = addonVersion; |
| 358 }); | 357 }); |
| 359 | 358 getDocLink("releases", function(link) |
| 359 { | |
| 360 E("link-version").setAttribute("href", link); | |
| 361 }); | |
| 362 | |
| 363 getDocLink("contribute", function(link) | |
| 364 { | |
| 365 document.querySelector("#tab-contribute a").setAttribute("href", link); | |
| 366 }); | |
| 367 | |
| 368 updateShareLink(); | |
| 369 | |
| 370 // Initialize interactive UI elements | |
| 360 var placeholderValue = ext.i18n.getMessage("options_dialog_language_find"); | 371 var placeholderValue = ext.i18n.getMessage("options_dialog_language_find"); |
| 361 E("find-language").setAttribute("placeholder", placeholderValue); | 372 E("find-language").setAttribute("placeholder", placeholderValue); |
| 362 E("add-blocking-list").addEventListener("click", function() | 373 E("add-blocking-list").addEventListener("click", function() |
| 363 { | 374 { |
| 364 openDialog("customlist"); | 375 openDialog("customlist"); |
| 365 }, false); | 376 }, false); |
| 366 E("add-website-language").addEventListener("click", function() | 377 E("add-website-language").addEventListener("click", function() |
| 367 { | 378 { |
| 368 openDialog("language"); | 379 openDialog("language"); |
| 369 }, false); | 380 }, false); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 { | 624 { |
| 614 // TODO: modify "share" link accordingly | 625 // TODO: modify "share" link accordingly |
| 615 }); | 626 }); |
| 616 } | 627 } |
| 617 | 628 |
| 618 function E(id) | 629 function E(id) |
| 619 { | 630 { |
| 620 return document.getElementById(id); | 631 return document.getElementById(id); |
| 621 } | 632 } |
| 622 | 633 |
| 634 function getDocLink(link, callback) | |
| 635 { | |
| 636 ext.backgroundPage.sendMessage({ | |
|
saroyanm
2015/06/29 15:59:17
nit: please place the opening curly bracket in the
Thomas Greiner
2015/06/29 16:34:11
I changed it but seeing that it's done differently
saroyanm
2015/06/29 18:40:41
Good point, will create ticket for that.
| |
| 637 type: "app.get", | |
| 638 what: "doclink", | |
| 639 link: link | |
| 640 }, callback); | |
| 641 } | |
| 642 | |
| 623 ext.onMessage.addListener(function(message) | 643 ext.onMessage.addListener(function(message) |
| 624 { | 644 { |
| 625 switch (message.type) | 645 switch (message.type) |
| 626 { | 646 { |
| 627 case "app.listen": | 647 case "app.listen": |
| 628 if (message.action == "addSubscription") | 648 if (message.action == "addSubscription") |
| 629 showAddSubscriptionDialog(message.args[0]); | 649 showAddSubscriptionDialog(message.args[0]); |
| 630 break; | 650 break; |
| 631 case "filters.listen": | 651 case "filters.listen": |
| 632 onFilterMessage(message.action, message.args[0]); | 652 onFilterMessage(message.action, message.args[0]); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 648 filter: ["added", "loaded", "removed"] | 668 filter: ["added", "loaded", "removed"] |
| 649 }); | 669 }); |
| 650 ext.backgroundPage.sendMessage( | 670 ext.backgroundPage.sendMessage( |
| 651 { | 671 { |
| 652 type: "subscriptions.listen", | 672 type: "subscriptions.listen", |
| 653 filter: ["added", "disabled", "homepage", "removed", "title"] | 673 filter: ["added", "disabled", "homepage", "removed", "title"] |
| 654 }); | 674 }); |
| 655 | 675 |
| 656 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 676 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 657 })(); | 677 })(); |
| OLD | NEW |