Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holtzermann17/450418 to your computer and use it in GitHub Desktop.
Save holtzermann17/450418 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Step41
// @namespace http://metameso.org/
// @description Now an iframe appears -- literally with every page!
// @include *
// @exclude http://metameso.org:9000/*
// @version 0.1
// ==/UserScript==
// We do something here to modify the CSS of the main page.
GM_addStyle("body { float: left; width: 40%; }");
// Now create a new iframe
var newTop = document.createElement("iframe");
newTop.setAttribute("id", "addedPad");
newTop.setAttribute("name", "addedPad");
newTop.setAttribute("frameborder", "yes");
newTop.setAttribute("height", "800px");
newTop.setAttribute("width", "40%");
newTop.setAttribute("scrolling", "auto");
newTop.setAttribute("style", "float: right;");
newTop.setAttribute("src", "http://metameso.org:9000/" +
window.location.href.replace(/\//gi,"-"));
// Put it into the DOM
document.documentElement.appendChild(newTop);
// ==UserScript==
// @name Step41
// @namespace http://metameso.org/
// @description Now an iframe appears -- literally with every page!
// @include *
// @exclude http://metameso.org:9000/*
// @version 0.1
// ==/UserScript==
// We do something here to modify the CSS of the main page.
// Note that this is a bit sloppy, in that ideally we would reroute
// the main page into an iframe of its own, to keep things cleaner.
GM_addStyle("body { float: left; width: 50%; }");
// Now create a new iframe
var newTop = document.createElement("iframe");
newTop.setAttribute("id", "addedPad");
newTop.setAttribute("name", "addedPad");
newTop.setAttribute("frameborder", "yes");
newTop.setAttribute("height", "887px");
newTop.setAttribute("width", "40%");
newTop.setAttribute("style", "float: right; position: fixed; z-index: 9999; right: 1px;");
newTop.setAttribute("src", "http://metameso.org:9000/" +
window.location.href.replace(/\//gi,"-"));
// Put it into the DOM
document.documentElement.appendChild(newTop);
// ==UserScript==
// @name Step41
// @namespace http://metameso.org/
// @description Now an iframe appears -- literally with every page!
// @exclude *li101-104.members.linode.com*
// @exclude *doc.etherpad.org*
// @exclude about:blank
// @version 0.1
// ==/UserScript==
// It seems necessary to exclude most versions of
// Etherpad, apparently because an extra iframe triggers
// greasemonkey.
// We do something here to modify the CSS of the main page.
// Note that this is a bit sloppy, in that ideally we would reroute
// the main page into an iframe of its own, to keep things cleaner.
GM_addStyle("body { float: left; width: 50%; }");
// Now create a new iframe
var newTop = document.createElement("iframe");
newTop.setAttribute("id", "addedPad");
newTop.setAttribute("name", "addedPad");
newTop.setAttribute("frameborder", "yes");
newTop.setAttribute("height", "887px");
newTop.setAttribute("width", "40%");
newTop.setAttribute("style", "float: right; position: fixed; z-index: 9999; right: 1px;");
newTop.setAttribute("src", "http://li101-104.members.linode.com:9000/" +
window.location.href.replace(/\//gi,"-"));
// Put it into the DOM
document.documentElement.appendChild(newTop);
// ==UserScript==
// @name Step41
// @namespace http://metameso.org/
// @description Now an iframe appears -- literally with every page!
// @exclude *metameso.org*
// @exclude *doc.etherpad.org*
// @exclude about:blank
// @version 0.1
// ==/UserScript==
// It seems necessary to exclude most versions of
// Etherpad, apparently because an extra iframe triggers
// greasemonkey.
// We do something here to modify the CSS of the main page.
// Note that this is a bit sloppy, in that ideally we would reroute
// the main page into an iframe of its own, to keep things cleaner.
GM_addStyle("body { float: left; width: 50%; }");
// Now create a new iframe
var newTop = document.createElement("iframe");
newTop.setAttribute("id", "addedPad");
newTop.setAttribute("name", "addedPad");
newTop.setAttribute("frameborder", "yes");
newTop.setAttribute("height", "887px");
newTop.setAttribute("width", "40%");
newTop.setAttribute("style", "float: right; position: fixed; z-index: 9999; right: 1px;");
newTop.setAttribute("src", "http://metameso.org:9000/" +
window.location.href.replace(/\//gi,"-"));
// Put it into the DOM
document.documentElement.appendChild(newTop);
@holtzermann17
Copy link
Author

Added another version since I've improved CSS handling a bit.

@holtzermann17
Copy link
Author

Yet another since I decided to switch etherpad host servers. Also noticed weird behaviour on doc.etherpad.org so I turned the script off for that site. And note that the 2b version solves a problem discussed at http://gist.github.com/452929.

@holtzermann17
Copy link
Author

I've been experimenting with getting [[wiki-style links]] to open in the iframe defined by greasemonkey.
So far, no success.

I found some relevant notes at http://stackoverflow.com/questions/899258/why-wont-an-html-form-load-into-a-javascript-created-iframe

@holtzermann17
Copy link
Author

This provides another possible solution for browsers that support css3... http://www.w3.org/TR/css3-hyperlinks/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment