Greasy Fork is available in English.

RU AdList JS Fixes

try to take over the world!

Старая: v20180201.1 - 01.02.2018 - Returned back k5evib.ru into piguiqproxy since it's apparently used not only on oane.ws. Also added 46p5gi.ru which is currently present on oane.ws and could be the same.
Новая: v20180207.0 - 07.02.2018 - Fix for compatibility issue with MooTools Core on fan-tv.ru. Also disabled script on telegram.org since they are using some API which Tampermonkey and Violentmonkey replace when there is a script to run there and the do so without proper error handling which causes errors on Telegram.

  • --- /tmp/diffy20240419-602265-ixlsed 2024-04-19 23:36:16.585641418 +0000
  • +++ /tmp/diffy20240419-602265-44wy9f 2024-04-19 23:36:16.585641418 +0000
  • @@ -1,7 +1,7 @@
  • // ==UserScript==
  • // @name RU AdList JS Fixes
  • // @namespace ruadlist_js_fixes
  • -// @version 20180201.1
  • +// @version 20180207.0
  • // @description try to take over the world!
  • // @author lainverse & dimisa
  • // @match *://*/*
  • @@ -9,6 +9,8 @@
  • // @exclude *://alfabank.ru/*
  • // @exclude *://*.unicreditbanking.net/*
  • // @exclude *://unicreditbanking.net/*
  • +// @exclude *://*.telegram.org/*
  • +// @exclude *://telegram.org/*
  • // @grant unsafeWindow
  • // @grant window.close
  • // @grant GM_getValue
  • @@ -19,8 +21,11 @@
  • (function() {
  • 'use strict';
  • let win = (unsafeWindow || window),
  • + // MooTools are crazy enough to replace standard API and replaces window.Document: https://mootools.net/core
  • + // Occasionally their code runs before my script on some domains and causes all kinds of havoc.
  • + _Document = Object.getPrototypeOf(HTMLDocument);
  • // http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
  • - isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0,
  • + let isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0,
  • isChrome = !!window.chrome && !!window.chrome.webstore,
  • isSafari = (Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 ||
  • (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window.safari || safari.pushNotification)),
  • @@ -30,9 +35,9 @@
  • _setAttribute = Element.prototype.setAttribute,
  • _removeAttribute = Element.prototype.removeAttribute,
  • _de = document.documentElement,
  • - _appendChild = Document.prototype.appendChild.bind(_de),
  • - _removeChild = Document.prototype.removeChild.bind(_de),
  • - _createElement = Document.prototype.createElement.bind(document);
  • + _appendChild = _Document.prototype.appendChild.bind(_de),
  • + _removeChild = _Document.prototype.removeChild.bind(_de),
  • + _createElement = _Document.prototype.createElement.bind(document);
  • if (isFirefox && // Exit on image pages in Fx
  • document.constructor.prototype.toString() === '[object ImageDocumentPrototype]')
  • @@ -1064,7 +1069,8 @@
  • function CreateElementWrapper()
  • {
  • let key = `_${Math.random().toString(36).substr(2)}`,
  • - _createElement = Document.prototype.createElement,
  • + _Document = Object.getPrototypeOf(HTMLDocument),
  • + _createElement = _Document.prototype.createElement,
  • _addEventListener = Element.prototype.addEventListener,
  • isDataURL = /^data:/i,
  • isBlobURL = /^blob:/i;
  • @@ -1141,7 +1147,7 @@
  • },
  • enumerable: true
  • };
  • - Document.prototype.createElement = function createElement(...args) {
  • + _Document.prototype.createElement = function createElement(...args) {
  • let el = _createElement.apply(this, args);
  • if (el.tagName === 'IFRAME')
  • @@ -1284,7 +1290,7 @@
  • // Naive ABP Style protector
  • {
  • - let _querySelector = Document.prototype.querySelector.bind(document);
  • + let _querySelector = _Document.prototype.querySelector.bind(document);
  • let _removeChild = Node.prototype.removeChild;
  • let _appendChild = Node.prototype.appendChild;
  • let createShadow = () => _createElement('shadow');
  • @@ -1441,7 +1447,7 @@
  • localStorage.ic = '';
  • localStorage._mt__data = '';
  • },100);
  • - let _doc_proto = ('cookie' in Document.prototype) ? Document.prototype : Object.getPrototypeOf(document);
  • + let _doc_proto = ('cookie' in _Document.prototype) ? _Document.prototype : Object.getPrototypeOf(document);
  • let _cookie = Object.getOwnPropertyDescriptor(_doc_proto, 'cookie');
  • if (_cookie)
  • {
  • @@ -1992,7 +1998,8 @@
  • // wrap popular methods to open a new tab to catch specific behaviours
  • function createWindowOpenWrapper(openFunc, onClickFunc)
  • {
  • - let _createElement = Document.prototype.createElement,
  • + let _Document = Object.getPrototypeOf(HTMLDocument),
  • + _createElement = _Document.prototype.createElement,
  • _appendChild = Element.prototype.appendChild,
  • fakeNative = (f) => (f.toString = () => `function ${f.name}() { [native code] }`);
  • @@ -2006,7 +2013,7 @@
  • };
  • let redefineOpen = (obj) => {
  • - for (let root of [obj, obj.document, obj.Document.prototype]) if ('open' in root) {
  • + for (let root of [obj, obj.document, _Document.prototype]) if ('open' in root) {
  • let _open = root.open.bind(root);
  • nt.define(root, 'open', (...args) => {
  • if (openWhitelist(args[0])) {
  • @@ -2038,7 +2045,7 @@
  • fakeNative(createElement);
  • let redefineCreateElement = (obj) => {
  • - for (let root of [obj.document, obj.Document.prototype]) if ('createElement' in root)
  • + for (let root of [obj.document, _Document.prototype]) if ('createElement' in root)
  • nt.define(root, 'createElement', createElement);
  • };
  • redefineCreateElement(win);