RU AdList JS Fixes

try to take over the world!

当前为 2016-10-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name RU AdList JS Fixes
  3. // @namespace ruadlist_js_fixes
  4. // @version 20161027.1
  5. // @description try to take over the world!
  6. // @author lainverse & dimisa
  7. // @match *://*/*
  8. // @grant unsafeWindow
  9. // @grant window.close
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var win = (unsafeWindow || window),
  16. isFirefox = /firefox/i.test(navigator.userAgent);
  17.  
  18. // NodeList iterator polyfill (mostly for Safari)
  19. // https://jakearchibald.com/2014/iterators-gonna-iterate/
  20. if (!NodeList.prototype[Symbol.iterator]) {
  21. NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
  22. }
  23.  
  24. // Creates and return protected style (unless protection is manually disabled).
  25. // Protected style will re-add itself on removal and remaind enabled on attempt to disable it.
  26. function createStyle(rules, props, skip_protect) {
  27. var root = document.documentElement;
  28.  
  29. function _protect(style) {
  30. Object.defineProperty(style, 'sheet', {
  31. value: style.sheet,
  32. enumerable: true
  33. });
  34. Object.defineProperty(style, 'disabled', {
  35. get: function() {return true;}, //pretend to be disabled
  36. set: function() {},
  37. enumerable: true
  38. });
  39. }
  40.  
  41. function _create() {
  42. var style = root.appendChild(document.createElement('style')),
  43. prop, rule;
  44. style.type = 'text/css';
  45. for (prop in props) {
  46. if (style.hasOwnProperty(prop)) {
  47. style[prop] = props[prop];
  48. }
  49. }
  50. for (rule of rules) {
  51. try {
  52. style.sheet.insertRule(rule, 0);
  53. } catch (e) {
  54. console.error(e);
  55. }
  56. }
  57. if (!skip_protect) {
  58. _protect(style);
  59. }
  60. return style;
  61. }
  62.  
  63. var style = _create();
  64. if (skip_protect) {
  65. return style;
  66. }
  67.  
  68. var o = new MutationObserver(function(ms){
  69. var m, node, rule;
  70. for (m of ms) {
  71. for (node of m.removedNodes) {
  72. if (node === style) {
  73. (new Promise(function(resolve){
  74. setTimeout(function(resolve){
  75. resolve(_create());
  76. }, 0, resolve);
  77. })).then(function(st){
  78. style = st;
  79. })
  80. }
  81. }
  82. }
  83. });
  84. o.observe(root, {childList:true});
  85.  
  86. return style;
  87. }
  88.  
  89. // https://gf.qytechs.cn/scripts/19144-websuckit/
  90. (function() {
  91. // check does browser support Proxy and WebSocket
  92. if (typeof Proxy !== 'function' ||
  93. typeof WebSocket !== 'function') {
  94. return;
  95. }
  96.  
  97. function getWrappedCode(removeSelf) {
  98. var text = getWrappedCode.toString()+WSI.toString();
  99. text = (
  100. '(function(){"use strict";'+
  101. text.replace(/\/\/[^\r\n]*/g,'').replace(/[\s\r\n]+/g,' ')+
  102. '(new WSI(self||window)).init();'+
  103. '})();\n'+
  104. (removeSelf?'var s = document.currentScript; if (s) {s.parentNode.removeChild(s);}':'')
  105. );
  106. return text;
  107. }
  108.  
  109. function WSI(win, safeWin) {
  110. safeWin = safeWin || win;
  111. var masks = [], filter;
  112. for (filter of [// blacklist
  113. '||24video.xxx^',
  114. '||adlabs.ru^', '||adspayformymortgage.win^', '||aviabay.ru^',
  115. '||bgrndi.com^', '||brokeloy.com^',
  116. '||cnamerutor.ru^',
  117. '||docfilms.info^', '||dreadfula.ru^',
  118. '||et-code.ru^',
  119. '||film-doma.ru^',
  120. '||free-torrent.org^', '||free-torrent.pw^',
  121. '||free-torrents.org^', '||free-torrents.pw^',
  122. '||game-torrent.info^', '||gocdn.ru^',
  123. '||hdkinoshka.com^', '||hghit.com^', '||hindcine.net^',
  124. '||kiev.ua^', '||kinotochka.net^',
  125. '||kinott.com^', '||kinott.ru^', '||kuveres.com^',
  126. '||lepubs.com^', '||luxadv.com^', '||luxup.ru^',
  127. '||mail.ru^', '||marketgid.com^', '||mxtads.com^',
  128. '||oconner.biz^',
  129. '||pkpojhc.com^',
  130. '||psma01.com^', '||psma02.com^', '||psma03.com^',
  131. '||recreativ.ru^', '||regpole.com^', '||ruttwind.com^',
  132. '||skidl.ru^',
  133. '||torvind.com^', '||trafmag.com^',
  134. '||webadvert-gid.ru^', '||webadvertgid.ru^',
  135. '||xxuhter.ru^',
  136. '||yuiout.online^',
  137. '||zoom-film.ru^'
  138. ]) {
  139. masks.push(new RegExp(
  140. filter.replace(/([\\\/\[\].*+?(){}$])/g, '\\$1')
  141. .replace(/\^(?!$)/g,'\\.?[^\\w%._-]')
  142. .replace(/\^$/,'\\.?([^\\w%._-]|$)')
  143. .replace(/^\|\|/,'^wss?:\\/+([^\/.]+\\.)*'),
  144. 'i'));
  145. }
  146.  
  147. function isBlocked(url) {
  148. for (var mask of masks) {
  149. if (mask.test(url)) {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155.  
  156. var realWebSocket = win.WebSocket;
  157. function wsGetter (target, name) {
  158. try {
  159. if (typeof realWebSocket.prototype[name] === 'function') {
  160. if (name === 'close' || name === 'send') { // send also closes connection
  161. target.readyState = realWebSocket.CLOSED;
  162. }
  163. return (
  164. function fake() {
  165. console.log('[WSI] Invoked function "'+name+'"', '| Tracing', (new Error()));
  166. return;
  167. }
  168. );
  169. }
  170. if (typeof realWebSocket.prototype[name] === 'number') {
  171. return realWebSocket[name];
  172. }
  173. } catch(ignore) {}
  174. return target[name];
  175. }
  176.  
  177. function createWebSocketWrapper(target) {
  178. return new Proxy(realWebSocket, {
  179. construct: function (target, args) {
  180. var url = args[0];
  181. console.log('[WSI] Opening socket on ' + url + ' \u2026');
  182. if (isBlocked(url)) {
  183. console.log("[WSI] Blocked.");
  184. return new Proxy({
  185. url: url,
  186. readyState: realWebSocket.OPEN
  187. }, {
  188. get: wsGetter
  189. });
  190. }
  191. return new target(args[0], args[1]);
  192. }
  193. });
  194. }
  195.  
  196. function WorkerWrapper() {
  197. var realWorker = win.Worker;
  198. function wrappedWorker(resourceURI) {
  199. var isBlobURL = /^blob:/i,
  200. xhr = null,
  201. _callbacks = new WeakMap(),
  202. _worker = null,
  203. _terminate = false,
  204. _onerror = null,
  205. _onmessage = null,
  206. _messages = [],
  207. _events = [],
  208. _self = this;
  209.  
  210. function callbackWrapper(func) {
  211. if (typeof func !== 'function') {
  212. return undefined;
  213. }
  214. return (
  215. function callback() {
  216. func.apply(_self, arguments);
  217. }
  218. );
  219. }
  220.  
  221. _self.terminate = function(){
  222. _terminate = true;
  223. if (_worker) {
  224. _worker.terminate();
  225. }
  226. };
  227. Object.defineProperty(_self, 'onmessage', {
  228. get: function() {
  229. return _onmessage;
  230. },
  231. set: function(val) {
  232. _onmessage = val;
  233. if (_worker) {
  234. _worker.onmessage = callbackWrapper(val);
  235. }
  236. }
  237. });
  238. Object.defineProperty(_self, 'onerror', {
  239. get: function() {
  240. return _onerror;
  241. },
  242. set: function(val) {
  243. _onerror = val;
  244. if (_worker) {
  245. _worker.onerror = callbackWrapper(val);
  246. }
  247. }
  248. });
  249. _self.postMessage = function(message){
  250. if (_worker) {
  251. _worker.postMessage(message);
  252. } else {
  253. _messages.push(message);
  254. }
  255. };
  256. _self.terminate = function() {
  257. _terminate = true;
  258. if (_worker) {
  259. _worker.terminate();
  260. }
  261. };
  262. _self.addEventListener = function(){
  263. if (typeof arguments[1] !== 'function') {
  264. return;
  265. }
  266. if (!_callbacks.has(arguments[1])) {
  267. _callbacks.set(arguments[1], callbackWrapper(arguments[1]));
  268. }
  269. arguments[1] = _callbacks.get(arguments[1]);
  270. if (_worker) {
  271. _worker.addEventListener.apply(_worker, arguments);
  272. } else {
  273. _events.push(['addEventListener', arguments]);
  274. }
  275. };
  276. _self.removeEventListener = function(){
  277. if (typeof arguments[1] !== 'function' || !_callbacks.has(arguments[1])) {
  278. return;
  279. }
  280. arguments[1] = _callbacks.get(arguments[1]);
  281. _callbacks.delete(arguments[1]);
  282. if (_worker) {
  283. _worker.removeEventListener.apply(_worker, arguments);
  284. } else {
  285. _events.push(['removeEventListener', arguments]);
  286. }
  287. };
  288.  
  289. if (!isBlobURL.test(resourceURI)) {
  290. _worker = new realWorker(resourceURI);
  291. return; // not a blob, no need to wrap
  292. }
  293.  
  294. xhr = new XMLHttpRequest();
  295. xhr.responseType = 'blob';
  296. try {
  297. xhr.open('GET', resourceURI, true);
  298. } catch(ignore) {
  299. _worker = new realWorker(resourceURI);
  300. return; // failed to open connection, unable to continue wrapping procedure
  301. }
  302. (new Promise(function(resolve, reject){
  303. if (xhr.readyState !== XMLHttpRequest.OPENED) {
  304. // connection wasn't opened, unable to continue wrapping procedure
  305. return reject();
  306. }
  307. xhr.onload = function(){
  308. if (this.status === 200) {
  309. var reader = new FileReader();
  310. reader.addEventListener("loadend", function() {
  311. resolve(new realWorker(URL.createObjectURL(
  312. new Blob([getWrappedCode(false)+this.result])
  313. )));
  314. });
  315. reader.readAsText(this.response);
  316. }
  317. };
  318. xhr.send();
  319. })).then(function(val) {
  320. _worker = val;
  321. _worker.onerror = callbackWrapper(_onerror);
  322. _worker.onmessage = callbackWrapper(_onmessage);
  323. var _e;
  324. while(_events.length) {
  325. _e = _events.shift();
  326. _worker[_e[0]].apply(_worker, _e[1]);
  327. }
  328. while(_messages.length) {
  329. _worker.postMessage(_messages.shift());
  330. }
  331. if (_terminate) {
  332. _worker.terminate();
  333. }
  334. }).catch(function(){});
  335.  
  336. }
  337. win.Worker = wrappedWorker.bind(safeWin);
  338. }
  339.  
  340. function CreateElementWrapper() {
  341. var realCreateElement = document.createElement.bind(document),
  342. code = encodeURIComponent('<scr'+'ipt>'+getWrappedCode(true)+'</scr'+'ipt>\n'),
  343. isDataURL = /^data:/i,
  344. isBlobURL = /^blob:/i;
  345.  
  346. function frameRewrite(e) {
  347. var f = e.target,
  348. w = f.contentWindow;
  349. if (!f.src || (w && isBlobURL.test(f.src))) {
  350. w.WebSocket = createWebSocketWrapper();
  351. }
  352. if (isDataURL.test(f.src) && f.src.indexOf(code) < 0) {
  353. f.src = f.src.replace(',',',' + code);
  354. }
  355. }
  356.  
  357. function wrappedCreateElement(name) {
  358. var el = realCreateElement.apply(document, arguments);
  359. if (el.tagName === 'IFRAME') {
  360. el.addEventListener('load', frameRewrite, false);
  361. }
  362. return el;
  363. }
  364. document.createElement = wrappedCreateElement.bind(document);
  365.  
  366. document.addEventListener('DOMContentLoaded', function(){
  367. for (var ifr of document.querySelectorAll('IFRAME')) {
  368. ifr.addEventListener('load', frameRewrite, false);
  369. }
  370. }, false);
  371. }
  372.  
  373. this.init = function() {
  374. win.WebSocket = createWebSocketWrapper();
  375. WorkerWrapper();
  376. if (typeof document !== 'undefined') {
  377. CreateElementWrapper();
  378. }
  379. };
  380. }
  381.  
  382. if (isFirefox) {
  383. var script = document.createElement('script');
  384. script.appendChild(document.createTextNode(getWrappedCode()));
  385. document.head.insertBefore(script, document.head.firstChild);
  386. return; //we don't want to call functions on page from here in Fx, so exit
  387. }
  388.  
  389. (new WSI((unsafeWindow||self||window),(self||window))).init();
  390. })();
  391.  
  392. if (!isFirefox) { // scripts for non-Firefox browsers
  393.  
  394. // https://gf.qytechs.cn/scripts/14720-it-s-not-important
  395. (function(){
  396. var imptt = /((display|(margin|padding)(-top|-bottom)?)\s*:[^;!]*)!\s*important/ig;
  397.  
  398. function unimportanter(el, si) {
  399. if (!imptt.test(si) || el.style.display === 'none') {
  400. return 0; // get out if we have nothing to do here
  401. }
  402. if (el.nodeName === 'IFRAME' && el.src &&
  403. el.src.slice(0,17) === 'chrome-extension:') {
  404. return 0; // Web of Trust uses this method to add their frame
  405. }
  406. var so = si.replace(imptt, function(){return arguments[1];}), ret = 0;
  407. if (si !== so) {
  408. ret = 1;
  409. el.setAttribute('style', so);
  410. }
  411. return ret;
  412. }
  413.  
  414. function logger(c) {
  415. if (c) {
  416. console.log('Some page elements became a bit less important.');
  417. }
  418. }
  419.  
  420. function checkTarget(node, cnt) {
  421. if (!(node && node.getAttribute)) {
  422. return 0;
  423. }
  424. var si = node.getAttribute('style');
  425. if (si && si.indexOf('!') > -1) {
  426. cnt += unimportanter(node, si);
  427. }
  428. return cnt;
  429. }
  430.  
  431. var observer = new MutationObserver(function(mutations) {
  432. setTimeout(function(ms) {
  433. var cnt = 0, m, node;
  434. for (m of ms) {
  435. cnt = checkTarget(m.target, cnt);
  436. for (node of m.addedNodes) {
  437. cnt += checkTarget(node, cnt);
  438. }
  439. }
  440. logger(cnt);
  441. }, 0, mutations);
  442. });
  443.  
  444. observer.observe(document, { childList : true, attributes : true, attributeFilter : ['style'], subtree : true });
  445.  
  446. win.addEventListener ("load", function(){
  447. var c = 0, imp;
  448. for (imp of document.querySelectorAll('[style*="!"]')) {
  449. c+= checkTarget(imp, c);
  450. }
  451. logger(c);
  452. }, false);
  453. })();
  454.  
  455. }
  456.  
  457. if (/^https?:\/\/(news\.yandex\.|(www\.)?yandex\.[^\/]+\/(yand)?search[\/?])/i.test(win.location.href)) {
  458. // https://gf.qytechs.cn/en/scripts/809-no-yandex-ads
  459. (function(){
  460. var adWords = ['Яндекс.Директ','Реклама','Ad'];
  461. function remove(node) {
  462. node.parentNode.removeChild(node);
  463. }
  464. // Generic ads removal and fixes
  465. function removeGenericAds() {
  466. var s, i;
  467. s = document.querySelector('.serp-header');
  468. if (s) {
  469. s.style.marginTop='0';
  470. }
  471. for (s of document.querySelectorAll('.serp-adv__head + .serp-item, #adbanner, .serp-adv, .b-spec-adv, div[class*="serp-adv__"]')) {
  472. remove(s);
  473. }
  474. }
  475. // Search ads
  476. function removeSearchAds() {
  477. var s, item;
  478. for (s of document.querySelectorAll('.serp-block, .serp-item, .search-item')) {
  479. item = s.querySelector('.label, .serp-item__label, .document__provider-name');
  480. if (item && adWords.indexOf(item.textContent) > -1) {
  481. remove(s);
  482. console.log('Ads removed.');
  483. }
  484. }
  485. }
  486. // News ads
  487. function removeNewsAds() {
  488. var s;
  489. for (s of document.querySelectorAll('.page-content__left > *,.page-content__right > *:not(.page-content__col),.page-content__right > .page-content__col > *')) {
  490. if (s.textContent.indexOf(adWords[0]) > -1) {
  491. remove(s);
  492. console.log('Ads removed.');
  493. }
  494. }
  495. }
  496. // News fixes
  497. function removePageAdsClass() {
  498. if (document.body.classList.contains("b-page_ads_yes")){
  499. document.body.classList.remove("b-page_ads_yes");
  500. console.log('Page ads class removed.');
  501. }
  502. }
  503. // Function to attach an observer to monitor dynamic changes on the page
  504. function pageUpdateObserver(func, obj, params) {
  505. if (obj) {
  506. var o = new MutationObserver(func);
  507. o.observe(obj,(params || {childList:true, subtree:true}));
  508. }
  509. }
  510. // Cleaner
  511. document.addEventListener ('DOMContentLoaded', function() {
  512. removeGenericAds();
  513. if (win.location.hostname.search(/^news\./i) === 0) {
  514. pageUpdateObserver(removeNewsAds, document.querySelector('BODY'));
  515. pageUpdateObserver(removePageAdsClass, document.body, {attributes:true, attributesFilter:['class']});
  516. removeNewsAds();
  517. removePageAdsClass();
  518. } else {
  519. pageUpdateObserver(removeSearchAds, document.querySelector('.main__content'));
  520. removeSearchAds();
  521. }
  522. });
  523. })();
  524. return; //skip fixes for other sites
  525. }
  526.  
  527. // https://gf.qytechs.cn/en/scripts/14470-4pda-unbrender
  528. if (/(^|\.)4pda\.ru$/i.test(window.location.hostname)) {
  529. (function() {
  530. var isForum = document.location.href.search('/forum/') !== -1,
  531. hStyle;
  532.  
  533. function remove(n) {
  534. if (n) {
  535. n.parentNode.removeChild(n);
  536. }
  537. }
  538.  
  539. function afterClean() {
  540. hStyle.disabled = true;
  541. remove(hStyle);
  542. }
  543.  
  544. function beforeClean() {
  545. // attach styles before document displayed
  546. hStyle = createStyle([
  547. 'html { overflow-y: scroll }',
  548. 'article + aside * { display: none !important }',
  549. '#header + div:after {'+(
  550. 'content: "";'+
  551. 'position: fixed;'+
  552. 'top: 0;'+
  553. 'left: 0;'+
  554. 'width: 100%;'+
  555. 'height: 100%;'+
  556. 'background-color: #E6E7E9'
  557. )+'}',
  558. // http://codepen.io/Beaugust/pen/DByiE
  559. '@keyframes spin { 100% { transform: rotate(360deg) } }',
  560. 'article + aside:after {'+(
  561. 'content: "";'+
  562. 'position: absolute;'+
  563. 'width: 150px;'+
  564. 'height: 150px;'+
  565. 'top: 150px;'+
  566. 'left: 50%;'+
  567. 'margin-top: -75px;'+
  568. 'margin-left: -75px;'+
  569. 'box-sizing: border-box;'+
  570. 'border-radius: 100%;'+
  571. 'border: 10px solid rgba(0, 0, 0, 0.2);'+
  572. 'border-top-color: rgba(0, 0, 0, 0.6);'+
  573. 'animation: spin 2s infinite linear'
  574. )+'}'
  575. ], {id:'ubrHider'}, true);
  576.  
  577. // display content of a page if time to load a page is more than 2 seconds to avoid
  578. // blocking access to a page if it is loading for too long or stuck in a loading state
  579. setTimeout(2000, afterClean);
  580. }
  581.  
  582. createStyle([
  583. '#nav .use-ad { display: block !important }',
  584. 'article:not(.post) + article:not(#id), a[target="_blank"] img[height="90"] { display: none !important }'
  585. ]);
  586.  
  587. if (!isForum) {
  588. beforeClean();
  589. }
  590.  
  591. // save links to non-overridden functions to use later
  592. var oGA = Element.prototype.getAttribute,
  593. oSA = Element.prototype.setAttribute,
  594. protectedElems;
  595. // protect/hide changed attributes in case site attempt to restore them
  596. function styleProtector(eventMode) {
  597. var oRAN = Element.prototype.removeAttributeNode,
  598. isStyleText = function(t){ return t === 'style'; },
  599. isStyleAttr = function(a){ return a instanceof Attr && a.nodeName === 'style' },
  600. returnUndefined = function(){},
  601. protectedElems = new WeakMap();
  602. function protoOverride(element, functionName, isStyleCheck, returnIfProtected) {
  603. var oF = element.prototype[functionName];
  604. element.prototype[functionName] = function(){
  605. if (protectedElems.get(this) !== undefined && isStyleCheck(arguments[0])) {
  606. return returnIfProtected(protectedElems.get(this), arguments, this);
  607. }
  608. return oF.apply(this, arguments);
  609. }
  610. }
  611. protoOverride(Element, 'removeAttribute', isStyleText, returnUndefined);
  612. protoOverride(Element, 'removeAttributeNS', isStyleText, returnUndefined);
  613. protoOverride(Element, 'removeAttributeNode', isStyleAttr, function(o, args, node) {
  614. if (args[0] instanceof Attr && args[0].ownerElement !== node) {
  615. // throw 'attribute of another element' error
  616. oRAN.call(node, document.createAttribute('style'));
  617. }
  618. if (o.oldStyle === null) {
  619. // throw 'not an Attr' error
  620. oRAN.call(node, null);
  621. }
  622. o.oldStyle = null;
  623. return args[0];
  624. });
  625. protoOverride(Element, 'hasAttribute', isStyleText, function(o) {
  626. return o.oldStyle !== null;
  627. });
  628. protoOverride(Element, 'hasAttributeNS', isStyleText, function(o) {
  629. return o.oldStyle !== null;
  630. });
  631. protoOverride(Element, 'setAttribute', isStyleText, function(o, args) {
  632. o.oldStyle = args[1];
  633. });
  634. protoOverride(Element, 'setAttributeNS', isStyleText, returnUndefined);
  635. protoOverride(Element, 'setAttributeNode', isStyleAttr, returnUndefined);
  636. protoOverride(Element, 'getAttribute', isStyleText, function(o) {
  637. return o.oldStyle;
  638. });
  639. protoOverride(Element, 'getAttributeNS', isStyleText, returnUndefined);
  640. protoOverride(Element, 'getAttributeNode', isStyleText, function(o){
  641. if (o.oldStyle === null) {
  642. return null;
  643. }
  644. var at = document.createAttribute('style');
  645. at.value = o.oldStyle;
  646. Object.defineProperty(at, 'ownerElement', {
  647. value: this,
  648. enumerable: true
  649. });
  650. return at;
  651. });
  652. if (eventMode) {
  653. var e = document.createEvent('Event');
  654. e.initEvent('protoOverride', false, false);
  655. window.protectedElems = protectedElems;
  656. window.dispatchEvent(e);
  657. } else {
  658. return protectedElems;
  659. }
  660. }
  661. if (isFirefox) {
  662. var s = document.createElement('script');
  663. s.textContent = '(' + styleProtector.toString() + ')(true);' +
  664. 'var s = document.currentScript; if (s) {s.parentNode.removeChild(s);}'
  665. window.addEventListener('protoOverride', function protoOverrideCallback(e){
  666. if (win.protectedElems) {
  667. protectedElems = win.protectedElems;
  668. delete win.protectedElems;
  669. }
  670. document.removeEventListener('protoOverride', protoOverrideCallback, true);
  671. }, true);
  672. document.documentElement.appendChild(s);
  673. } else {
  674. protectedElems = styleProtector(false);
  675. }
  676.  
  677. // clean a page
  678. window.addEventListener('DOMContentLoaded', function(){
  679. var rem, si, itm;
  680. function width(){ return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; }
  681. function height(){ return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; }
  682.  
  683.  
  684. if (isForum) {
  685. si = document.querySelector('#logostrip');
  686. if (si) {
  687. remove(si.parentNode.nextSibling);
  688. }
  689. }
  690.  
  691. if (document.location.href.search('/forum/dl/') !== -1) {
  692. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+
  693. ';background-color:black!important');
  694. for (itm of document.querySelectorAll('body>div')) {
  695. if (!itm.querySelector('.dw-fdwlink')) {
  696. remove(itm);
  697. }
  698. }
  699. }
  700.  
  701. if (isForum) { // Do not continue if it's a forum
  702. return;
  703. }
  704.  
  705. si = document.querySelector('#header');
  706. if (si) {
  707. rem = si.previousSibling;
  708. while (rem) {
  709. si = rem.previousSibling;
  710. remove(rem);
  711. rem = si;
  712. }
  713. }
  714.  
  715. for (itm of document.querySelectorAll('#nav li[class]')) {
  716. if (itm && itm.querySelector('a[href^="/tag/"]')) {
  717. remove(itm);
  718. }
  719. }
  720.  
  721. var style, result;
  722. for (itm of document.querySelectorAll('DIV')) {
  723. if (itm.offsetWidth > 0.95 * width() && itm.offsetHeight > 0.8 * height()) {
  724. style = window.getComputedStyle(itm, null);
  725. result = [];
  726. if (style.backgroundImage !== 'none') {
  727. result.push('background-image:none!important');
  728. }
  729. if (style.backgroundColor !== 'transparent' &&
  730. style.backgroundColor !== 'rgba(0, 0, 0, 0)') {
  731. result.push('background-color:transparent!important');
  732. }
  733. if (result.length) {
  734. if (itm.getAttribute('style')) {
  735. result.unshift(itm.getAttribute('style'));
  736. }
  737. (function(){
  738. var fakeStyle = {
  739. 'backgroundImage': itm.style.backgroundImage,
  740. 'backgroundColor': itm.style.backgroundColor
  741. };
  742. try {
  743. Object.defineProperty(itm, 'style', {
  744. value: new Proxy(itm.style, {
  745. get: function(target, prop){
  746. if (fakeStyle.hasOwnProperty(prop)) {
  747. return fakeStyle[prop];
  748. } else {
  749. return target[prop];
  750. }
  751. },
  752. set: function(target, prop, value){
  753. if (fakeStyle.hasOwnProperty(prop)) {
  754. fakeStyle[prop] = value;
  755. } else {
  756. target[prop] = value;
  757. }
  758. return value;
  759. }
  760. }),
  761. enumerable: true
  762. });
  763. } catch (e) {
  764. console.log('Unable to protect style property.', e)
  765. }
  766. })();
  767. if (protectedElems) {
  768. protectedElems.set(itm, {oldStyle: oGA.call(itm, 'style')});
  769. }
  770. oSA.call(itm, 'style', result.join(';'));
  771. }
  772. }
  773. }
  774.  
  775. for (itm of document.querySelectorAll('ASIDE>DIV')) {
  776. if ( ((itm.querySelector('script, iframe, a[href*="/ad/www/"]') ||
  777. itm.querySelector('img[src$=".gif"]:not([height="0"]), img[height="400"]')) &&
  778. !itm.classList.contains('post') ) || !itm.childNodes.length ) {
  779. remove(itm);
  780. }
  781. }
  782.  
  783. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+';background-color:#E6E7E9!important');
  784.  
  785. // display content of the page
  786. afterClean();
  787. });
  788. })();
  789. return;
  790. }
  791.  
  792. // https://gf.qytechs.cn/en/scripts/21937-moonwalk-hdgo-kodik-fix v0.7+ (adapted & fixed)
  793. document.addEventListener ('DOMContentLoaded', function() {
  794. var tmp, t;1
  795. function log (e) {
  796. console.log('Moonwalk&HDGo&Kodik FIX: ' + e + ' player in ' + win.location.href);
  797. }
  798. if (win.adv_enabled !== undefined && win.condition_detected !== undefined) { // moonwalk
  799. log('Moonwalk');
  800. if (win.adv_enabled) {
  801. win.adv_enabled = false;
  802. }
  803. win.condition_detected = false;
  804. if (win.MXoverrollCallback) {
  805. document.addEventListener('click', function catcher(e){
  806. e.stopPropagation();
  807. win.MXoverrollCallback.call(window);
  808. document.removeEventListener('click', catcher, true);
  809. }, true);
  810. }
  811. } else if (win.banner_second !== undefined && win.$banner_ads !== undefined) { // hdgo
  812. log('HDGo');
  813. tmp = document.querySelector('#swtf');
  814. if (tmp) {
  815. tmp.style.display = 'none';
  816. }
  817. win.banner_second = 0;
  818. win.$banner_ads = false;
  819. if (win.$new_ads !== undefined) {
  820. win.$new_ads = false;
  821. }
  822. if (win.canRunAds !== undefined && win.canRunAds !== true) {
  823. win.canRunAds = true;
  824. }
  825. } else if (win.MXoverrollCallback && win.iframeSearch !== undefined) { // kodik
  826. log('Kodik');
  827. tmp = document.querySelector('.play_button');
  828. if (tmp) {
  829. tmp.onclick = win.MXoverrollCallback.bind(window);
  830. }
  831. win.IsAdBlock = false;
  832. }
  833. }, false);
  834.  
  835. // function to search and remove nodes by content
  836. // selector - standard CSS selector to define set of nodes to check
  837. // words - regular expression to check content of the suspicious nodes
  838. // params - object with multiple extra parameters:
  839. // .hide - set display to none instead of removing from the page
  840. // .parent - parent node to remove if content is found in the child node
  841. // .siblings - number of simling nodes to remove (excluding text nodes)
  842. function scRemove(e) {e.parentNode.removeChild(e);}
  843. function scHide(e) {
  844. var s = e.getAttribute('style')||'',
  845. h = ';display:none!important;';
  846. if (s.indexOf(h) < 0) {
  847. e.setAttribute('style', s+h);
  848. }
  849. }
  850. function scissors (selector, words, scope, params) {
  851. var remFunc = (params.hide ? scHide : scRemove),
  852. iterFunc = (params.siblings > 0 ?
  853. 'nextSibling' :
  854. 'previousSibling'),
  855. toRemove = [],
  856. siblings,
  857. node;
  858. for (node of scope.querySelectorAll(selector)) {
  859. if (words.test(node.innerHTML) || !node.childNodes.length) {
  860. // drill up to the specified parent node if required
  861. if (params.parent) {
  862. while(node !== scope && !(node.matches(params.parent))) {
  863. node = node.parentNode;
  864. }
  865. }
  866. if (node === scope) {
  867. break;
  868. }
  869. toRemove.push(node);
  870. // add multiple nodes if defined more than one sibling
  871. siblings = Math.abs(params.siblings) || 0;
  872. while (siblings) {
  873. node = node[iterFunc];
  874. toRemove.push(node);
  875. if (node.nodeType === Node.ELEMENT_NODE) {
  876. siblings -= 1; //count only element nodes
  877. }
  878. }
  879. }
  880. }
  881. for (node of toRemove) {
  882. remFunc(node);
  883. }
  884. return toRemove.length;
  885. }
  886.  
  887. // function to perform multiple checks if ads inserted with a delay
  888. // by default does 30 checks withing a 3 seconds unless nonstop mode specified
  889. // also does 1 extra check when a page completely loads
  890. // selector and words - passed dow to scissors
  891. // params - object with multiple extra parameters:
  892. // .root - selector to narrow down scope to scan;
  893. // .observe - if true then check will be performed continuously;
  894. // Other parameters passed down to scissors.
  895. function gardener(selector, words, params) {
  896. params = params || {};
  897. var scope = document.body,
  898. nonstop = false;
  899. // narrow down scope to a specific element
  900. if (params.root) {
  901. scope = scope.querySelector(params.root);
  902. if (!scope) {// exit if the root element is not present on the page
  903. return 0;
  904. }
  905. }
  906. // add observe mode if required
  907. if (params.observe) {
  908. if (typeof MutationObserver === 'function') {
  909. var o = new MutationObserver(function(ms){
  910. for (var m of ms) {
  911. if (m.addedNodes.length) {
  912. scissors(selector, words, scope, params);
  913. }
  914. }
  915. });
  916. o.observe(scope, {childList:true, subtree: true});
  917. } else {
  918. nonstop = true;
  919. }
  920. }
  921. // wait for a full page load to do one extra cut
  922. win.addEventListener('load',function(){
  923. scissors(selector, words, scope, params);
  924. });
  925. // do multiple cuts until ads removed
  926. function cut(sci, s, w, sc, p, i) {
  927. if (i > 0) {
  928. i -= 1;
  929. }
  930. if (i && !sci(s, w, sc, p)) {
  931. setTimeout(cut, 100, sci, s, w, sc, p, i);
  932. }
  933. }
  934. cut(scissors, selector, words, scope, params, (nonstop ? -1 : 30));
  935. }
  936.  
  937. function preventBackgroundRedirect() {
  938. // create "cose_me" event to call high-level window.close()
  939. var key = Math.random().toString(36).substr(2);
  940. window.addEventListener('close_me_'+key, function(e) {
  941. window.close();
  942. });
  943.  
  944. // window.open wrapper
  945. function pbrLander() {
  946. var orgOpen = window.open.bind(window);
  947. function closeWindow(){
  948. // site went to a new tab and attempts to unload
  949. // call for high-level close through event
  950. var event = new CustomEvent("close_me_%key%", {});
  951. window.dispatchEvent(event);
  952. }
  953. function open(){
  954. var idx = String.prototype.indexOf;
  955. if (arguments[0] &&
  956. (idx.call(arguments[0], window.location.host) > -1 ||
  957. idx.call(arguments[0], '://') === -1)) {
  958. window.addEventListener('unload', closeWindow, true);
  959. }
  960. orgOpen.apply(window, arguments);
  961. }
  962. window.open = open.bind(window);
  963. var s = document.currentScript;
  964. if (s) {s.parentNode.removeChild(s);}
  965. }
  966.  
  967. // land wrapper on the page
  968. var script = document.createElement('script');
  969. script.appendChild(document.createTextNode('('+pbrLander.toString().replace(/%key%/g,key)+')();'));
  970. document.head.insertBefore(script,document.head.firstChild);
  971. console.log("Background redirect prevention enabled.");
  972. }
  973.  
  974. function forbidServiceWorker() {
  975. if (!("serviceWorker" in navigator)) {
  976. return;
  977. }
  978. var svr = navigator.serviceWorker.ready;
  979. Object.defineProperty(navigator, 'serviceWorker', {
  980. value: {
  981. register: function(){
  982. console.log('Registration of serviceWorker ' + arguments[0] + ' blocked.');
  983. return new Promise(function(){});
  984. },
  985. ready: new Promise(function(){}),
  986. addEventListener:function(){}
  987. }
  988. });
  989. document.addEventListener('DOMContentLoaded', function() {
  990. if (!svr) {
  991. return;
  992. }
  993. svr.then(function(sw) {
  994. console.log('Found existing serviceWorker:', sw);
  995. console.log('Attempting to unregister...');
  996. sw.unregister().then(function() {
  997. console.log('Unregistered! :)');
  998. }).catch(function(err) {
  999. console.log('Unregistration failed. :(', err);
  1000. console.log('Try to remove it manually:');
  1001. console.log(' 1. Open: chrome://serviceworker-internals/ (Google Chrome and alike) or about:serviceworkers (Mozilla Firefox) in a new tab.');
  1002. console.log(' 2. Search there for one with "'+document.domain+'" in the name.');
  1003. console.log(' 3. Use buttons in the same block with service you found to stop it and uninstall/unregister.');
  1004. });
  1005. }).catch(function(err) {
  1006. console.log("Lol, it failed on it's own. -_-", err);
  1007. });
  1008. }, false);
  1009. }
  1010.  
  1011. var scripts = {};
  1012. scripts['fs.to'] = function() {
  1013. function skipClicker(i) {
  1014. if (!i) {
  1015. return;
  1016. }
  1017. var skip = document.querySelector('.b-aplayer-banners__close');
  1018. if (skip) {
  1019. skip.click();
  1020. } else {
  1021. setTimeout(skipClicker, 100, i-1);
  1022. }
  1023. }
  1024. setTimeout(skipClicker, 100, 30);
  1025.  
  1026. createStyle([
  1027. '.l-body-branding *,'+
  1028. '.b-styled__item-central,'+
  1029. '.b-styled__content-right,'+
  1030. '.b-styled__section-central,'+
  1031. 'div[id^="adsProxy-"]'+
  1032. '{display:none!important}',
  1033. 'body {background-image:url(data:image/png;base64,'+
  1034. 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACX'+
  1035. 'BIWXMAAC4jAAAuIwF4pT92AAAADUlEQVR42mOQUdL5DwACMgFq'+
  1036. 'BC3ttwAAAABJRU5ErkJggg==)!important}'
  1037. ]);
  1038.  
  1039. if (/\/(view_iframe|iframeplayer)\//i.test(document.location.pathname)) {
  1040. var p = document.querySelector('#player:not([preload="auto"])'),
  1041. m = document.querySelector('.main'),
  1042. adStepper = function(p) {
  1043. if (p.currentTime < p.duration) {
  1044. p.currentTime += 1;
  1045. }
  1046. },
  1047. adSkipper = function(f, p) {
  1048. f.click();
  1049. p.waitAfterSkip = false;
  1050. p.longerSkipper = false;
  1051. console.log('Пропустили.');
  1052. },
  1053. cl = function(p) {
  1054. var faster = document.querySelector('.b-aplayer__html5-desktop-skip'),
  1055. series = document.querySelector('.b-aplayer__actions-series');
  1056.  
  1057. function clickSelected() {
  1058. var s = document.querySelector('.b-aplayer__popup-series-episodes .selected a');
  1059. if (s) {
  1060. s.click();
  1061. }
  1062. }
  1063.  
  1064. if ((!faster || faster.style.display !== 'block') && series && !p.seriesClicked) {
  1065. series.click();
  1066. p.seriesClicked = true;
  1067. p.longerSkipper = true;
  1068. setTimeout(clickSelected, 1000);
  1069. p.pause();
  1070. }
  1071.  
  1072. function skipListener() {
  1073. if (p.waitAfterSkip) {
  1074. console.log('В процессе пропуска…');
  1075. return;
  1076. }
  1077. p.pause();
  1078. if (!p.classList.contains('m-hidden')) {
  1079. p.classList.add('m-hidden');
  1080. }
  1081. if (faster && p.currentTime &&
  1082. win.getComputedStyle(faster).display === 'block' &&
  1083. !faster.querySelector('.b-aplayer__html5-desktop-skip-timer')) {
  1084. p.waitAfterSkip = true;
  1085. setTimeout(adSkipper, (p.longerSkipper?3:1)*1000, faster, p);
  1086. console.log('Доступен быстрый пропуск…');
  1087. } else {
  1088. setTimeout(adStepper, 1000, p);
  1089. }
  1090. }
  1091.  
  1092. p.addEventListener('timeupdate', skipListener, false);
  1093. },
  1094. o = new MutationObserver(function (ms) {
  1095. var m, node;
  1096. for (m of ms) {
  1097. for (node of m.addedNodes) {
  1098. if (node.id === 'player' &&
  1099. node.nodeName === 'VIDEO' &&
  1100. node.getAttribute('preload') !== 'auto') {
  1101. cl(node);
  1102. }
  1103. }
  1104. }
  1105. });
  1106. if (p.nodeName === 'VIDEO') {
  1107. cl(p);
  1108. } else {
  1109. o.observe(m, {childList: true});
  1110. }
  1111. }
  1112. };
  1113. scripts['brb.to'] = scripts['fs.to'];
  1114. scripts['cxz.to'] = scripts['fs.to'];
  1115.  
  1116. scripts['drive2.ru'] = function() {
  1117. gardener('.c-block:not(.js-recommendations),.o-grid__item', />Реклама<\//i);
  1118. };
  1119.  
  1120. scripts['fishki.net'] = function() {
  1121. gardener('.main-post', /543769|Реклама/);
  1122. };
  1123.  
  1124. scripts['hdgo.cc'] = {
  1125. 'now': function(){
  1126. var o = new MutationObserver(function(ms) {
  1127. var m, node;
  1128. for (m of ms) {
  1129. for (node of m.addedNodes) {
  1130. if (node.tagName === 'SCRIPT' && node.getAttribute('onerror') !== null) {
  1131. node.removeAttribute('onerror');
  1132. }
  1133. }
  1134. }
  1135. });
  1136. o.observe(document, {childList:true, subtree: true});
  1137. }
  1138. };
  1139. scripts['couber.be'] = scripts['hdgo.cc'];
  1140. scripts['46.30.43.38'] = scripts['hdgo.cc'];
  1141.  
  1142. scripts['hdrezka.me'] = {
  1143. 'now': function() {
  1144. Object.defineProperty(win, 'fuckAdBlock', {
  1145. value: {
  1146. onDetected: function() {
  1147. console.log('Pretending to be an ABP detector.');
  1148. }
  1149. }
  1150. });
  1151. Object.defineProperty(win, 'ab', {
  1152. value: false,
  1153. enumerable: true
  1154. });
  1155. },
  1156. 'DOMContentLoaded': function() {
  1157. gardener('div[id][onclick][onmouseup][onmousedown]', /onmouseout/i);
  1158. }
  1159. };
  1160.  
  1161. scripts['megogo.net'] = {
  1162. 'now': function() {
  1163. Object.defineProperty(win, "adBlock", {
  1164. value : false,
  1165. enumerable : true
  1166. });
  1167. Object.defineProperty(win, "showAdBlockMessage", {
  1168. value : function () {},
  1169. enumerable : true
  1170. });
  1171. }
  1172. };
  1173.  
  1174. scripts['naruto-base.su'] = function() {
  1175. gardener('div[id^="entryID"],.block', /href="http.*?target="_blank"/i);
  1176. };
  1177.  
  1178. scripts['overclockers.ru'] = {
  1179. 'now': function() {
  1180. // Following code inspired by:
  1181. // https://gf.qytechs.cn/en/scripts/23922-anti-adblock-killer-for-overclockers-ru
  1182. function antiAntiABP() {
  1183. var o = new MutationObserver(function(ms) {
  1184. var m, node;
  1185. for (m of ms) {
  1186. for (node of m.addedNodes) {
  1187. if (node.nodeType === Node.ELEMENT_NODE && node.onerror) {
  1188. node.onerror = null;
  1189. console.log("Disabled 'onerror' on", node);
  1190. }
  1191. }
  1192. }
  1193. });
  1194. o.observe(document, {childList: true, subtree: true});
  1195. var s = document.currentScript;
  1196. s.parentNode.removeChild(s);
  1197. }
  1198. var s = document.createElement('script');
  1199. s.textContent = '(' + antiAntiABP.toString() + ')();';
  1200. document.documentElement.appendChild(s);
  1201. }
  1202. };
  1203. scripts['forums.overclockers.ru'] = {
  1204. 'now': function() {
  1205. createStyle(['.needblock {position: fixed; left: -10000px}']);
  1206. Object.defineProperty(win, 'adblck', {
  1207. value: 'no',
  1208. enumerable: true
  1209. });
  1210. }
  1211. };
  1212.  
  1213. scripts['pb.wtf'] = function() {
  1214. createStyle(['.reques,#result,tbody.row1:not([id]) {display: none !important}']);
  1215. // image in the slider in the header
  1216. gardener('a[href$="=="]', /img/i, {root:'.release-navbar', observe:true, parent:'div'});
  1217. // ads in blocks on the page
  1218. gardener('a[href^="/"]', /<img\s.*<br>/i, {root:'#main_content', observe:true, parent:'div[class]'});
  1219. // line above topic content
  1220. gardener('.re_top1', /./, {root:'#main_content', parent:'.hidden-sm'});
  1221. };
  1222. scripts['piratbit.org'] = scripts['pb.wtf'];
  1223. scripts['piratbit.ru'] = scripts['pb.wtf'];
  1224.  
  1225. scripts['pikabu.ru'] = function() {
  1226. gardener('.story', /story__sponsor|story__gag|profile\/ads"/i, {root: '.inner_wrap', observe: true});
  1227. };
  1228.  
  1229. scripts['rp5.ru'] = function() {
  1230. var co = document.querySelector('#content'), i, nodes;
  1231. if (!co) {
  1232. return;
  1233. }
  1234. nodes = co.parentNode.childNodes;
  1235. i = nodes.length;
  1236. while (i--) {
  1237. if (nodes[i] !== co) {
  1238. nodes[i].parentNode.removeChild(nodes[i]);
  1239. }
  1240. }
  1241. };
  1242.  
  1243. scripts['rustorka.com'] = {
  1244. 'now':function(){
  1245. win.open = function(){
  1246. console.log('Site attempted to open a new window', arguments);
  1247. }
  1248. },
  1249. 'DOMContentLoaded':function() {
  1250. gardener('span[class],ul[class],span[id],ul[id]', /\/\d{12,}\.php/i, {root:'#sidebar1', observe:true});
  1251. gardener('div[id][style*="!important"]', /!important/i);
  1252. }
  1253. };
  1254. scripts['rumedia.ws'] = scripts['rustorka.com'];
  1255.  
  1256. scripts['sport-express.ru'] = function() {
  1257. gardener('.js-relap__item',/>Реклама\s+<\//, {root:'.container', observe: true});
  1258. };
  1259.  
  1260. scripts['sports.ru'] = function() {
  1261. gardener('.aside-news-list__item', /aside-news-list__advert/i, {root:'.aside-news-block'});
  1262. };
  1263.  
  1264. scripts['turbobit.net'] = {'now': preventBackgroundRedirect};
  1265.  
  1266. scripts['yap.ru'] = function() {
  1267. var words = /member1438|Administration/;
  1268. gardener('form > table[id^="p_row_"]', words);
  1269. gardener('tr > .holder.newsbottom', words, {parent:'tr', siblings:-2});
  1270. };
  1271. scripts['yaplakal.com'] = scripts['yap.ru'];
  1272.  
  1273. scripts['reactor.cc'] = {
  1274. 'now': function() {
  1275. win.open = (function(){ throw new Error('Redirect prevention.'); }).bind(window);
  1276. },
  1277. 'click': function(e) {
  1278. var node = e.target;
  1279. if (node.nodeType === Node.ELEMENT_NODE &&
  1280. node.style.position === 'absolute' &&
  1281. node.style.zIndex > 0)
  1282. node.parentNode.removeChild(node);
  1283. },
  1284. 'DOMContentLoaded': function() {
  1285. var words = new RegExp(
  1286. 'блокировщика рекламы'
  1287. .split('')
  1288. .map(function(e){return e+'[\u200b\u200c\u200d]*';})
  1289. .join('')
  1290. .replace(' ', '\\s*')
  1291. .replace(/[аоре]/g, function(e){return ['[аa]','[оo]','[рp]','[еe]']['аоре'.indexOf(e)];}),
  1292. 'i'),
  1293. can;
  1294. function deeper(spider) {
  1295. var c, l, n;
  1296. if (words.test(spider.innerText)) {
  1297. if (spider.nodeType === Node.TEXT_NODE) {
  1298. return true;
  1299. }
  1300. c = spider.childNodes;
  1301. l = c.length;
  1302. n = 0;
  1303. while(l--) {
  1304. if (deeper(c[l]), can) {
  1305. n++;
  1306. }
  1307. }
  1308. if (n > 0 && n === c.length && spider.offsetHeight < 750) {
  1309. can.push(spider);
  1310. }
  1311. return false;
  1312. }
  1313. return true;
  1314. }
  1315. function probe(){
  1316. if (words.test(document.body.innerText)) {
  1317. can = [];
  1318. deeper(document.body);
  1319. var i = can.length, j, spider;
  1320. while(i--) {
  1321. spider = can[i];
  1322. if (spider.offsetHeight > 10 && spider.offsetHeight < 750) {
  1323. spider.setAttribute('style', 'background:none!important');
  1324. }
  1325. }
  1326. }
  1327. }
  1328. var o = new MutationObserver(probe);
  1329. o.observe(document,{childList:true, subtree:true});
  1330. }
  1331. };
  1332. scripts['joyreactor.cc'] = scripts['reactor.cc'];
  1333. scripts['pornreactor.cc'] = scripts['reactor.cc'];
  1334.  
  1335. scripts['auto.ru'] = function() {
  1336. var words = /Реклама|Яндекс.Директ|yandex_ad_/;
  1337. var userAdsListAds = [
  1338. '.listing-list > .listing-item',
  1339. '.listing-item_type_fixed.listing-item'
  1340. ];
  1341. var catalogAds = [
  1342. 'div[class*="layout_catalog-inline"]',
  1343. 'div[class$="layout_horizontal"]'
  1344. ];
  1345. var otherAds = [
  1346. '.advt_auto',
  1347. '.sidebar-block',
  1348. '.pager-listing + div[class]',
  1349. '.card > div[class][style]',
  1350. '.sidebar > div[class]',
  1351. '.main-page__section + div[class]',
  1352. '.listing > tbody'];
  1353. gardener(userAdsListAds.join(','), words, {root:'.listing-wrap', observe:true});
  1354. gardener(catalogAds.join(','), words, {root:'.catalog__page,.content__wrapper', observe:true});
  1355. gardener(otherAds.join(','), words);
  1356. };
  1357.  
  1358. scripts['online.anidub.com'] = function() {
  1359. var script = document.createElement('script');
  1360. script.type = "text/javascript";
  1361. script.innerHTML = "function ogonekstart1() {}";
  1362. document.getElementsByTagName('head')[0].appendChild(script);
  1363.  
  1364. var style = document.createElement('style');
  1365. style.type = 'text/css';
  1366. style.appendChild(document.createTextNode('.background {background: none!important;}'));
  1367. style.appendChild(document.createTextNode('.background > script + div, .background > script ~ div:not([id]):not([class]) + div[id][class] {display:none!important}'));
  1368. document.head.appendChild(style);
  1369. };
  1370.  
  1371. scripts['rsload.net'] = {
  1372. 'load': function() {
  1373. var dis = document.querySelector('.cb-disable');
  1374. if (dis) {
  1375. dis.click();
  1376. }
  1377. },
  1378. 'click': function(e) {
  1379. var t = e.target;
  1380. if (t && t.href && (/:\/\/\d+\.\d+\.\d+\.\d+\//.test(t.href))) {
  1381. t.href = t.href.replace('://','://rsload.net:rsload.net@');
  1382. }
  1383. }
  1384. };
  1385.  
  1386. scripts['imageban.ru'] = {
  1387. 'now': preventBackgroundRedirect,
  1388. 'DOMContentLoaded': function() {
  1389. win.addEventListener('unload', function() {
  1390. if (!window.location.hash) {
  1391. window.location.replace(window.location+'#');
  1392. } else {
  1393. window.location.hash = '';
  1394. }
  1395. }, true);
  1396. }
  1397. };
  1398.  
  1399. var domain = document.domain, name;
  1400. while (domain.indexOf('.') !== -1) {
  1401. if (scripts.hasOwnProperty(domain)) {
  1402. if (typeof scripts[domain] === 'function') {
  1403. document.addEventListener ('DOMContentLoaded', scripts[domain], false);
  1404. }
  1405. for (name in scripts[domain]) {
  1406. if (name !== 'now') {
  1407. (name === 'load' ? window : document)
  1408. .addEventListener (name, scripts[domain][name], false);
  1409. } else {
  1410. scripts[domain][name]();
  1411. }
  1412. }
  1413. }
  1414. domain = domain.slice(domain.indexOf('.') + 1);
  1415. }
  1416. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址