因为plusActive
对于目标页面范围(不是脚本范围)是全局的......
仅适用于 Firefox ,这将起作用:
// ==UserScript==
// @name PLUS
// @namespace http://userstyles.org
// @description PLUS
// @author md
// @homepage http://userstyles.org/styles/43691
// @include http://azet.sk/*
// @include https://azet.sk/*
// @include http://-azet.sk/*
// @include https://-azet.sk/*
// @include http://*.azet.sk/*
// @include https://*.azet.sk/*
// @include http://*-azet.sk/*
// @include https://*-azet.sk/*
// @grant none
// ==/UserScript==
window.plusActive = true;
对于@grant none
此脚本,对于确保始终预期的操作非常重要。
对于跨浏览器方法,使用脚本注入:
// ==UserScript==
// @name PLUS
// @namespace http://userstyles.org
// @description PLUS
// @author md
// @homepage http://userstyles.org/styles/43691
// @include http://azet.sk/*
// @include https://azet.sk/*
// @include http://-azet.sk/*
// @include https://-azet.sk/*
// @include http://*.azet.sk/*
// @include https://*.azet.sk/*
// @include http://*-azet.sk/*
// @include https://*-azet.sk/*
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
addJS_Node ('plusActive = true;');
function addJS_Node (text, s_URL, funcToRun, runOnLoad) {
var D = document;
var scriptNode = D.createElement ('script');
if (runOnLoad) {
scriptNode.addEventListener ("load", runOnLoad, false);
}
scriptNode.type = "text/javascript";
if (text) scriptNode.textContent = text;
if (s_URL) scriptNode.src = s_URL;
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
targ.appendChild (scriptNode);
}