Simple Alternative to Greasemonkey
There is no simpler alternative to Firefox's Greasemonkey or to Chrome's userscripts that runs user JS automatically. You could write your own extension/add-on, but there wouldn't be much point to it.
If you don't care about the awesome extra power that GM and userscripts provide and always want to just "(take) a few lines of JS and (run) them after page load for a certain site" -- ignoring iframes, then just use the following code as a base-template for all of your scripts:
// ==UserScript==// @name _Base template for simple, cross-browser, JS injection.// @match *://YOUR_SERVER.COM/YOUR_PATH/*// @run-at document-start// ==/UserScript==if (window.top != window.self) //-- Don't run on frames or iframes. return;function scriptMain () { // PUT ALL OF YOUR CODE HERE, INCLUDING ANY FUNCTIONS YOU CREATE. console.log ("Hello World!");}window.addEventListener ("load", scriptMainLoader, false);function scriptMainLoader () { addJS_Node (null, null, scriptMain);}function addJS_Node (text, s_URL, funcToRun) { var D = document; var scriptNode = D.createElement ('script'); scriptNode.type = "text/javascript"; if (text) scriptNode.textContent = text; if (s_URL) scriptNode.src = s_URL; if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()'; var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement; targ.appendChild (scriptNode);}
Note that the @run-at document-start
is required (for Chrome) but your code will still fire at document load.