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

Side by Side Diff: popup.js

Issue 29544720: Noissue - Remove ext.closePopup() (Closed)
Patch Set: Created Sept. 15, 2017, 12:54 a.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 | « ext/popup.js ('k') | no next file » | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 "click", toggleEnabled, false 70 "click", toggleEnabled, false
71 ); 71 );
72 document.getElementById("clickhide").addEventListener( 72 document.getElementById("clickhide").addEventListener(
73 "click", activateClickHide, false 73 "click", activateClickHide, false
74 ); 74 );
75 document.getElementById("clickhide-cancel").addEventListener( 75 document.getElementById("clickhide-cancel").addEventListener(
76 "click", cancelClickHide, false 76 "click", cancelClickHide, false
77 ); 77 );
78 document.getElementById("options").addEventListener("click", () => 78 document.getElementById("options").addEventListener("click", () =>
79 { 79 {
80 ext.showOptions(ext.closePopup); 80 ext.showOptions(window.close);
81 }, false); 81 }, false);
82 82
83 // Set up collapsing of menu items 83 // Set up collapsing of menu items
84 for (let collapser of document.getElementsByClassName("collapse")) 84 for (let collapser of document.getElementsByClassName("collapse"))
85 { 85 {
86 collapser.addEventListener("click", toggleCollapse, false); 86 collapser.addEventListener("click", toggleCollapse, false);
87 if (!Prefs[collapser.dataset.option]) 87 if (!Prefs[collapser.dataset.option])
88 { 88 {
89 document.getElementById( 89 document.getElementById(
90 collapser.dataset.collapsable 90 collapser.dataset.collapsable
(...skipping 30 matching lines...) Expand all
121 } 121 }
122 } 122 }
123 } 123 }
124 124
125 function activateClickHide() 125 function activateClickHide()
126 { 126 {
127 document.body.classList.add("clickhide-active"); 127 document.body.classList.add("clickhide-active");
128 page.sendMessage({type: "composer.content.startPickingElement"}); 128 page.sendMessage({type: "composer.content.startPickingElement"});
129 129
130 // Close the popup after a few seconds, so user doesn't have to 130 // Close the popup after a few seconds, so user doesn't have to
131 activateClickHide.timeout = window.setTimeout(ext.closePopup, 5000); 131 activateClickHide.timeout = window.setTimeout(window.close, 5000);
132 } 132 }
133 133
134 function cancelClickHide() 134 function cancelClickHide()
135 { 135 {
136 if (activateClickHide.timeout) 136 if (activateClickHide.timeout)
137 { 137 {
138 window.clearTimeout(activateClickHide.timeout); 138 window.clearTimeout(activateClickHide.timeout);
139 activateClickHide.timeout = null; 139 activateClickHide.timeout = null;
140 } 140 }
141 document.body.classList.remove("clickhide-active"); 141 document.body.classList.remove("clickhide-active");
142 page.sendMessage({type: "composer.content.finished"}); 142 page.sendMessage({type: "composer.content.finished"});
143 } 143 }
144 144
145 function toggleCollapse(event) 145 function toggleCollapse(event)
146 { 146 {
147 let collapser = event.currentTarget; 147 let collapser = event.currentTarget;
148 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; 148 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option];
149 collapser.parentNode.classList.toggle("collapsed"); 149 collapser.parentNode.classList.toggle("collapsed");
150 } 150 }
151 151
152 document.addEventListener("DOMContentLoaded", onLoad, false); 152 document.addEventListener("DOMContentLoaded", onLoad, false);
OLDNEW
« no previous file with comments | « ext/popup.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld