Skip to content

Instantly share code, notes, and snippets.

@myfonj
Created January 13, 2022 10:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myfonj/36a2a72a8ac6b6172ee32aae271e7ca3 to your computer and use it in GitHub Desktop.
Save myfonj/36a2a72a8ac6b6172ee32aae271e7ca3 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML><html><head><title>Firefox shell</title>
<script type="text/javascript">
/*
howto:
# place this file somewhere on your disk
# open it in Firefox
# bookmark it, so it's address is like
# file:///c:/web-root/utils/firefox-shell.html
# edit new bookmark: append '?%s' to its URL, so it becomes
# file:///c:/web-root/utils/firefox-shell.html?%s
# set some handy Keyword, eg. '>', '#' or '!' for it
# try it. you should see a list of defined 'bookmarks' (testing only)
# extend, tweak.
# remember that you must use space after the main Keyword: "> command argument1 argument2"
*/
var library =
{ 'args' : function ()
{ document.write( Array.prototype.join.call( arguments ) )
}
, 'goto' : function ( where )
{ if ( where ) return where
}
, 'g' : function()
{ return 'http://google.com/search?q="'+args+'"'
}
, 'time' : function()
{ document.write( new Date() )
}
}
var args = decodeURIComponent( document.location.search ).slice(1).split(/\s+/)
var fnc = args.shift()
if( library[fnc] )
{ var ret = library[fnc].call(library[fnc],args)
; if( ret ) document.location.replace( ret )
}
else
{ var notice = ['Supported commands: <ul>'] , i = 0 , fnc
; for( fnc in library ) notice[++i] = fnc
; document.write( notice.join('<li>') + '</ul>')
}
</script>
</head>
<body></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment