AGEFans 允许控制台调试

允许在 AGEFans 使用网页控制台,去除无限debugger以及页面自动跳转

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

/* eslint-disable no-multi-spaces */

// ==UserScript==
// @name               AGEFans 允许控制台调试
// @name:zh-CN         AGEFans 允许控制台调试
// @name:en            AGEFans anti-anti-debugger
// @namespace          AGEFans-anti-anti-debugger
// @version            0.1
// @description        允许在 AGEFans 使用网页控制台,去除无限debugger以及页面自动跳转
// @description:zh-CN  允许在 AGEFans 使用网页控制台,去除无限debugger以及页面自动跳转
// @description:en     Allows you to use devtools in agefans
// @author             PY-DNG
// @license            WTFPL - see http://wtfpl.net/
// @include            https://www.age.tv/*
// @include            https://www.agefans.*
// @include            https://www.agemys.*
// @icon               none
// @grant              none
// @run-at             document-start
// ==/UserScript==

(function __MAIN__() {
    'use strict';

	let logged = false;
	Object.defineProperty(window, 'devtoolsDetector', {
		get: function() {
			return window.test_backup;
		},
		set: function(v) {
			window.test_backup = new Proxy(v, {
				get: function(target, prop, reciever) {
					// 笑死,他居然还把launch错写成了lanuch
					if (prop === 'lanuch') {
						// Log once
						!logged && console.log('%c Fuck you, devtoolsDetector', 'color:#ff0000');
						!logged && console.log('%c devtoolsDetector >> passed', 'color:#00aa00');
						logged = true;

						// Fake lanuch function
						return new Proxy(fake_lanuch, {
							get: function(target, prop, reciever) {
								const inherits = ['name', 'toString', 'toLocaleString'];
								return inherits.includes(prop) ? (typeof v.lanuch[prop] === 'function' ? () => (v.lanuch[prop]()) : v.lanuch[prop]) : fake_lanuch[prop];
							}
						});

						function fake_lanuch() {/* Fuck you, devtoolsDetector */}
					}
					return v[prop];
				}
			});
		}
	});

	/*
	const interval = setInterval(function() {
		if (typeof(devtoolsDetector) === 'object') {
			devtoolsDetector.stop();
			clearInterval(interval);
		}
	}, 500);
	*/
})();