forked from hant0508-zz/usescripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Avito Cleaner.user.js
46 lines (39 loc) · 1.27 KB
/
Avito Cleaner.user.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
// ==UserScript==
// @name Avito Cleaner
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Unchecks commercial services and hides some intrusive ads
// @author hant0508
// @include https://www.avito.ru/*
// @grant none
// @run-at document-idle
// ==/UserScript==
function uncheck (elm) {
if (elm !== null && elm !== undefined) {
elm.checked = false;
}
}
function hide (elm) {
elm.setAttribute('style', 'display: none !important;');
}
function hideArr (arr) {
for(var i = 0; i < arr.length; ++i) {
hide(arr[i]);
}
}
(function() {
var elm = document.getElementsByClassName('packages-tab_free')[0];
if (elm !== null && elm !== undefined) {
elm.closest('.packages-tab').click();
}
uncheck(document.getElementById('service-premium'));
uncheck(document.getElementById('service-up-x2'));
uncheck(document.getElementById('service-vip'));
uncheck(document.getElementById('service-highlight'));
hideArr(document.getElementsByClassName('profile-item-promo'));
hideArr(document.getElementsByClassName('profile-item-warning'));
elm = document.getElementsByClassName('js-packages')[0];
if (elm.children[1].innerHTML.includes('Примените к объявлению пакет услуг')) {
hide(elm);
}
})();