Greasemonkeyのサンドボックス(XPCNativeWrapper)が変更されたようです。これはバグの可能性がありますが、現時点で未解決の問題はありません。
また、watch()
は非標準(離れるかもしれない)であり、the documentationはnot meant to be used except for temporary debuggingである。
一方
、あなたはそうのように、ページスコープにそれを注入することによって、再び働いているコードを取得することができます:
function AddTitleWatch() {
document.watch ('title', function (prop, oldval, newval) {
var matches, names;
if (matches = newval.match (/Inbox \((\d+)\)/)) {
names = newval.match (/\w+/)
newval = '(' + matches[1] + ') unread - ' + names[0] + ' Inbox';
}
return (newval);
});
}
function addJS_Node (text, s_URL, funcToRun) {
var D = document;
var scriptNode = D.createElement ('script');
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);
}
addJS_Node (null, null, AddTitleWatch);
しかし賢く、長期的には、より堅牢、ポータブルソリューションにありインターバルタイマーを使用するコードをリファクタリングします。 ...
setInterval (RefactorTitle, 200);
function RefactorTitle() {
var oldTitle = RefactorTitle.oldTitle || "";
var docTitle = document.title;
if (docTitle != oldTitle) {
var matches, names;
if (matches = docTitle.match (/Inbox \((\d+)\)/)) {
names = docTitle.match (/\w+/);
docTitle = '(' + matches[1] + ') unread - ' + names[0] + ' Inbox';
}
document.title = docTitle;
RefactorTitle.oldTitle = docTitle;
}
}
unsafeWindow.document.watchはページ固有の機能ですか?私の(しかし、限られた)読んでからそれはjavascriptであり、サイトやページに特定すべきではありません。新しい機能を特定するためにページソースで何を探すべきでしょうか? – EBlackstone
はい、そうです。 'watch()'はページ固有ではありません。ウォッチポイントを設定するためのFirefox専用のメカニズムであり、[ドキュメント](https://developer.mozilla.org/ja/JavaScript/Reference/Global_Objects/Object/watch)にはこのように使用すべきではありません。 GMやFFが変わったときにそれがなぜ壊れたのかは間違いありません。私はちょっとした回避策を投稿します。 –