Last active
May 31, 2016 15:34
-
-
Save ncaq/241aeef4f01a0bac625341f1c873063d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var PLUGIN_INFO = | |
<KeySnailPlugin> | |
<name>HoK Private</name> | |
<description>add hok-start-private-mode</description> | |
<version>0.1</version> | |
<updateURL>https://gist.github.com/ncaq/241aeef4f01a0bac625341f1c873063d/raw</updateURL> | |
<author mail='[email protected]' homepage='https://www.ncaq.net'>ncaq</author> | |
<license>The MIT License</license> | |
<minVersion>1.8.0</minVersion> | |
<include>main</include> | |
</KeySnailPlugin>; | |
function openInPrivateWindow(url) { | |
const file = Components.classes['@mozilla.org/file/local;1']. | |
createInstance(Components.interfaces.nsIFile); | |
file.initWithPath('/usr/bin/firefox'); | |
const process = Components.classes['@mozilla.org/process/util;1']. | |
createInstance(Components.interfaces.nsIProcess); | |
process.init(file); | |
const args = ['--private-window', url]; | |
process.run(false, args, args.length); | |
} | |
function hokStartPrivate() { | |
plugins.hok.hok.start(function(elem){ | |
openInPrivateWindow((new URL(elem.getAttribute('href'), gBrowser.contentDocument.location.href)).toString()); | |
}, {}); | |
} | |
ext.add('hok-start-private-mode', hokStartPrivate, | |
M({ja: 'HoK - リンクをプライベートウィンドウで開く', | |
en: 'Start Hit a Hint private window mode'})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment