RU AdList JS Fixes

try to take over the world!

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

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址