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