includes/clientside/static/ajax.js
changeset 827 2c20563245b2
parent 823 4596c40aaa94
child 869 58bc29c14a4d
--- a/includes/clientside/static/ajax.js	Sun Jan 25 21:20:14 2009 -0500
+++ b/includes/clientside/static/ajax.js	Sun Jan 25 21:21:07 2009 -0500
@@ -13,7 +13,7 @@
   enableUnload();
   setAjaxLoading();
   var redir = ( disable_redirect ) ? '&redirect=no' : '';
-  ajaxGet(append_sid(scriptPath + '/ajax.php?title=' + physical_title +'&_mode=getpage&noheaders' + redir), function() {
+  ajaxGet(append_sid(scriptPath + '/ajax.php?title=' + physical_title +'&_mode=getpage&noheaders' + redir), function(ajax) {
     // Allow for 404 here, it's generated by the "page not found" error message
     // (even with noheaders specified, probably should be fixed)
     if ( ajax.readyState == 4 && ( ajax.status == 200 || ajax.status == 404 ) ) {
@@ -50,7 +50,7 @@
   document.getElementById('protbtn_1').style.textDecoration = 'none';
   document.getElementById('protbtn_2').style.textDecoration = 'none';
   document.getElementById('protbtn_'+l).style.textDecoration = 'underline';
-  ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+ajaxEscape(r)+'&level='+l, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+ajaxEscape(r)+'&level='+l, function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       if(ajax.responseText == 'good')
@@ -177,7 +177,7 @@
   whiteout.style.width = ( $dynano(whiteout).Width() - 78 ) + 'px';
   whiteout.style.left = ( $dynano(whiteout).Left() + 44 ) + 'px';
   
-  ajaxPost(stdAjaxPrefix + '&_mode=rename', 'newtitle=' + ajaxEscape(newname), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=rename', 'newtitle=' + ajaxEscape(newname), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -367,7 +367,7 @@
   
   // tenemos la confirmación y la razón - borre la página.
   setAjaxLoading();
-  ajaxPost(stdAjaxPrefix + '&_mode=deletepage', 'reason=' + ajaxEscape(trim(reason.value)), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=deletepage', 'reason=' + ajaxEscape(trim(reason.value)), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -424,7 +424,7 @@
           {
             miniPromptDestroy(this);
             setAjaxLoading();
-            ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() {
+            ajaxGet(stdAjaxPrefix+'&_mode=delvote', function(ajax) {
               if ( ajax.readyState == 4 && ajax.status == 200 ) {
                 unsetAjaxLoading();
                 alert(ajax.responseText);
@@ -464,7 +464,7 @@
           {
             miniPromptDestroy(this);
             setAjaxLoading();
-            ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() {
+            ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function(ajax) {
               if ( ajax.readyState == 4 && ajax.status == 200 ) {
                 unsetAjaxLoading();
                 alert(ajax.responseText);
@@ -499,7 +499,7 @@
   if ( KILL_SWITCH )
     return true;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=catedit', function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=catedit', function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -526,7 +526,7 @@
   }
   setAjaxLoading();
   query = query.substring(1, query.length);
-  ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -544,7 +544,7 @@
   if ( KILL_SWITCH )
     return true;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=histlist', function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=histlist', function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -562,7 +562,7 @@
     return true;
   if(!ttl) ttl=title;
   setAjaxLoading();
-  ajaxGet(append_sid(scriptPath+'/ajax.php?title='+ttl+'&_mode=getpage&oldid='+oldid), function() {
+  ajaxGet(append_sid(scriptPath+'/ajax.php?title='+ttl+'&_mode=getpage&oldid='+oldid), function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -576,7 +576,7 @@
   if ( KILL_SWITCH )
     return true;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       
@@ -629,7 +629,7 @@
           {
             miniPromptDestroy(this);
             setAjaxLoading();
-            ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() {
+            ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function(ajax) {
               if ( ajax.readyState == 4 && ajax.status == 200 ) {
                 unsetAjaxLoading();
                 alert(ajax.responseText);
@@ -721,7 +721,7 @@
   }
   if(!id1 || !id2) { alert('BUG: Couldn\'t get checked radiobutton state'); return; }
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function()
+  ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -765,12 +765,11 @@
   {
     return null;
   }
-  ajaxGet(stdAjaxPrefix + '&_mode=getstyles&id=' + id, function() {
+  ajaxGet(stdAjaxPrefix + '&_mode=getstyles&id=' + id, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         // IE doesn't like substr() on ajax.responseText
-        var response = String(ajax.responseText + ' ');
-        response = response.substr(0, response.length - 1);
+        var response = String(ajax.responseText + '');
         if ( response.substr(0,1) != '[' )
         {
           alert('Invalid or unexpected JSON response from server:\n' + response);
@@ -839,7 +838,7 @@
     return true;
   }
   
-  ajaxPost(stdAjaxPrefix + '&_mode=change_theme', 'theme_id=' + ajaxEscape(theme_id) + '&style_id=' + ajaxEscape(style_id), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=change_theme', 'theme_id=' + ajaxEscape(theme_id) + '&style_id=' + ajaxEscape(style_id), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -885,7 +884,7 @@
   load_component('crypto');
   pass = hex_sha1(document.getElementById('mdgPassSetField').value);
   setAjaxLoading();
-  ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function()
+  ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function(ajax)
     {
       unsetAjaxLoading();
       if ( ajax.readyState == 4 && ajax.status == 200 )
@@ -910,7 +909,7 @@
   }
   $killdiv.object.innerHTML = '<img alt="Loading..." src="' + scriptPath + '/images/loading-big.gif" /><br />Making request...';
   var url = makeUrlNS('Admin', 'Home', 'src=ajax');
-  ajaxPost(url, 'act=kill_php', function() {
+  ajaxPost(url, 'act=kill_php', function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         if ( ajax.responseText == '1' )
@@ -941,7 +940,7 @@
   if ( KILL_SWITCH )
     return false;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix + '&_mode=get_tags', function()
+  ajaxGet(stdAjaxPrefix + '&_mode=get_tags', function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1039,7 +1038,7 @@
   addtag_nukeme = nukeme;
   tag = ajaxEscape(tag);
   setAjaxLoading();
-  ajaxPost(stdAjaxPrefix + '&_mode=addtag', 'tag=' + tag, function()
+  ajaxPost(stdAjaxPrefix + '&_mode=addtag', 'tag=' + tag, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1111,7 +1110,7 @@
     if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == $lang.get('tags_btn_add_tag'))
       writeNoTags = true;
     
-  ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1159,7 +1158,7 @@
 
 window.ajaxPingServer = function()
 {
-  ajaxGet(stdAjaxPrefix + '&_mode=ping', function()
+  ajaxGet(stdAjaxPrefix + '&_mode=ping', function(ajax)
     {
     });
 }
@@ -1221,7 +1220,7 @@
   img.src = cdnPath + '/images/loading.gif';
   img.alt = 'Loading...';
   target.appendChild(img);
-  ajaxGet(makeUrlNS('Admin', 'Home/updates.xml'), function()
+  ajaxGet(makeUrlNS('Admin', 'Home/updates.xml'), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1441,7 +1440,7 @@
       mode: action,
       plugin: plugin_filename
     });
-  ajaxPost(makeUrlNS('Admin', 'PluginManager/action.json'), 'r=' + ajaxEscape(request), function()
+  ajaxPost(makeUrlNS('Admin', 'PluginManager/action.json'), 'r=' + ajaxEscape(request), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1502,7 +1501,7 @@
   else var ipaddr = o.innerHTML;
   rDnsObj = o;
   rDnsBannerObj = bannerOn('Retrieving reverse DNS info...');
-  ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         off = fetch_offset(rDnsObj);