Created
March 23, 2010 15:34
-
-
Save erikvold/341300 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name JavaScript Open In Tab Menu Command [TEST] | |
// @author Erik Vold | |
// @namespace openInTab | |
// @include * | |
// @version 1.0 | |
// @datecreated 2010-03-23 | |
// @lastupdated 2010-03-23 | |
// @description This simple test userscript will create a menu command which will produce a javascript alert with the provided string or ask you for one. | |
// ==/UserScript== | |
executeFunc = function( str ){ | |
if( !str && unsafeWindow.ubiquityGMInput && unsafeWindow.ubiquityGMInput.length ){ | |
var str = unsafeWindow.ubiquityGMInput; | |
// reset for next execution | |
unsafeWindow.ubiquityGMInput = ""; | |
} | |
else if ( !str ) { | |
var str = prompt( "Input:" ); | |
} | |
var win = GM_openInTab( str ); | |
alert(win.toString()); | |
}; | |
GM_registerMenuCommand( "open tab", executeFunc, "o", "control alt", "o" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment