RU AdList JS Fixes

try to take over the world!

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

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

QingJ © 2025

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