Created
June 23, 2010 19:03
-
-
Save holtzermann17/450398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!