RU AdList JS Fixes

try to take over the world!

目前為 2016-08-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name RU AdList JS Fixes
  3. // @namespace ruadlist_js_fixes
  4. // @version 1.1.10
  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. '||gocdn.ru^',
  40. '||hghit.com^',
  41. '||kuveres.com^',
  42. '||lepubs.com^',
  43. '||mail.ru^',
  44. '||marketgid.com^',
  45. '||mxtads.com^',
  46. '||oconner.biz^',
  47. '||psma01.com^',
  48. '||psma02.com^',
  49. '||psma03.com^',
  50. '||recreativ.ru^',
  51. '||regpole.com^',
  52. '||skidl.ru^',
  53. '||torvind.com^',
  54. '||trafmag.com^',
  55. '||xxuhter.ru^',
  56. '||yuiout.online^'
  57. ];
  58. var masks = [];
  59. to_block.forEach(function(m){
  60. masks.push(new RegExp(
  61. m.replace(/([\\\/\[\].*+?(){}$])/g, '\\$1')
  62. .replace(/\^(?!$)/g,'\\.?[^\\w%._-]')
  63. .replace(/\^$/,'\\.?([^\\w%._-]|$)')
  64. .replace(/^\|\|/,'^wss?:\\/+([^\/.]+\\.)*'),
  65. 'i'));
  66. });
  67. var ws = win.WebSocket,
  68. closingFunctions = ['close', 'send'];
  69. function wsGetter(tgt, nm) {
  70. console.log('[WSI] Registered call to property "', nm, '"');
  71. try {
  72. if (typeof ws.prototype[nm] === 'function') {
  73. if (closingFunctions.indexOf(nm) > -1) {
  74. tgt.readyState = ws.CLOSED;
  75. }
  76. return function(){return;};
  77. }
  78. if (typeof ws.prototype[nm] === 'number') {
  79. return ws[nm];
  80. }
  81. } catch(ignore) {}
  82. return tgt[nm];
  83. }
  84. win.WebSocket = new Proxy(ws, {
  85. construct: function(target, args) {
  86. var url = args[0];
  87. console.log('[WSI] Opening socket on', url, '…');
  88. var i = masks.length;
  89. while(i--) {
  90. if (masks[i].test(url)) {
  91. console.log("[WSI] Blocked.");
  92. return new Proxy({url: url, readyState: ws.OPEN}, {
  93. get: wsGetter
  94. });
  95. }
  96. }
  97. return new target(args[0], args[1]);
  98. }
  99. });
  100. })();
  101.  
  102. // https://greasyfork.org/scripts/14720-it-s-not-important
  103. (function(){
  104. var imptt = /((display|(margin|padding)(-top|-bottom)?)\s*:[^;!]*)!\s*important/ig;
  105.  
  106. function unimportanter(el, si) {
  107. if (!imptt.test(si) || el.style.display === 'none') {
  108. return 0; // get out if we have nothing to do here
  109. }
  110. if (el.nodeName === 'IFRAME' && el.src &&
  111. el.src.slice(0,17) === 'chrome-extension:') {
  112. return 0; // Web of Trust uses this method to add their frame
  113. }
  114. var so = si.replace(imptt, function(){return arguments[1];}), ret = 0;
  115. if (si !== so) {
  116. ret = 1;
  117. el.setAttribute('style', so);
  118. }
  119. return ret;
  120. }
  121.  
  122. function logger(c) {
  123. if (c) {
  124. console.log('Some page elements became a bit less important.');
  125. }
  126. }
  127.  
  128. function checkTarget(m, c) {
  129. var si = m.getAttribute ? m.getAttribute('style') : null;
  130. if (si && si.indexOf('!') > -1) {
  131. c += unimportanter(m, si);
  132. }
  133. return c;
  134. }
  135.  
  136. function checkNodes(m, c) {
  137. var i = m.length;
  138. while(i--) {
  139. c = checkTarget(m[i], c);
  140. }
  141. return c;
  142. }
  143.  
  144. var observer = new MutationObserver(function(mutations) {
  145. setTimeout(function(m) {
  146. var i = m.length, c = 0;
  147. while(i--) {
  148. if (m[i].target) {
  149. c = checkTarget(m[i].target, c);
  150. }
  151. if (m[i].addedNodes.length) {
  152. c = checkNodes(m[i].addedNodes, c);
  153. }
  154. }
  155. logger(c);
  156. },0,mutations);
  157. });
  158.  
  159. observer.observe(document, { childList : true, attributes : true, attributeFilter : ['style'], subtree : true });
  160.  
  161. win.addEventListener ("load", function(){
  162. var c = 0, imp = document.querySelectorAll('[style*="!"]'), i = imp.length;
  163. while(i--) {
  164. c+= checkTarget(imp[i], c);
  165. }
  166. logger(c);
  167. }, false);
  168. })();
  169.  
  170. }
  171.  
  172. if (/^https?:\/\/(news\.yandex\.|(www\.)?yandex\.[^\/]+\/(yand)?search[\/?])/i.test(win.location.href)) {
  173. // https://greasyfork.org/en/scripts/809-no-yandex-ads
  174. (function(){
  175. // Generic ads removal and fixes
  176. function removeGenericAds() {
  177. var s, i;
  178. s = document.querySelector('.serp-header');
  179. if (s) {
  180. s.style.marginTop='0';
  181. }
  182. s = document.querySelectorAll('.serp-adv__head + .serp-item');
  183. i = s.length;
  184. while(i--) {
  185. s[i].parentNode.removeChild(s[i]);
  186. }
  187. s = document.querySelectorAll('#adbanner, .serp-adv, .b-spec-adv, div[class*="serp-adv__"]');
  188. i = s.length;
  189. while(i--) {
  190. s[i].parentNode.removeChild(s[i]);
  191. }
  192. }
  193. // Search ads
  194. function removeSearchAds() {
  195. var s = document.querySelectorAll('.serp-block, .serp-item, .search-item');
  196. var i = s.length, item;
  197. while(i--) {
  198. item = s[i].querySelector('.label, .serp-item__label, .document__provider-name');
  199. if (item && (
  200. item.textContent.indexOf('Реклама') > -1 ||
  201. item.textContent.indexOf('Яндекс.Директ') > -1)) {
  202. s[i].parentNode.removeChild(s[i]);
  203. console.log('Ads removed.');
  204. }
  205. }
  206. }
  207. // News ads
  208. function removeNewsAds() {
  209. var s = document.querySelectorAll('.story[id], .document[id], .story__group[id]');
  210. var i = s.length;
  211. while(i--) {
  212. if (win.getComputedStyle(s[i]).position === 'absolute') {
  213. s[i].parentNode.removeChild(s[i]);
  214. console.log('Ads removed.');
  215. }
  216. }
  217. }
  218. // News fixes
  219. function removePageAdsClass() {
  220. if (document.body.classList.contains("b-page_ads_yes")){
  221. document.body.classList.remove("b-page_ads_yes");
  222. console.log('Page ads class removed.');
  223. }
  224. }
  225. // Function to attach an observer to monitor dynamic changes on the page
  226. function pageUpdateObserver(func, obj, params) {
  227. if (obj) {
  228. var o = new MutationObserver(func);
  229. o.observe(obj,(params || {childList:true}));
  230. }
  231. }
  232. // Cleaner
  233. document.addEventListener ("DOMContentLoaded", function() {
  234. removeGenericAds();
  235. if (win.location.hostname.search(/^news\./i) === 0) {
  236. pageUpdateObserver(removeNewsAds, document.querySelector('BODY'));
  237. pageUpdateObserver(removePageAdsClass, document.body, {attributes:true, attributesFilter:['class']});
  238. removeNewsAds();
  239. removePageAdsClass();
  240. } else {
  241. pageUpdateObserver(removeSearchAds, document.querySelector('.main__content'));
  242. removeSearchAds();
  243. }
  244. });
  245. })();
  246. return; //skip fixes for other sites
  247. }
  248.  
  249. // https://greasyfork.org/en/scripts/14470-4pda-unbrender
  250. if (/(^|\.)4pda\.ru$/i.test(window.location.hostname)) {
  251. (function(){
  252. var isForum = document.location.href.search('/forum/') !== -1,
  253. isSafari = (/Safari/i.test(navigator.userAgent)) && (/Apple\sComputer/i.test(navigator.vendor)),
  254. hStyle;
  255.  
  256. function remove(n) {
  257. if (n) {
  258. n.parentNode.removeChild(n);
  259. }
  260. }
  261.  
  262. function afterClean() {
  263. hStyle.disabled = true;
  264. remove(hStyle);
  265. }
  266.  
  267. function beforeClean() {
  268. // attach styles before document displayed
  269. hStyle = document.createElement('style');
  270. hStyle.id = 'ubrHider';
  271. hStyle.type = 'text/css';
  272. document.head.appendChild(hStyle);
  273.  
  274. hStyle.sheet.insertRule('html { overflow-y: scroll }', 0);
  275. hStyle.sheet.insertRule('article + aside * { display: none !important }', 0);
  276. hStyle.sheet.insertRule('#header + div:after {'+(
  277. 'content: "";'+
  278. 'position: fixed;'+
  279. 'top: 0;'+
  280. 'left: 0;'+
  281. 'width: 100%;'+
  282. 'height: 100%;'+
  283. 'background-color: #E6E7E9'
  284. )+'}', 0);
  285. // http://codepen.io/Beaugust/pen/DByiE
  286. hStyle.sheet.insertRule('@keyframes spin { 100% { transform: rotate(360deg) } }', 0);
  287. hStyle.sheet.insertRule('article + aside:after {'+(
  288. 'content: "";'+
  289. 'position: absolute;'+
  290. 'width: 150px;'+
  291. 'height: 150px;'+
  292. 'top: 150px;'+
  293. 'left: 50%;'+
  294. 'margin-top: -75px;'+
  295. 'margin-left: -75px;'+
  296. 'box-sizing: border-box;'+
  297. 'border-radius: 100%;'+
  298. 'border: 10px solid rgba(0, 0, 0, 0.2);'+
  299. 'border-top-color: rgba(0, 0, 0, 0.6);'+
  300. 'animation: spin 2s infinite linear'
  301. )+'}', 0);
  302.  
  303. // display content of a page if time to load a page is more than 2 seconds to avoid
  304. // blocking access to a page if it is loading for too long or stuck in a loading state
  305. setTimeout(2000, afterClean);
  306. }
  307.  
  308. GM_addStyle('#nav .use-ad {display: block !important;} ' +
  309. 'article:not(.post) + article:not(#id) { display: none !important }');
  310. if (!isForum && !isSafari) {
  311. beforeClean();
  312. }
  313.  
  314. // clean the page
  315. window.addEventListener('DOMContentLoaded', function(){
  316. var rem, si, lst, i;
  317. function width(){ return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; }
  318. function height(){ return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; }
  319.  
  320.  
  321. if (isForum) {
  322. si = document.querySelector('#logostrip');
  323. if (si) {
  324. remove(si.parentNode.nextSibling);
  325. }
  326. }
  327.  
  328. if (document.location.href.search('/forum/dl/') !== -1) {
  329. lst = document.querySelectorAll('body>div');
  330. i = lst.length;
  331. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+
  332. ';background-color:black!important');
  333. while (i--) {
  334. if (!lst[i].querySelector('.dw-fdwlink')) {
  335. remove(lst[i]);
  336. }
  337. }
  338. }
  339.  
  340. if (isForum) { // Do not continue if it's a forum
  341. return;
  342. }
  343.  
  344. si = document.querySelector('#header');
  345. if (si) {
  346. rem = si.previousSibling;
  347. while (rem) {
  348. si = rem.previousSibling;
  349. remove(rem);
  350. rem = si;
  351. }
  352. }
  353.  
  354. lst = document.querySelectorAll('#nav li[class]');
  355. i = lst.length;
  356. while (i--) {
  357. if (lst[i] && lst[i].querySelector('a[href^="/tag/"]')) {
  358. remove(lst[i]);
  359. }
  360. }
  361.  
  362. lst = document.querySelectorAll('DIV');
  363. i = lst.length;
  364. var style, result;
  365. while (i--) {
  366. if (lst[i].offsetWidth > 0.95 * width() && lst[i].offsetHeight > 0.9 * height()) {
  367. style = window.getComputedStyle(lst[i], null);
  368. result = [];
  369. if(style.backgroundImage !== 'none') {
  370. result.push('background-image:none!important');
  371. }
  372. if(style.backgroundColor !== 'transparent') {
  373. result.push('background-color:transparent!important');
  374. }
  375. if (result.length) {
  376. if (lst[i].getAttribute('style')) {
  377. result.unshift(lst[i].getAttribute('style'));
  378. }
  379. lst[i].setAttribute('style', result.join(';'));
  380. }
  381. }
  382. }
  383.  
  384. lst = document.querySelectorAll('ASIDE>DIV');
  385. i = lst.length;
  386. while (i--) {
  387. if ( ((lst[i].querySelector('script, iframe, a[href*="/ad/www/"]') ||
  388. lst[i].querySelector('img[src$=".gif"]:not([height="0"]), img[height="400"]')) &&
  389. !lst[i].classList.contains('post') ) || !lst[i].childNodes.length ) {
  390. remove(lst[i]);
  391. }
  392. }
  393.  
  394. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+';background-color:#E6E7E9!important');
  395.  
  396. // display content of the page
  397. afterClean();
  398. });
  399. })();
  400. return;
  401. }
  402.  
  403. // https://greasyfork.org/en/scripts/21937-moonwalk-hdgo-kodik-fix
  404. (function () {
  405. if (!inIFrame) {
  406. return;
  407. }
  408.  
  409. document.addEventListener ("DOMContentLoaded", function() {
  410. var player;
  411. if (win.iframe_adv_enabled !== undefined) {
  412. win.iframe_adv_enabled = false;
  413. } else if (win.banner_second !== undefined) {
  414. win.banner_second = 0;
  415. player = document.getElementById('play-player-hd');
  416. if (player) {
  417. player.onclick = function() {
  418. var adsdiv = document.getElementById("ads-player-hd");
  419. adsdiv.parentNode.removeChild(adsdiv);
  420. win.setPlayer();
  421. };
  422. }
  423. } else if (win.MXoverrollCallback !== undefined) {
  424. player = document.getElementsByClassName('play_button')[0];
  425. if (player) {
  426. player.onclick = win.MXoverrollCallback.bind(window);
  427. }
  428. }
  429. },false);
  430. })();
  431.  
  432. document.addEventListener ("DOMContentLoaded", function() {
  433. // function to search and remove nodes by content
  434. // selector - standard CSS selector to define set of nodes to check
  435. // words - regular expression to check content of the suspicious nodes
  436. // params - object with multiple extra parameters:
  437. // .hide - set display to none instead of removing from the page
  438. // .parent - parent node to remove if content is found in the child node
  439. // .siblings - number of simling nodes to remove (excluding text nodes)
  440. function scRemove(e) {e.parentNode.removeChild(e);}
  441. function scHide(e) {e.style.display='none';}
  442. function scissors (selector, words, scope, params) {
  443. var remFunc = (params.hide ? scHide : scRemove),
  444. iterFunc = (params.siblings > 0 ?
  445. 'nextSibling' :
  446. 'previousSibling'),
  447. nodes = scope.querySelectorAll(selector),
  448. i = nodes.length,
  449. toRemove = [],
  450. siblings,
  451. node;
  452. while(i--) {
  453. node = nodes[i];
  454. if (words.test(node.innerHTML) || !node.childNodes.length) {
  455. // drill up to the specified parent node if required
  456. if (params.parent) {
  457. while(node !== scope && !(node.matches(params.parent))) {
  458. node = node.parentNode;
  459. }
  460. }
  461. if (node === scope) {
  462. break;
  463. }
  464. toRemove.push(node);
  465. // add multiple nodes if defined more than one sibling
  466. siblings = Math.abs(params.siblings) || 0;
  467. while (siblings) {
  468. node = node[iterFunc];
  469. toRemove.push(node);
  470. if (node.nodeType === 1) {
  471. siblings -= 1; //count only element nodes
  472. }
  473. }
  474. }
  475. }
  476. i = toRemove.length;
  477. while(i--) {
  478. remFunc(toRemove[i]);
  479. }
  480.  
  481. return toRemove.length;
  482. }
  483.  
  484. // function to perform multiple checks if ads inserted with a delay
  485. // by default does 30 checks withing a 3 seconds unless nonstop mode specified
  486. // also does 1 extra check when a page completely loads
  487. // selector and words - passed dow to scissors
  488. // params - object with multiple extra parameters:
  489. // .root - selector to narrow down scope to scan;
  490. // .observe - if true then check will be performed continuously;
  491. // Other parameters passed down to scissors.
  492. function gardener(selector, words, params) {
  493. params = params || {};
  494. var scope = document.body,
  495. nonstop = false;
  496. // narrow down scope to a specific element
  497. if (params.root) {
  498. scope = scope.querySelector(params.root);
  499. if (!scope) {// exit if the root element is not present on the page
  500. return 0;
  501. }
  502. }
  503. // add observe mode if required
  504. if (params.observe) {
  505. if (typeof MutationObserver === 'function') {
  506. var o = new MutationObserver(function(ms){
  507. ms.forEach(function(m){
  508. if (m.addedNodes.length) {
  509. scissors(selector, words, scope, params);
  510. }
  511. });
  512. });
  513. o.observe(document.querySelector(params.root),
  514. {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|profile\/ads"/i, {root:'.stories,.page-story', 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. })();