RU AdList JS Fixes

try to take over the world!

当前为 2016-08-31 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name RU AdList JS Fixes
  3. // @namespace ruadlist_js_fixes
  4. // @version 1.1.14
  5. // @description try to take over the world!
  6. // @author lainverse & dimisa
  7. // @match *://*/*
  8. // @grant unsafeWindow
  9. // @grant window.close
  10. // @grant GM_addStyle
  11. // @run-at document-start
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. var win = unsafeWindow || window;
  17. function inIFrame() {
  18. try {
  19. return win.self !== win.top;
  20. } catch (ignore) {
  21. return true;
  22. }
  23. }
  24.  
  25. if (!(/firefox/i.test(navigator.userAgent))) { // scripts for non-Firefox browsers
  26.  
  27. // https://greasyfork.org/scripts/19144-websuckit/
  28. (function() {
  29. // check if the browser supports Proxy and WebSocket
  30. if (typeof Proxy !== 'function' ||
  31. typeof WebSocket !== 'function') {
  32. return;
  33. }
  34. var to_block = [
  35. '||bgrndi.com^',
  36. '||brokeloy.com^',
  37. '||dreadfula.ru^',
  38. '||et-code.ru^',
  39. '||free-torrents.org^',
  40. '||gocdn.ru^',
  41. '||hghit.com^',
  42. '||kinotochka.net^',
  43. '||kuveres.com^',
  44. '||lepubs.com^',
  45. '||mail.ru^',
  46. '||marketgid.com^',
  47. '||mxtads.com^',
  48. '||oconner.biz^',
  49. '||psma01.com^',
  50. '||psma02.com^',
  51. '||psma03.com^',
  52. '||recreativ.ru^',
  53. '||regpole.com^',
  54. '||skidl.ru^',
  55. '||torvind.com^',
  56. '||trafmag.com^',
  57. '||xxuhter.ru^',
  58. '||yuiout.online^'
  59. ];
  60. var masks = [];
  61. to_block.forEach(function(m){
  62. masks.push(new RegExp(
  63. m.replace(/([\\\/\[\].*+?(){}$])/g, '\\$1')
  64. .replace(/\^(?!$)/g,'\\.?[^\\w%._-]')
  65. .replace(/\^$/,'\\.?([^\\w%._-]|$)')
  66. .replace(/^\|\|/,'^wss?:\\/+([^\/.]+\\.)*'),
  67. 'i'));
  68. });
  69. var ws = win.WebSocket,
  70. closingFunctions = ['close', 'send'];
  71. function wsGetter(tgt, nm) {
  72. console.log('[WSI] Registered call to property "', nm, '"');
  73. try {
  74. if (typeof ws.prototype[nm] === 'function') {
  75. if (closingFunctions.indexOf(nm) > -1) {
  76. tgt.readyState = ws.CLOSED;
  77. }
  78. return function(){return;};
  79. }
  80. if (typeof ws.prototype[nm] === 'number') {
  81. return ws[nm];
  82. }
  83. } catch(ignore) {}
  84. return tgt[nm];
  85. }
  86. win.WebSocket = new Proxy(ws, {
  87. construct: function(target, args) {
  88. var url = args[0];
  89. console.log('[WSI] Opening socket on', url, '…');
  90. var i = masks.length;
  91. while(i--) {
  92. if (masks[i].test(url)) {
  93. console.log("[WSI] Blocked.");
  94. return new Proxy({url: url, readyState: ws.OPEN}, {
  95. get: wsGetter
  96. });
  97. }
  98. }
  99. return new target(args[0], args[1]);
  100. }
  101. });
  102. })();
  103.  
  104. // https://greasyfork.org/scripts/14720-it-s-not-important
  105. (function(){
  106. var imptt = /((display|(margin|padding)(-top|-bottom)?)\s*:[^;!]*)!\s*important/ig;
  107.  
  108. function unimportanter(el, si) {
  109. if (!imptt.test(si) || el.style.display === 'none') {
  110. return 0; // get out if we have nothing to do here
  111. }
  112. if (el.nodeName === 'IFRAME' && el.src &&
  113. el.src.slice(0,17) === 'chrome-extension:') {
  114. return 0; // Web of Trust uses this method to add their frame
  115. }
  116. var so = si.replace(imptt, function(){return arguments[1];}), ret = 0;
  117. if (si !== so) {
  118. ret = 1;
  119. el.setAttribute('style', so);
  120. }
  121. return ret;
  122. }
  123.  
  124. function logger(c) {
  125. if (c) {
  126. console.log('Some page elements became a bit less important.');
  127. }
  128. }
  129.  
  130. function checkTarget(m, c) {
  131. var si = m.getAttribute ? m.getAttribute('style') : null;
  132. if (si && si.indexOf('!') > -1) {
  133. c += unimportanter(m, si);
  134. }
  135. return c;
  136. }
  137.  
  138. function checkNodes(m, c) {
  139. var i = m.length;
  140. while(i--) {
  141. c = checkTarget(m[i], c);
  142. }
  143. return c;
  144. }
  145.  
  146. var observer = new MutationObserver(function(mutations) {
  147. setTimeout(function(m) {
  148. var i = m.length, c = 0;
  149. while(i--) {
  150. if (m[i].target) {
  151. c = checkTarget(m[i].target, c);
  152. }
  153. if (m[i].addedNodes.length) {
  154. c = checkNodes(m[i].addedNodes, c);
  155. }
  156. }
  157. logger(c);
  158. },0,mutations);
  159. });
  160.  
  161. observer.observe(document, { childList : true, attributes : true, attributeFilter : ['style'], subtree : true });
  162.  
  163. win.addEventListener ("load", function(){
  164. var c = 0, imp = document.querySelectorAll('[style*="!"]'), i = imp.length;
  165. while(i--) {
  166. c+= checkTarget(imp[i], c);
  167. }
  168. logger(c);
  169. }, false);
  170. })();
  171.  
  172. }
  173.  
  174. if (/^https?:\/\/(news\.yandex\.|(www\.)?yandex\.[^\/]+\/(yand)?search[\/?])/i.test(win.location.href)) {
  175. // https://greasyfork.org/en/scripts/809-no-yandex-ads
  176. (function(){
  177. // Generic ads removal and fixes
  178. function removeGenericAds() {
  179. var s, i;
  180. s = document.querySelector('.serp-header');
  181. if (s) {
  182. s.style.marginTop='0';
  183. }
  184. s = document.querySelectorAll('.serp-adv__head + .serp-item');
  185. i = s.length;
  186. while(i--) {
  187. s[i].parentNode.removeChild(s[i]);
  188. }
  189. s = document.querySelectorAll('#adbanner, .serp-adv, .b-spec-adv, div[class*="serp-adv__"]');
  190. i = s.length;
  191. while(i--) {
  192. s[i].parentNode.removeChild(s[i]);
  193. }
  194. }
  195. // Search ads
  196. var adWords = ['Реклама','Ad','Яндекс.Директ'];
  197. function removeSearchAds() {
  198. var s = document.querySelectorAll('.serp-block, .serp-item, .search-item');
  199. var i = s.length, item;
  200. while(i--) {
  201. item = s[i].querySelector('.label, .serp-item__label, .document__provider-name');
  202. if (item && adWords.indexOf(item.textContent) > -1) {
  203. s[i].parentNode.removeChild(s[i]);
  204. console.log('Ads removed.');
  205. }
  206. }
  207. }
  208. // News ads
  209. function removeNewsAds() {
  210. var s = document.querySelectorAll('.story[id], .document[id], .story__group[id]');
  211. var i = s.length;
  212. while(i--) {
  213. if (win.getComputedStyle(s[i]).position === 'absolute') {
  214. s[i].parentNode.removeChild(s[i]);
  215. console.log('Ads removed.');
  216. }
  217. }
  218. }
  219. // News fixes
  220. function removePageAdsClass() {
  221. if (document.body.classList.contains("b-page_ads_yes")){
  222. document.body.classList.remove("b-page_ads_yes");
  223. console.log('Page ads class removed.');
  224. }
  225. }
  226. // Function to attach an observer to monitor dynamic changes on the page
  227. function pageUpdateObserver(func, obj, params) {
  228. if (obj) {
  229. var o = new MutationObserver(func);
  230. o.observe(obj,(params || {childList:true}));
  231. }
  232. }
  233. // Cleaner
  234. document.addEventListener ("DOMContentLoaded", function() {
  235. removeGenericAds();
  236. if (win.location.hostname.search(/^news\./i) === 0) {
  237. pageUpdateObserver(removeNewsAds, document.querySelector('BODY'));
  238. pageUpdateObserver(removePageAdsClass, document.body, {attributes:true, attributesFilter:['class']});
  239. removeNewsAds();
  240. removePageAdsClass();
  241. } else {
  242. pageUpdateObserver(removeSearchAds, document.querySelector('.main__content'));
  243. removeSearchAds();
  244. }
  245. });
  246. })();
  247. return; //skip fixes for other sites
  248. }
  249.  
  250. // https://greasyfork.org/en/scripts/14470-4pda-unbrender
  251. if (/(^|\.)4pda\.ru$/i.test(window.location.hostname)) {
  252. (function(){
  253. var isForum = document.location.href.search('/forum/') !== -1,
  254. isSafari = (/Safari/i.test(navigator.userAgent)) && (/Apple\sComputer/i.test(navigator.vendor)),
  255. hStyle;
  256.  
  257. function remove(n) {
  258. if (n) {
  259. n.parentNode.removeChild(n);
  260. }
  261. }
  262.  
  263. function afterClean() {
  264. hStyle.disabled = true;
  265. remove(hStyle);
  266. }
  267.  
  268. function beforeClean() {
  269. // attach styles before document displayed
  270. hStyle = document.createElement('style');
  271. hStyle.id = 'ubrHider';
  272. hStyle.type = 'text/css';
  273. document.head.appendChild(hStyle);
  274.  
  275. hStyle.sheet.insertRule('html { overflow-y: scroll }', 0);
  276. hStyle.sheet.insertRule('article + aside * { display: none !important }', 0);
  277. hStyle.sheet.insertRule('#header + div:after {'+(
  278. 'content: "";'+
  279. 'position: fixed;'+
  280. 'top: 0;'+
  281. 'left: 0;'+
  282. 'width: 100%;'+
  283. 'height: 100%;'+
  284. 'background-color: #E6E7E9'
  285. )+'}', 0);
  286. // http://codepen.io/Beaugust/pen/DByiE
  287. hStyle.sheet.insertRule('@keyframes spin { 100% { transform: rotate(360deg) } }', 0);
  288. hStyle.sheet.insertRule('article + aside:after {'+(
  289. 'content: "";'+
  290. 'position: absolute;'+
  291. 'width: 150px;'+
  292. 'height: 150px;'+
  293. 'top: 150px;'+
  294. 'left: 50%;'+
  295. 'margin-top: -75px;'+
  296. 'margin-left: -75px;'+
  297. 'box-sizing: border-box;'+
  298. 'border-radius: 100%;'+
  299. 'border: 10px solid rgba(0, 0, 0, 0.2);'+
  300. 'border-top-color: rgba(0, 0, 0, 0.6);'+
  301. 'animation: spin 2s infinite linear'
  302. )+'}', 0);
  303.  
  304. // display content of a page if time to load a page is more than 2 seconds to avoid
  305. // blocking access to a page if it is loading for too long or stuck in a loading state
  306. setTimeout(2000, afterClean);
  307. }
  308.  
  309. GM_addStyle('#nav .use-ad {display: block !important;} ' +
  310. 'article:not(.post) + article:not(#id) { display: none !important }');
  311. if (!isForum && !isSafari) {
  312. beforeClean();
  313. }
  314.  
  315. // clean the page
  316. window.addEventListener('DOMContentLoaded', function(){
  317. var rem, si, lst, i;
  318. function width(){ return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; }
  319. function height(){ return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; }
  320.  
  321.  
  322. if (isForum) {
  323. si = document.querySelector('#logostrip');
  324. if (si) {
  325. remove(si.parentNode.nextSibling);
  326. }
  327. }
  328.  
  329. if (document.location.href.search('/forum/dl/') !== -1) {
  330. lst = document.querySelectorAll('body>div');
  331. i = lst.length;
  332. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+
  333. ';background-color:black!important');
  334. while (i--) {
  335. if (!lst[i].querySelector('.dw-fdwlink')) {
  336. remove(lst[i]);
  337. }
  338. }
  339. }
  340.  
  341. if (isForum) { // Do not continue if it's a forum
  342. return;
  343. }
  344.  
  345. si = document.querySelector('#header');
  346. if (si) {
  347. rem = si.previousSibling;
  348. while (rem) {
  349. si = rem.previousSibling;
  350. remove(rem);
  351. rem = si;
  352. }
  353. }
  354.  
  355. lst = document.querySelectorAll('#nav li[class]');
  356. i = lst.length;
  357. while (i--) {
  358. if (lst[i] && lst[i].querySelector('a[href^="/tag/"]')) {
  359. remove(lst[i]);
  360. }
  361. }
  362.  
  363. lst = document.querySelectorAll('DIV');
  364. i = lst.length;
  365. var style, result;
  366. while (i--) {
  367. if (lst[i].offsetWidth > 0.95 * width() && lst[i].offsetHeight > 0.9 * height()) {
  368. style = window.getComputedStyle(lst[i], null);
  369. result = [];
  370. if(style.backgroundImage !== 'none') {
  371. result.push('background-image:none!important');
  372. }
  373. if(style.backgroundColor !== 'transparent') {
  374. result.push('background-color:transparent!important');
  375. }
  376. if (result.length) {
  377. if (lst[i].getAttribute('style')) {
  378. result.unshift(lst[i].getAttribute('style'));
  379. }
  380. lst[i].setAttribute('style', result.join(';'));
  381. }
  382. }
  383. }
  384.  
  385. lst = document.querySelectorAll('ASIDE>DIV');
  386. i = lst.length;
  387. while (i--) {
  388. if ( ((lst[i].querySelector('script, iframe, a[href*="/ad/www/"]') ||
  389. lst[i].querySelector('img[src$=".gif"]:not([height="0"]), img[height="400"]')) &&
  390. !lst[i].classList.contains('post') ) || !lst[i].childNodes.length ) {
  391. remove(lst[i]);
  392. }
  393. }
  394.  
  395. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+';background-color:#E6E7E9!important');
  396.  
  397. // display content of the page
  398. afterClean();
  399. });
  400. })();
  401. return;
  402. }
  403.  
  404. // https://greasyfork.org/en/scripts/21937-moonwalk-hdgo-kodik-fix
  405. (function () {
  406. if (!inIFrame) {
  407. return;
  408. }
  409.  
  410. document.addEventListener ("DOMContentLoaded", function() {
  411. var player;
  412. if (win.iframe_adv_enabled !== undefined) {
  413. win.iframe_adv_enabled = false;
  414. } else if (win.banner_second !== undefined) {
  415. win.banner_second = 0;
  416. player = document.getElementById('play-player-hd');
  417. if (player) {
  418. player.onclick = function() {
  419. var adsdiv = document.getElementById("ads-player-hd");
  420. adsdiv.parentNode.removeChild(adsdiv);
  421. win.setPlayer();
  422. };
  423. }
  424. } else if (win.MXoverrollCallback !== undefined) {
  425. player = document.getElementsByClassName('play_button')[0];
  426. if (player) {
  427. player.onclick = win.MXoverrollCallback.bind(window);
  428. }
  429. }
  430. },false);
  431. })();
  432.  
  433. document.addEventListener ("DOMContentLoaded", function() {
  434. // function to search and remove nodes by content
  435. // selector - standard CSS selector to define set of nodes to check
  436. // words - regular expression to check content of the suspicious nodes
  437. // params - object with multiple extra parameters:
  438. // .hide - set display to none instead of removing from the page
  439. // .parent - parent node to remove if content is found in the child node
  440. // .siblings - number of simling nodes to remove (excluding text nodes)
  441. function scRemove(e) {e.parentNode.removeChild(e);}
  442. function scHide(e) {e.style.display='none';}
  443. function scissors (selector, words, scope, params) {
  444. var remFunc = (params.hide ? scHide : scRemove),
  445. iterFunc = (params.siblings > 0 ?
  446. 'nextSibling' :
  447. 'previousSibling'),
  448. nodes = scope.querySelectorAll(selector),
  449. i = nodes.length,
  450. toRemove = [],
  451. siblings,
  452. node;
  453. while(i--) {
  454. node = nodes[i];
  455. if (words.test(node.innerHTML) || !node.childNodes.length) {
  456. // drill up to the specified parent node if required
  457. if (params.parent) {
  458. while(node !== scope && !(node.matches(params.parent))) {
  459. node = node.parentNode;
  460. }
  461. }
  462. if (node === scope) {
  463. break;
  464. }
  465. toRemove.push(node);
  466. // add multiple nodes if defined more than one sibling
  467. siblings = Math.abs(params.siblings) || 0;
  468. while (siblings) {
  469. node = node[iterFunc];
  470. toRemove.push(node);
  471. if (node.nodeType === 1) {
  472. siblings -= 1; //count only element nodes
  473. }
  474. }
  475. }
  476. }
  477. i = toRemove.length;
  478. while(i--) {
  479. remFunc(toRemove[i]);
  480. }
  481.  
  482. return toRemove.length;
  483. }
  484.  
  485. // function to perform multiple checks if ads inserted with a delay
  486. // by default does 30 checks withing a 3 seconds unless nonstop mode specified
  487. // also does 1 extra check when a page completely loads
  488. // selector and words - passed dow to scissors
  489. // params - object with multiple extra parameters:
  490. // .root - selector to narrow down scope to scan;
  491. // .observe - if true then check will be performed continuously;
  492. // Other parameters passed down to scissors.
  493. function gardener(selector, words, params) {
  494. params = params || {};
  495. var scope = document.body,
  496. nonstop = false;
  497. // narrow down scope to a specific element
  498. if (params.root) {
  499. scope = scope.querySelector(params.root);
  500. if (!scope) {// exit if the root element is not present on the page
  501. return 0;
  502. }
  503. }
  504. // add observe mode if required
  505. if (params.observe) {
  506. if (typeof MutationObserver === 'function') {
  507. var o = new MutationObserver(function(ms){
  508. ms.forEach(function(m){
  509. if (m.addedNodes.length) {
  510. scissors(selector, words, scope, params);
  511. }
  512. });
  513. });
  514. o.observe(scope, {childList:true, subtree: true});
  515. } else {
  516. nonstop = true;
  517. }
  518. }
  519. // wait for a full page load to do one extra cut
  520. win.addEventListener('load',function(){
  521. scissors(selector, words, scope, params);
  522. });
  523. // do multiple cuts until ads removed
  524. function cut(sci, s, w, sc, p, i) {
  525. if (i > 0) {
  526. i -= 1;
  527. }
  528. if (i && !sci(s, w, sc, p)) {
  529. setTimeout(cut, 100, sci, s, w, sc, p, i);
  530. }
  531. }
  532. cut(scissors, selector, words, scope, params, (nonstop ? -1 : 30));
  533. }
  534.  
  535. function preventBackgroundRedirect() {
  536. console.log("Background redirect prevention enabled.");
  537. var orgOpen = win.open;
  538. win.open = function(){
  539. var loc = arguments[0];
  540. if (loc.indexOf(win.location.host) > -1 ||
  541. loc.indexOf('://') === -1) {
  542. win.addEventListener('unload',function(){
  543. win.close();
  544. }, true);
  545. }
  546. orgOpen.apply(window, arguments);
  547. };
  548. }
  549.  
  550. var scripts = {};
  551. scripts['fs.to'] = function() {
  552. function skipClicker(i) {
  553. if (!i) {
  554. return;
  555. }
  556. var skip = document.querySelector('.b-aplayer-banners__close');
  557. if (skip) {
  558. skip.click();
  559. } else {
  560. setTimeout(skipClicker, 100, i-1);
  561. }
  562. }
  563. setTimeout(skipClicker, 100, 30);
  564.  
  565. var divs = document.getElementsByTagName('div'),
  566. re = /^b-[a-z]+\d+[a-z\d]*$/,
  567. i = divs.length;
  568. while(i--) {
  569. if (re.test(divs[i].className)) {
  570. divs[i].style.display = 'none';
  571. }
  572. }
  573.  
  574. GM_addStyle('.b-aplayer-teasers > a, div[class^="b-adproxy"], div[id^="admixer_async_"],'+
  575. '.b-player-popup__content > div[class][style="position: relative;"]'+
  576. '{display:none!important}');
  577.  
  578. if (/\/(view_iframe|iframeplayer)\//i.test(document.location.pathname)) {
  579. var p = document.querySelector('#player:not([preload="auto"])'),
  580. m = document.querySelector('.main'),
  581. adStepper = function(p) {
  582. if (p.currentTime < p.duration) {
  583. p.currentTime += 1;
  584. }
  585. },
  586. adSkipper = function(f, p) {
  587. f.click();
  588. p.waitAfterSkip = false;
  589. p.longerSkipper = false;
  590. console.log('Пропустили.');
  591. },
  592. cl = function(p) {
  593. var faster = document.querySelector('.b-aplayer__html5-desktop-skip'),
  594. series = document.querySelector('.b-aplayer__actions-series');
  595.  
  596. function clickSelected() {
  597. var s = document.querySelector('.b-aplayer__popup-series-episodes .selected a');
  598. if (s) {
  599. s.click();
  600. }
  601. }
  602.  
  603. if ((!faster || faster.style.display !== 'block') && series && !p.seriesClicked) {
  604. series.click();
  605. p.seriesClicked = true;
  606. p.longerSkipper = true;
  607. setTimeout(clickSelected, 1000);
  608. p.pause();
  609. }
  610.  
  611. function skipListener() {
  612. if (p.waitAfterSkip) {
  613. console.log('В процессе пропуска…');
  614. return;
  615. }
  616. p.pause();
  617. if (!p.classList.contains('m-hidden')) {
  618. p.classList.add('m-hidden');
  619. }
  620. if (faster && p.currentTime &&
  621. win.getComputedStyle(faster).display === 'block' &&
  622. !faster.querySelector('.b-aplayer__html5-desktop-skip-timer')) {
  623. p.waitAfterSkip = true;
  624. setTimeout(adSkipper, (p.longerSkipper?3:1)*1000, faster, p);
  625. console.log('Доступен быстрый пропуск…');
  626. } else {
  627. setTimeout(adStepper, 1000, p);
  628. }
  629. }
  630.  
  631. p.addEventListener('timeupdate', skipListener, false);
  632. },
  633. o = new MutationObserver(function (mut) {
  634. mut.forEach(function (e) {
  635. var i = e.addedNodes.length;
  636. while(i--) {
  637. if (e.addedNodes[i].id === 'player' &&
  638. e.addedNodes[i].nodeName === 'VIDEO' &&
  639. e.addedNodes[i].getAttribute('preload') !== 'auto') {
  640. cl(e.addedNodes[i]);
  641. }
  642. }
  643. });
  644. });
  645. if (p.nodeName === 'VIDEO') {
  646. cl(p);
  647. } else {
  648. o.observe(m, {childList: true});
  649. }
  650. }
  651. };
  652. scripts['brb.to'] = scripts['fs.to'];
  653. scripts['cxz.to'] = scripts['fs.to'];
  654.  
  655. scripts['drive2.ru'] = function() {
  656. gardener('.c-block', /Реклама<\/div>|\.relap\..*display:\s?none/i);
  657. };
  658.  
  659. scripts['pikabu.ru'] = function() {
  660. gardener('.story', /story__sponsor|story__gag|profile\/ads"/i, {root: '.inner_wrap', observe: true});
  661. };
  662.  
  663. scripts['fishki.net'] = function() {
  664. gardener('.main-post', /543769|Реклама/);
  665. };
  666.  
  667. scripts['hdrezka.me'] = function() {
  668. gardener('div[id][onclick][onmouseup][onmousedown]', /onmouseout/i);
  669. };
  670.  
  671. scripts['naruto-base.su'] = function() {
  672. gardener('div[id^="entryID"],.block', /href="http.*?target="_blank"/i);
  673. };
  674.  
  675. scripts['pb.wtf'] = function() {
  676. GM_addStyle('#result,tbody.row1:not([id]) {display: none !important}');
  677. gardener('a[href$="=="]', /img/i, {root:'#page_container .containe', observe:true, parent:'div[class]'});
  678. gardener('a[href^="/"]', /<img\s.*<br>/i, {root:'#main_content', observe:true, parent:'div[class]'});
  679. gardener('.re_top1', /./, {root:'#main_content', parent:'table.border'});
  680. };
  681. scripts['piratbit.org'] = scripts['pb.wtf'];
  682. scripts['piratbit.ru'] = scripts['pb.wtf'];
  683.  
  684. scripts['sports.ru'] = function() {
  685. gardener('.aside-news-list__item', /aside-news-list__advert/i, {root:'.aside-news-block'});
  686. };
  687.  
  688. scripts['rustorka.com'] = function() {
  689. var s = document.head.childNodes, i = s.length;
  690. if (i < 5) {
  691. while(i--) {
  692. if (s[i].httpEquiv && s[i].httpEquiv === 'refresh') {
  693. win.close();
  694. }
  695. }
  696. }
  697. gardener('span[class],ul[class],span[id],ul[id]', /\/\d{12,}\.php/i, {root:'#sidebar1', observe:true});
  698. gardener('div[id][style*="!important"]', /!important/i);
  699. };
  700. scripts['rumedia.ws'] = scripts['rustorka.com'];
  701.  
  702. scripts['yap.ru'] = function() {
  703. var words = /member1438|Administration/;
  704. gardener('form > table[id^="p_row_"]', words);
  705. gardener('tr > .holder.newsbottom', words, {parent:'tr', siblings:-2});
  706. };
  707. scripts['yaplakal.com'] = scripts['yap.ru'];
  708.  
  709. scripts['reactor.cc'] = preventBackgroundRedirect;
  710. scripts['joyreactor.cc'] = preventBackgroundRedirect;
  711. scripts['pornreactor.cc'] = preventBackgroundRedirect;
  712.  
  713. scripts['auto.ru'] = function() {
  714. var words = /Реклама|Яндекс.Директ|yandex_ad_/;
  715. var userAdsListAds = [
  716. '.listing-list > .listing-item',
  717. '.listing-item_type_fixed.listing-item'
  718. ];
  719. var catalogAds = [
  720. 'div[class*="layout_catalog-inline"]',
  721. 'div[class$="layout_horizontal"]'
  722. ];
  723. var otherAds = [
  724. '.advt_auto',
  725. '.sidebar-block',
  726. '.pager-listing + div[class]',
  727. '.card > div[class][style]',
  728. '.sidebar > div[class]',
  729. '.main-page__section + div[class]',
  730. '.listing > tbody'];
  731. gardener(userAdsListAds.join(','), words, {root:'.listing-wrap', observe:true});
  732. gardener(catalogAds.join(','), words, {root:'.catalog__page,.content__wrapper', observe:true});
  733. gardener(otherAds.join(','), words);
  734. };
  735.  
  736. scripts['online.anidub.com'] = function() {
  737. var script = document.createElement('script');
  738. script.type = "text/javascript";
  739. script.innerHTML = "function ogonekstart1() {}";
  740. document.getElementsByTagName('head')[0].appendChild(script);
  741.  
  742. var style = document.createElement('style');
  743. style.type = 'text/css';
  744. style.appendChild(document.createTextNode('.background {background: none!important;}'));
  745. style.appendChild(document.createTextNode('.background > script + div, .background > script ~ div:not([id]):not([class]) + div[id][class] {display:none!important}'));
  746. document.head.appendChild(style);
  747. };
  748.  
  749. scripts['rsload.net'] = function() {
  750. win.addEventListener('load', function() {
  751. var dis = document.querySelector('.cb-disable');
  752. if (dis) {
  753. dis.click();
  754. }
  755. });
  756. document.addEventListener('click',function(e){
  757. var t = e.target;
  758. if (t && t.href && (/:\/\/\d+\.\d+\.\d+\.\d+\//.test(t.href))) {
  759. t.href = t.href.replace('://','://rsload.net:rsload.net@');
  760. }
  761. });
  762. };
  763.  
  764. var domain = document.domain;
  765. while (domain.indexOf('.') !== -1) {
  766. if (scripts.hasOwnProperty(domain)) {
  767. scripts[domain]();
  768. break;
  769. }
  770. domain = domain.slice(domain.indexOf('.') + 1);
  771. }
  772. });
  773. })();