Старая: v20191208.0 - 08.12.2019 - Compatibility with Firefox 56... Why am I still supporting this?
Новая: v20191208.1 - 08.12.2019 - Updated code for kinopoisk.ru. Fixed a few warnings.
- @@ -1,7 +1,7 @@
- // ==UserScript==
- // @name RU AdList JS Fixes
- // @namespace ruadlist_js_fixes
-// @version 20191208.0
- +// @version 20191208.1
- // @description try to take over the world!
- // @author lainverse & dimisa
- // @supportURL https://greasyfork.org/en/scripts/19993-ru-adlist-js-fixes/feedback
- @@ -74,9 +74,9 @@
- } catch(ignore){}
- let batchLand = [];
- let batchPrepend = new Set();
- const _APIString = `const win = window, _console = {}, isFirefox = ${isFirefox}, inIFrame = ${inIFrame}, _document = win.document,
- _Document = Object.getPrototypeOf(HTMLDocument.prototype), _Element = Object.getPrototypeOf(HTMLElement.prototype),
- _Node = Object.getPrototypeOf(_Element); for (let name in win.console) _console[name] = console[name];`
- + const _APIString = `const win = window, _console = {}, isFirefox = ${isFirefox}, inIFrame = ${inIFrame}, _document = win.document,`+
- + '_Document = Object.getPrototypeOf(HTMLDocument.prototype), _Element = Object.getPrototypeOf(HTMLElement.prototype),' +
- + '_Node = Object.getPrototypeOf(_Element); for (let name in win.console) _console[name] = console[name];'
- let landScript = (f, pre) => {
- let script = _createElement('script');
- script.textContent = `(()=>{${_APIString}${[...pre].join(';')};(${f.join(')();(')})();})();`;
- @@ -1350,10 +1350,11 @@
- abortExecution(onAccess.Get, 'yaads.adRenderedCount');
- nt.define(win.Object.prototype, 'AdvertPartner', nt.func(false), false);
- // abp detector cookie on yandex pogoda and afisha
- + const _Reflect_apply = Reflect.apply
- win.Element.prototype.getAttribute = new Proxy(win.Element.prototype.getAttribute, {
- apply (get, el, args) {
- let res = Reflect.apply(get, el, args);
- if (res && res.length > 20 && el instanceof HTMLBodyElement) {
- + let res = _Reflect_apply(get, el, args);
- + if (res && res.length > 20 && el instanceof HTMLBodyElement)
- try {
- let o = JSON.parse(res),
- found = false, check;
- @@ -1370,7 +1371,7 @@
- if (!found) _console.log(el.tagName, o);
- res = JSON.stringify(o);
- } catch(ignore) {}
- } //else _console.log(el.tagName, res);
- + //else _console.log(el.tagName, res);
- return res;
- }
- });
- @@ -3297,7 +3298,6 @@
-
- scripts['kinopoisk.ru'] = () => {
- // filter cookies
- scriptLander(() => selectiveCookies('cmtchd|crookie|kpunk|technology'), selectiveCookies);
- // set no-branding body style and adjust other blocks on the page
- let style = [
- '.app__header.app__header_margin-bottom_brand, #top { margin-bottom: 20px !important }',
- @@ -3306,6 +3306,23 @@
- if (location.hostname === 'www.kinopoisk.ru' && !location.pathname.startsWith('/games/'))
- style.push('html:not(#id), body:not(#id), .app-container { background: #d5d5d5 url(/images/noBrandBg.jpg) 50% 0 no-repeat !important }');
- createStyle(style);
- + scriptLander(() => {
- + selectiveCookies('cmtchd|crookie|kpunk')
- + // filter JSON
- + const _Reflect_apply = Reflect.apply;
- + win.JSON.parse = new Proxy(win.JSON.parse, {
- + apply (fun, that, args) {
- + let o = _Reflect_apply(fun, that, args);
- + let name = 'antiAdBlockCookieName';
- + if (name in o && typeof o[name] === 'string')
- + selectiveCookies(o[name]);
- + name = 'branding';
- + if (name in o) o[name] = {};
- + //_console.log('JSON.parse', o);
- + return o;
- + }
- + });
- + }, selectiveCookies);
- // catch branding and other things
- let _KP = undefined;
- Object.defineProperty(win, 'KP', {
- @@ -3342,12 +3359,6 @@
- _console.log('KP =', val);
- }
- });
- // skip branding and some other junk
- if (!('advBlock' in win))
- Object.defineProperty(win, 'advBlock', {
- get: () => () => null,
- set: () => true
- });
- // skip timeout check for blocked requests
- let _setTimeout = Function.prototype.apply.bind(win.setTimeout);
- let _toString = Function.prototype.apply.bind(Function.prototype.toString);
- @@ -3359,17 +3370,6 @@
- }
- return _setTimeout(this, args);
- };
- // eval skipper
- win.eval = new win.Proxy(win.eval, {
- apply: (evl, ths, args) => {
- if (typeof args[0] === 'string')
- if (/\s[a-z0-9]+\(\{[\s\S]+?\sid:[\s\S]+?\s(type:[\s\S]+?\sname|name:[\s\S]+?\stype):[\s\S]+?\}\);|sendAdsVolumesStat/.test(args[0])) {
- _console.warn('skip eval', args[0]);
- return;
- }// else _console.log('run eval', args[0]);
- return Reflect.apply(evl, ths, args);
- }
- });
- // obfuscated Yandex.Direct
- scriptLander(() => {
- nt.define(win.Object.prototype, 'initYaDirect', undefined, false);
- @@ -3501,9 +3501,8 @@
- if (count < 0 || addOldInterfaceLink())
- clearInterval(iv);
- }, delay);
- if (count == -1) {
- _console.warn('Unable to locate Settings menu');
- }
-
- + if (count === -1)
- + _console.warn('Unable to locate Settings menu.');
- });
-
- // Disable page scrambler on mail.ru to let extensions easily block ads there