Shellshock.io Remove Adblocker messages

Block the adblocker messages

当前为 2022-08-04 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Shellshock.io Remove Adblocker messages
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Block the adblocker messages
// @author       mewen25
// @match        https://shellshock.io/
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @run-at       document-start
// ==/UserScript==

var open_prototype = XMLHttpRequest.prototype.open, intercept_response = function(callback) {
  XMLHttpRequest.prototype.open = function(method, url) {
    if(url.indexOf("shellshock.js") > -1) this.isScript = true;
    this.addEventListener('readystatechange', function(event) {
     if ( this.readyState === 4 && this.isScript ) {
         var response = callback(event.target.responseText);
         Object.defineProperty(this, 'response', {writable: true});
         Object.defineProperty(this, 'responseText', {writable: true});
         this.response = this.responseText = response;
     }
    });
    return open_prototype.apply(this, arguments);
  };
};

intercept_response(function(response) {
    const ad = /((showAdBlockerVideo\(\),set).+?(?=l\(\),).{4})([A-z].+?(?=\(\)\})).+?(?=;var)/.exec(response);
    const timer = /function Fr\(.+?(?=var)/.exec(response)[0];

    const adLine = ad[0];
    const adVar = ad[3];
    const replaceAd = `hideAdBlockerVideo(),setTimeout(()=>{${adVar}()},100))}`;
    console.log("[INJECTING] - Adblock popup block");
    response = response.replace(adLine, replaceAd);
    response = response.replace(timer, 'function Fr(e){setTimeout(() => {Fi=-1,Ka.clear(rr),an()}, 3000)}');
    return response;
});