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

Delta Between Two Patch Sets: chrome/content/ui/firstRun.js

Issue 11039060: first run page redesign (Closed)
Left Patch Set: chinese version added Created Sept. 23, 2013, 1:43 p.m.
Right Patch Set: improve after wladimirs code review Created Oct. 4, 2013, 4:50 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
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-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 28 matching lines...) Expand all
39 title: "EasyPrivacy", 39 title: "EasyPrivacy",
40 url: "https://easylist-downloads.adblockplus.org/easyprivacy.txt" 40 url: "https://easylist-downloads.adblockplus.org/easyprivacy.txt"
41 } 41 }
42 ]; 42 ];
43 43
44 function onDOMLoaded() 44 function onDOMLoaded()
45 { 45 {
46 var locale = require("utils").Utils.appLocale; 46 var locale = require("utils").Utils.appLocale;
47 document.documentElement.setAttribute("lang", locale); 47 document.documentElement.setAttribute("lang", locale);
48 48
49 // Set up URL 49 // Set up URLs
50 var donateLink = E("donate"); 50 var donateLink = E("donate");
51 donateLink.href = Utils.getDocLink("donate"); 51 donateLink.href = Utils.getDocLink("donate");
52 52
53 var contributors = E("contributors"); 53 var contributors = E("contributors");
54 contributors.href = Utils.getDocLink("contributors"); 54 contributors.href = Utils.getDocLink("contributors");
55 55
56 setLinks("acceptableAdsExplanation", Utils.getDocLink("acceptable_ads_criter ia"), openFilters); 56 setLinks("acceptableAdsExplanation", Utils.getDocLink("acceptable_ads_criter ia"), openFilters);
57 setLinks("share-headline", Utils.getDocLink("contribute")); 57 setLinks("share-headline", Utils.getDocLink("contribute"));
58 58
59 // Show warning if data corruption was detected 59 // Show warning if data corruption was detected
(...skipping 16 matching lines...) Expand all
76 } 76 }
77 } 77 }
78 } 78 }
79 FilterNotifier.addListener(filterListener); 79 FilterNotifier.addListener(filterListener);
80 window.addEventListener("unload", function(event) 80 window.addEventListener("unload", function(event)
81 { 81 {
82 FilterNotifier.removeListener(filterListener); 82 FilterNotifier.removeListener(filterListener);
83 }, false); 83 }, false);
84 84
85 // You can click activate-feature or one of the icons to toggle the features area 85 // You can click activate-feature or one of the icons to toggle the features area
86 E("activate-features").addEventListener("click", showFeature, false); 86 E("activate-features").addEventListener("click", toggleFeature, false);
87 E("can-do-more-overview").addEventListener("click", showFeature, false); 87 E("can-do-more-overview").addEventListener("click", toggleFeature, false);
88 88
89 initSocialLinks(); 89 initSocialLinks();
90 } 90 }
91 91
92 function showFeature() 92 function toggleFeature()
93 { 93 {
94 var canDoMore = E("can-do-more"); 94 var canDoMore = E("can-do-more");
95 var canDoMoreOverview = E("can-do-more-overview");
96 var canDoMoreExpanded = E("can-do-more-expanded");
97
98 if (!canDoMore.classList.contains("expanded")) 95 if (!canDoMore.classList.contains("expanded"))
99 { 96 {
100 canDoMore.classList.add("expanded"); 97 canDoMore.classList.add("expanded");
101 canDoMoreOverview.classList.add("fade");
102
103 setTimeout(function()
104 {
105 canDoMoreOverview.classList.add("hide");
106 canDoMoreExpanded.classList.remove("hide");
107 },500);
108
109 /* Next timeout has to be done because of an js bug.
110 * If you set "display: block" and "opacity: 1"
111 * at the same time the content would be shown
112 * directly without any transition.
113 * With the following timeout the opacity
114 * transition works correctly
115 */
116 setTimeout(function()
117 {
118 canDoMoreExpanded.classList.remove("fade");
119 },520);
120 } 98 }
121 else if (canDoMore.classList.contains("expanded")) 99 else if (canDoMore.classList.contains("expanded"))
122 { 100 {
123 canDoMore.classList.remove("expanded"); 101 canDoMore.classList.remove("expanded");
124 canDoMoreExpanded.classList.add("fade");
125
126 setTimeout(function()
127 {
128 canDoMoreExpanded.classList.add("hide");
129 canDoMoreOverview.classList.remove("hide");
130 },500);
131
132 setTimeout(function()
133 {
134 canDoMoreOverview.classList.remove("fade");
135 },520);
136 } 102 }
Wladimir Palant 2013/10/05 09:15:59 Nit: One line of code is enough for the entire fun
137 } 103 }
138 104
139 function isSubscriptionEnabled(featureSubscription) 105 function isSubscriptionEnabled(featureSubscription)
140 { 106 {
141 return featureSubscription.url in FilterStorage.knownSubscriptions 107 return featureSubscription.url in FilterStorage.knownSubscriptions
142 && !Subscription.fromURL(featureSubscription.url).disabled; 108 && !Subscription.fromURL(featureSubscription.url).disabled;
143 } 109 }
144 110
145 function setToggleSubscriptionButton(featureSubscription) 111 function setToggleSubscriptionButton(featureSubscription)
146 { 112 {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 { 242 {
277 var button = E("toggle-" + feature); 243 var button = E("toggle-" + feature);
278 if (isEnabled) 244 if (isEnabled)
279 button.classList.remove("off"); 245 button.classList.remove("off");
280 else 246 else
281 button.classList.add("off"); 247 button.classList.add("off");
282 } 248 }
283 249
284 document.addEventListener("DOMContentLoaded", onDOMLoaded, false); 250 document.addEventListener("DOMContentLoaded", onDOMLoaded, false);
285 })(); 251 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld