// ==UserScript== // @name SENv4 AJAX Shoutbox // @namespace http://doodle77.dyndns.org/ // @description replace normal SEN shoutbox with AJAX one. // @include http://*staredit.net/index.php* // ==/UserScript== var tmp = document.getElementsByTagName('iframe')[0].contentDocument.innerHTML; document.getElementById('fo_dsbglobal').innerHTML = '
"+ ''; function makeRequest(url,method,postdata) { var http_request = false; http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/plain'); // See note below about this line } http_request.onreadystatechange = function() { if (http_request.readyState == 4) { if (http_request.status == 200) { document.getElementById('shoutarea').innerHTML = http_request.responseText; } else { alert('There was a problem with the request.'); } } }; http_request.open(method, url, true); http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); http_request.send(postdata); } function getid(id) {return document.getElementById(id);} getid('globsb').addEventListener('submit',function() { if (document.getElementById('boxthing').value != "") { makeRequest('http://www.staredit.net/index.php?act=Shoutbox','POST','status=add&viewing=global&Color=white&add_shout=shout&my_shout='+escape(document.getElementById('boxthing').value)); document.getElementById('boxthing').value = ""; } },false); getid('refresh-button').addEventListener('click',function() { makeRequest('http://www.staredit.net/index.php?act=Shoutbox&view=globalshouts','GET',''); document.getElementById('refresh-button').disabled = true; setTimeout("document.getElementById('refresh-button').disabled = false",2000); },false); getid('refresh-button').click();