-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject.js
41 lines (32 loc) · 1.04 KB
/
inject.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
chrome.storage.sync.get('kitty', function (data) {
if (data.kitty && data.kitty !== 'false') {
(function () {
var imgs = document.querySelectorAll('img');
for (var i = 0; i < imgs.length; i++) {
if (!imgs[i].src.includes('tumblr_')) {
imgs[i].src = cats[Math.floor(Math.random() * 1500)];
}
}
window.onscroll = function () {
var images = document.getElementsByTagName('img');
for (var i = 0; i < images.length; i++) {
if (!images[i].src.includes('tumblr_')) {
images[i].src = cats[Math.floor(Math.random() * 1500)];
}
}
var source = document.getElementsByTagName('source');
for (var i = 0; i < source.length; i++) {
if (!source[i].srcset.includes('tumblr_')) {
source[i].srcset = cats[Math.floor(Math.random() * 1500)];
}
}
var lazy = document.getElementsByClassName('lazyloaded');
for (var i = 0; i < lazy.length; i++) {
if (!lazy[i].src.includes('tumblr_')) {
lazy[i].src = cats[Math.floor(Math.random() * 1500)];
}
}
}
})();
}
})