Difference between revisions of "MediaWiki:Edittools.js"

From Learning Languages Through Video Games
Jump to navigationJump to search
Line 1: Line 1:
 
function runFixer(fixer) {
 
function runFixer(fixer) {
     var textarea = $j('#wpTextbox1')[0];
+
     var textarea = document.getElementById('wpTextbox1');
 
     if(textarea.selectionStart === undefined) {
 
     if(textarea.selectionStart === undefined) {
         alert("Looks like the fixers won't work on your browser...");
+
         alert("Looks like the fixers won't work in this browser. If you're running Internet Explorer, well, that's why.");
 +
        return;
 
     }
 
     }
 
     var sel_start = textarea.selectionStart;
 
     var sel_start = textarea.selectionStart;

Revision as of 02:05, 20 October 2010

function runFixer(fixer) {
    var textarea = document.getElementById('wpTextbox1');
    if(textarea.selectionStart === undefined) {
        alert("Looks like the fixers won't work in this browser. If you're running Internet Explorer, well, that's why.");
        return;
    }
    var sel_start = textarea.selectionStart;
    var sel_end = textarea.selectionEnd;
    var selected_text = textarea.value;
    fixer();
}

function fixJp(text) {
    //alert("Hey, what's your problem? I said this stuff isn't working yet!");
    alert(text);
}

addOnloadHook(function() {
    $j('#fixer-jp').append("<input type='submit' onclick='runFixer(fixJp); return false' value='Tempt Fate' />");
});