Skip to content

Instantly share code, notes, and snippets.

@erikvold
Created March 23, 2010 15:34
Show Gist options
  • Save erikvold/341300 to your computer and use it in GitHub Desktop.
Save erikvold/341300 to your computer and use it in GitHub Desktop.
// ==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