RU AdList JS Fixes

try to take over the world!

当前为 2016-09-02 提交的版本,查看 最新版本

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