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

Side by Side Diff: chrome/content/ui/progressBar.js

Issue 5055554716172288: Issue 653 -Object.defineProperty instead of defineGetter / defineSetter (Closed)
Patch Set: I am generally not a big fan of iterating over property names. It seems like for most objects here … Created June 26, 2014, 8:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/ui/filters-subscriptionactions.js ('k') | chrome/content/ui/sidebar.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25
26 // Init global variables 26 // Init global variables
27 progressBar = document.getElementById("progressBar"); 27 progressBar = document.getElementById("progressBar");
28 canvas = document.getElementById("progressBarCanvas"); 28 canvas = document.getElementById("progressBarCanvas");
29 29
30 headers = Array.prototype.slice.call(progressBar.getElementsByTagName("label ")); 30 headers = Array.prototype.slice.call(progressBar.getElementsByTagName("label "));
31 for (let i = 0; i < headers.length; i++) 31 for (let i = 0; i < headers.length; i++)
32 canvas.parentNode.appendChild(headers[i]); 32 canvas.parentNode.appendChild(headers[i]);
33 33
34 // Expose properties 34 // Expose properties
35 progressBar.__defineGetter__("activeItem", getActiveItem); 35 Object.defineProperty(progressBar, "activeItem",
36 progressBar.__defineSetter__("activeItem", setActiveItem); 36 {
37 progressBar.__defineGetter__("activeItemComplete", getActiveItemComplete); 37 get: getActiveItem,
38 progressBar.__defineSetter__("activeItemComplete", setActiveItemComplete); 38 set: setActiveItem
39 });
40 Object.defineProperty(progressBar, "activeItemComplete",
41 {
42 get: getActiveItemComplete,
43 set: setActiveItemComplete
44 });
39 45
40 isRTL = (window.getComputedStyle(document.documentElement).direction == "rtl "); 46 isRTL = (window.getComputedStyle(document.documentElement).direction == "rtl ");
41 47
42 // Run actual drawing delayed, once the sizes are fixed 48 // Run actual drawing delayed, once the sizes are fixed
43 window.setTimeout(init, 0); 49 window.setTimeout(init, 0);
44 }; 50 };
45 window.addEventListener("load", onLoad, false); 51 window.addEventListener("load", onLoad, false);
46 52
47 function init() 53 function init()
48 { 54 {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 let activeItem = this.activeItem; 155 let activeItem = this.activeItem;
150 if (!activeItem) 156 if (!activeItem)
151 return; 157 return;
152 158
153 if (!val && activeItem.value[0] == "✔") 159 if (!val && activeItem.value[0] == "✔")
154 activeItem.value = activeItem.value.replace(/^✔\s*/, ""); 160 activeItem.value = activeItem.value.replace(/^✔\s*/, "");
155 else if (val && activeItem.value[0] != "✔") 161 else if (val && activeItem.value[0] != "✔")
156 activeItem.value = "✔ " + activeItem.value; 162 activeItem.value = "✔ " + activeItem.value;
157 } 163 }
158 })(); 164 })();
OLDNEW
« no previous file with comments | « chrome/content/ui/filters-subscriptionactions.js ('k') | chrome/content/ui/sidebar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld