-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadblock-uiscripts-blacklisting-overlay.js
70 lines (61 loc) · 1.99 KB
/
adblock-uiscripts-blacklisting-overlay.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* This file is part of AdBlock <https://getadblock.com/>,
* Copyright (C) 2013-present Adblock, Inc.
*
* AdBlock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* AdBlock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AdBlock. If not, see <http://www.gnu.org/licenses/>.
*/
function Overlay(options) {
const el = $(options.domElement);
this.image = $("<div class='adblock-killme-overlay'></div>")
.css({
left: el.position().left,
top: el.position().top,
'background-color': 'transparent !important',
position: 'absolute',
'z-index': 1000000,
})
.width(el.width() || 0)
.height(el.height() || 0);
this.el = el;
this.clickHandler = options.clickHandler;
this.image
.on('mouseenter', function onEnter() {
// crbug.com/110084
this.style.setProperty('background-color', 'rgba(130, 180, 230, 0.5)', 'important');
})
.on('mouseleave', function onLeave() {
// crbug.com/110084
this.style.setProperty('background-color', 'transparent', 'important');
});
Overlay.instances.push(this);
}
Overlay.instances = [];
Overlay.removeAll = function removeAllOverlays() {
$.each(Overlay.instances, (i, overlay) => {
overlay.image.remove();
});
Overlay.instances = [];
};
Overlay.prototype.display = function displayOverlay() {
const that = this;
this.image
.appendTo(that.el.parent())
.on('click', () => {
that.clickHandler(that.el);
return false;
});
};
// required return value for tabs.executeScript
/* eslint-disable-next-line no-unused-expressions */
'';
//# sourceURL=/uiscripts/blacklisting/overlay.js