OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * |
| 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 |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ |
| 17 |
| 18 (function() |
| 19 { |
| 20 function onDOMLoaded() |
| 21 { |
| 22 initTabs(); |
| 23 initModal(); |
| 24 initWhitelist(); |
| 25 } |
| 26 |
| 27 function initTabs() |
| 28 { |
| 29 var showContent = function(tab) |
| 30 { |
| 31 var tab = tab.querySelector(".tabs li.active"); |
| 32 if (tab.dataset.show) |
| 33 E(tab.dataset.show).style.display = "block"; |
| 34 }; |
| 35 var optionList = document.querySelectorAll('.tabs li[data-show]'); |
| 36 for (i = 0; i < optionList.length; ++i) |
| 37 { |
| 38 optionList[i].addEventListener("click", function(ev) |
| 39 { |
| 40 var tab = this.parentNode.querySelector(".active"); |
| 41 tab.classList.remove("active"); |
| 42 this.classList.add("active"); |
| 43 E(tab.dataset.show).style.display = "none";; |
| 44 showContent(this.parentNode); |
| 45 }, false); |
| 46 } |
| 47 showContent(E("main-navigation-tabs")); |
| 48 showContent(E("blocking-list-tabs")); |
| 49 } |
| 50 |
| 51 function initModal() |
| 52 { |
| 53 var openModal = function() |
| 54 { |
| 55 E("modal").style.visibility = "visible"; |
| 56 }; |
| 57 var closeModal = function() |
| 58 { |
| 59 E("modal").style.visibility = "hidden"; |
| 60 }; |
| 61 E("add-blocking-list").addEventListener("click", openModal, false); |
| 62 E("add-website-language").addEventListener("click", openModal, false); |
| 63 E("modal-close").addEventListener("click", closeModal, false); |
| 64 } |
| 65 |
| 66 function initWhitelist() |
| 67 { |
| 68 |
| 69 } |
| 70 |
| 71 function getDocLink(link, callback) |
| 72 { |
| 73 ext.backgroundPage.sendMessage({ |
| 74 type: "app.get", |
| 75 what: "doclink", |
| 76 link: link |
| 77 }, callback); |
| 78 } |
| 79 |
| 80 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 81 })(); |
OLD | NEW |