User:Smallman12q/test2.user.js

// ==UserScript== // @name          Red Link Recovery // @namespace     http://www.google.com // @description   A test // @include       https://secure.wikimedia.org/wikipedia/en/wiki/User:Smallman12q/test // @include       http://en.wikipedia.org/wiki/User:Smallman12q/test // @include       http://www.google.com/ // ==/UserScript== //http://wiki.github.com/Martii/greasemonkey/unsafewindow function myScript {	var answer = confirm ("Would you like to load the Red Link Recovery Tool now?\nPres 'OK' to load\nPress 'Cancel' to not load") if (answer) {		alert ("I'll load it now."); document.body.innerHTML = '';//clear the page alert("going to write"); try {   var oNewDoc = document.open("text/html", "replace"); var sMarkup = "  New Document   Hello, world  "; oNewDoc.writeln(" "); oNewDoc.writeln(" "); oNewDoc.writeln(""); oNewDoc.writeln(" Title 1<\/title>"); oNewDoc.writeln("<\/head>"); oNewDoc.writeln(""); oNewDoc.writeln("	"); oNewDoc.writeln("	"); oNewDoc.writeln("		"); oNewDoc.writeln("		"); oNewDoc.writeln("	<\/frameset>"); oNewDoc.writeln("	 "); oNewDoc.writeln("	 "); oNewDoc.writeln(""); oNewDoc.writeln("	 This page uses frames, but your browser doesn&#39;t support them.<\/p>"); oNewDoc.writeln(""); oNewDoc.writeln("	<\/body>"); oNewDoc.writeln("	<\/noframes>"); oNewDoc.writeln("<\/frameset>"); oNewDoc.writeln(""); oNewDoc.writeln("<\/html>"); oNewDoc.writeln(""); oNewDoc.close; }               catch(err) {                   alert("Error:" + err.description); }               alert("finished write"); }	//else //	alert ("Darn. Well, keep trying then.") //for (var x in document) { /* some code with x */ //} /* some code */ }

function writein {   alert("writing"); var oNewDoc = document.open("text/html", "replace"); var sMarkup = "  New Document   Hello, world  "; oNewDoc.writeln(" "); oNewDoc.writeln(" "); oNewDoc.writeln(""); oNewDoc.writeln(" Title 1<\/title>"); oNewDoc.writeln("<\/head>"); oNewDoc.writeln(""); oNewDoc.writeln("	"); oNewDoc.writeln("	"); oNewDoc.writeln("		"); oNewDoc.writeln("		"); oNewDoc.writeln("	<\/frameset>"); oNewDoc.writeln("	 "); oNewDoc.writeln("	 "); oNewDoc.writeln(""); oNewDoc.writeln("	 This page uses frames, but your browser doesn&#39;t support them.<\/p>"); oNewDoc.writeln(""); oNewDoc.writeln("	<\/body>"); oNewDoc.writeln("	<\/noframes>"); oNewDoc.writeln("<\/frameset>"); oNewDoc.writeln(""); oNewDoc.writeln("<\/html>"); oNewDoc.writeln(""); oNewDoc.close; alert("written");

}

/* Attaches script into page body and executes it via an anonymous function call. NOTES: Script can therefore reference variables on the page, but likewise cannot use Greasemonkey API methods var script = document.createElement("script"); script.type = "application/javascript"; script.textContent = "(" + myScript + ");";

document.body.appendChild(script);