forked from hant0508/usescripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAvito Cleaner.user.js
56 lines (48 loc) · 1.66 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
47
48
49
50
51
52
53
54
55
56
// ==UserScript==
// @name Avito Cleaner
// @namespace http://tampermonkey.net/
// @version 0.2.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'));
// Removing top banner
var elms = document.querySelectorAll('*[class^="index-module-left-block-"]');
if (elms.length > 0) {
setTimeout(() => {
elm = elms[0].nextElementSibling.firstElementChild;
if (elm !== null && elm !== undefined &&
elm.querySelectorAll('*[name="close"], *[class^="personal-discount-"], *[class*="Close-module-mask-"]').length > 0) { hide(elm); }
}, 2000);
}
elm = document.getElementsByClassName('js-packages')[0];
if (elm.children[1].innerHTML.includes('Примените к объявлению пакет услуг')) {
hide(elm);
}
})();