OLD | NEW |
1 /* | 1 /* |
2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * Initialization function, called when the window is loaded. | 8 * Initialization function, called when the window is loaded. |
9 */ | 9 */ |
10 function init() | 10 function init() |
11 { | 11 { |
12 if (window.arguments && window.arguments.length) | 12 if (window.arguments && window.arguments.length) |
13 { | 13 { |
14 let filter = window.arguments[0].wrappedJSObject; | 14 let filter = window.arguments[0].wrappedJSObject; |
15 if (filter instanceof Filter) | 15 if (filter instanceof Filter) |
16 Utils.runAsync(SubscriptionActions.selectFilter, SubscriptionActions, filt
er); | 16 Utils.runAsync(SubscriptionActions.selectFilter, SubscriptionActions, filt
er); |
17 } | 17 } |
| 18 |
| 19 TypoActions.init(); |
18 } | 20 } |
19 | 21 |
20 /** | 22 /** |
21 * Called whenever the currently selected tab changes. | 23 * Called whenever the currently selected tab changes. |
22 */ | 24 */ |
23 function onTabChange(/**Element*/ tabbox) | 25 function onTabChange(/**Element*/ tabbox) |
24 { | 26 { |
25 updateSelectedSubscription(); | 27 updateSelectedSubscription(); |
26 | 28 |
27 Utils.runAsync(function() | 29 Utils.runAsync(function() |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 * Updates filter list when selected subscription changes. | 78 * Updates filter list when selected subscription changes. |
77 */ | 79 */ |
78 function updateSelectedSubscription() | 80 function updateSelectedSubscription() |
79 { | 81 { |
80 let panel = E("tabs").selectedPanel; | 82 let panel = E("tabs").selectedPanel; |
81 if (!panel) | 83 if (!panel) |
82 return; | 84 return; |
83 | 85 |
84 let list = panel.getElementsByTagName("richlistbox")[0]; | 86 let list = panel.getElementsByTagName("richlistbox")[0]; |
85 if (!list) | 87 if (!list) |
| 88 { |
| 89 E("filtersContainer").style.visibility = "hidden"; |
86 return; | 90 return; |
| 91 } |
| 92 |
| 93 E("filtersContainer").style.visibility = "visible"; |
87 | 94 |
88 let data = Templater.getDataForNode(list.selectedItem); | 95 let data = Templater.getDataForNode(list.selectedItem); |
89 FilterView.subscription = (data ? data.subscription : null); | 96 FilterView.subscription = (data ? data.subscription : null); |
90 FilterActions.updateCommands(); | 97 FilterActions.updateCommands(); |
91 } | 98 } |
92 | 99 |
93 /** | 100 /** |
94 * Template processing functions. | 101 * Template processing functions. |
95 * @class | 102 * @class |
96 */ | 103 */ |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 * data object. | 208 * data object. |
202 */ | 209 */ |
203 getNodeForData: function(/**Node*/ parent, /**String*/ property, /**Object*/ d
ata) /**Node*/ | 210 getNodeForData: function(/**Node*/ parent, /**String*/ property, /**Object*/ d
ata) /**Node*/ |
204 { | 211 { |
205 for (let child = parent.firstChild; child; child = child.nextSibling) | 212 for (let child = parent.firstChild; child; child = child.nextSibling) |
206 if ("_data" in child && property in child._data && child._data[property] =
= data) | 213 if ("_data" in child && property in child._data && child._data[property] =
= data) |
207 return child; | 214 return child; |
208 return null; | 215 return null; |
209 } | 216 } |
210 }; | 217 }; |
OLD | NEW |