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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 if (element != this.currentElement || this.hideTimer) | 219 if (element != this.currentElement || this.hideTimer) |
220 return; | 220 return; |
221 | 221 |
222 this.hideTargetTime = Date.now() + this.HIDE_DELAY; | 222 this.hideTargetTime = Date.now() + this.HIDE_DELAY; |
223 this.hideTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); | 223 this.hideTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
224 this.hideTimer.init(this, 40, Ci.nsITimer.TYPE_REPEATING_SLACK); | 224 this.hideTimer.init(this, 40, Ci.nsITimer.TYPE_REPEATING_SLACK); |
225 }, | 225 }, |
226 | 226 |
227 /** | 227 /** |
228 * Makes the tab element visible. | 228 * Makes the tab element visible. |
| 229 * @param {Element} element |
| 230 * @param {RequestEntry} data |
229 */ | 231 */ |
230 _showTab: function(/**Element*/ element, /**RequestEntry*/ data) | 232 _showTab: function(element, data) |
231 { | 233 { |
232 let {UI} = require("ui"); | 234 let {UI} = require("ui"); |
233 if (!UI.overlay) | 235 if (!UI.overlay) |
234 return; | 236 return; |
235 | 237 |
236 let doc = element.ownerDocument.defaultView.top.document; | 238 let doc = element.ownerDocument.defaultView.top.document; |
237 | 239 |
238 this.objtabElement = doc.createElementNS("http://www.w3.org/1999/xhtml", "a"
); | 240 this.objtabElement = doc.createElementNS("http://www.w3.org/1999/xhtml", "a"
); |
239 this.objtabElement.textContent = UI.overlay.attributes.objtabtext; | 241 this.objtabElement.textContent = UI.overlay.attributes.objtabtext; |
240 this.objtabElement.setAttribute("title", UI.overlay.attributes.objtabtooltip
); | 242 this.objtabElement.setAttribute("title", UI.overlay.attributes.objtabtooltip
); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 doBlock: function() | 415 doBlock: function() |
414 { | 416 { |
415 let {UI} = require("ui"); | 417 let {UI} = require("ui"); |
416 let {Utils} = require("utils"); | 418 let {Utils} = require("utils"); |
417 let chromeWindow = Utils.getChromeWindow(this.currentElement.ownerDocument.d
efaultView); | 419 let chromeWindow = Utils.getChromeWindow(this.currentElement.ownerDocument.d
efaultView); |
418 UI.blockItem(chromeWindow, this.currentElement, this.objtabElement.nodeData)
; | 420 UI.blockItem(chromeWindow, this.currentElement, this.objtabElement.nodeData)
; |
419 }, | 421 }, |
420 | 422 |
421 /** | 423 /** |
422 * Called whenever a timer fires. | 424 * Called whenever a timer fires. |
| 425 * @param {nsISupport} subject |
| 426 * @param {string} topic |
| 427 * @param {string} data |
423 */ | 428 */ |
424 observe: function(/**nsISupport*/ subject, /**String*/ topic, /**String*/ data
) | 429 observe: function(subject, topic, data) |
425 { | 430 { |
426 if (subject == this.positionTimer) | 431 if (subject == this.positionTimer) |
427 { | 432 { |
428 // Don't update position if it was already updated recently (via MozAfterP
aint) | 433 // Don't update position if it was already updated recently (via MozAfterP
aint) |
429 if (Date.now() - this.prevPositionUpdate > 100) | 434 if (Date.now() - this.prevPositionUpdate > 100) |
430 this._positionTab(); | 435 this._positionTab(); |
431 } | 436 } |
432 else if (subject == this.hideTimer) | 437 else if (subject == this.hideTimer) |
433 { | 438 { |
434 let now = Date.now(); | 439 let now = Date.now(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 event.stopPropagation(); | 488 event.stopPropagation(); |
484 | 489 |
485 objTabs.doBlock(); | 490 objTabs.doBlock(); |
486 } | 491 } |
487 else if (event.type == "mouseover") | 492 else if (event.type == "mouseover") |
488 objTabs.showTabFor(objTabs.currentElement); | 493 objTabs.showTabFor(objTabs.currentElement); |
489 else if (event.type == "mouseout") | 494 else if (event.type == "mouseout") |
490 objTabs.hideTabFor(objTabs.currentElement); | 495 objTabs.hideTabFor(objTabs.currentElement); |
491 } | 496 } |
492 exports.objectMouseEventHander = objectMouseEventHander; | 497 exports.objectMouseEventHander = objectMouseEventHander; |
OLD | NEW |