Left: | ||
Right: |
OLD | NEW |
---|---|
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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 document.documentElement.appendChild(overlay); | 264 document.documentElement.appendChild(overlay); |
265 return overlay; | 265 return overlay; |
266 } | 266 } |
267 | 267 |
268 // Show dialog asking user whether she wants to add the proposed filters derived | 268 // Show dialog asking user whether she wants to add the proposed filters derived |
269 // from selected page element | 269 // from selected page element |
270 function clickHide_showDialog(left, top, filters) | 270 function clickHide_showDialog(left, top, filters) |
271 { | 271 { |
272 // If we are already selecting, abort now | 272 // If we are already selecting, abort now |
273 if (clickHide_activated || clickHideFiltersDialog) | 273 if (clickHide_activated || clickHideFiltersDialog) |
274 clickHide_deactivate(true); | 274 clickHide_rulesPending(); |
kzar
2015/03/04 10:20:21
Nit: Seems like weird mix of camel case with snake
Sebastian Noack
2015/03/04 10:47:09
Yes, function names should be properly camelcase'd
| |
275 | 275 |
276 clickHide_filters = filters; | 276 clickHide_filters = filters; |
277 | 277 |
278 clickHideFiltersDialog = document.createElement("iframe"); | 278 clickHideFiltersDialog = document.createElement("iframe"); |
279 clickHideFiltersDialog.src = ext.getURL("block.html"); | 279 clickHideFiltersDialog.src = ext.getURL("block.html"); |
280 clickHideFiltersDialog.setAttribute("style", "position: fixed !important; visi bility: hidden; display: block !important; border: 0px !important;"); | 280 clickHideFiltersDialog.setAttribute("style", "position: fixed !important; visi bility: hidden; display: block !important; border: 0px !important;"); |
281 clickHideFiltersDialog.style.WebkitBoxShadow = "5px 5px 20px rgba(0,0,0,0.5)"; | 281 clickHideFiltersDialog.style.WebkitBoxShadow = "5px 5px 20px rgba(0,0,0,0.5)"; |
282 clickHideFiltersDialog.style.zIndex = 0x7FFFFFFF; | 282 clickHideFiltersDialog.style.zIndex = 0x7FFFFFFF; |
283 | 283 |
284 // Position in upper-left all the time | 284 // Position in upper-left all the time |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 document.removeEventListener("mousedown", clickHide_stopPropagation, true); | 340 document.removeEventListener("mousedown", clickHide_stopPropagation, true); |
341 document.removeEventListener("mouseup", clickHide_stopPropagation, true); | 341 document.removeEventListener("mouseup", clickHide_stopPropagation, true); |
342 document.removeEventListener("mouseenter", clickHide_stopPropagation, true); | 342 document.removeEventListener("mouseenter", clickHide_stopPropagation, true); |
343 document.removeEventListener("mouseleave", clickHide_stopPropagation, true); | 343 document.removeEventListener("mouseleave", clickHide_stopPropagation, true); |
344 document.removeEventListener("mouseover", clickHide_mouseOver, true); | 344 document.removeEventListener("mouseover", clickHide_mouseOver, true); |
345 document.removeEventListener("mouseout", clickHide_mouseOut, true); | 345 document.removeEventListener("mouseout", clickHide_mouseOut, true); |
346 document.removeEventListener("click", clickHide_mouseClick, true); | 346 document.removeEventListener("click", clickHide_mouseClick, true); |
347 document.removeEventListener("keydown", clickHide_keyDown, true); | 347 document.removeEventListener("keydown", clickHide_keyDown, true); |
348 } | 348 } |
349 | 349 |
350 // Turn off click-to-hide | 350 // Turn off click-to-hide |
kzar
2015/03/04 10:20:21
I don't think this comment really adds anything.
Sebastian Noack
2015/03/04 10:47:09
Also not really matter of this change, but fair en
| |
351 function clickHide_deactivate(keepOverlays) | 351 function clickHide_deactivate() |
352 { | 352 { |
353 clickHide_rulesPending(); | |
354 | |
353 if (clickHideFiltersDialog) | 355 if (clickHideFiltersDialog) |
354 { | 356 { |
355 document.documentElement.removeChild(clickHideFiltersDialog); | 357 document.documentElement.removeChild(clickHideFiltersDialog); |
356 clickHideFiltersDialog = null; | 358 clickHideFiltersDialog = null; |
357 } | 359 } |
358 | 360 |
359 clickHide_activated = false; | |
360 clickHide_filters = null; | 361 clickHide_filters = null; |
361 if(!document) | 362 lastRightClickEvent = null; |
362 return; // This can happen inside a nuked iframe...I think | |
363 | 363 |
364 document.removeEventListener("mousedown", clickHide_stopPropagation, true); | 364 if (currentElement) { |
365 document.removeEventListener("mouseup", clickHide_stopPropagation, true); | 365 currentElement.removeEventListener("contextmenu", clickHide_elementClickHan dler, true); |
366 document.removeEventListener("mouseenter", clickHide_stopPropagation, true); | 366 unhighlightElements(); |
367 document.removeEventListener("mouseleave", clickHide_stopPropagation, true); | 367 unhighlightElement(currentElement); |
368 document.removeEventListener("mouseover", clickHide_mouseOver, true); | 368 currentElement = null; |
369 document.removeEventListener("mouseout", clickHide_mouseOut, true); | 369 } |
370 document.removeEventListener("click", clickHide_mouseClick, true); | 370 unhighlightElements(); |
371 document.removeEventListener("keydown", clickHide_keyDown, true); | |
372 | 371 |
373 if (keepOverlays !== true) | 372 var overlays = document.getElementsByClassName("__adblockplus__overlay"); |
374 { | 373 while (overlays.length > 0) |
375 lastRightClickEvent = null; | 374 overlays[0].parentNode.removeChild(overlays[0]); |
376 | 375 |
377 if (currentElement) { | 376 ext.onExtensionUnloaded.removeListener(clickHide_deactivate); |
378 currentElement.removeEventListener("contextmenu", clickHide_elementClickH andler, true); | |
379 unhighlightElements(); | |
380 unhighlightElement(currentElement); | |
381 currentElement = null; | |
382 } | |
383 unhighlightElements(); | |
384 | |
385 var overlays = document.getElementsByClassName("__adblockplus__overlay"); | |
386 while (overlays.length > 0) | |
387 overlays[0].parentNode.removeChild(overlays[0]); | |
388 | |
389 ext.onExtensionUnloaded.removeListener(clickHide_deactivate); | |
390 } | |
391 } | 377 } |
392 | 378 |
393 function clickHide_stopPropagation(e) | 379 function clickHide_stopPropagation(e) |
394 { | 380 { |
395 e.stopPropagation(); | 381 e.stopPropagation(); |
396 } | 382 } |
397 | 383 |
398 function clickHide_elementClickHandler(e) { | 384 function clickHide_elementClickHandler(e) { |
399 e.preventDefault(); | 385 e.preventDefault(); |
400 e.stopPropagation(); | 386 e.stopPropagation(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
717 lastRightClickEventValid = false; | 703 lastRightClickEventValid = false; |
718 else | 704 else |
719 lastRightClickEvent = null; | 705 lastRightClickEvent = null; |
720 break; | 706 break; |
721 } | 707 } |
722 }); | 708 }); |
723 | 709 |
724 if (window == window.top) | 710 if (window == window.top) |
725 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 711 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
726 } | 712 } |
OLD | NEW |