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

Side by Side Diff: block.js

Issue 5088751004942336: Issue 370 - Right-clicked element is removed independent of created filter (Closed)
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:
View unified diff | Download patch
« no previous file with comments | « 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')
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
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, false)); 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",
(...skipping 24 matching lines...) Expand all
62 } 62 }
63 } 63 }
64 64
65 function addFilters() 65 function addFilters()
66 { 66 {
67 // Tell the background page to add the filters 67 // Tell the background page to add the filters
68 var filters = document.getElementById("filters").value.split(/[\r\n]+/) 68 var filters = document.getElementById("filters").value.split(/[\r\n]+/)
69 .map(function(f) {return f.replace(/^\s+/, "").replace(/ \s+$/, "");}) 69 .map(function(f) {return f.replace(/^\s+/, "").replace(/ \s+$/, "");})
70 .filter(function(f) {return f != "";}); 70 .filter(function(f) {return f != "";});
71 ext.backgroundPage.sendMessage({type: "add-filters", filters: filters}); 71 ext.backgroundPage.sendMessage({type: "add-filters", filters: filters});
72 closeDialog(true); 72 closeDialog(filters);
73 } 73 }
74 74
75 function closeDialog(success) 75 function closeDialog(filters)
76 { 76 {
77 ext.backgroundPage.sendMessage( 77 ext.backgroundPage.sendMessage(
78 { 78 {
79 type: "forward", 79 type: "forward",
80 payload: 80 payload:
81 { 81 {
82 type: "clickhide-close", 82 type: "clickhide-close",
83 remove: (typeof success == "boolean" ? success : false) 83 filters: filters
84 } 84 }
85 } 85 }
86 ); 86 );
87 } 87 }
88 88
89 var dragCoords = null; 89 var dragCoords = null;
90 function onDragStart(event) 90 function onDragStart(event)
91 { 91 {
92 dragCoords = [event.screenX, event.screenY]; 92 dragCoords = [event.screenX, event.screenY];
93 } 93 }
(...skipping 22 matching lines...) Expand all
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 }
OLDNEW
« no previous file with comments | « no previous file | include.postload.js » ('j') | include.postload.js » ('J')

Powered by Google App Engine
This is Rietveld