Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 | 498 |
499 this.firstRunDone = true; | 499 this.firstRunDone = true; |
500 | 500 |
501 let {addonVersion} = require("info"); | 501 let {addonVersion} = require("info"); |
502 let prevVersion = Prefs.currentVersion; | 502 let prevVersion = Prefs.currentVersion; |
503 if (prevVersion != addonVersion) | 503 if (prevVersion != addonVersion) |
504 { | 504 { |
505 Prefs.currentVersion = addonVersion; | 505 Prefs.currentVersion = addonVersion; |
506 this.addSubscription(window, prevVersion); | 506 this.addSubscription(window, prevVersion); |
507 | 507 |
508 // The "Hide placeholders" option has been removed from the UI in 2.6.6.38 79 | 508 // The "Hide placeholders" option has been removed from the UI in 2.6.6.38 81 |
509 // So we reset the option for users updating from older versions. | 509 // So we reset the option for users updating from older versions. |
510 if (prevVersion && Services.vc.compare(prevVersion, "2.6.6.3879") < 0) | 510 if (prevVersion && Services.vc.compare(prevVersion, "2.6.6.3881") < 0) |
511 Prefs.fastcollapse = false; | 511 Prefs.fastcollapse = false; |
512 } | 512 } |
513 }, | 513 }, |
514 | 514 |
515 /** | 515 /** |
516 * Will be set to true after the check whether first-run actions should run | 516 * Will be set to true after the check whether first-run actions should run |
517 * has been performed. | 517 * has been performed. |
518 * @type Boolean | 518 * @type Boolean |
519 */ | 519 */ |
520 firstRunDone: false, | 520 firstRunDone: false, |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
949 if (!title) | 949 if (!title) |
950 title = url; | 950 title = url; |
951 | 951 |
952 // Main subscription needs both title and URL | 952 // Main subscription needs both title and URL |
953 if (mainSubscriptionTitle && !mainSubscriptionURL) | 953 if (mainSubscriptionTitle && !mainSubscriptionURL) |
954 mainSubscriptionTitle = null; | 954 mainSubscriptionTitle = null; |
955 if (mainSubscriptionURL && !mainSubscriptionTitle) | 955 if (mainSubscriptionURL && !mainSubscriptionTitle) |
956 mainSubscriptionURL = null; | 956 mainSubscriptionURL = null; |
957 | 957 |
958 // Trim spaces in title and URL | 958 // Trim spaces in title and URL |
959 title = title.replace(/^\s+/, "").replace(/\s+$/, ""); | 959 title = title.trim(); |
960 url = url.replace(/^\s+/, "").replace(/\s+$/, ""); | 960 url = url.trim(); |
961 if (mainSubscriptionURL) | 961 if (mainSubscriptionURL) |
962 { | 962 { |
963 mainSubscriptionTitle = mainSubscriptionTitle.replace(/^\s+/, "").replace( /\s+$/, ""); | 963 mainSubscriptionTitle = mainSubscriptionTitle.trim(); |
964 mainSubscriptionURL = mainSubscriptionURL.replace(/^\s+/, "").replace(/\s+ $/, ""); | 964 mainSubscriptionURL = mainSubscriptionURL.trim(); |
965 } | 965 } |
966 | 966 |
967 // Verify that the URL is valid | 967 // Verify that the URL is valid |
968 url = Utils.makeURI(url); | 968 url = Utils.makeURI(url); |
969 if (!url || (url.scheme != "http" && url.scheme != "https" && url.scheme != "ftp")) | 969 if (!url || (url.scheme != "http" && url.scheme != "https" && url.scheme != "ftp")) |
970 return; | 970 return; |
971 url = url.spec; | 971 url = url.spec; |
972 | 972 |
973 if (mainSubscriptionURL) | 973 if (mainSubscriptionURL) |
974 { | 974 { |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1530 setChecked(prefix + "whitelistsite", siteWhitelist.subscriptions.length && !siteWhitelist.disabled); | 1530 setChecked(prefix + "whitelistsite", siteWhitelist.subscriptions.length && !siteWhitelist.disabled); |
1531 generateLabel(prefix + "whitelistsite", location.spec.replace(/^mailto:/ , "")); | 1531 generateLabel(prefix + "whitelistsite", location.spec.replace(/^mailto:/ , "")); |
1532 hideElement(prefix + "whitelistsite", false); | 1532 hideElement(prefix + "whitelistsite", false); |
1533 } | 1533 } |
1534 } | 1534 } |
1535 | 1535 |
1536 setDisabled("abp-command-sendReport", !location || !Policy.isBlockableScheme (location) || location.scheme == "mailto"); | 1536 setDisabled("abp-command-sendReport", !location || !Policy.isBlockableScheme (location) || location.scheme == "mailto"); |
1537 | 1537 |
1538 setChecked(prefix + "disabled", !Prefs.enabled); | 1538 setChecked(prefix + "disabled", !Prefs.enabled); |
1539 setChecked(prefix + "frameobjects", Prefs.frameobjects); | 1539 setChecked(prefix + "frameobjects", Prefs.frameobjects); |
1540 setChecked(prefix + "slowcollapse", !Prefs.fastcollapse); | |
Wladimir Palant
2014/12/11 10:23:15
Wait, shouldn't this be removed as well?
Sebastian Noack
2014/12/11 10:41:28
Done.
| |
1541 setChecked(prefix + "savestats", Prefs.savestats); | 1540 setChecked(prefix + "savestats", Prefs.savestats); |
1542 | 1541 |
1543 let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); | 1542 let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); |
1544 let hasToolbar = defaultToolbarPosition; | 1543 let hasToolbar = defaultToolbarPosition; |
1545 let hasStatusBar = statusbarPosition; | 1544 let hasStatusBar = statusbarPosition; |
1546 hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar- "); | 1545 hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar- "); |
1547 hideElement(prefix + "showinstatusbar", !hasStatusBar); | 1546 hideElement(prefix + "showinstatusbar", !hasStatusBar); |
1548 hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || ! hasToolbar) && !hasStatusBar); | 1547 hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || ! hasToolbar) && !hasStatusBar); |
1549 | 1548 |
1550 setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); | 1549 setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1939 * handler the element ID, event and the actual event handler are listed. | 1938 * handler the element ID, event and the actual event handler are listed. |
1940 * @type Array | 1939 * @type Array |
1941 */ | 1940 */ |
1942 let eventHandlers = [ | 1941 let eventHandlers = [ |
1943 ["abp-command-sendReport", "command", UI.openReportDialog.bind(UI)], | 1942 ["abp-command-sendReport", "command", UI.openReportDialog.bind(UI)], |
1944 ["abp-command-filters", "command", UI.openFiltersDialog.bind(UI)], | 1943 ["abp-command-filters", "command", UI.openFiltersDialog.bind(UI)], |
1945 ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], | 1944 ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], |
1946 ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si teWhitelist); }], | 1945 ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si teWhitelist); }], |
1947 ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa geWhitelist); }], | 1946 ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa geWhitelist); }], |
1948 ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects" )], | 1947 ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects" )], |
1949 ["abp-command-togglecollapse", "command", UI.togglePref.bind(UI, "fastcollapse ")], | |
Wladimir Palant
2014/12/11 10:23:15
And this.
Sebastian Noack
2014/12/11 10:41:28
Done.
| |
1950 ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], | 1948 ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], |
1951 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], | 1949 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], |
1952 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], | 1950 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], |
1953 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi nstatusbar")], | 1951 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi nstatusbar")], |
1954 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], | 1952 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], |
1955 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1953 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
1956 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1954 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |
1957 ]; | 1955 ]; |
1958 | 1956 |
1959 onShutdown.add(function() | 1957 onShutdown.add(function() |
1960 { | 1958 { |
1961 for (let window in UI.applicationWindows) | 1959 for (let window in UI.applicationWindows) |
1962 if (UI.isBottombarOpen(window)) | 1960 if (UI.isBottombarOpen(window)) |
1963 UI.toggleBottombar(window); | 1961 UI.toggleBottombar(window); |
1964 }); | 1962 }); |
LEFT | RIGHT |