Greasy Fork镜像 还支持 简体中文。

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.2
  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. for (var s of document.querySelectorAll(
  489. '.page-content__left > *,'+
  490. '.page-content__right > *:not(.page-content__col),'+
  491. '.page-content__right > .page-content__col > *'
  492. )) {
  493. if (s.textContent.indexOf(adWords[0]) > -1 ||
  494. (s.clientHeight < 15 && s.classList.contains('rubric'))) {
  495. remove(s);
  496. console.log('Ads removed.');
  497. }
  498. }
  499. }
  500. // News fixes
  501. function removePageAdsClass() {
  502. if (document.body.classList.contains("b-page_ads_yes")){
  503. document.body.classList.remove("b-page_ads_yes");
  504. console.log('Page ads class removed.');
  505. }
  506. }
  507. // Function to attach an observer to monitor dynamic changes on the page
  508. function pageUpdateObserver(func, obj, params) {
  509. if (obj) {
  510. var o = new MutationObserver(func);
  511. o.observe(obj,(params || {childList:true, subtree:true}));
  512. }
  513. }
  514. // Cleaner
  515. document.addEventListener ('DOMContentLoaded', function() {
  516. removeGenericAds();
  517. if (win.location.hostname.search(/^news\./i) === 0) {
  518. pageUpdateObserver(removeNewsAds, document.querySelector('BODY'));
  519. pageUpdateObserver(removePageAdsClass, document.body, {attributes:true, attributesFilter:['class']});
  520. removeNewsAds();
  521. removePageAdsClass();
  522. } else {
  523. pageUpdateObserver(removeSearchAds, document.querySelector('.main__content'));
  524. removeSearchAds();
  525. }
  526. });
  527. })();
  528. return; //skip fixes for other sites
  529. }
  530.  
  531. // https://gf.qytechs.cn/en/scripts/14470-4pda-unbrender
  532. if (/(^|\.)4pda\.ru$/i.test(window.location.hostname)) {
  533. (function() {
  534. var isForum = document.location.href.search('/forum/') !== -1,
  535. hStyle;
  536.  
  537. function remove(n) {
  538. if (n) {
  539. n.parentNode.removeChild(n);
  540. }
  541. }
  542.  
  543. function afterClean() {
  544. hStyle.disabled = true;
  545. remove(hStyle);
  546. }
  547.  
  548. function beforeClean() {
  549. // attach styles before document displayed
  550. hStyle = createStyle([
  551. 'html { overflow-y: scroll }',
  552. 'article + aside * { display: none !important }',
  553. '#header + div:after {'+(
  554. 'content: "";'+
  555. 'position: fixed;'+
  556. 'top: 0;'+
  557. 'left: 0;'+
  558. 'width: 100%;'+
  559. 'height: 100%;'+
  560. 'background-color: #E6E7E9'
  561. )+'}',
  562. // http://codepen.io/Beaugust/pen/DByiE
  563. '@keyframes spin { 100% { transform: rotate(360deg) } }',
  564. 'article + aside:after {'+(
  565. 'content: "";'+
  566. 'position: absolute;'+
  567. 'width: 150px;'+
  568. 'height: 150px;'+
  569. 'top: 150px;'+
  570. 'left: 50%;'+
  571. 'margin-top: -75px;'+
  572. 'margin-left: -75px;'+
  573. 'box-sizing: border-box;'+
  574. 'border-radius: 100%;'+
  575. 'border: 10px solid rgba(0, 0, 0, 0.2);'+
  576. 'border-top-color: rgba(0, 0, 0, 0.6);'+
  577. 'animation: spin 2s infinite linear'
  578. )+'}'
  579. ], {id:'ubrHider'}, true);
  580.  
  581. // display content of a page if time to load a page is more than 2 seconds to avoid
  582. // blocking access to a page if it is loading for too long or stuck in a loading state
  583. setTimeout(2000, afterClean);
  584. }
  585.  
  586. createStyle([
  587. '#nav .use-ad { display: block !important }',
  588. 'article:not(.post) + article:not(#id), a[target="_blank"] img[height="90"] { display: none !important }'
  589. ]);
  590.  
  591. if (!isForum) {
  592. beforeClean();
  593. }
  594.  
  595. // save links to non-overridden functions to use later
  596. var oGA = Element.prototype.getAttribute,
  597. oSA = Element.prototype.setAttribute,
  598. protectedElems;
  599. // protect/hide changed attributes in case site attempt to restore them
  600. function styleProtector(eventMode) {
  601. var oRAN = Element.prototype.removeAttributeNode,
  602. isStyleText = function(t){ return t === 'style'; },
  603. isStyleAttr = function(a){ return a instanceof Attr && a.nodeName === 'style' },
  604. returnUndefined = function(){},
  605. protectedElems = new WeakMap();
  606. function protoOverride(element, functionName, isStyleCheck, returnIfProtected) {
  607. var oF = element.prototype[functionName];
  608. element.prototype[functionName] = function(){
  609. if (protectedElems.get(this) !== undefined && isStyleCheck(arguments[0])) {
  610. return returnIfProtected(protectedElems.get(this), arguments, this);
  611. }
  612. return oF.apply(this, arguments);
  613. }
  614. }
  615. protoOverride(Element, 'removeAttribute', isStyleText, returnUndefined);
  616. protoOverride(Element, 'removeAttributeNS', isStyleText, returnUndefined);
  617. protoOverride(Element, 'removeAttributeNode', isStyleAttr, function(o, args, node) {
  618. if (args[0] instanceof Attr && args[0].ownerElement !== node) {
  619. // throw 'attribute of another element' error
  620. oRAN.call(node, document.createAttribute('style'));
  621. }
  622. if (o.oldStyle === null) {
  623. // throw 'not an Attr' error
  624. oRAN.call(node, null);
  625. }
  626. o.oldStyle = null;
  627. return args[0];
  628. });
  629. protoOverride(Element, 'hasAttribute', isStyleText, function(o) {
  630. return o.oldStyle !== null;
  631. });
  632. protoOverride(Element, 'hasAttributeNS', isStyleText, function(o) {
  633. return o.oldStyle !== null;
  634. });
  635. protoOverride(Element, 'setAttribute', isStyleText, function(o, args) {
  636. o.oldStyle = args[1];
  637. });
  638. protoOverride(Element, 'setAttributeNS', isStyleText, returnUndefined);
  639. protoOverride(Element, 'setAttributeNode', isStyleAttr, returnUndefined);
  640. protoOverride(Element, 'getAttribute', isStyleText, function(o) {
  641. return o.oldStyle;
  642. });
  643. protoOverride(Element, 'getAttributeNS', isStyleText, returnUndefined);
  644. protoOverride(Element, 'getAttributeNode', isStyleText, function(o){
  645. if (o.oldStyle === null) {
  646. return null;
  647. }
  648. var at = document.createAttribute('style');
  649. at.value = o.oldStyle;
  650. Object.defineProperty(at, 'ownerElement', {
  651. value: this,
  652. enumerable: true
  653. });
  654. return at;
  655. });
  656. if (eventMode) {
  657. var e = document.createEvent('Event');
  658. e.initEvent('protoOverride', false, false);
  659. window.protectedElems = protectedElems;
  660. window.dispatchEvent(e);
  661. } else {
  662. return protectedElems;
  663. }
  664. }
  665. if (isFirefox) {
  666. var s = document.createElement('script');
  667. s.textContent = '(' + styleProtector.toString() + ')(true);' +
  668. 'var s = document.currentScript; if (s) {s.parentNode.removeChild(s);}'
  669. window.addEventListener('protoOverride', function protoOverrideCallback(e){
  670. if (win.protectedElems) {
  671. protectedElems = win.protectedElems;
  672. delete win.protectedElems;
  673. }
  674. document.removeEventListener('protoOverride', protoOverrideCallback, true);
  675. }, true);
  676. document.documentElement.appendChild(s);
  677. } else {
  678. protectedElems = styleProtector(false);
  679. }
  680.  
  681. // clean a page
  682. window.addEventListener('DOMContentLoaded', function(){
  683. var rem, si, itm;
  684. function width(){ return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; }
  685. function height(){ return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; }
  686.  
  687.  
  688. if (isForum) {
  689. si = document.querySelector('#logostrip');
  690. if (si) {
  691. remove(si.parentNode.nextSibling);
  692. }
  693. }
  694.  
  695. if (document.location.href.search('/forum/dl/') !== -1) {
  696. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+
  697. ';background-color:black!important');
  698. for (itm of document.querySelectorAll('body>div')) {
  699. if (!itm.querySelector('.dw-fdwlink')) {
  700. remove(itm);
  701. }
  702. }
  703. }
  704.  
  705. if (isForum) { // Do not continue if it's a forum
  706. return;
  707. }
  708.  
  709. si = document.querySelector('#header');
  710. if (si) {
  711. rem = si.previousSibling;
  712. while (rem) {
  713. si = rem.previousSibling;
  714. remove(rem);
  715. rem = si;
  716. }
  717. }
  718.  
  719. for (itm of document.querySelectorAll('#nav li[class]')) {
  720. if (itm && itm.querySelector('a[href^="/tag/"]')) {
  721. remove(itm);
  722. }
  723. }
  724.  
  725. var style, result;
  726. for (itm of document.querySelectorAll('DIV')) {
  727. if (itm.offsetWidth > 0.95 * width() && itm.offsetHeight > 0.8 * height()) {
  728. style = window.getComputedStyle(itm, null);
  729. result = [];
  730. if (style.backgroundImage !== 'none') {
  731. result.push('background-image:none!important');
  732. }
  733. if (style.backgroundColor !== 'transparent' &&
  734. style.backgroundColor !== 'rgba(0, 0, 0, 0)') {
  735. result.push('background-color:transparent!important');
  736. }
  737. if (result.length) {
  738. if (itm.getAttribute('style')) {
  739. result.unshift(itm.getAttribute('style'));
  740. }
  741. (function(){
  742. var fakeStyle = {
  743. 'backgroundImage': itm.style.backgroundImage,
  744. 'backgroundColor': itm.style.backgroundColor
  745. };
  746. try {
  747. Object.defineProperty(itm, 'style', {
  748. value: new Proxy(itm.style, {
  749. get: function(target, prop){
  750. if (fakeStyle.hasOwnProperty(prop)) {
  751. return fakeStyle[prop];
  752. } else {
  753. return target[prop];
  754. }
  755. },
  756. set: function(target, prop, value){
  757. if (fakeStyle.hasOwnProperty(prop)) {
  758. fakeStyle[prop] = value;
  759. } else {
  760. target[prop] = value;
  761. }
  762. return value;
  763. }
  764. }),
  765. enumerable: true
  766. });
  767. } catch (e) {
  768. console.log('Unable to protect style property.', e)
  769. }
  770. })();
  771. if (protectedElems) {
  772. protectedElems.set(itm, {oldStyle: oGA.call(itm, 'style')});
  773. }
  774. oSA.call(itm, 'style', result.join(';'));
  775. }
  776. }
  777. }
  778.  
  779. for (itm of document.querySelectorAll('ASIDE>DIV')) {
  780. if ( ((itm.querySelector('script, iframe, a[href*="/ad/www/"]') ||
  781. itm.querySelector('img[src$=".gif"]:not([height="0"]), img[height="400"]')) &&
  782. !itm.classList.contains('post') ) || !itm.childNodes.length ) {
  783. remove(itm);
  784. }
  785. }
  786.  
  787. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+';background-color:#E6E7E9!important');
  788.  
  789. // display content of the page
  790. afterClean();
  791. });
  792. })();
  793. return;
  794. }
  795.  
  796. // https://gf.qytechs.cn/en/scripts/21937-moonwalk-hdgo-kodik-fix v0.7+ (adapted & fixed)
  797. document.addEventListener ('DOMContentLoaded', function() {
  798. var tmp, t;1
  799. function log (e) {
  800. console.log('Moonwalk&HDGo&Kodik FIX: ' + e + ' player in ' + win.location.href);
  801. }
  802. if (win.adv_enabled !== undefined && win.condition_detected !== undefined) { // moonwalk
  803. log('Moonwalk');
  804. if (win.adv_enabled) {
  805. win.adv_enabled = false;
  806. }
  807. win.condition_detected = false;
  808. if (win.MXoverrollCallback) {
  809. document.addEventListener('click', function catcher(e){
  810. e.stopPropagation();
  811. win.MXoverrollCallback.call(window);
  812. document.removeEventListener('click', catcher, true);
  813. }, true);
  814. }
  815. } else if (win.banner_second !== undefined && win.$banner_ads !== undefined) { // hdgo
  816. log('HDGo');
  817. tmp = document.querySelector('#swtf');
  818. if (tmp) {
  819. tmp.style.display = 'none';
  820. }
  821. win.banner_second = 0;
  822. win.$banner_ads = false;
  823. if (win.$new_ads !== undefined) {
  824. win.$new_ads = false;
  825. }
  826. if (win.canRunAds !== undefined && win.canRunAds !== true) {
  827. win.canRunAds = true;
  828. }
  829. } else if (win.MXoverrollCallback && win.iframeSearch !== undefined) { // kodik
  830. log('Kodik');
  831. tmp = document.querySelector('.play_button');
  832. if (tmp) {
  833. tmp.onclick = win.MXoverrollCallback.bind(window);
  834. }
  835. win.IsAdBlock = false;
  836. }
  837. }, false);
  838.  
  839. // function to search and remove nodes by content
  840. // selector - standard CSS selector to define set of nodes to check
  841. // words - regular expression to check content of the suspicious nodes
  842. // params - object with multiple extra parameters:
  843. // .hide - set display to none instead of removing from the page
  844. // .parent - parent node to remove if content is found in the child node
  845. // .siblings - number of simling nodes to remove (excluding text nodes)
  846. function scRemove(e) {e.parentNode.removeChild(e);}
  847. function scHide(e) {
  848. var s = e.getAttribute('style')||'',
  849. h = ';display:none!important;';
  850. if (s.indexOf(h) < 0) {
  851. e.setAttribute('style', s+h);
  852. }
  853. }
  854. function scissors (selector, words, scope, params) {
  855. var remFunc = (params.hide ? scHide : scRemove),
  856. iterFunc = (params.siblings > 0 ?
  857. 'nextSibling' :
  858. 'previousSibling'),
  859. toRemove = [],
  860. siblings,
  861. node;
  862. for (node of scope.querySelectorAll(selector)) {
  863. if (words.test(node.innerHTML) || !node.childNodes.length) {
  864. // drill up to the specified parent node if required
  865. if (params.parent) {
  866. while(node !== scope && !(node.matches(params.parent))) {
  867. node = node.parentNode;
  868. }
  869. }
  870. if (node === scope) {
  871. break;
  872. }
  873. toRemove.push(node);
  874. // add multiple nodes if defined more than one sibling
  875. siblings = Math.abs(params.siblings) || 0;
  876. while (siblings) {
  877. node = node[iterFunc];
  878. toRemove.push(node);
  879. if (node.nodeType === Node.ELEMENT_NODE) {
  880. siblings -= 1; //count only element nodes
  881. }
  882. }
  883. }
  884. }
  885. for (node of toRemove) {
  886. remFunc(node);
  887. }
  888. return toRemove.length;
  889. }
  890.  
  891. // function to perform multiple checks if ads inserted with a delay
  892. // by default does 30 checks withing a 3 seconds unless nonstop mode specified
  893. // also does 1 extra check when a page completely loads
  894. // selector and words - passed dow to scissors
  895. // params - object with multiple extra parameters:
  896. // .root - selector to narrow down scope to scan;
  897. // .observe - if true then check will be performed continuously;
  898. // Other parameters passed down to scissors.
  899. function gardener(selector, words, params) {
  900. params = params || {};
  901. var scope = document.body,
  902. nonstop = false;
  903. // narrow down scope to a specific element
  904. if (params.root) {
  905. scope = scope.querySelector(params.root);
  906. if (!scope) {// exit if the root element is not present on the page
  907. return 0;
  908. }
  909. }
  910. // add observe mode if required
  911. if (params.observe) {
  912. if (typeof MutationObserver === 'function') {
  913. var o = new MutationObserver(function(ms){
  914. for (var m of ms) {
  915. if (m.addedNodes.length) {
  916. scissors(selector, words, scope, params);
  917. }
  918. }
  919. });
  920. o.observe(scope, {childList:true, subtree: true});
  921. } else {
  922. nonstop = true;
  923. }
  924. }
  925. // wait for a full page load to do one extra cut
  926. win.addEventListener('load',function(){
  927. scissors(selector, words, scope, params);
  928. });
  929. // do multiple cuts until ads removed
  930. function cut(sci, s, w, sc, p, i) {
  931. if (i > 0) {
  932. i -= 1;
  933. }
  934. if (i && !sci(s, w, sc, p)) {
  935. setTimeout(cut, 100, sci, s, w, sc, p, i);
  936. }
  937. }
  938. cut(scissors, selector, words, scope, params, (nonstop ? -1 : 30));
  939. }
  940.  
  941. function preventBackgroundRedirect() {
  942. // create "cose_me" event to call high-level window.close()
  943. var key = Math.random().toString(36).substr(2);
  944. window.addEventListener('close_me_'+key, function(e) {
  945. window.close();
  946. });
  947.  
  948. // window.open wrapper
  949. function pbrLander() {
  950. var orgOpen = window.open.bind(window);
  951. function closeWindow(){
  952. // site went to a new tab and attempts to unload
  953. // call for high-level close through event
  954. var event = new CustomEvent("close_me_%key%", {});
  955. window.dispatchEvent(event);
  956. }
  957. function open(){
  958. var idx = String.prototype.indexOf;
  959. if (arguments[0] &&
  960. (idx.call(arguments[0], window.location.host) > -1 ||
  961. idx.call(arguments[0], '://') === -1)) {
  962. window.addEventListener('unload', closeWindow, true);
  963. }
  964. orgOpen.apply(window, arguments);
  965. }
  966. window.open = open.bind(window);
  967. var s = document.currentScript;
  968. if (s) {s.parentNode.removeChild(s);}
  969. }
  970.  
  971. // land wrapper on the page
  972. var script = document.createElement('script');
  973. script.appendChild(document.createTextNode('('+pbrLander.toString().replace(/%key%/g,key)+')();'));
  974. document.head.insertBefore(script,document.head.firstChild);
  975. console.log("Background redirect prevention enabled.");
  976. }
  977.  
  978. function forbidServiceWorker() {
  979. if (!("serviceWorker" in navigator)) {
  980. return;
  981. }
  982. var svr = navigator.serviceWorker.ready;
  983. Object.defineProperty(navigator, 'serviceWorker', {
  984. value: {
  985. register: function(){
  986. console.log('Registration of serviceWorker ' + arguments[0] + ' blocked.');
  987. return new Promise(function(){});
  988. },
  989. ready: new Promise(function(){}),
  990. addEventListener:function(){}
  991. }
  992. });
  993. document.addEventListener('DOMContentLoaded', function() {
  994. if (!svr) {
  995. return;
  996. }
  997. svr.then(function(sw) {
  998. console.log('Found existing serviceWorker:', sw);
  999. console.log('Attempting to unregister...');
  1000. sw.unregister().then(function() {
  1001. console.log('Unregistered! :)');
  1002. }).catch(function(err) {
  1003. console.log('Unregistration failed. :(', err);
  1004. console.log('Try to remove it manually:');
  1005. console.log(' 1. Open: chrome://serviceworker-internals/ (Google Chrome and alike) or about:serviceworkers (Mozilla Firefox) in a new tab.');
  1006. console.log(' 2. Search there for one with "'+document.domain+'" in the name.');
  1007. console.log(' 3. Use buttons in the same block with service you found to stop it and uninstall/unregister.');
  1008. });
  1009. }).catch(function(err) {
  1010. console.log("Lol, it failed on it's own. -_-", err);
  1011. });
  1012. }, false);
  1013. }
  1014.  
  1015. var scripts = {};
  1016. scripts['fs.to'] = function() {
  1017. function skipClicker(i) {
  1018. if (!i) {
  1019. return;
  1020. }
  1021. var skip = document.querySelector('.b-aplayer-banners__close');
  1022. if (skip) {
  1023. skip.click();
  1024. } else {
  1025. setTimeout(skipClicker, 100, i-1);
  1026. }
  1027. }
  1028. setTimeout(skipClicker, 100, 30);
  1029.  
  1030. createStyle([
  1031. '.l-body-branding *,'+
  1032. '.b-styled__item-central,'+
  1033. '.b-styled__content-right,'+
  1034. '.b-styled__section-central,'+
  1035. 'div[id^="adsProxy-"]'+
  1036. '{display:none!important}',
  1037. 'body {background-image:url(data:image/png;base64,'+
  1038. 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACX'+
  1039. 'BIWXMAAC4jAAAuIwF4pT92AAAADUlEQVR42mOQUdL5DwACMgFq'+
  1040. 'BC3ttwAAAABJRU5ErkJggg==)!important}'
  1041. ]);
  1042.  
  1043. if (/\/(view_iframe|iframeplayer)\//i.test(document.location.pathname)) {
  1044. var p = document.querySelector('#player:not([preload="auto"])'),
  1045. m = document.querySelector('.main'),
  1046. adStepper = function(p) {
  1047. if (p.currentTime < p.duration) {
  1048. p.currentTime += 1;
  1049. }
  1050. },
  1051. adSkipper = function(f, p) {
  1052. f.click();
  1053. p.waitAfterSkip = false;
  1054. p.longerSkipper = false;
  1055. console.log('Пропустили.');
  1056. },
  1057. cl = function(p) {
  1058. var faster = document.querySelector('.b-aplayer__html5-desktop-skip'),
  1059. series = document.querySelector('.b-aplayer__actions-series');
  1060.  
  1061. function clickSelected() {
  1062. var s = document.querySelector('.b-aplayer__popup-series-episodes .selected a');
  1063. if (s) {
  1064. s.click();
  1065. }
  1066. }
  1067.  
  1068. if ((!faster || faster.style.display !== 'block') && series && !p.seriesClicked) {
  1069. series.click();
  1070. p.seriesClicked = true;
  1071. p.longerSkipper = true;
  1072. setTimeout(clickSelected, 1000);
  1073. p.pause();
  1074. }
  1075.  
  1076. function skipListener() {
  1077. if (p.waitAfterSkip) {
  1078. console.log('В процессе пропуска…');
  1079. return;
  1080. }
  1081. p.pause();
  1082. if (!p.classList.contains('m-hidden')) {
  1083. p.classList.add('m-hidden');
  1084. }
  1085. if (faster && p.currentTime &&
  1086. win.getComputedStyle(faster).display === 'block' &&
  1087. !faster.querySelector('.b-aplayer__html5-desktop-skip-timer')) {
  1088. p.waitAfterSkip = true;
  1089. setTimeout(adSkipper, (p.longerSkipper?3:1)*1000, faster, p);
  1090. console.log('Доступен быстрый пропуск…');
  1091. } else {
  1092. setTimeout(adStepper, 1000, p);
  1093. }
  1094. }
  1095.  
  1096. p.addEventListener('timeupdate', skipListener, false);
  1097. },
  1098. o = new MutationObserver(function (ms) {
  1099. var m, node;
  1100. for (m of ms) {
  1101. for (node of m.addedNodes) {
  1102. if (node.id === 'player' &&
  1103. node.nodeName === 'VIDEO' &&
  1104. node.getAttribute('preload') !== 'auto') {
  1105. cl(node);
  1106. }
  1107. }
  1108. }
  1109. });
  1110. if (p.nodeName === 'VIDEO') {
  1111. cl(p);
  1112. } else {
  1113. o.observe(m, {childList: true});
  1114. }
  1115. }
  1116. };
  1117. scripts['brb.to'] = scripts['fs.to'];
  1118. scripts['cxz.to'] = scripts['fs.to'];
  1119.  
  1120. scripts['drive2.ru'] = function() {
  1121. gardener('.c-block:not(.js-recommendations),.o-grid__item', />Реклама<\//i);
  1122. };
  1123.  
  1124. scripts['fishki.net'] = function() {
  1125. gardener('.main-post', /543769|Реклама/);
  1126. };
  1127.  
  1128. scripts['hdgo.cc'] = {
  1129. 'now': function(){
  1130. var o = new MutationObserver(function(ms) {
  1131. var m, node;
  1132. for (m of ms) {
  1133. for (node of m.addedNodes) {
  1134. if (node.tagName === 'SCRIPT' && node.getAttribute('onerror') !== null) {
  1135. node.removeAttribute('onerror');
  1136. }
  1137. }
  1138. }
  1139. });
  1140. o.observe(document, {childList:true, subtree: true});
  1141. }
  1142. };
  1143. scripts['couber.be'] = scripts['hdgo.cc'];
  1144. scripts['46.30.43.38'] = scripts['hdgo.cc'];
  1145.  
  1146. scripts['hdrezka.me'] = {
  1147. 'now': function() {
  1148. Object.defineProperty(win, 'fuckAdBlock', {
  1149. value: {
  1150. onDetected: function() {
  1151. console.log('Pretending to be an ABP detector.');
  1152. }
  1153. }
  1154. });
  1155. Object.defineProperty(win, 'ab', {
  1156. value: false,
  1157. enumerable: true
  1158. });
  1159. },
  1160. 'DOMContentLoaded': function() {
  1161. gardener('div[id][onclick][onmouseup][onmousedown]', /onmouseout/i);
  1162. }
  1163. };
  1164.  
  1165. scripts['megogo.net'] = {
  1166. 'now': function() {
  1167. Object.defineProperty(win, "adBlock", {
  1168. value : false,
  1169. enumerable : true
  1170. });
  1171. Object.defineProperty(win, "showAdBlockMessage", {
  1172. value : function () {},
  1173. enumerable : true
  1174. });
  1175. }
  1176. };
  1177.  
  1178. scripts['naruto-base.su'] = function() {
  1179. gardener('div[id^="entryID"],.block', /href="http.*?target="_blank"/i);
  1180. };
  1181.  
  1182. scripts['overclockers.ru'] = {
  1183. 'now': function() {
  1184. // Following code inspired by:
  1185. // https://gf.qytechs.cn/en/scripts/23922-anti-adblock-killer-for-overclockers-ru
  1186. function antiAntiABP() {
  1187. var o = new MutationObserver(function(ms) {
  1188. var m, node;
  1189. for (m of ms) {
  1190. for (node of m.addedNodes) {
  1191. if (node.nodeType === Node.ELEMENT_NODE && node.onerror) {
  1192. node.onerror = null;
  1193. console.log("Disabled 'onerror' on", node);
  1194. }
  1195. }
  1196. }
  1197. });
  1198. o.observe(document, {childList: true, subtree: true});
  1199. var s = document.currentScript;
  1200. s.parentNode.removeChild(s);
  1201. }
  1202. var s = document.createElement('script');
  1203. s.textContent = '(' + antiAntiABP.toString() + ')();';
  1204. document.documentElement.appendChild(s);
  1205. }
  1206. };
  1207. scripts['forums.overclockers.ru'] = {
  1208. 'now': function() {
  1209. createStyle(['.needblock {position: fixed; left: -10000px}']);
  1210. Object.defineProperty(win, 'adblck', {
  1211. value: 'no',
  1212. enumerable: true
  1213. });
  1214. }
  1215. };
  1216.  
  1217. scripts['pb.wtf'] = function() {
  1218. createStyle(['.reques,#result,tbody.row1:not([id]) {display: none !important}']);
  1219. // image in the slider in the header
  1220. gardener('a[href$="=="]', /img/i, {root:'.release-navbar', observe:true, parent:'div'});
  1221. // ads in blocks on the page
  1222. gardener('a[href^="/"]', /<img\s.*<br>/i, {root:'#main_content', observe:true, parent:'div[class]'});
  1223. // line above topic content
  1224. gardener('.re_top1', /./, {root:'#main_content', parent:'.hidden-sm'});
  1225. };
  1226. scripts['piratbit.org'] = scripts['pb.wtf'];
  1227. scripts['piratbit.ru'] = scripts['pb.wtf'];
  1228.  
  1229. scripts['pikabu.ru'] = function() {
  1230. gardener('.story', /story__sponsor|story__gag|profile\/ads"/i, {root: '.inner_wrap', observe: true});
  1231. };
  1232.  
  1233. scripts['rp5.ru'] = function() {
  1234. var co = document.querySelector('#content'), i, nodes;
  1235. if (!co) {
  1236. return;
  1237. }
  1238. nodes = co.parentNode.childNodes;
  1239. i = nodes.length;
  1240. while (i--) {
  1241. if (nodes[i] !== co) {
  1242. nodes[i].parentNode.removeChild(nodes[i]);
  1243. }
  1244. }
  1245. };
  1246.  
  1247. scripts['rustorka.com'] = {
  1248. 'now':function(){
  1249. win.open = function(){
  1250. console.log('Site attempted to open a new window', arguments);
  1251. }
  1252. },
  1253. 'DOMContentLoaded':function() {
  1254. gardener('span[class],ul[class],span[id],ul[id]', /\/\d{12,}\.php/i, {root:'#sidebar1', observe:true});
  1255. gardener('div[id][style*="!important"]', /!important/i);
  1256. }
  1257. };
  1258. scripts['rumedia.ws'] = scripts['rustorka.com'];
  1259.  
  1260. scripts['sport-express.ru'] = function() {
  1261. gardener('.js-relap__item',/>Реклама\s+<\//, {root:'.container', observe: true});
  1262. };
  1263.  
  1264. scripts['sports.ru'] = function() {
  1265. gardener('.aside-news-list__item', /aside-news-list__advert/i, {root:'.aside-news-block'});
  1266. };
  1267.  
  1268. scripts['turbobit.net'] = {'now': preventBackgroundRedirect};
  1269.  
  1270. scripts['yap.ru'] = function() {
  1271. var words = /member1438|Administration/;
  1272. gardener('form > table[id^="p_row_"]', words);
  1273. gardener('tr > .holder.newsbottom', words, {parent:'tr', siblings:-2});
  1274. };
  1275. scripts['yaplakal.com'] = scripts['yap.ru'];
  1276.  
  1277. scripts['reactor.cc'] = {
  1278. 'now': function() {
  1279. win.open = (function(){ throw new Error('Redirect prevention.'); }).bind(window);
  1280. },
  1281. 'click': function(e) {
  1282. var node = e.target;
  1283. if (node.nodeType === Node.ELEMENT_NODE &&
  1284. node.style.position === 'absolute' &&
  1285. node.style.zIndex > 0)
  1286. node.parentNode.removeChild(node);
  1287. },
  1288. 'DOMContentLoaded': function() {
  1289. var words = new RegExp(
  1290. 'блокировщика рекламы'
  1291. .split('')
  1292. .map(function(e){return e+'[\u200b\u200c\u200d]*';})
  1293. .join('')
  1294. .replace(' ', '\\s*')
  1295. .replace(/[аоре]/g, function(e){return ['[аa]','[оo]','[рp]','[еe]']['аоре'.indexOf(e)];}),
  1296. 'i'),
  1297. can;
  1298. function deeper(spider) {
  1299. var c, l, n;
  1300. if (words.test(spider.innerText)) {
  1301. if (spider.nodeType === Node.TEXT_NODE) {
  1302. return true;
  1303. }
  1304. c = spider.childNodes;
  1305. l = c.length;
  1306. n = 0;
  1307. while(l--) {
  1308. if (deeper(c[l]), can) {
  1309. n++;
  1310. }
  1311. }
  1312. if (n > 0 && n === c.length && spider.offsetHeight < 750) {
  1313. can.push(spider);
  1314. }
  1315. return false;
  1316. }
  1317. return true;
  1318. }
  1319. function probe(){
  1320. if (words.test(document.body.innerText)) {
  1321. can = [];
  1322. deeper(document.body);
  1323. var i = can.length, j, spider;
  1324. while(i--) {
  1325. spider = can[i];
  1326. if (spider.offsetHeight > 10 && spider.offsetHeight < 750) {
  1327. spider.setAttribute('style', 'background:none!important');
  1328. }
  1329. }
  1330. }
  1331. }
  1332. var o = new MutationObserver(probe);
  1333. o.observe(document,{childList:true, subtree:true});
  1334. }
  1335. };
  1336. scripts['joyreactor.cc'] = scripts['reactor.cc'];
  1337. scripts['pornreactor.cc'] = scripts['reactor.cc'];
  1338.  
  1339. scripts['auto.ru'] = function() {
  1340. var words = /Реклама|Яндекс.Директ|yandex_ad_/;
  1341. var userAdsListAds = [
  1342. '.listing-list > .listing-item',
  1343. '.listing-item_type_fixed.listing-item'
  1344. ];
  1345. var catalogAds = [
  1346. 'div[class*="layout_catalog-inline"]',
  1347. 'div[class$="layout_horizontal"]'
  1348. ];
  1349. var otherAds = [
  1350. '.advt_auto',
  1351. '.sidebar-block',
  1352. '.pager-listing + div[class]',
  1353. '.card > div[class][style]',
  1354. '.sidebar > div[class]',
  1355. '.main-page__section + div[class]',
  1356. '.listing > tbody'];
  1357. gardener(userAdsListAds.join(','), words, {root:'.listing-wrap', observe:true});
  1358. gardener(catalogAds.join(','), words, {root:'.catalog__page,.content__wrapper', observe:true});
  1359. gardener(otherAds.join(','), words);
  1360. };
  1361.  
  1362. scripts['online.anidub.com'] = function() {
  1363. var script = document.createElement('script');
  1364. script.type = "text/javascript";
  1365. script.innerHTML = "function ogonekstart1() {}";
  1366. document.getElementsByTagName('head')[0].appendChild(script);
  1367.  
  1368. var style = document.createElement('style');
  1369. style.type = 'text/css';
  1370. style.appendChild(document.createTextNode('.background {background: none!important;}'));
  1371. style.appendChild(document.createTextNode('.background > script + div, .background > script ~ div:not([id]):not([class]) + div[id][class] {display:none!important}'));
  1372. document.head.appendChild(style);
  1373. };
  1374.  
  1375. scripts['rsload.net'] = {
  1376. 'load': function() {
  1377. var dis = document.querySelector('.cb-disable');
  1378. if (dis) {
  1379. dis.click();
  1380. }
  1381. },
  1382. 'click': function(e) {
  1383. var t = e.target;
  1384. if (t && t.href && (/:\/\/\d+\.\d+\.\d+\.\d+\//.test(t.href))) {
  1385. t.href = t.href.replace('://','://rsload.net:rsload.net@');
  1386. }
  1387. }
  1388. };
  1389.  
  1390. scripts['imageban.ru'] = {
  1391. 'now': preventBackgroundRedirect,
  1392. 'DOMContentLoaded': function() {
  1393. win.addEventListener('unload', function() {
  1394. if (!window.location.hash) {
  1395. window.location.replace(window.location+'#');
  1396. } else {
  1397. window.location.hash = '';
  1398. }
  1399. }, true);
  1400. }
  1401. };
  1402.  
  1403. var domain = document.domain, name;
  1404. while (domain.indexOf('.') !== -1) {
  1405. if (scripts.hasOwnProperty(domain)) {
  1406. if (typeof scripts[domain] === 'function') {
  1407. document.addEventListener ('DOMContentLoaded', scripts[domain], false);
  1408. }
  1409. for (name in scripts[domain]) {
  1410. if (name !== 'now') {
  1411. (name === 'load' ? window : document)
  1412. .addEventListener (name, scripts[domain][name], false);
  1413. } else {
  1414. scripts[domain][name]();
  1415. }
  1416. }
  1417. }
  1418. domain = domain.slice(domain.indexOf('.') + 1);
  1419. }
  1420. })();

QingJ © 2025

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