User:RandomStringOfCharacters/Scripts/test.js

var api = sajax_init_object; api.open('GET', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Defcon&action=render', true); api.onreadystatechange = show_result; api.send(null); var response_var = 'Fetching...'; // handle response function show_result(_api) { if(_api.readyState==4) { if(_api.status==200) alert('The remote page contains:\n' + _api.responseText); else alert('The query returned an error.'); }

var link_div = document.createElement('div'); link_div.className = 'body'; var div = document.createElement('div'); div.setAttribute('id', 'p-testdefcon'); div.className = 'portal'; var heading = document.createElement('h5'); heading.appendChild(document.createTextNode('Defcon')); div.appendChild(heading); div.appendChild(link_div); // enable link var p = document.createElement('p'); p.style.fontSize = 'x-small'; p.style.margin = '0px'; var a = document.createElement('a'); a.appendChild(document.createTextNode(response_var)); p.appendChild(a); link_div.appendChild(p); // now replace the div var old_div = document.getElementById('p-testdefcon'); if (old_div != null) { document.getElementById('panel').replaceChild(div, old_div); } else {

var node = document.getElementById('p-interaction'); document.getElementById('panel').insertBefore(div, node); } }