OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 | 889 |
890 let match = /^abp:\/*subscribe\/*\?(.*)/i.exec(linkTarget); | 890 let match = /^abp:\/*subscribe\/*\?(.*)/i.exec(linkTarget); |
891 if (!match) | 891 if (!match) |
892 return; | 892 return; |
893 | 893 |
894 // Decode URL parameters | 894 // Decode URL parameters |
895 let title = null; | 895 let title = null; |
896 let url = null; | 896 let url = null; |
897 let mainSubscriptionTitle = null; | 897 let mainSubscriptionTitle = null; |
898 let mainSubscriptionURL = null; | 898 let mainSubscriptionURL = null; |
899 for each (let param in match[1].split('&')) | 899 for (let param of match[1].split('&')) |
900 { | 900 { |
901 let parts = param.split("=", 2); | 901 let parts = param.split("=", 2); |
902 if (parts.length != 2 || !/\S/.test(parts[1])) | 902 if (parts.length != 2 || !/\S/.test(parts[1])) |
903 continue; | 903 continue; |
904 switch (parts[0]) | 904 switch (parts[0]) |
905 { | 905 { |
906 case "title": | 906 case "title": |
907 title = decodeURIComponent(parts[1]); | 907 title = decodeURIComponent(parts[1]); |
908 break; | 908 break; |
909 case "location": | 909 case "location": |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 function E(id) window.document.getElementById(id); | 1316 function E(id) window.document.getElementById(id); |
1317 | 1317 |
1318 let node = window.document.tooltipNode; | 1318 let node = window.document.tooltipNode; |
1319 if (!node || !node.hasAttribute("tooltip")) | 1319 if (!node || !node.hasAttribute("tooltip")) |
1320 { | 1320 { |
1321 event.preventDefault(); | 1321 event.preventDefault(); |
1322 return; | 1322 return; |
1323 } | 1323 } |
1324 | 1324 |
1325 // Prevent tooltip from overlapping menu | 1325 // Prevent tooltip from overlapping menu |
1326 for each (let id in ["abp-toolbar-popup", "abp-status-popup"]) | 1326 for (let id of ["abp-toolbar-popup", "abp-status-popup"]) |
1327 { | 1327 { |
1328 let element = E(id); | 1328 let element = E(id); |
1329 if (element && element.state == "open") | 1329 if (element && element.state == "open") |
1330 { | 1330 { |
1331 event.preventDefault(); | 1331 event.preventDefault(); |
1332 return; | 1332 return; |
1333 } | 1333 } |
1334 } | 1334 } |
1335 | 1335 |
1336 let type = (node.id == "abp-toolbarbutton" ? "toolbar" : "statusbar"); | 1336 let type = (node.id == "abp-toolbarbutton" ? "toolbar" : "statusbar"); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 } | 1784 } |
1785 }, | 1785 }, |
1786 | 1786 |
1787 /** | 1787 /** |
1788 * Hide contribute button and persist this choice. | 1788 * Hide contribute button and persist this choice. |
1789 */ | 1789 */ |
1790 hideContributeButton: function(/**Window*/ window) | 1790 hideContributeButton: function(/**Window*/ window) |
1791 { | 1791 { |
1792 Prefs.hideContributeButton = true; | 1792 Prefs.hideContributeButton = true; |
1793 | 1793 |
1794 for each (let id in ["abp-status-contributebutton", "abp-toolbar-contributeb
utton", "abp-menuitem-contributebutton"]) | 1794 for (let id of ["abp-status-contributebutton", "abp-toolbar-contributebutton
", "abp-menuitem-contributebutton"]) |
1795 { | 1795 { |
1796 let button = window.document.getElementById(id); | 1796 let button = window.document.getElementById(id); |
1797 if (button) | 1797 if (button) |
1798 button.hidden = true; | 1798 button.hidden = true; |
1799 } | 1799 } |
1800 }, | 1800 }, |
1801 | 1801 |
1802 showNextNotification: function(url) | 1802 showNextNotification: function(url) |
1803 { | 1803 { |
1804 let window = this.currentWindow; | 1804 let window = this.currentWindow; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 | 1844 |
1845 insertMessage(element, after, links); | 1845 insertMessage(element, after, links); |
1846 } | 1846 } |
1847 | 1847 |
1848 let texts = Notification.getLocalizedTexts(notification); | 1848 let texts = Notification.getLocalizedTexts(notification); |
1849 let titleElement = window.document.getElementById("abp-notification-title"); | 1849 let titleElement = window.document.getElementById("abp-notification-title"); |
1850 titleElement.textContent = texts.title; | 1850 titleElement.textContent = texts.title; |
1851 let messageElement = window.document.getElementById("abp-notification-messag
e"); | 1851 let messageElement = window.document.getElementById("abp-notification-messag
e"); |
1852 messageElement.innerHTML = ""; | 1852 messageElement.innerHTML = ""; |
1853 let docLinks = []; | 1853 let docLinks = []; |
1854 for each (let link in notification.links) | 1854 for (let link of notification.links) |
1855 docLinks.push(Utils.getDocLink(link)); | 1855 docLinks.push(Utils.getDocLink(link)); |
1856 insertMessage(messageElement, texts.message, docLinks); | 1856 insertMessage(messageElement, texts.message, docLinks); |
1857 | 1857 |
1858 messageElement.addEventListener("click", function(event) | 1858 messageElement.addEventListener("click", function(event) |
1859 { | 1859 { |
1860 let link = event.target; | 1860 let link = event.target; |
1861 while (link && link !== messageElement && link.localName !== "a") | 1861 while (link && link !== messageElement && link.localName !== "a") |
1862 link = link.parentNode; | 1862 link = link.parentNode; |
1863 if (!link || link.localName !== "a") | 1863 if (!link || link.localName !== "a") |
1864 return; | 1864 return; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1912 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
1913 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1913 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |
1914 ]; | 1914 ]; |
1915 | 1915 |
1916 onShutdown.add(function() | 1916 onShutdown.add(function() |
1917 { | 1917 { |
1918 for (let window in UI.applicationWindows) | 1918 for (let window in UI.applicationWindows) |
1919 if (UI.isBottombarOpen(window)) | 1919 if (UI.isBottombarOpen(window)) |
1920 UI.toggleBottombar(window); | 1920 UI.toggleBottombar(window); |
1921 }); | 1921 }); |
OLD | NEW |