From 9bfb8b2499f81bb70e5d3278752dcbac8335a716 Mon Sep 17 00:00:00 2001 From: Giwayume Date: Sun, 28 May 2017 15:25:51 +0000 Subject: [PATCH 1/6] Add new master file (work in progress) --- source/aak-cont-master-es6.js | 299 ++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 source/aak-cont-master-es6.js diff --git a/source/aak-cont-master-es6.js b/source/aak-cont-master-es6.js new file mode 100644 index 0000000..db77784 --- /dev/null +++ b/source/aak-cont-master-es6.js @@ -0,0 +1,299 @@ +// ==UserScript== +// @name AAK-Cont Userscript +// @namespace https://userscripts.org/scripts/show/155840 +// @description Helps you keep your Ad-Blocker active, when you visit a website and it asks you to disable. +// @author Originally by Reek, revived by jspenguin2017 +// @version 1.005 +// @encoding utf-8 +// @license https://creativecommons.org/licenses/by-sa/4.0/ +// @icon https://gitlab.com/xuhaiyang1234/AAK-Cont/raw/master/images/icon.png +// @homepage https://xuhaiyang1234.gitlab.io/AAK-Cont/ +// @supportURL https://gitlab.com/xuhaiyang1234/AAK-Cont/issues +// @updateURL https://gitlab.com/xuhaiyang1234/AAK-Cont/raw/master/source/aak-cont-script.user.js +// @downloadURL https://gitlab.com/xuhaiyang1234/AAK-Cont/raw/master/source/aak-cont-script.user.js +// @include http://*/* +// @include https://*/* +// @grant unsafeWindow +// @grant GM_addStyle +// @grant GM_getValue +// @grant GM_setValue +// @grant GM_xmlhttpRequest +// @grant GM_registerMenuCommand +// @grant GM_deleteValue +// @grant GM_listValues +// @grant GM_getResourceText +// @grant GM_getResourceURL +// @grant GM_log +// @grant GM_openInTab +// @grant GM_setClipboard +// @grant GM_info +// @grant GM_getMetadata +// @run-at document-start +// @connect * +// ==/UserScript== +/*jshint evil:true newcap:false*/ +/*global unsafeWindow, GM_addStyle, GM_getValue, GM_setValue, GM_xmlhttpRequest, GM_registerMenuCommand, GM_deleteValue, GM_listValues, GM_getResourceText, GM_getResourceURL, GM_log, GM_openInTab, GM_setClipboard, GM_info, GM_getMetadata, $, document, console, location, setInterval, setTimeout, clearInterval*/ +/*===================================================== + Thanks +====================================================== + + Donors: M. Howard, Shunjou, Charmine, Kierek93, G. Barnard, H. Young, Seinhor9, ImGlodar, Ivanosevitch, HomeDipo, R. Martin, DrFiZ, Tippy, B. Rohner, P. Kozica, M. Patel, W4rell, Tscheckoff, AdBlock Polska, AVENIR INTERNET, coolNAO, Ben, J. Park, C. Young, J. Bou, M. Cano, J. Jung, A. Sonino, J. Litten, M. Schrumpf, G. Pepe, A. Trufanov, R. Palmer, J. Rautiainen, S. Blystone, M. Silveira, K. MacArthur, M. Ivanov, A. Schmidt, A. Waage, F. Tismer, S. Ehnert, J. Corpus, J. Dluhos, Maklemenz, Strobelix, Modellpilot.EU, E. Benedetti, V. Venditti, Shakos, A. Eliason, A. Saloranta, S. Geiger, A. Otterloo, M. Coppen, S. Fischer, H. Becker, D. Ackerman, S. Pitsch, K. Pertcheck, S. Abel, K. O'Connor, B. Obrien, S. Vogler, S. Goebl, A. Biar, S. Scott, Bassmobile.org, S. Große, M. Peot, R. Chan Balam, L. Bond-Kennedy, R. Emond, A. Pavlov, W. Tracey, A. Sergey, R. López López, R. Reddy Kasireddy, A. Moujeer, M. Betz, M. Lefèvre, R. McCurdy, LR Geeks, M. Beauregard, CasperTech Ltd, M. Dudas, S. Scharf, S. Prokhorov, K. Papalias, J. Wojnowski, B. Curtis, D. Lawrence, D. He, N. Kelsall, Idogewallet, J. Spaulding, S. Lafon, Mat, H. Roberts, C. Hedlund, J. Hawkins, J. Andersen, M. Bjorksten, B. Wolfe III, T. Yocom, Š. Intas, S. Moenich, J. Chang, C. Munk, A. Naruta, Б. Михаил, J. Benz, F. Sloot, J. Creed, M. Gillam, C. Leicht, A. Gnana, S. Sundaram, A. Koller, M. Kotlar, S. Abel, T. Flanagan, M. Arduini, P. Stackhouse, B. Oliver, M. Johnson, R. Mannert, E. Siordia + + Collaborators: InfinityCoding, Couchy, Dindog, Floxflob, U Bless, Watilin, @prdonahue, Hoshie, 3lf3nLi3d, Alexo, Crits, Noname120, Crt32, JixunMoe, Athorcis, Killerbadger, SMed79, Alexander255, Anonsubmitter, RaporLoLpro, Maynak00, Robotex, Vinctux, Blahx, MajkiIT, F4z, Angelsl, Mikhaelk, Marek, Hamsterbacke, Gorhill, Hacker999, xxcriticxx, Skr4tchGr3azyMonkiBallllllZzzz, Giwayume, MrSherlockHolmes, xDarkARG, Noahp78, Mapx- + + Users: Thank you to all those who use Anti Adblock Killer, who report problems, who write the review, which add to their favorites, making donations, which support the project and help in its development or promote. + +======================================================= + Mirrors +======================================================= + + Github: http://tinyurl.com/mcra3dn + Greasyfork: http://tinyurl.com/pbbdnh6 + Openuserjs: http://tinyurl.com/nnqje32 + MonkeyGuts: http://tinyurl.com/ka5fcqm + Userscripts: http://tinyurl.com/q8xcejl + +======================================================= + Documentation +======================================================= + + Greasemonkey: http://tinyurl.com/yeefnj5 + Scriptish: http://tinyurl.com/cnd9nkd + Tampermonkey: http://tinyurl.com/pdytfde + Violentmonkey: http://tinyurl.com/n34wn6j + NinjaKit: http://tinyurl.com/pkkm9ug + +======================================================= + Script +======================================================*/ + +/* AAK/uBP API */ +var a = (function(window) { + "use strict"; + + var unsafeWindow = (typeof unsafeWindow !== "undefined") ? unsafeWindow : window; + + var aak = { + + /** + * Runs a function on DOM & window load. + * @method always + * @param func {Function} The function to run. + * @param capture {Boolean} Dispatches event to the listener (func) before the event target. + */ + always(func, capture) { + func(); + this.on("DOMContentLoaded", func, capture); + this.on("load", func, capture); + }, + + /** + * Adds an HTML element to the page for scripts checking an element's existence. + * @method bait + * @param type {String} The element tag name. + * @param identifier {String} CSS selector for adding an ID or class to the element. + */ + bait(type, identifier) { + let elem = a.$(`<${type}>`); + if (identifier.startsWith("#") { + elem.attr("id", identifier.substr(1)); + } else if (identifier.startsWith(".")) { + elem.addClass(identifier.substr(1)); + } + elem.html("
").prependTo("html"); + }, + + /** + * Configuration for this script. + * @property config + * @type Object + */ + config: { + aggressiveAdflySkipper: true, + allowExperimental: true, + allowGeneric: true, + debugMode: false, + domExcluded: null, + init() { + this.debugMode = GM_getValue("config_debugMode", this.debugMode); + this.allowExperimental = GM_getValue("config_allowExperimental", this.allowExperimental); + this.aggressiveAdflySkipper = GM_getValue("config_aggressiveAdflySkiper", this.aggressiveAdflySkipper); + aak.mods.Facebook_JumpToTop = GM_getValue("mods_Facebook_JumpToTop", aak.mods.Facebook_JumpToTop); + aak.mods.Blogspot_AutoNCR = GM_getValue("mods_Blogspot_AutoNCR", aak.mods.Blogspot_AutoNCR); + aak.mods.NoAutoplay = GM_getValue("mods_NoAutoplay", aak.mods.NoAutoplay); + }, + update(id, val) { + const names = [ + "config_debugMode", + "config_allowExperimental", + "config_aggressiveAdflySkiper", + "mods_Facebook_JumpToTop", + "mods_Blogspot_AutoNCR", + "mods_NoAutoplay" + ]; + if (names.includes(id)) { + GM_setValue(id, Boolean(val)); + } + } + }, + + /** + * Sets or gets a cookie, depending on whether the value is provided or not. + * @method cookie + * @param key {String} The cookie name. + * @param val {String} The cookie value. Leave out to retrieve the current value. + * @param time {Number} Number of milliseconds in which to expire the cookie. + * @param path {String} The cookie path. + * @return {String} The value of the cookie, if "val" parameter is omitted. + */ + cookie(key, val, time, path) { + if (typeof val === "undefined") { + const value = "; " + a.doc.cookie; + let parts = value.split("; " + key + "="); + if (parts.length == 2) { + return parts.pop().split(";").shift(); + } else { + return null; + } + } else { + let expire = new this.win.Date(); + expire.setTime((new this.win.Date()).getTime() + (time || 31536000000)); + this.doc.cookie = key + "=" + this.win.encodeURIComponent(val) + ";expires=" + expire.toGMTString() + ";path=" + (path || "/"); + } + }, + + /** + * Adds CSS styles to the page. + * @method css + * @param str {String} The CSS string to add. + */ + css(str) { + let temp = str.split(";"); + for (let i=0; i Date: Sun, 28 May 2017 17:03:00 +0000 Subject: [PATCH 2/6] Update aak-cont-master-es6.js --- source/aak-cont-master-es6.js | 437 ++++++++++++++++++++++++++++++---- 1 file changed, 388 insertions(+), 49 deletions(-) diff --git a/source/aak-cont-master-es6.js b/source/aak-cont-master-es6.js index db77784..13c46d3 100644 --- a/source/aak-cont-master-es6.js +++ b/source/aak-cont-master-es6.js @@ -87,6 +87,45 @@ var a = (function(window) { this.on("load", func, capture); }, + /** + * String content matching across an array of strings. Returns true if any string in the args array is matched. + * @method applyMatch + * @param args {Array} The strings to match against. + * @param method {Number} The method to match with. Defined in the enum (aak.matchMethod). + * @param filter {String|RegExp} The matching criteria. + * @return {Boolen} True if any string match, false otherwise. + */ + applyMatch(args, method, filter) { + switch (method) { + case this.matchMethod.string: + for (let i=0; i`); + let elem = this.$(`<${type}>`); if (identifier.startsWith("#") { elem.attr("id", identifier.substr(1)); } else if (identifier.startsWith(".")) { @@ -105,36 +144,16 @@ var a = (function(window) { /** * Configuration for this script. - * @property config + * @method config * @type Object */ - config: { - aggressiveAdflySkipper: true, - allowExperimental: true, - allowGeneric: true, - debugMode: false, - domExcluded: null, - init() { - this.debugMode = GM_getValue("config_debugMode", this.debugMode); - this.allowExperimental = GM_getValue("config_allowExperimental", this.allowExperimental); - this.aggressiveAdflySkipper = GM_getValue("config_aggressiveAdflySkiper", this.aggressiveAdflySkipper); - aak.mods.Facebook_JumpToTop = GM_getValue("mods_Facebook_JumpToTop", aak.mods.Facebook_JumpToTop); - aak.mods.Blogspot_AutoNCR = GM_getValue("mods_Blogspot_AutoNCR", aak.mods.Blogspot_AutoNCR); - aak.mods.NoAutoplay = GM_getValue("mods_NoAutoplay", aak.mods.NoAutoplay); - }, - update(id, val) { - const names = [ - "config_debugMode", - "config_allowExperimental", - "config_aggressiveAdflySkiper", - "mods_Facebook_JumpToTop", - "mods_Blogspot_AutoNCR", - "mods_NoAutoplay" - ]; - if (names.includes(id)) { - GM_setValue(id, Boolean(val)); - } - } + config() { + this.config.debugMode = GM_getValue("config_debugMode", this.config.debugMode); + this.config.allowExperimental = GM_getValue("config_allowExperimental", this.config.allowExperimental); + this.config.aggressiveAdflySkipper = GM_getValue("config_aggressiveAdflySkiper", this.config.aggressiveAdflySkipper); + this.mods.Facebook_JumpToTop = GM_getValue("mods_Facebook_JumpToTop", this.mods.Facebook_JumpToTop); + this.mods.Blogspot_AutoNCR = GM_getValue("mods_Blogspot_AutoNCR", this.mods.Blogspot_AutoNCR); + this.mods.NoAutoplay = GM_getValue("mods_NoAutoplay", this.mods.NoAutoplay); }, /** @@ -148,7 +167,7 @@ var a = (function(window) { */ cookie(key, val, time, path) { if (typeof val === "undefined") { - const value = "; " + a.doc.cookie; + const value = "; " + this.doc.cookie; let parts = value.split("; " + key + "="); if (parts.length == 2) { return parts.pop().split(";").shift(); @@ -162,6 +181,17 @@ var a = (function(window) { } }, + /** + * Removes an inline script on the page, using the sample string. + * @method crashScript + * @param sample {String} Sample function string. + */ + crashScript(sample) { + this.patchHTML((html) => { + return html.replace(sample, "])} \"'` ])} \n\r \r\n */ ])}"); + }); + }, + /** * Adds CSS styles to the page. * @method css @@ -229,6 +259,7 @@ var a = (function(window) { /** * Displays a console error. + * @method err * @param name {String} Descriptive type of error. */ err(name) { @@ -240,22 +271,144 @@ var a = (function(window) { this.out.error(`Uncaught AdBlock Error: ${name}AdBlocker detectors are not allowed on this device! `); }, + /** + * Replaces a global function with a version that can stop or modify its execution based on the arguments passed. + * @method filter + * @param func {String} The name of the function (or dot separate path to the function) to be replaced. Starts at the global context. + * @param method {Number} The method to match function arguments with. Defined in the enum (aak.matchMethod). + * @param filter {String|RegExp} This string or regex criteria that determines a match. If this matches, the original function is not executed. + * @param onMatch {Function} Callback when the "filter" argument matches. The return value of this function is used instead of the original function's return value. + * @param onAfter {Function} Callback that fires every time original function is called. The first argument is whether or not the flter matched. The second argument is the args passed into the original function. + * @return {Boolean} True if errors did not occur. + */ filter(func, method, filter, onMatch, onAfter) { + let original = this.win; + let parent; + const newFunc = (...args) => { + if (this.config.debugMode) { + this.out.warn(func + "is called with these arguments: "); + for (let i=0; i { + this.doc.write(patcher(result.responseText)); + } + }); + }, + + /** + * Stops websites from detecting function modifications by utilizing the toString method of the function. Used in conjunction with "filter". + * @method protectFunc + */ + protectFunc() { + this.protectFunc.enabled = true; + const original = this.win.Function.prototype.toString; + const newFunc = () => { + const index = this.protectFunc.pointers.indexOf(this); + if (index === -1) { + return original.apply(this); + } else { + return this.protectFunc.masks[index]; + } + }; + try { + this.win.Function.prototype.toString = newFunc; + this.protectFunc.pointers.push(newFunc); + this.protectFunc.masks.push(String(original)); + this.config.debugMode && this.out.warn("Functions protected."); + } catch(err) { + this.config.debugMode && this.out.error("AAK failed to protect functions!"); + return false; + } + return true; + }, + + /** + * Makes it so a global property is not modifiable by further scripts. + * @method noAccess + * @param name {String} The name of the property to make read-only. Using "." will traverse an object's properties. Starts at the global context. + * @param val {Any} The desired value of the read-only property. + */ + readOnly(name, val) { + try { + let property = this.win; + let parent; + let stack = name.split("."); + let current; + while (current = stack.shift()) { + parent = property; + property = parent[current]; + if (!stack.length) { + this.win.Object.defineProperty(parent, current { + configurable: false, + set: function() {}, + get: function() { + return val; + } + }); + } + } + } catch(err) { + this.config.debugMode && this.out.error("AAK failed to define read-only property " + name + "!"); + return false; + } + return true; + }, + + /** + * Fires when the DOM is ready for modification. + * @method ready + * @param func {Function} Callback to fire when DOM is ready. + * @param capture {Boolean} Whether or not the callback should fire before event target. + */ + ready(func, capture) { + this.on("DOMContentLoaded", func, capture); + }, + + /** + * The unsafe window's setTimeout. + * @property setTimeout + */ + setTimeout: unsafeWindow.setTimeout, + + /** + * The unsafe window's setInterval. + * @property setInterval + */ + setInterval: unsafeWindow.setInterval, + + sha256() { }, - protectFunc() { - + /** + * Similar to "filter", except all arguments are multiplied by a "ratio" for detection on the next call. Usually used on "setInterval". + * @method timewarp + */ + timewarp(func, method, filter, onMatch, onAfter, ratio) { + ratio = ratio || 0.02; + const original = this.win[func]; + const newFunc = (...args) => { + if (this.config.debugMode) { + this.out.warn("Timewarpped " + func + " is called with these arguments: "); + for (let i = 0; i < args.length; i++) { + this.out.warn(String(args[i])); + } + } + if (!method || this.applyMatch(args, method, filter)) { + this.config.debugMode && this.out.warn("Timewarpped. "); + onMatch && onMatch(args); + onAfter && onAfter(true, args); + args[1] = args[1] * ratio; + return original.apply(this.win, args); + } else { + this.config.debugMode && this.out.info("Not timewarpped. "); + onAfter && onAfter(false, args); + return original.apply(this.win, args); + } + }; + try { + this.win[func] = newFunc; + if (this.protectFunc.enabled) { + this.protectFunc.pointers.push(newFunc); + this.protectFunc.masks.push(String(original)); + } + this.config.debugMode && this.out.warn("Timewarp activated on " + func); + } catch (err) { + this.config.debugMode && this.out.error("uBlock Protector failed to apply timewarp on " + func + "! "); + return false; + } + return true; }, - readOnly() { - + uid() { + }, - ready() { - - }, - - timewarp() { - + videoJS() { + }, /** @@ -291,6 +576,60 @@ var a = (function(window) { win: unsafeWindow }; + + // Defaults for config + aak.config.aggressiveAdflySkipper = true; + aak.config.allowExperimental = true; + aak.config.allowGeneric = true; + aak.config.debugMode = false; + aak.config.domExcluded = null; + aak.config.update = (id, val) => { + const names = [ + "config_debugMode", + "config_allowExperimental", + "config_aggressiveAdflySkiper", + "mods_Facebook_JumpToTop", + "mods_Blogspot_AutoNCR", + "mods_NoAutoplay" + ]; + if (names.includes(id)) { + GM_setValue(id, Boolean(val)); + } + }; + + // Defaults for observe + aak.observe.init = () => { + const observer = new this.win.MutationObserver(function(mutations) { + for (let i=0; i Date: Sun, 28 May 2017 17:41:56 +0000 Subject: [PATCH 3/6] Update aak-cont-master-es6.js --- source/aak-cont-master-es6.js | 368 ++++++++++++++++++++++++++++++++-- 1 file changed, 351 insertions(+), 17 deletions(-) diff --git a/source/aak-cont-master-es6.js b/source/aak-cont-master-es6.js index 13c46d3..05626a7 100644 --- a/source/aak-cont-master-es6.js +++ b/source/aak-cont-master-es6.js @@ -326,7 +326,210 @@ var a = (function(window) { return true; }, - generic: undefined, // TODO + /** + * Generic anti-adblocking solutions that run on every page. + * @method generic + */ + generic() { + //@pragma-keepline Based on generic solutions of Anti-Adblock Killer + //@pragma-keepline License: https://github.com/reek/anti-adblock-killer/blob/master/LICENSE + if (this.config.allowGeneric && !this.config.domExcluded) { + const data = {}; + this.generic.FuckAdBlock("FuckAdBlock", "fuckAdBlock"); + this.generic.FuckAdBlock("BlockAdBlock", "blockAdBlock"); + this.readOnly("canRunAds", true); + this.readOnly("canShowAds", true); + this.readOnly("isAdBlockActive", false); + let playwireZeus; + this.win.Object.defineProperty(this.win, "Zeus", { + configurable: false, + set: function (val) { + playwireZeus = val; + }, + get: function () { + this.config.debugMode && this.err("Playwire"); + try { + playwireZeus.AdBlockTester = { + check: function (a) { a(); } + }; + } catch (err) { } + return playwireZeus; + } + }); + this.ready(function () { + if (this.win.XenForo && typeof this.win.XenForo.rellect === "object") { + this.config.debugMode && this.err("XenForo"); + this.win.XenForo.rellect = { + AdBlockDetector: { + start: function () { } + } + }; + } + if (typeof this.win.closeAdbuddy === "function") { + this.config.debugMode && this.err("Adbuddy"); + this.win.closeAdbuddy(); + } + if (this.$("div.adb_overlay > div.adb_modal_img").length > 0) { + this.config.debugMode && this.err("AdBlock Alerter"); + this.$("div.adb_overlay").remove(); + this.css("html,body {height:auto; overflow: auto;}"); + } + if (this.$("#blockdiv").html() === "disable ad blocking or use another browser without any adblocker when you visit") { + this.config.debugMode && this.out.err("Uncaught AdBlock Error: Generic block screens are not allowed on this device! "); + this.$("#blockdiv").remove(); + } + const styles = document.querySelectorAll("style"); + for (let i = 0; i < styles.length; i++) { + const style = styles[i]; + const cssRules = style.sheet.cssRules; + for (var j = 0; j < cssRules.length; j++) { + const cssRule = cssRules[j]; + const cssText = cssRule.cssText; + const pattern = /^#([a-z0-9]{4,10}) ~ \* \{ display: none; \}/; + if (pattern.test(cssText)) { + const id = pattern.exec(cssText)[1]; + if (this.$("script:contains(w.addEventListener('load'," + id + ",false))")) { + this.config.debugMode && this.err("Antiblock.org v2"); + data.abo2 = id; + break; + } + } + } + } + for (let prop in this.win) { + try { + if (!prop.startsWith("webkit") && /^[a-z0-9]{4,12}$/i.test(prop) && prop !== "document" && (this.win[prop] instanceof this.win.HTMLDocument) === false && this.win.hasOwnProperty(prop) && typeof this.win[prop] === "object") { + const method = this.win[prop]; + if (method.deferExecution && + method.displayMessage && + method.getElementBy && + method.getStyle && + method.insert && + method.nextFunction) { + if (method.toggle) { + this.config.debugMode && this.err("BetterStopAdblock"); + data.bsa = prop; + } else { + this.config.debugMode && this.err("Antiblock.org v3"); + data.abo3 = prop; + } + this.win[prop] = null; + } + if (method.bab) { + this.config.debugMode && this.err("BlockAdBlock"); + this.win[prop] = null; + } else if (this.win.Object.keys(method).length === 3 && this.win.Object.keys(method).join().length === 32) { + this.config.debugMode && this.err("BlockAdBlock"); + this.win[prop] = null; + } + } + } catch (err) { } + } + }); + const onInsertHandler = function (insertedNode) { + if (insertedNode.nodeName === "DIV" && + insertedNode.id && + insertedNode.id.length === 4 && + /^[a-z0-9]{4}$/.test(insertedNode.id) && + insertedNode.firstChild && + insertedNode.firstChild.id && + insertedNode.firstChild.id === insertedNode.id && + insertedNode.innerHTML.includes("no-adblock.com")) { + this.config.debugMode && this.err("No-Adblock"); + insertedNode.remove(); + } + if (insertedNode.nodeName === "DIV" && + insertedNode.id && + insertedNode.id.length === 7 && + /^a[a-z0-9]{6}$/.test(insertedNode.id) && + insertedNode.parentNode && + insertedNode.parentNode.id && + insertedNode.parentNode.id === insertedNode.id + "2" && + insertedNode.innerHTML.includes("stopadblock.org")) { + this.config.debugMode && this.err("StopAdblock"); + insertedNode.remove(); + } + const reIframeId = /^(zd|wd)$/; + const reImgId = /^(xd|gd)$/; + const reImgSrc = /\/ads\/banner.jpg/; + const reIframeSrc = /(\/adhandler\/|\/adimages\/|ad.html)/; + if (insertedNode.id && + reImgId.test(insertedNode.id) && + insertedNode.nodeName === "IMG" && + reImgSrc.test(insertedNode.src) || + insertedNode.id && + reIframeId.test(insertedNode.id) && + insertedNode.nodeName === "IFRAME" && + reIframeSrc.test(insertedNode.src)) { + this.config.debugMode && this.err("AntiAdblock"); + insertedNode.remove(); + } + const reId = /^[a-z]{8}$/; + const reClass = /^[a-z]{8} [a-z]{8}/; + const reBg = /^[a-z]{8}-bg$/; + if (typeof this.win.vtfab !== "undefined" && + typeof this.win.adblock_antib !== "undefined" && + insertedNode.parentNode && + insertedNode.parentNode.nodeName === "BODY" && + insertedNode.id && + reId.test(insertedNode.id) && + insertedNode.nodeName === "DIV" && + insertedNode.nextSibling && + insertedNode.nextSibling.className && + insertedNode.nextSibling.nodeName === "DIV") { + if (insertedNode.className && + reClass.test(insertedNode.className) && + reBg.test(insertedNode.nextSibling.className) && + insertedNode.nextSibling.style && + insertedNode.nextSibling.style.display !== "none") { + this.config.debugMode && this.err("Adunblock Premium"); + insertedNode.nextSibling.remove(); + insertedNode.remove(); + } else if (insertedNode.nextSibling.id && + reId.test(insertedNode.nextSibling.id) && + insertedNode.innerHTML.includes("Il semblerait que vous utilisiez un bloqueur de publicité !")) { + this.config.debugMode && this.err("Adunblock Free"); + insertedNode.remove(); + } + } + const reMsgId = /^[a-z0-9]{4,10}$/i; + const reTag1 = /^(div|span|b|i|font|strong|center)$/i; + const reTag2 = /^(a|b|i|s|u|q|p|strong|center)$/i; + const reWords1 = /ad blocker|ad block|ad-block|adblocker|ad-blocker|adblock|bloqueur|bloqueador|Werbeblocker|adblockert|آدبلوك بلس|блокировщиком/i; + const reWords2 = /kapat|disable|désactivez|désactiver|desactivez|desactiver|desative|desactivar|desactive|desactiva|deaktiviere|disabilitare|απενεργοποίηση|запрещать|állítsd le|publicités|рекламе|verhindert|advert|kapatınız/i; + if (insertedNode.parentNode && + insertedNode.id && + insertedNode.style && + insertedNode.childNodes.length && + insertedNode.firstChild && + !insertedNode.firstChild.id && + !insertedNode.firstChild.className && + reMsgId.test(insertedNode.id) && + reTag1.test(insertedNode.nodeName) && + reTag2.test(insertedNode.firstChild.nodeName)) { + this.config.debugMode && this.err("Antiblock.org"); + const audio = insertedNode.querySelector("audio[loop]"); + if (audio) { + audio.pause(); + audio.remove(); + } else if ((data.abo2 && insertedNode.id === data.abo2) || + (insertedNode.firstChild.hasChildNodes() && reWords1.test(insertedNode.firstChild.innerHTML) && reWords2.test(insertedNode.firstChild.innerHTML))) { + insertedNode.remove(); + } else if ((data.abo3 && insertedNode.id === data.abo3) || + (insertedNode.firstChild.hasChildNodes() && insertedNode.firstChild.firstChild.nodeName === "IMG" && insertedNode.firstChild.firstChild.src.startsWith("data:image/png;base64"))) { + a.win[data.abo3] = null; + insertedNode.remove(); + } else if (data.bsa && insertedNode.id === data.bsa) { + this.win[data.bsa] = null; + insertedNode.remove(); + } + } + }; + this.observe("insert", onInsertHandler); + } else if (this.config.debugMode) { + this.out.warn("Generic solutions are disabled on this domain. "); + } + }, /** * Match enum for the "applyMatch" method. @@ -341,8 +544,38 @@ var a = (function(window) { callback: 4 // Callback, arguments list will be supplied as an array. Retrun true for match, false for no match. }, - nativePlayer() { - + /** + * Creates a native video player. + * @method nativePlayer + * @param source {String} The source URL of the video stream. + * @param [typeIn] {String} Specify a video MIME type. + * @param [widthIn] {String} Specify a custom width. + * @param [heightIn] {String} Specify a custom height. + */ + nativePlayer(source, typeIn, widthIn, heightIn) { + let type; + if (typeIn) { + type = typeIn; + } else { + const temp = source.split("."); + switch (temp[temp.length - 1]) { + case "webm": + type = "video/webm"; + break; + case "mp4": + type = "video/mp4"; + break; + case "ogg": + type = "video/ogg"; + break; + default: + type = "video/mp4"; + break; + } + } + const width = widthIn || "100%"; + const height = heightIn || "auto"; + return ``; }, /** @@ -517,8 +750,74 @@ var a = (function(window) { */ setInterval: unsafeWindow.setInterval, - sha256() { - + /** + * Creates a SHA-256 hash signature of provided string. + * @method sha256 + * @param r {String} The string to encrypt. + */ + sha256(r) { + //@pragma-keepline Based on work of Angel Marin and Paul Johnston + //@pragma-keepline More information: http://www.webtoolkit.info/javascript-sha256.html + function n(r, n) { + var t = (65535 & r) + (65535 & n), + e = (r >> 16) + (n >> 16) + (t >> 16); + return e << 16 | 65535 & t; + } + function t(r, n) { + return r >>> n | r << 32 - n; + } + function e(r, n) { + return r >>> n; + } + function o(r, n, t) { + return r & n ^ ~r & t; + } + function u(r, n, t) { + return r & n ^ r & t ^ n & t; + } + function a(r) { + return t(r, 2) ^ t(r, 13) ^ t(r, 22); + } + function f(r) { + return t(r, 6) ^ t(r, 11) ^ t(r, 25); + } + function c(r) { + return t(r, 7) ^ t(r, 18) ^ e(r, 3); + } + function i(r) { + return t(r, 17) ^ t(r, 19) ^ e(r, 10); + } + function h(r, t) { + var e, h, C, g, d, v, A, l, m, S, y, w, b = new Array(1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298), + p = new Array(1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225), + s = new Array(64); + r[t >> 5] |= 128 << 24 - t % 32, r[(t + 64 >> 9 << 4) + 15] = t; + for (m = 0; m < r.length; m += 16) { + e = p[0], h = p[1], C = p[2], g = p[3], d = p[4], v = p[5], A = p[6], l = p[7]; + for (S = 0; 64 > S; S++) 16 > S ? s[S] = r[S + m] : s[S] = n(n(n(i(s[S - 2]), s[S - 7]), c(s[S - 15])), s[S - 16]), y = n(n(n(n(l, f(d)), o(d, v, A)), b[S]), s[S]), w = n(a(e), u(e, h, C)), l = A, A = v, v = d, d = n(g, y), g = C, C = h, h = e, e = n(y, w); + p[0] = n(e, p[0]), p[1] = n(h, p[1]), p[2] = n(C, p[2]), p[3] = n(g, p[3]), p[4] = n(d, p[4]), p[5] = n(v, p[5]), p[6] = n(A, p[6]), p[7] = n(l, p[7]); + } + return p; + } + function C(r) { + for (var n = Array(), t = (1 << v) - 1, e = 0; e < r.length * v; e += v) n[e >> 5] |= (r.charCodeAt(e / v) & t) << 24 - e % 32; + return n; + } + function g(r) { + r = r.replace(/\r\n/g, "\n"); + for (var n = "", t = 0; t < r.length; t++) { + var e = r.charCodeAt(t); + 128 > e ? n += String.fromCharCode(e) : e > 127 && 2048 > e ? (n += String.fromCharCode(e >> 6 | 192), n += String.fromCharCode(63 & e | 128)) : (n += String.fromCharCode(e >> 12 | 224), n += String.fromCharCode(e >> 6 & 63 | 128), n += String.fromCharCode(63 & e | 128)); + } + return n; + } + function d(r) { + for (var n = A ? "0123456789ABCDEF" : "0123456789abcdef", t = "", e = 0; e < 4 * r.length; e++) t += n.charAt(r[e >> 2] >> 8 * (3 - e % 4) + 4 & 15) + n.charAt(r[e >> 2] >> 8 * (3 - e % 4) & 15); + return t; + } + var v = 8, + A = 0; + return r = g(r), d(h(C(r), r.length * v)); }, /** @@ -561,12 +860,33 @@ var a = (function(window) { return true; }, + /** + * Generated a unique ID string. + * @method uid + * @return {String} The unique id. + */ uid() { - + const chars = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + let str = ""; + for (let i = 0; i < 10; i++) { + str += chars.charAt(this.win.Math.floor(this.win.Math.random() * chars.length)); + } + this.uid.counter++; + return str + this.uid.counter.toString(); }, - videoJS() { - + /** + * Creates a videoJS player. + * @method videoJS + * + */ + videoJS(sources, types, width, height) { + let html = ``; + return html; }, /** @@ -577,7 +897,7 @@ var a = (function(window) { }; - // Defaults for config + // Static properties for aak.config aak.config.aggressiveAdflySkipper = true; aak.config.allowExperimental = true; aak.config.allowGeneric = true; @@ -597,27 +917,27 @@ var a = (function(window) { } }; - // Defaults for observe + // Static properties for aak.observe aak.observe.init = () => { - const observer = new this.win.MutationObserver(function(mutations) { + const observer = new aak.win.MutationObserver(function(mutations) { for (let i=0; i { + try { + aak.win.HELP_IMPROVE_VIDEOJS = false; + } catch (err) { } + let plugins = args.join(); + aak.$("head").append(`