User:Smallman12q/test2.user.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Smallman12q/test2.user. |
// ==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 = "<html><head><title>New Document</title></head><body>Hello, world</body></html>";
oNewDoc.writeln("<html>");
oNewDoc.writeln("<head>");
oNewDoc.writeln("<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\">");
oNewDoc.writeln("<title>Title 1<\/title>");
oNewDoc.writeln("<\/head>");
oNewDoc.writeln("<frameset rows=\"177,*\">");
oNewDoc.writeln(" <frame name=\"banner_frame\" scrolling=\"no\" noresize=\"noresize\" src=\"http:\/\/en.wikipedia.org\/w\/index.php?action=raw&ctype=text\/javascript&title=User:Smallman12q\/htmltest\">");
oNewDoc.writeln(" <frameset cols=\"50%,50%\">");
oNewDoc.writeln(" <frame name=\"refer_frame\" src=\"http:\/\/en.wikipedia.org\/wiki\/HTTP_referrer\" scrolling=\"auto\">");
oNewDoc.writeln(" <frame name=\"target_frame\" src=\"http:\/\/en.wikipedia.org\/wiki\/Target_shooting\" scrolling=\"auto\">");
oNewDoc.writeln(" <\/frameset>");
oNewDoc.writeln(" <noframes>");
oNewDoc.writeln(" <body>");
oNewDoc.writeln("");
oNewDoc.writeln(" <p>This page uses frames, but your browser doesn'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 = "<html><head><title>New Document</title></head><body>Hello, world</body></html>";
oNewDoc.writeln("<html>");
oNewDoc.writeln("<head>");
oNewDoc.writeln("<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\">");
oNewDoc.writeln("<title>Title 1<\/title>");
oNewDoc.writeln("<\/head>");
oNewDoc.writeln("<frameset rows=\"177,*\">");
oNewDoc.writeln(" <frame name=\"banner_frame\" scrolling=\"no\" noresize=\"noresize\" src=\"Test_table.html\">");
oNewDoc.writeln(" <frameset cols=\"50%,50%\">");
oNewDoc.writeln(" <frame name=\"refer_frame\" src=\"http:\/\/en.wikipedia.org\/wiki\/HTTP_referrer\" scrolling=\"auto\">");
oNewDoc.writeln(" <frame name=\"target_frame\" src=\"http:\/\/en.wikipedia.org\/wiki\/Target_shooting\" scrolling=\"auto\">");
oNewDoc.writeln(" <\/frameset>");
oNewDoc.writeln(" <noframes>");
oNewDoc.writeln(" <body>");
oNewDoc.writeln("");
oNewDoc.writeln(" <p>This page uses frames, but your browser doesn'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);