RU AdList JS Fixes

try to take over the world!

当前为 2016-10-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name RU AdList JS Fixes
  3. // @namespace ruadlist_js_fixes
  4. // @version 20161018.4
  5. // @description try to take over the world!
  6. // @author lainverse & dimisa
  7. // @match *://*/*
  8. // @grant unsafeWindow
  9. // @grant window.close
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var win = (unsafeWindow || window),
  16. isFirefox = /firefox/i.test(navigator.userAgent);
  17.  
  18. // NodeList iterator polyfill (mostly for Safari)
  19. // https://jakearchibald.com/2014/iterators-gonna-iterate/
  20. if (!NodeList.prototype[Symbol.iterator]) {
  21. NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
  22. }
  23.  
  24. // Creates and return protected style (unless protection is manually disabled).
  25. // Protected style will re-add itself on removal and remaind enabled on attempt to disable it.
  26. function createStyle(rules, props, skip_protect) {
  27. var root = document.documentElement;
  28.  
  29. function _protect(style) {
  30. Object.defineProperty(style, 'sheet', {
  31. value: style.sheet,
  32. enumerable: true
  33. });
  34. Object.defineProperty(style, 'disabled', {
  35. get: function() {return true;}, //pretend to be disabled
  36. set: function() {},
  37. enumerable: true
  38. });
  39. }
  40.  
  41. function _create() {
  42. var style = root.appendChild(document.createElement('style')),
  43. prop, rule;
  44. style.type = 'text/css';
  45. for (prop in props) {
  46. if (style.hasOwnProperty(prop)) {
  47. style[prop] = props[prop];
  48. }
  49. }
  50. for (rule of rules) {
  51. try {
  52. style.sheet.insertRule(rule, 0);
  53. } catch (e) {
  54. console.error(e);
  55. }
  56. }
  57. if (!skip_protect) {
  58. _protect(style);
  59. }
  60. return style;
  61. }
  62.  
  63. var style = _create();
  64. if (skip_protect) {
  65. return style;
  66. }
  67.  
  68. var o = new MutationObserver(function(ms){
  69. var m, node, rule;
  70. for (m of ms) {
  71. for (node of m.removedNodes) {
  72. if (node === style) {
  73. (new Promise(function(resolve){
  74. setTimeout(function(resolve){
  75. resolve(_create());
  76. }, 0, resolve);
  77. })).then(function(st){
  78. style = st;
  79. })
  80. }
  81. }
  82. }
  83. });
  84. o.observe(root, {childList:true});
  85.  
  86. return style;
  87. }
  88.  
  89. // https://greasyfork.org/scripts/19144-websuckit/
  90. (function() {
  91. // check does browser support Proxy and WebSocket
  92. if (typeof Proxy !== 'function' ||
  93. typeof WebSocket !== 'function') {
  94. return;
  95. }
  96.  
  97. function getWrappedCode(removeSelf) {
  98. var text = getWrappedCode.toString()+WSI.toString();
  99. text = (
  100. '(function(){"use strict";'+
  101. text.replace(/\/\/[^\r\n]*/g,'').replace(/[\s\r\n]+/g,' ')+
  102. '(new WSI(self||window)).init();'+
  103. '})();\n'+
  104. (removeSelf?'var s = document.currentScript; if (s) {s.parentNode.removeChild(s);}':'')
  105. );
  106. return text;
  107. }
  108.  
  109. function WSI(win, safeWin) {
  110. safeWin = safeWin || win;
  111. var masks = [], filter;
  112. for (filter of [// blacklist
  113. '||24video.xxx^',
  114. '||adlabs.ru^', '||adspayformymortgage.win^', '||aviabay.ru^',
  115. '||bgrndi.com^', '||brokeloy.com^',
  116. '||cnamerutor.ru^',
  117. '||docfilms.info^', '||dreadfula.ru^',
  118. '||et-code.ru^',
  119. '||film-doma.ru^',
  120. '||free-torrent.org^', '||free-torrent.pw^',
  121. '||free-torrents.org^', '||free-torrents.pw^',
  122. '||game-torrent.info^', '||gocdn.ru^',
  123. '||hdkinoshka.com^', '||hghit.com^', '||hindcine.net^',
  124. '||kiev.ua^', '||kinotochka.net^',
  125. '||kinott.com^', '||kinott.ru^', '||kuveres.com^',
  126. '||lepubs.com^', '||luxadv.com^', '||luxup.ru^',
  127. '||mail.ru^', '||marketgid.com^', '||mxtads.com^',
  128. '||oconner.biz^',
  129. '||pkpojhc.com^',
  130. '||psma01.com^', '||psma02.com^', '||psma03.com^',
  131. '||recreativ.ru^', '||regpole.com^', '||ruttwind.com^',
  132. '||skidl.ru^',
  133. '||torvind.com^', '||trafmag.com^',
  134. '||webadvert-gid.ru^', '||webadvertgid.ru^',
  135. '||xxuhter.ru^',
  136. '||yuiout.online^',
  137. '||zoom-film.ru^'
  138. ]) {
  139. masks.push(new RegExp(
  140. filter.replace(/([\\\/\[\].*+?(){}$])/g, '\\$1')
  141. .replace(/\^(?!$)/g,'\\.?[^\\w%._-]')
  142. .replace(/\^$/,'\\.?([^\\w%._-]|$)')
  143. .replace(/^\|\|/,'^wss?:\\/+([^\/.]+\\.)*'),
  144. 'i'));
  145. }
  146.  
  147. function isBlocked(url) {
  148. for (var mask of masks) {
  149. if (mask.test(url)) {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155.  
  156. var realWebSocket = win.WebSocket;
  157. function wsGetter (target, name) {
  158. try {
  159. if (typeof realWebSocket.prototype[name] === 'function') {
  160. if (name === 'close' || name === 'send') { // send also closes connection
  161. target.readyState = realWebSocket.CLOSED;
  162. }
  163. return (
  164. function fake() {
  165. console.log('[WSI] Invoked function "'+name+'"', '| Tracing', (new Error()));
  166. return;
  167. }
  168. );
  169. }
  170. if (typeof realWebSocket.prototype[name] === 'number') {
  171. return realWebSocket[name];
  172. }
  173. } catch(ignore) {}
  174. return target[name];
  175. }
  176.  
  177. function createWebSocketWrapper(target) {
  178. return new Proxy(realWebSocket, {
  179. construct: function (target, args) {
  180. var url = args[0];
  181. console.log('[WSI] Opening socket on ' + url + ' \u2026');
  182. if (isBlocked(url)) {
  183. console.log("[WSI] Blocked.");
  184. return new Proxy({
  185. url: url,
  186. readyState: realWebSocket.OPEN
  187. }, {
  188. get: wsGetter
  189. });
  190. }
  191. return new target(args[0], args[1]);
  192. }
  193. });
  194. }
  195.  
  196. function WorkerWrapper() {
  197. var realWorker = win.Worker;
  198. function wrappedWorker(resourceURI) {
  199. var isBlobURL = /^blob:/i,
  200. _callbacks = new WeakMap(),
  201. _worker = null,
  202. _terminate = false,
  203. _onerror = null,
  204. _onmessage = null,
  205. _messages = [],
  206. _events = [],
  207. _self = this;
  208.  
  209. function callbackWrapper(func) {
  210. if (typeof func !== 'function') {
  211. return undefined;
  212. }
  213. return (
  214. function callback() {
  215. func.apply(_self, arguments);
  216. }
  217. );
  218. }
  219.  
  220. (new Promise(function(resolve, reject){
  221. if (!isBlobURL.test(resourceURI)) {
  222. return resolve(new realWorker(resourceURI));
  223. }
  224.  
  225. var xhr = new XMLHttpRequest();
  226. xhr.open('GET', resourceURI, true);
  227. xhr.responseType = 'blob';
  228. xhr.onload = function(){
  229. if (this.status === 200) {
  230. var reader = new FileReader();
  231. reader.addEventListener("loadend", function() {
  232. resolve(new realWorker(URL.createObjectURL(
  233. new Blob([getWrappedCode(false)+this.result])
  234. )));
  235. });
  236. reader.readAsText(this.response);
  237. }
  238. };
  239. xhr.send();
  240. })).then(function(val) {
  241. _worker = val;
  242. _worker.onerror = callbackWrapper(_onerror);
  243. _worker.onmessage = callbackWrapper(_onmessage);
  244. var _e;
  245. while(_events.length) {
  246. _e = _events.shift();
  247. _worker[_e[0]].apply(_worker, _e[1]);
  248. }
  249. while(_messages.length) {
  250. _worker.postMessage(_messages.shift());
  251. }
  252. if (_terminate) {
  253. _worker.terminate();
  254. }
  255. });
  256.  
  257. _self.terminate = function(){
  258. _terminate = true;
  259. if (_worker) {
  260. _worker.terminate();
  261. }
  262. };
  263. Object.defineProperty(_self, 'onmessage', {
  264. get: function() {
  265. return _onmessage;
  266. },
  267. set: function(val) {
  268. _onmessage = val;
  269. if (_worker) {
  270. _worker.onmessage = callbackWrapper(val);
  271. }
  272. }
  273. });
  274. Object.defineProperty(_self, 'onerror', {
  275. get: function() {
  276. return _onerror;
  277. },
  278. set: function(val) {
  279. _onerror = val;
  280. if (_worker) {
  281. _worker.onerror = callbackWrapper(val);
  282. }
  283. }
  284. });
  285. _self.postMessage = function(message){
  286. if (_worker) {
  287. _worker.postMessage(message);
  288. } else {
  289. _messages.push(message);
  290. }
  291. };
  292. _self.terminate = function() {
  293. _terminate = true;
  294. if (_worker) {
  295. _worker.terminate();
  296. }
  297. };
  298. _self.addEventListener = function(){
  299. if (typeof arguments[1] !== 'function') {
  300. return;
  301. }
  302. if (!_callbacks.has(arguments[1])) {
  303. _callbacks.set(arguments[1], callbackWrapper(arguments[1]));
  304. }
  305. arguments[1] = _callbacks.get(arguments[1]);
  306. if (_worker) {
  307. _worker.addEventListener.apply(_worker, arguments);
  308. } else {
  309. _events.push(['addEventListener', arguments]);
  310. }
  311. };
  312. _self.removeEventListener = function(){
  313. if (typeof arguments[1] !== 'function' || !_callbacks.has(arguments[1])) {
  314. return;
  315. }
  316. arguments[1] = _callbacks.get(arguments[1]);
  317. _callbacks.delete(arguments[1]);
  318. if (_worker) {
  319. _worker.removeEventListener.apply(_worker, arguments);
  320. } else {
  321. _events.push(['removeEventListener', arguments]);
  322. }
  323. };
  324. }
  325. win.Worker = wrappedWorker.bind(safeWin);
  326. }
  327.  
  328. function CreateElementWrapper() {
  329. var realCreateElement = document.createElement.bind(document),
  330. code = encodeURIComponent('<scr'+'ipt>'+getWrappedCode(true)+'</scr'+'ipt>\n'),
  331. isDataURL = /^data:/i,
  332. isBlobURL = /^blob:/i;
  333.  
  334. function frameRewrite(e) {
  335. var f = e.target,
  336. w = f.contentWindow;
  337. if (!f.src) {
  338. return; // nothing to do here if source is unknown
  339. }
  340. if (isDataURL.test(f.src) && f.src.indexOf(code) < 0) {
  341. f.src = f.src.replace(',',',' + code);
  342. }
  343. if (w && isBlobURL.test(f.src)) {
  344. w.WebSocket = createWebSocketWrapper();
  345. }
  346. }
  347.  
  348. function wrappedCreateElement(name) {
  349. if (name && name.toUpperCase &&
  350. name.toUpperCase() === 'IFRAME') {
  351. var ifr = realCreateElement.apply(document, arguments);
  352. ifr.addEventListener('load', frameRewrite, false);
  353. return ifr;
  354. }
  355. return realCreateElement.apply(document, arguments);
  356. }
  357. document.createElement = wrappedCreateElement.bind(document);
  358.  
  359. document.addEventListener('DOMContentLoaded', function(){
  360. for (var ifr of document.querySelectorAll('IFRAME')) {
  361. ifr.addEventListener('load', frameRewrite, false);
  362. }
  363. }, false);
  364. }
  365.  
  366. this.init = function() {
  367. win.WebSocket = createWebSocketWrapper();
  368. // TempFix: Skip WorkerWrapper on Twitter due to weird CPS which breaks their own Worker object (or my code instead)
  369. if (!/^([^.]*?\.)*?twitter.com$/.test(safeWin.location.hostname)) {
  370. WorkerWrapper();
  371. }
  372. if (typeof document !== 'undefined') {
  373. CreateElementWrapper();
  374. }
  375. };
  376. }
  377.  
  378. if (isFirefox) {
  379. var script = document.createElement('script');
  380. script.appendChild(document.createTextNode(getWrappedCode()));
  381. document.head.insertBefore(script, document.head.firstChild);
  382. return; //we don't want to call functions on page from here in Fx, so exit
  383. }
  384.  
  385. (new WSI((unsafeWindow||self||window),(self||window))).init();
  386. })();
  387.  
  388. if (!isFirefox) { // scripts for non-Firefox browsers
  389.  
  390. // https://greasyfork.org/scripts/14720-it-s-not-important
  391. (function(){
  392. var imptt = /((display|(margin|padding)(-top|-bottom)?)\s*:[^;!]*)!\s*important/ig;
  393.  
  394. function unimportanter(el, si) {
  395. if (!imptt.test(si) || el.style.display === 'none') {
  396. return 0; // get out if we have nothing to do here
  397. }
  398. if (el.nodeName === 'IFRAME' && el.src &&
  399. el.src.slice(0,17) === 'chrome-extension:') {
  400. return 0; // Web of Trust uses this method to add their frame
  401. }
  402. var so = si.replace(imptt, function(){return arguments[1];}), ret = 0;
  403. if (si !== so) {
  404. ret = 1;
  405. el.setAttribute('style', so);
  406. }
  407. return ret;
  408. }
  409.  
  410. function logger(c) {
  411. if (c) {
  412. console.log('Some page elements became a bit less important.');
  413. }
  414. }
  415.  
  416. function checkTarget(node, cnt) {
  417. if (!(node && node.getAttribute)) {
  418. return 0;
  419. }
  420. var si = node.getAttribute('style');
  421. if (si && si.indexOf('!') > -1) {
  422. cnt += unimportanter(node, si);
  423. }
  424. return cnt;
  425. }
  426.  
  427. var observer = new MutationObserver(function(mutations) {
  428. setTimeout(function(ms) {
  429. var cnt = 0, m, node;
  430. for (m of ms) {
  431. cnt = checkTarget(m.target, cnt);
  432. for (node of m.addedNodes) {
  433. cnt += checkTarget(node, cnt);
  434. }
  435. }
  436. logger(cnt);
  437. }, 0, mutations);
  438. });
  439.  
  440. observer.observe(document, { childList : true, attributes : true, attributeFilter : ['style'], subtree : true });
  441.  
  442. win.addEventListener ("load", function(){
  443. var c = 0, imp;
  444. for (imp of document.querySelectorAll('[style*="!"]')) {
  445. c+= checkTarget(imp, c);
  446. }
  447. logger(c);
  448. }, false);
  449. })();
  450.  
  451. }
  452.  
  453. if (/^https?:\/\/(news\.yandex\.|(www\.)?yandex\.[^\/]+\/(yand)?search[\/?])/i.test(win.location.href)) {
  454. // https://greasyfork.org/en/scripts/809-no-yandex-ads
  455. (function(){
  456. var adWords = ['Яндекс.Директ','Реклама','Ad'];
  457. function remove(node) {
  458. node.parentNode.removeChild(node);
  459. }
  460. // Generic ads removal and fixes
  461. function removeGenericAds() {
  462. var s, i;
  463. s = document.querySelector('.serp-header');
  464. if (s) {
  465. s.style.marginTop='0';
  466. }
  467. for (s of document.querySelectorAll('.serp-adv__head + .serp-item, #adbanner, .serp-adv, .b-spec-adv, div[class*="serp-adv__"]')) {
  468. remove(s);
  469. }
  470. }
  471. // Search ads
  472. function removeSearchAds() {
  473. var s, item;
  474. for (s of document.querySelectorAll('.serp-block, .serp-item, .search-item')) {
  475. item = s.querySelector('.label, .serp-item__label, .document__provider-name');
  476. if (item && adWords.indexOf(item.textContent) > -1) {
  477. remove(s);
  478. console.log('Ads removed.');
  479. }
  480. }
  481. }
  482. // News ads
  483. function removeNewsAds() {
  484. var s;
  485. for (s of document.querySelectorAll('.page-content__left > *,.page-content__right > *:not(.page-content__col),.page-content__right > .page-content__col > *')) {
  486. if (s.textContent.indexOf(adWords[0]) > -1) {
  487. remove(s);
  488. console.log('Ads removed.');
  489. }
  490. }
  491. }
  492. // News fixes
  493. function removePageAdsClass() {
  494. if (document.body.classList.contains("b-page_ads_yes")){
  495. document.body.classList.remove("b-page_ads_yes");
  496. console.log('Page ads class removed.');
  497. }
  498. }
  499. // Function to attach an observer to monitor dynamic changes on the page
  500. function pageUpdateObserver(func, obj, params) {
  501. if (obj) {
  502. var o = new MutationObserver(func);
  503. o.observe(obj,(params || {childList:true, subtree:true}));
  504. }
  505. }
  506. // Cleaner
  507. document.addEventListener ('DOMContentLoaded', function() {
  508. removeGenericAds();
  509. if (win.location.hostname.search(/^news\./i) === 0) {
  510. pageUpdateObserver(removeNewsAds, document.querySelector('BODY'));
  511. pageUpdateObserver(removePageAdsClass, document.body, {attributes:true, attributesFilter:['class']});
  512. removeNewsAds();
  513. removePageAdsClass();
  514. } else {
  515. pageUpdateObserver(removeSearchAds, document.querySelector('.main__content'));
  516. removeSearchAds();
  517. }
  518. });
  519. })();
  520. return; //skip fixes for other sites
  521. }
  522.  
  523. // https://greasyfork.org/en/scripts/14470-4pda-unbrender
  524. if (/(^|\.)4pda\.ru$/i.test(window.location.hostname)) {
  525. (function() {
  526. var isForum = document.location.href.search('/forum/') !== -1,
  527. hStyle;
  528.  
  529. function remove(n) {
  530. if (n) {
  531. n.parentNode.removeChild(n);
  532. }
  533. }
  534.  
  535. function afterClean() {
  536. hStyle.disabled = true;
  537. remove(hStyle);
  538. }
  539.  
  540. function beforeClean() {
  541. // attach styles before document displayed
  542. hStyle = createStyle([
  543. 'html { overflow-y: scroll }',
  544. 'article + aside * { display: none !important }',
  545. '#header + div:after {'+(
  546. 'content: "";'+
  547. 'position: fixed;'+
  548. 'top: 0;'+
  549. 'left: 0;'+
  550. 'width: 100%;'+
  551. 'height: 100%;'+
  552. 'background-color: #E6E7E9'
  553. )+'}',
  554. // http://codepen.io/Beaugust/pen/DByiE
  555. '@keyframes spin { 100% { transform: rotate(360deg) } }',
  556. 'article + aside:after {'+(
  557. 'content: "";'+
  558. 'position: absolute;'+
  559. 'width: 150px;'+
  560. 'height: 150px;'+
  561. 'top: 150px;'+
  562. 'left: 50%;'+
  563. 'margin-top: -75px;'+
  564. 'margin-left: -75px;'+
  565. 'box-sizing: border-box;'+
  566. 'border-radius: 100%;'+
  567. 'border: 10px solid rgba(0, 0, 0, 0.2);'+
  568. 'border-top-color: rgba(0, 0, 0, 0.6);'+
  569. 'animation: spin 2s infinite linear'
  570. )+'}'
  571. ], {id:'ubrHider'}, true);
  572.  
  573. // display content of a page if time to load a page is more than 2 seconds to avoid
  574. // blocking access to a page if it is loading for too long or stuck in a loading state
  575. setTimeout(2000, afterClean);
  576. }
  577.  
  578. createStyle([
  579. '#nav .use-ad { display: block !important }',
  580. 'article:not(.post) + article:not(#id), a[target="_blank"] img[height="90"] { display: none !important }'
  581. ]);
  582.  
  583. if (!isForum) {
  584. beforeClean();
  585. }
  586.  
  587. // save links to non-overridden functions to use later
  588. var oGA = Element.prototype.getAttribute,
  589. oSA = Element.prototype.setAttribute,
  590. protectedElems;
  591. // protect/hide changed attributes in case site attempt to restore them
  592. function styleProtector(eventMode) {
  593. var oRAN = Element.prototype.removeAttributeNode,
  594. isStyleText = function(t){ return t === 'style'; },
  595. isStyleAttr = function(a){ return a instanceof Attr && a.nodeName === 'style' },
  596. returnUndefined = function(){},
  597. protectedElems = new WeakMap();
  598. function protoOverride(element, functionName, isStyleCheck, returnIfProtected) {
  599. var oF = element.prototype[functionName];
  600. element.prototype[functionName] = function(){
  601. if (protectedElems.get(this) !== undefined && isStyleCheck(arguments[0])) {
  602. return returnIfProtected(protectedElems.get(this), arguments, this);
  603. }
  604. return oF.apply(this, arguments);
  605. }
  606. }
  607. protoOverride(Element, 'removeAttribute', isStyleText, returnUndefined);
  608. protoOverride(Element, 'removeAttributeNS', isStyleText, returnUndefined);
  609. protoOverride(Element, 'removeAttributeNode', isStyleAttr, function(o, args, node) {
  610. if (args[0] instanceof Attr && args[0].ownerElement !== node) {
  611. // throw 'attribute of another element' error
  612. oRAN.call(node, document.createAttribute('style'));
  613. }
  614. if (o.oldStyle === null) {
  615. // throw 'not an Attr' error
  616. oRAN.call(node, null);
  617. }
  618. o.oldStyle = null;
  619. return args[0];
  620. });
  621. protoOverride(Element, 'hasAttribute', isStyleText, function(o) {
  622. return o.oldStyle !== null;
  623. });
  624. protoOverride(Element, 'hasAttributeNS', isStyleText, function(o) {
  625. return o.oldStyle !== null;
  626. });
  627. protoOverride(Element, 'setAttribute', isStyleText, function(o, args) {
  628. o.oldStyle = args[1];
  629. });
  630. protoOverride(Element, 'setAttributeNS', isStyleText, returnUndefined);
  631. protoOverride(Element, 'setAttributeNode', isStyleAttr, returnUndefined);
  632. protoOverride(Element, 'getAttribute', isStyleText, function(o) {
  633. return o.oldStyle;
  634. });
  635. protoOverride(Element, 'getAttributeNS', isStyleText, returnUndefined);
  636. protoOverride(Element, 'getAttributeNode', isStyleText, function(o){
  637. if (o.oldStyle === null) {
  638. return null;
  639. }
  640. var at = document.createAttribute('style');
  641. at.value = o.oldStyle;
  642. Object.defineProperty(at, 'ownerElement', {
  643. value: this,
  644. enumerable: true
  645. });
  646. return at;
  647. });
  648. if (eventMode) {
  649. var e = document.createEvent('Event');
  650. e.initEvent('protoOverride', false, false);
  651. window.protectedElems = protectedElems;
  652. window.dispatchEvent(e);
  653. } else {
  654. return protectedElems;
  655. }
  656. }
  657. if (isFirefox) {
  658. var s = document.createElement('script');
  659. s.textContent = '(' + styleProtector.toString() + ')(true);' +
  660. 'var s = document.currentScript; if (s) {s.parentNode.removeChild(s);}'
  661. window.addEventListener('protoOverride', function protoOverrideCallback(e){
  662. if (win.protectedElems) {
  663. protectedElems = win.protectedElems;
  664. delete win.protectedElems;
  665. }
  666. document.removeEventListener('protoOverride', protoOverrideCallback, true);
  667. }, true);
  668. document.documentElement.appendChild(s);
  669. } else {
  670. protectedElems = styleProtector(false);
  671. }
  672.  
  673. // clean a page
  674. window.addEventListener('DOMContentLoaded', function(){
  675. var rem, si, itm;
  676. function width(){ return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; }
  677. function height(){ return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; }
  678.  
  679.  
  680. if (isForum) {
  681. si = document.querySelector('#logostrip');
  682. if (si) {
  683. remove(si.parentNode.nextSibling);
  684. }
  685. }
  686.  
  687. if (document.location.href.search('/forum/dl/') !== -1) {
  688. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+
  689. ';background-color:black!important');
  690. for (itm of document.querySelectorAll('body>div')) {
  691. if (!itm.querySelector('.dw-fdwlink')) {
  692. remove(itm);
  693. }
  694. }
  695. }
  696.  
  697. if (isForum) { // Do not continue if it's a forum
  698. return;
  699. }
  700.  
  701. si = document.querySelector('#header');
  702. if (si) {
  703. rem = si.previousSibling;
  704. while (rem) {
  705. si = rem.previousSibling;
  706. remove(rem);
  707. rem = si;
  708. }
  709. }
  710.  
  711. for (itm of document.querySelectorAll('#nav li[class]')) {
  712. if (itm && itm.querySelector('a[href^="/tag/"]')) {
  713. remove(itm);
  714. }
  715. }
  716.  
  717. var style, result;
  718. for (itm of document.querySelectorAll('DIV')) {
  719. if (itm.offsetWidth > 0.95 * width() && itm.offsetHeight > 0.8 * height()) {
  720. style = window.getComputedStyle(itm, null);
  721. result = [];
  722. if (style.backgroundImage !== 'none') {
  723. result.push('background-image:none!important');
  724. }
  725. if (style.backgroundColor !== 'transparent' &&
  726. style.backgroundColor !== 'rgba(0, 0, 0, 0)') {
  727. result.push('background-color:transparent!important');
  728. }
  729. if (result.length) {
  730. if (itm.getAttribute('style')) {
  731. result.unshift(itm.getAttribute('style'));
  732. }
  733. (function(){
  734. var bgi = itm.style.backgroundImage,
  735. bgc = itm.style.backgroundColor;
  736. try {
  737. Object.defineProperty(itm, 'style', {
  738. value: new Proxy(itm.style, {
  739. get: function(){
  740. //console.log(arguments);
  741. },
  742. set: function(){
  743. //console.log(arguments);
  744. }
  745. }),
  746. enumerable: true
  747. });
  748. } catch (e) {
  749. console.log('Unable to protect style property.', e)
  750. }
  751. })();
  752. if (protectedElems) {
  753. protectedElems.set(itm, {oldStyle: oGA.call(itm, 'style')});
  754. }
  755. oSA.call(itm, 'style', result.join(';'));
  756. //itm.style = 'a';
  757. itm.style.backgroundImage = 'a';
  758. itm.style.backgroundColor = 'a';
  759. }
  760. }
  761. }
  762.  
  763. for (itm of document.querySelectorAll('ASIDE>DIV')) {
  764. if ( ((itm.querySelector('script, iframe, a[href*="/ad/www/"]') ||
  765. itm.querySelector('img[src$=".gif"]:not([height="0"]), img[height="400"]')) &&
  766. !itm.classList.contains('post') ) || !itm.childNodes.length ) {
  767. remove(itm);
  768. }
  769. }
  770.  
  771. document.body.setAttribute('style', (document.body.getAttribute('style')||'')+';background-color:#E6E7E9!important');
  772.  
  773. // display content of the page
  774. afterClean();
  775. });
  776. })();
  777. return;
  778. }
  779.  
  780. // https://greasyfork.org/en/scripts/21937-moonwalk-hdgo-kodik-fix v0.7+ (adapted & fixed)
  781. document.addEventListener ('DOMContentLoaded', function() {
  782. var tmp, t;1
  783. function log (e) {
  784. console.log('Moonwalk&HDGo&Kodik FIX: ' + e + ' player in ' + win.location.href);
  785. }
  786. if (win.adv_enabled !== undefined && win.condition_detected !== undefined) { // moonwalk
  787. log('Moonwalk');
  788. win.adv_enabled = false;
  789. win.condition_detected = false;
  790. if (win.MXoverrollCallback) {
  791. document.addEventListener('click', function catcher(e){
  792. e.stopPropagation();
  793. win.MXoverrollCallback.call(window);
  794. document.removeEventListener('click', catcher, true);
  795. }, true);
  796. }
  797. } else if (win.banner_second !== undefined && win.$banner_ads !== undefined) { // hdgo
  798. log('HDGo');
  799. tmp = document.querySelector('#swtf');
  800. if (tmp) {
  801. tmp.style.display = 'none';
  802. }
  803. win.banner_second = 0;
  804. win.$banner_ads = false;
  805. if (win.$new_ads !== undefined) {
  806. win.$new_ads = false;
  807. }
  808. if (win.canRunAds !== undefined && win.canRunAds !== true) {
  809. win.canRunAds = true;
  810. }
  811. } else if (win.MXoverrollCallback && win.iframeSearch !== undefined) { // kodik
  812. log('Kodik');
  813. tmp = document.querySelector('.play_button');
  814. if (tmp) {
  815. tmp.onclick = win.MXoverrollCallback.bind(window);
  816. }
  817. win.IsAdBlock = false;
  818. }
  819. }, false);
  820.  
  821. // function to search and remove nodes by content
  822. // selector - standard CSS selector to define set of nodes to check
  823. // words - regular expression to check content of the suspicious nodes
  824. // params - object with multiple extra parameters:
  825. // .hide - set display to none instead of removing from the page
  826. // .parent - parent node to remove if content is found in the child node
  827. // .siblings - number of simling nodes to remove (excluding text nodes)
  828. function scRemove(e) {e.parentNode.removeChild(e);}
  829. function scHide(e) {
  830. var s = e.getAttribute('style')||'',
  831. h = ';display:none!important;';
  832. if (s.indexOf(h) < 0) {
  833. e.setAttribute('style', s+h);
  834. }
  835. }
  836. function scissors (selector, words, scope, params) {
  837. var remFunc = (params.hide ? scHide : scRemove),
  838. iterFunc = (params.siblings > 0 ?
  839. 'nextSibling' :
  840. 'previousSibling'),
  841. toRemove = [],
  842. siblings,
  843. node;
  844. for (node of scope.querySelectorAll(selector)) {
  845. if (words.test(node.innerHTML) || !node.childNodes.length) {
  846. // drill up to the specified parent node if required
  847. if (params.parent) {
  848. while(node !== scope && !(node.matches(params.parent))) {
  849. node = node.parentNode;
  850. }
  851. }
  852. if (node === scope) {
  853. break;
  854. }
  855. toRemove.push(node);
  856. // add multiple nodes if defined more than one sibling
  857. siblings = Math.abs(params.siblings) || 0;
  858. while (siblings) {
  859. node = node[iterFunc];
  860. toRemove.push(node);
  861. if (node.nodeType === Node.ELEMENT_NODE) {
  862. siblings -= 1; //count only element nodes
  863. }
  864. }
  865. }
  866. }
  867. for (node of toRemove) {
  868. remFunc(node);
  869. }
  870. return toRemove.length;
  871. }
  872.  
  873. // function to perform multiple checks if ads inserted with a delay
  874. // by default does 30 checks withing a 3 seconds unless nonstop mode specified
  875. // also does 1 extra check when a page completely loads
  876. // selector and words - passed dow to scissors
  877. // params - object with multiple extra parameters:
  878. // .root - selector to narrow down scope to scan;
  879. // .observe - if true then check will be performed continuously;
  880. // Other parameters passed down to scissors.
  881. function gardener(selector, words, params) {
  882. params = params || {};
  883. var scope = document.body,
  884. nonstop = false;
  885. // narrow down scope to a specific element
  886. if (params.root) {
  887. scope = scope.querySelector(params.root);
  888. if (!scope) {// exit if the root element is not present on the page
  889. return 0;
  890. }
  891. }
  892. // add observe mode if required
  893. if (params.observe) {
  894. if (typeof MutationObserver === 'function') {
  895. var o = new MutationObserver(function(ms){
  896. for (var m of ms) {
  897. if (m.addedNodes.length) {
  898. scissors(selector, words, scope, params);
  899. }
  900. }
  901. });
  902. o.observe(scope, {childList:true, subtree: true});
  903. } else {
  904. nonstop = true;
  905. }
  906. }
  907. // wait for a full page load to do one extra cut
  908. win.addEventListener('load',function(){
  909. scissors(selector, words, scope, params);
  910. });
  911. // do multiple cuts until ads removed
  912. function cut(sci, s, w, sc, p, i) {
  913. if (i > 0) {
  914. i -= 1;
  915. }
  916. if (i && !sci(s, w, sc, p)) {
  917. setTimeout(cut, 100, sci, s, w, sc, p, i);
  918. }
  919. }
  920. cut(scissors, selector, words, scope, params, (nonstop ? -1 : 30));
  921. }
  922.  
  923. function preventBackgroundRedirect() {
  924. // create "cose_me" event to call high-level window.close()
  925. var key = Math.random().toString(36).substr(2);
  926. window.addEventListener('close_me_'+key, function(e) {
  927. window.close();
  928. });
  929.  
  930. // window.open wrapper
  931. function pbrLander() {
  932. var orgOpen = window.open.bind(window);
  933. function closeWindow(){
  934. // site went to a new tab and attempts to unload
  935. // call for high-level close through event
  936. var event = new CustomEvent("close_me_%key%", {});
  937. window.dispatchEvent(event);
  938. }
  939. function open(){
  940. var idx = String.prototype.indexOf;
  941. if (arguments[0] &&
  942. (idx.call(arguments[0], window.location.host) > -1 ||
  943. idx.call(arguments[0], '://') === -1)) {
  944. window.addEventListener('unload', closeWindow, true);
  945. }
  946. orgOpen.apply(window, arguments);
  947. }
  948. window.open = open.bind(window);
  949. var s = document.currentScript;
  950. if (s) {s.parentNode.removeChild(s);}
  951. }
  952.  
  953. // land wrapper on the page
  954. var script = document.createElement('script');
  955. script.appendChild(document.createTextNode('('+pbrLander.toString().replace(/%key%/g,key)+')();'));
  956. document.head.insertBefore(script,document.head.firstChild);
  957. console.log("Background redirect prevention enabled.");
  958. }
  959.  
  960. function forbidServiceWorker() {
  961. if (!("serviceWorker" in navigator)) {
  962. return;
  963. }
  964. var svr = navigator.serviceWorker.ready;
  965. Object.defineProperty(navigator, 'serviceWorker', {
  966. value: {
  967. register: function(){
  968. console.log('Registration of serviceWorker ' + arguments[0] + ' blocked.');
  969. return new Promise(function(){});
  970. },
  971. ready: new Promise(function(){}),
  972. addEventListener:function(){}
  973. }
  974. });
  975. document.addEventListener('DOMContentLoaded', function() {
  976. if (!svr) {
  977. return;
  978. }
  979. svr.then(function(sw) {
  980. console.log('Found existing serviceWorker:', sw);
  981. console.log('Attempting to unregister...');
  982. sw.unregister().then(function() {
  983. console.log('Unregistered! :)');
  984. }).catch(function(err) {
  985. console.log('Unregistration failed. :(', err);
  986. console.log('Try to remove it manually:');
  987. console.log(' 1. Open: chrome://serviceworker-internals/ (Google Chrome and alike) or about:serviceworkers (Mozilla Firefox) in a new tab.');
  988. console.log(' 2. Search there for one with "'+document.domain+'" in the name.');
  989. console.log(' 3. Use buttons in the same block with service you found to stop it and uninstall/unregister.');
  990. });
  991. }).catch(function(err) {
  992. console.log("Lol, it failed on it's own. -_-", err);
  993. });
  994. }, false);
  995. }
  996.  
  997. var scripts = {};
  998. scripts['fs.to'] = function() {
  999. function skipClicker(i) {
  1000. if (!i) {
  1001. return;
  1002. }
  1003. var skip = document.querySelector('.b-aplayer-banners__close');
  1004. if (skip) {
  1005. skip.click();
  1006. } else {
  1007. setTimeout(skipClicker, 100, i-1);
  1008. }
  1009. }
  1010. setTimeout(skipClicker, 100, 30);
  1011.  
  1012. createStyle([
  1013. '.l-body-branding *,'+
  1014. '.b-styled__item-central,'+
  1015. '.b-styled__content-right,'+
  1016. '.b-styled__section-central,'+
  1017. 'div[id^="adsProxy-"]'+
  1018. '{display:none!important}',
  1019. 'body {background-image:url(data:image/png;base64,'+
  1020. 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACX'+
  1021. 'BIWXMAAC4jAAAuIwF4pT92AAAADUlEQVR42mOQUdL5DwACMgFq'+
  1022. 'BC3ttwAAAABJRU5ErkJggg==)!important}'
  1023. ]);
  1024.  
  1025. if (/\/(view_iframe|iframeplayer)\//i.test(document.location.pathname)) {
  1026. var p = document.querySelector('#player:not([preload="auto"])'),
  1027. m = document.querySelector('.main'),
  1028. adStepper = function(p) {
  1029. if (p.currentTime < p.duration) {
  1030. p.currentTime += 1;
  1031. }
  1032. },
  1033. adSkipper = function(f, p) {
  1034. f.click();
  1035. p.waitAfterSkip = false;
  1036. p.longerSkipper = false;
  1037. console.log('Пропустили.');
  1038. },
  1039. cl = function(p) {
  1040. var faster = document.querySelector('.b-aplayer__html5-desktop-skip'),
  1041. series = document.querySelector('.b-aplayer__actions-series');
  1042.  
  1043. function clickSelected() {
  1044. var s = document.querySelector('.b-aplayer__popup-series-episodes .selected a');
  1045. if (s) {
  1046. s.click();
  1047. }
  1048. }
  1049.  
  1050. if ((!faster || faster.style.display !== 'block') && series && !p.seriesClicked) {
  1051. series.click();
  1052. p.seriesClicked = true;
  1053. p.longerSkipper = true;
  1054. setTimeout(clickSelected, 1000);
  1055. p.pause();
  1056. }
  1057.  
  1058. function skipListener() {
  1059. if (p.waitAfterSkip) {
  1060. console.log('В процессе пропуска…');
  1061. return;
  1062. }
  1063. p.pause();
  1064. if (!p.classList.contains('m-hidden')) {
  1065. p.classList.add('m-hidden');
  1066. }
  1067. if (faster && p.currentTime &&
  1068. win.getComputedStyle(faster).display === 'block' &&
  1069. !faster.querySelector('.b-aplayer__html5-desktop-skip-timer')) {
  1070. p.waitAfterSkip = true;
  1071. setTimeout(adSkipper, (p.longerSkipper?3:1)*1000, faster, p);
  1072. console.log('Доступен быстрый пропуск…');
  1073. } else {
  1074. setTimeout(adStepper, 1000, p);
  1075. }
  1076. }
  1077.  
  1078. p.addEventListener('timeupdate', skipListener, false);
  1079. },
  1080. o = new MutationObserver(function (ms) {
  1081. var m, node;
  1082. for (m of ms) {
  1083. for (node of m.addedNodes) {
  1084. if (node.id === 'player' &&
  1085. node.nodeName === 'VIDEO' &&
  1086. node.getAttribute('preload') !== 'auto') {
  1087. cl(node);
  1088. }
  1089. }
  1090. }
  1091. });
  1092. if (p.nodeName === 'VIDEO') {
  1093. cl(p);
  1094. } else {
  1095. o.observe(m, {childList: true});
  1096. }
  1097. }
  1098. };
  1099. scripts['brb.to'] = scripts['fs.to'];
  1100. scripts['cxz.to'] = scripts['fs.to'];
  1101.  
  1102. scripts['drive2.ru'] = function() {
  1103. gardener('.c-block:not(.js-recommendations),.o-grid__item', />Реклама<\//i);
  1104. };
  1105.  
  1106. scripts['fishki.net'] = function() {
  1107. gardener('.main-post', /543769|Реклама/);
  1108. };
  1109.  
  1110. scripts['hdgo.cc'] = {
  1111. 'now': function(){
  1112. var o = new MutationObserver(function(ms) {
  1113. var m, node;
  1114. for (m of ms) {
  1115. for (node of m.addedNodes) {
  1116. if (node.tagName === 'SCRIPT' && node.getAttribute('onerror') !== null) {
  1117. node.removeAttribute('onerror');
  1118. }
  1119. }
  1120. }
  1121. });
  1122. o.observe(document, {childList:true, subtree: true});
  1123. }
  1124. };
  1125. scripts['couber.be'] = scripts['hdgo.cc'];
  1126. scripts['46.30.43.38'] = scripts['hdgo.cc'];
  1127.  
  1128. scripts['hdrezka.me'] = {
  1129. 'now': function() {
  1130. Object.defineProperty(win, 'fuckAdBlock', {
  1131. value: {
  1132. onDetected: function() {
  1133. console.log('Pretending to be an ABP detector.');
  1134. }
  1135. }
  1136. });
  1137. Object.defineProperty(win, 'ab', {
  1138. value: false,
  1139. enumerable: true
  1140. });
  1141. },
  1142. 'DOMContentLoaded': function() {
  1143. gardener('div[id][onclick][onmouseup][onmousedown]', /onmouseout/i);
  1144. }
  1145. };
  1146.  
  1147. scripts['naruto-base.su'] = function() {
  1148. gardener('div[id^="entryID"],.block', /href="http.*?target="_blank"/i);
  1149. };
  1150.  
  1151. scripts['forums.overclockers.ru'] = {
  1152. 'now': function() {
  1153. createStyle(['.needblock {position: fixed; left: -10000px}']);
  1154. Object.defineProperty(win, 'adblck', {
  1155. value: 'no',
  1156. enumerable: true
  1157. });
  1158. // Following code inspired by:
  1159. // https://greasyfork.org/en/scripts/23922-anti-adblock-killer-for-overclockers-ru
  1160. function antiAntiABP() {
  1161. var o = new MutationObserver(function(ms) {
  1162. var triggered = false, m, node;
  1163. for (m of ms) {
  1164. for (node of m.addedNodes) {
  1165. if (node.nodeType === Node.ELEMENT_NODE &&
  1166. typeof node.onerror === 'function' &&
  1167. (node.tagName === 'SCRIPT' || node.tagName === 'IMG')) {
  1168. node.onerror = null;
  1169. triggered = true;
  1170. }
  1171. }
  1172. }
  1173. if (triggered) {
  1174. console.log('Disabled script.onerror ABP detection.');
  1175. }
  1176. });
  1177. o.observe(document, {childList: true, subtree: true});
  1178. var s = document.currentScript;
  1179. s.parentNode.removeChild(s);
  1180. }
  1181. var s = document.createElement('script');
  1182. s.textContent = '(' + antiAntiABP.toString() + ')();';
  1183. document.documentElement.appendChild(s);
  1184. }
  1185. };
  1186.  
  1187. scripts['pb.wtf'] = function() {
  1188. createStyle(['.reques,#result,tbody.row1:not([id]) {display: none !important}']);
  1189. // image in the slider in the header
  1190. gardener('a[href$="=="]', /img/i, {root:'.release-navbar', observe:true, parent:'div'});
  1191. // ads in blocks on the page
  1192. gardener('a[href^="/"]', /<img\s.*<br>/i, {root:'#main_content', observe:true, parent:'div[class]'});
  1193. // line above topic content
  1194. gardener('.re_top1', /./, {root:'#main_content', parent:'.hidden-sm'});
  1195. };
  1196. scripts['piratbit.org'] = scripts['pb.wtf'];
  1197. scripts['piratbit.ru'] = scripts['pb.wtf'];
  1198.  
  1199. scripts['pikabu.ru'] = function() {
  1200. gardener('.story', /story__sponsor|story__gag|profile\/ads"/i, {root: '.inner_wrap', observe: true});
  1201. };
  1202.  
  1203. scripts['rp5.ru'] = function() {
  1204. var co = document.querySelector('#content'), i, nodes;
  1205. if (!co) {
  1206. return;
  1207. }
  1208. nodes = co.parentNode.childNodes;
  1209. i = nodes.length;
  1210. while (i--) {
  1211. if (nodes[i] !== co) {
  1212. nodes[i].parentNode.removeChild(nodes[i]);
  1213. }
  1214. }
  1215. };
  1216.  
  1217. scripts['rustorka.com'] = {
  1218. 'now':function(){
  1219. win.open = function(){
  1220. console.log('Site attempted to open a new window', arguments);
  1221. }
  1222. },
  1223. 'DOMContentLoaded':function() {
  1224. gardener('span[class],ul[class],span[id],ul[id]', /\/\d{12,}\.php/i, {root:'#sidebar1', observe:true});
  1225. gardener('div[id][style*="!important"]', /!important/i);
  1226. }
  1227. };
  1228. scripts['rumedia.ws'] = scripts['rustorka.com'];
  1229.  
  1230. scripts['sport-express.ru'] = function() {
  1231. gardener('.js-relap__item',/>Реклама\s+<\//, {root:'.container', observe: true});
  1232. };
  1233.  
  1234. scripts['sports.ru'] = function() {
  1235. gardener('.aside-news-list__item', /aside-news-list__advert/i, {root:'.aside-news-block'});
  1236. };
  1237.  
  1238. scripts['turbobit.net'] = {'now': preventBackgroundRedirect};
  1239.  
  1240. scripts['yap.ru'] = function() {
  1241. var words = /member1438|Administration/;
  1242. gardener('form > table[id^="p_row_"]', words);
  1243. gardener('tr > .holder.newsbottom', words, {parent:'tr', siblings:-2});
  1244. };
  1245. scripts['yaplakal.com'] = scripts['yap.ru'];
  1246.  
  1247. scripts['reactor.cc'] = {
  1248. 'now': function() {
  1249. win.open = (function(){ throw new Error('Redirect prevention.'); }).bind(window);
  1250. },
  1251. 'click': function(e) {
  1252. var node = e.target;
  1253. if (node.nodeType === Node.ELEMENT_NODE &&
  1254. node.style.position === 'absolute' &&
  1255. node.style.zIndex > 0)
  1256. node.parentNode.removeChild(node);
  1257. },
  1258. 'DOMContentLoaded': function() {
  1259. var words = new RegExp(
  1260. 'блокировщика рекламы'
  1261. .split('')
  1262. .map(function(e){return e+'[\u200b\u200c\u200d]*';})
  1263. .join('')
  1264. .replace(' ', '\\s*')
  1265. .replace(/[аоре]/g, function(e){return ['[аa]','[оo]','[рp]','[еe]']['аоре'.indexOf(e)];}),
  1266. 'i'),
  1267. can;
  1268. function deeper(spider) {
  1269. var c, l, n;
  1270. if (words.test(spider.innerText)) {
  1271. if (spider.nodeType === Node.TEXT_NODE) {
  1272. return true;
  1273. }
  1274. c = spider.childNodes;
  1275. l = c.length;
  1276. n = 0;
  1277. while(l--) {
  1278. if (deeper(c[l]), can) {
  1279. n++;
  1280. }
  1281. }
  1282. if (n > 0 && n === c.length && spider.offsetHeight < 750) {
  1283. can.push(spider);
  1284. }
  1285. return false;
  1286. }
  1287. return true;
  1288. }
  1289. function probe(){
  1290. if (words.test(document.body.innerText)) {
  1291. can = [];
  1292. deeper(document.body);
  1293. var i = can.length, j, spider;
  1294. while(i--) {
  1295. spider = can[i];
  1296. if (spider.offsetHeight > 10 && spider.offsetHeight < 750) {
  1297. spider.setAttribute('style', 'background:none!important');
  1298. }
  1299. }
  1300. }
  1301. }
  1302. var o = new MutationObserver(probe);
  1303. o.observe(document,{childList:true, subtree:true});
  1304. }
  1305. };
  1306. scripts['joyreactor.cc'] = scripts['reactor.cc'];
  1307. scripts['pornreactor.cc'] = scripts['reactor.cc'];
  1308.  
  1309. scripts['auto.ru'] = function() {
  1310. var words = /Реклама|Яндекс.Директ|yandex_ad_/;
  1311. var userAdsListAds = [
  1312. '.listing-list > .listing-item',
  1313. '.listing-item_type_fixed.listing-item'
  1314. ];
  1315. var catalogAds = [
  1316. 'div[class*="layout_catalog-inline"]',
  1317. 'div[class$="layout_horizontal"]'
  1318. ];
  1319. var otherAds = [
  1320. '.advt_auto',
  1321. '.sidebar-block',
  1322. '.pager-listing + div[class]',
  1323. '.card > div[class][style]',
  1324. '.sidebar > div[class]',
  1325. '.main-page__section + div[class]',
  1326. '.listing > tbody'];
  1327. gardener(userAdsListAds.join(','), words, {root:'.listing-wrap', observe:true});
  1328. gardener(catalogAds.join(','), words, {root:'.catalog__page,.content__wrapper', observe:true});
  1329. gardener(otherAds.join(','), words);
  1330. };
  1331.  
  1332. scripts['online.anidub.com'] = function() {
  1333. var script = document.createElement('script');
  1334. script.type = "text/javascript";
  1335. script.innerHTML = "function ogonekstart1() {}";
  1336. document.getElementsByTagName('head')[0].appendChild(script);
  1337.  
  1338. var style = document.createElement('style');
  1339. style.type = 'text/css';
  1340. style.appendChild(document.createTextNode('.background {background: none!important;}'));
  1341. style.appendChild(document.createTextNode('.background > script + div, .background > script ~ div:not([id]):not([class]) + div[id][class] {display:none!important}'));
  1342. document.head.appendChild(style);
  1343. };
  1344.  
  1345. scripts['rsload.net'] = {
  1346. 'load': function() {
  1347. var dis = document.querySelector('.cb-disable');
  1348. if (dis) {
  1349. dis.click();
  1350. }
  1351. },
  1352. 'click': function(e) {
  1353. var t = e.target;
  1354. if (t && t.href && (/:\/\/\d+\.\d+\.\d+\.\d+\//.test(t.href))) {
  1355. t.href = t.href.replace('://','://rsload.net:rsload.net@');
  1356. }
  1357. }
  1358. };
  1359.  
  1360. scripts['imageban.ru'] = {
  1361. 'now': preventBackgroundRedirect,
  1362. 'DOMContentLoaded': function() {
  1363. win.addEventListener('unload', function() {
  1364. if (!window.location.hash) {
  1365. window.location.replace(window.location+'#');
  1366. } else {
  1367. window.location.hash = '';
  1368. }
  1369. }, true);
  1370. }
  1371. };
  1372.  
  1373. var domain = document.domain, name;
  1374. while (domain.indexOf('.') !== -1) {
  1375. if (scripts.hasOwnProperty(domain)) {
  1376. if (typeof scripts[domain] === 'function') {
  1377. document.addEventListener ('DOMContentLoaded', scripts[domain], false);
  1378. }
  1379. for (name in scripts[domain]) {
  1380. if (name !== 'now') {
  1381. (name === 'load' ? window : document)
  1382. .addEventListener (name, scripts[domain][name], false);
  1383. } else {
  1384. scripts[domain][name]();
  1385. }
  1386. }
  1387. }
  1388. domain = domain.slice(domain.indexOf('.') + 1);
  1389. }
  1390. })();