RU AdList JS Fixes

try to take over the world!

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

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