Created
June 25, 2011 00:41
-
-
Save littlefolk/1045958 to your computer and use it in GitHub Desktop.
Scriptish use sharedWindow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ScriptishでもLDRizeが使えるように、Greasemonkey用のパッチを流用して適応。 | |
// via. | |
// [Firefox 4.0b10でGreasemonkey 0.9.1のユーザスクリプトのwindowを共通にする改造(開発者orVimper向け) - wltの日記](http://d.hatena.ne.jp/wlt/20110130/1296359063) | |
// support. | |
// Greasemonkey 0.9.5 | |
// Scriptish 0.1.1 - 0.1.4 | |
javascript <<EOM | |
autocommands.add( | |
'VimperatorEnter', '.*', | |
function () { | |
let Cc = Components.classes['@greasemonkey.mozdev.org/greasemonkey-service;1'] || | |
Components.classes['@scriptish.erikvold.com/scriptish-service;1']; | |
if (Cc) { | |
Cc = Cc.getService().wrappedJSObject; | |
if (Cc.injectScripts.toSource().search('sharedWindow') == -1) { | |
Cc.injectScripts = liberator.eval( | |
Cc.injectScripts.toSource() | |
.replace(/(?=(?:var|let) delays|(?:firebug|fb)Console)/, | |
'var sharedWindow = {};' + | |
'sharedWindow.window = sharedWindow;' + | |
'sharedWindow.__proto__ = new XPCNativeWrapper(unsafeContentWin);') | |
.replace(/(?=sandbox\.__proto__)/, ' sandbox.window = sharedWindow;'), | |
Cc.injectScripts); | |
}; | |
}; | |
}); | |
EOM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment