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/450398 to your computer and use it in GitHub Desktop.
Save holtzermann17/450398 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Step31
// @namespace http://metameso.org/
// @description An iframe appears, but it doesn't contain anything useful.
// @include *
// @exclude http://metameso.org:9000/*
// @version 0.1
// ==/UserScript==
(function() {
// binding to the ESC key.
document.addEventListener("keypress", function(e) {
if(!e) e=window.event;
var key = e.keyCode ? e.keyCode : e.which;
if ( key === 27 ) {
alert("You're browsing \n"+window.location);
// 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");
// Put it into the DOM
document.documentElement.appendChild(newTop);
GM_xmlhttpRequest({
method: 'GET',
url: 'http://metameso.org:9000/landing',
onload: function(responseDetails)
{ console.log({responseDetails: responseDetails});
var oDiv = document.createElement('div');
oDiv.setAttribute('id', 'outsideWorld');
oDiv.setAttribute('name', 'outsideWorld');
oDiv.innerHTML = responseDetails.responseText;
var destination = document.getElementById('addedPad');
destination.appendChild(oDiv);
}
});
}
}, true);
})();
@holtzermann17
Copy link
Author

What I'm going for:

I want to create an iframe associated with the URL I'm browsing, and stick an etherpad in it.

What I've gotten to so far:

I can create an iframe, but I can't get anything to appear in it!

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