User:Wasted Time R/scripts/jlstest.js

/* User:Wasted Time R/scripts/jlstest.js */

function jlstest { //var apiurl = mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml'; //var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null; //xmlhttp.open('GET',apiurl, false); //xmlhttp.send(null); //alert(xmlhttp.responseXML.getElementById('14').childNodes[0].nodeValue);

var txt = document.editform.wpTextbox1.value; var sortkey = ''; // Save the position of the editbox scrollbar var scrollPosition = document.editform.wpTextbox1.scrollTop; if (!txt.match("External")) { alert('There\'s no External section to change!'); return; }    // Now that we know that everything is OK, we can proceed with modifying the content of External txt = txt.replace("External","Externaljls"); document.editform.wpTextbox1.value=txt; // Restore scroll position document.editform.wpTextbox1.scrollTop = scrollPosition; }

addOnloadHook(function {  if(document.forms.editform) {    mw.util.addPortletLink('p-cactions', 'javascript:jlstest', 'jlstest', 'ca-jlstest', , , document.getElementById('ca-purge'));  } });

/* */