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

Delta Between Two Patch Sets: block.js

Issue 5088751004942336: Issue 370 - Right-clicked element is removed independent of created filter (Closed)
Left Patch Set: Rebase to rev 3c9cea80c481 Created July 18, 2014, 8:54 a.m.
Right Patch Set: Created July 18, 2014, 9:13 a.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 | include.postload.js » ('j') | include.postload.js » ('J')
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 function init() 18 function init()
19 { 19 {
20 // Attach event listeners 20 // Attach event listeners
21 window.addEventListener("keydown", onKeyDown, false); 21 window.addEventListener("keydown", onKeyDown, false);
22 window.addEventListener("dragstart", onDragStart, false); 22 window.addEventListener("dragstart", onDragStart, false);
23 window.addEventListener("drag", onDrag, false); 23 window.addEventListener("drag", onDrag, false);
24 window.addEventListener("dragend", onDragEnd, false); 24 window.addEventListener("dragend", onDragEnd, false);
25 25
26 $("#addButton").click(addFilters); 26 $("#addButton").click(addFilters);
27 $("#cancelButton").click(closeDialog.bind(null, null)); 27 $("#cancelButton").click(closeDialog);
Wladimir Palant 2014/11/17 19:53:57 closeDialog() still has a filters parameter, with
28 28
29 // Apply jQuery UI styles 29 // Apply jQuery UI styles
30 $("button").button(); 30 $("button").button();
31 31
32 ext.backgroundPage.sendMessage( 32 ext.backgroundPage.sendMessage(
33 { 33 {
34 type: "forward", 34 type: "forward",
35 payload: 35 payload:
36 { 36 {
37 type: "clickhide-init", 37 type: "clickhide-init",
38 width: Math.max(document.body.offsetWidth || document.body.scrollWidth), 38 width: Math.max(document.body.offsetWidth || document.body.scrollWidth),
39 height: Math.max(document.body.offsetHeight || document.body.scrollHeight) 39 height: Math.max(document.body.offsetHeight || document.body.scrollHeight)
40 } 40 }
41 }, 41 },
42 function(response) 42 function(response)
43 { 43 {
44 document.getElementById("filters").value = response.filters.join("\n"); 44 document.getElementById("filters").value = response.filters.join("\n");
45 }); 45 });
46 46
47 document.getElementById("filters").focus(); 47 document.getElementById("filters").focus();
48 } 48 }
49 window.addEventListener("load", init, false); 49 window.addEventListener("load", init, false);
50 50
51 function onKeyDown(event) 51 function onKeyDown(event)
52 { 52 {
53 if (event.keyCode == 27) 53 if (event.keyCode == 27)
54 { 54 {
55 event.preventDefault(); 55 event.preventDefault();
56 closeDialog(null); 56 closeDialog();
57 } 57 }
58 else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey) 58 else if (event.keyCode == 13 && !event.shiftKey && !event.ctrlKey)
59 { 59 {
60 event.preventDefault(); 60 event.preventDefault();
61 addFilters(); 61 addFilters();
62 } 62 }
63 } 63 }
64 64
65 function addFilters() 65 function addFilters()
66 { 66 {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ); 116 );
117 dragCoords = [event.screenX, event.screenY]; 117 dragCoords = [event.screenX, event.screenY];
118 } 118 }
119 } 119 }
120 120
121 function onDragEnd(event) 121 function onDragEnd(event)
122 { 122 {
123 onDrag(event); 123 onDrag(event);
124 dragCoords = null; 124 dragCoords = null;
125 } 125 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld