Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/ui.js

Issue 5705421486555136: First run page and subscription on install fix (FF for android) (Closed)
Left Patch Set: moved CustomizableUI initialization into UI.initDone() Created April 25, 2014, 1:57 p.m.
Right Patch Set: check if CustomizableUI is set in isToolbarIconVisible() and toggleToolbarIcon() methods Created April 25, 2014, 3:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 14 matching lines...) Expand all
25 let {FilterStorage} = require("filterStorage"); 25 let {FilterStorage} = require("filterStorage");
26 let {FilterNotifier} = require("filterNotifier"); 26 let {FilterNotifier} = require("filterNotifier");
27 let {RequestNotifier} = require("requestNotifier"); 27 let {RequestNotifier} = require("requestNotifier");
28 let {Filter} = require("filterClasses"); 28 let {Filter} = require("filterClasses");
29 let {Subscription, SpecialSubscription, DownloadableSubscription} = require("sub scriptionClasses"); 29 let {Subscription, SpecialSubscription, DownloadableSubscription} = require("sub scriptionClasses");
30 let {Synchronizer} = require("synchronizer"); 30 let {Synchronizer} = require("synchronizer");
31 let {KeySelector} = require("keySelector"); 31 let {KeySelector} = require("keySelector");
32 let {Notification} = require("notification"); 32 let {Notification} = require("notification");
33 let {initAntiAdblockNotification} = require("antiadblockInit"); 33 let {initAntiAdblockNotification} = require("antiadblockInit");
34 34
35 let CustomizableUI; 35 let CustomizableUI = null;
36 36
37 /** 37 /**
38 * Filter corresponding with "disable on site" menu item (set in fillIconMent()) . 38 * Filter corresponding with "disable on site" menu item (set in fillIconMent()) .
39 * @type Filter 39 * @type Filter
40 */ 40 */
41 let siteWhitelist = null; 41 let siteWhitelist = null;
42 /** 42 /**
43 * Filter corresponding with "disable on site" menu item (set in fillIconMenu()) . 43 * Filter corresponding with "disable on site" menu item (set in fillIconMenu()) .
44 * @type Filter 44 * @type Filter
45 */ 45 */
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 { 132 {
133 this.value = UI.toggleAcceptableAds(); 133 this.value = UI.toggleAcceptableAds();
134 }); 134 });
135 135
136 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled); 136 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled);
137 addCommandHandler("adblockplus-sync", function() 137 addCommandHandler("adblockplus-sync", function()
138 { 138 {
139 this.value = UI.toggleSync(); 139 this.value = UI.toggleSync();
140 }); 140 });
141 141
142 if (hasToolbar) 142 setChecked("adblockplus-showintoolbar", UI.isToolbarIconVisible());
143 { 143 addCommandHandler("adblockplus-showintoolbar", function()
144 setChecked("adblockplus-showintoolbar", UI.isToolbarIconVisible()); 144 {
145 addCommandHandler("adblockplus-showintoolbar", function() 145 UI.toggleToolbarIcon();
146 { 146 this.value = UI.isToolbarIconVisible();
147 UI.toggleToolbarIcon(); 147 });
148 this.value = UI.isToolbarIconVisible();
149 });
150 }
Wladimir Palant 2014/04/25 14:32:19 Same change would have to be done in fillIconMenu(
saroyanm 2014/04/25 15:10:22 Good point, thanks.
151 148
152 let list = doc.getElementById("adblockplus-subscription-list"); 149 let list = doc.getElementById("adblockplus-subscription-list");
153 if (list) 150 if (list)
154 { 151 {
155 // Load subscriptions data 152 // Load subscriptions data
156 let request = new XMLHttpRequest(); 153 let request = new XMLHttpRequest();
157 request.mozBackgroundRequest = true; 154 request.mozBackgroundRequest = true;
158 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml") ; 155 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml") ;
159 request.addEventListener("load", function() 156 request.addEventListener("load", function()
160 { 157 {
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 } 1028 }
1032 1029
1033 return [parent, before]; 1030 return [parent, before];
1034 }, 1031 },
1035 1032
1036 /** 1033 /**
1037 * Toggles visibility state of the toolbar icon. 1034 * Toggles visibility state of the toolbar icon.
1038 */ 1035 */
1039 toggleToolbarIcon: function() 1036 toggleToolbarIcon: function()
1040 { 1037 {
1038 if (!CustomizableUI)
1039 return;
1041 if (this.isToolbarIconVisible()) 1040 if (this.isToolbarIconVisible())
1042 CustomizableUI.removeWidgetFromArea("abp-toolbarbutton"); 1041 CustomizableUI.removeWidgetFromArea("abp-toolbarbutton");
1043 else 1042 else
1044 { 1043 {
1045 let {defaultToolbarPosition} = require("appSupport"); 1044 let {defaultToolbarPosition} = require("appSupport");
1046 CustomizableUI.addWidgetToArea("abp-toolbarbutton", defaultToolbarPosition .parent); 1045 CustomizableUI.addWidgetToArea("abp-toolbarbutton", defaultToolbarPosition .parent);
1047 } 1046 }
1048 }, 1047 },
1049 1048
1050 /** 1049 /**
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 command.doCommand(); 1704 command.doCommand();
1706 } 1705 }
1707 } 1706 }
1708 }, 1707 },
1709 1708
1710 /** 1709 /**
1711 * Checks whether the toolbar icon is currently displayed. 1710 * Checks whether the toolbar icon is currently displayed.
1712 */ 1711 */
1713 isToolbarIconVisible: function() /**Boolean*/ 1712 isToolbarIconVisible: function() /**Boolean*/
1714 { 1713 {
1714 if (!CustomizableUI)
1715 return false;
1715 let placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton"); 1716 let placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton");
1716 return !!placement; 1717 return !!placement;
1717 }, 1718 },
1718 1719
1719 /** 1720 /**
1720 * Stores the selected hotkeys, initialized when the user presses a key. 1721 * Stores the selected hotkeys, initialized when the user presses a key.
1721 */ 1722 */
1722 hotkeys: null, 1723 hotkeys: null,
1723 1724
1724 /** 1725 /**
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 1917 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
1917 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 1918 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
1918 ]; 1919 ];
1919 1920
1920 onShutdown.add(function() 1921 onShutdown.add(function()
1921 { 1922 {
1922 for (let window in UI.applicationWindows) 1923 for (let window in UI.applicationWindows)
1923 if (UI.isBottombarOpen(window)) 1924 if (UI.isBottombarOpen(window))
1924 UI.toggleBottombar(window); 1925 UI.toggleBottombar(window);
1925 }); 1926 });
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld