includes/clientside/static/editor.js
changeset 407 35d94240a197
parent 405 adb7f8de8ce1
child 408 7ecbe721217c
equal deleted inserted replaced
406:7468a663315f 407:35d94240a197
    52   selectButtonMinor('edit');
    52   selectButtonMinor('edit');
    53   selectButtonMajor('article');
    53   selectButtonMajor('article');
    54   setAjaxLoading();
    54   setAjaxLoading();
    55   ajaxGet(stdAjaxPrefix + '&_mode=getsource', function()
    55   ajaxGet(stdAjaxPrefix + '&_mode=getsource', function()
    56     {
    56     {
    57       if ( ajax.readyState == 4 )
    57       if ( ajax.readyState == 4 && ajax.status == 200 )
    58       {
    58       {
    59         unsetAjaxLoading();
    59         unsetAjaxLoading();
    60         
    60         
    61         var response = String(ajax.responseText + '');
    61         var response = String(ajax.responseText + '');
    62         if ( response.substr(0, 1) != '{' )
    62         if ( response.substr(0, 1) != '{' )
   441   }
   441   }
   442   
   442   
   443   json_packet = ajaxEscape(toJSONString(json_packet));
   443   json_packet = ajaxEscape(toJSONString(json_packet));
   444   ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function()
   444   ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function()
   445     {
   445     {
   446       if ( ajax.readyState == 4 )
   446       if ( ajax.readyState == 4 && ajax.status == 200 )
   447       {
   447       {
   448         ajaxUnSetEditorLoading();
   448         ajaxUnSetEditorLoading();
   449         var response = String(ajax.responseText + '');
   449         var response = String(ajax.responseText + '');
   450         if ( response.substr(0, 1) != '{' )
   450         if ( response.substr(0, 1) != '{' )
   451         {
   451         {
   497           editor_open = false;
   497           editor_open = false;
   498           enableUnload();
   498           enableUnload();
   499           changeOpac(0, 'ajaxEditContainer');
   499           changeOpac(0, 'ajaxEditContainer');
   500           ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function()
   500           ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function()
   501             {
   501             {
   502               if ( ajax.readyState == 4 )
   502               if ( ajax.readyState == 4 && ajax.status == 200 )
   503               {
   503               {
   504                 unsetAjaxLoading();
   504                 unsetAjaxLoading();
   505                 selectButtonMajor('article');
   505                 selectButtonMajor('article');
   506                 unselectAllButtonsMinor();
   506                 unselectAllButtonsMinor();
   507                 
   507                 
   524   {
   524   {
   525     opacity('enano_editor_preview', 100, 0, 500);
   525     opacity('enano_editor_preview', 100, 0, 500);
   526   }
   526   }
   527   ajaxPost(stdAjaxPrefix + '&_mode=preview', 'text=' + ta_content, function()
   527   ajaxPost(stdAjaxPrefix + '&_mode=preview', 'text=' + ta_content, function()
   528     {
   528     {
   529       if ( ajax.readyState == 4 )
   529       if ( ajax.readyState == 4 && ajax.status == 200 )
   530       {
   530       {
   531         ajaxUnSetEditorLoading();
   531         ajaxUnSetEditorLoading();
   532         changeOpac(0, 'enano_editor_preview');
   532         changeOpac(0, 'enano_editor_preview');
   533         $('enano_editor_preview').object.innerHTML = ajax.responseText;
   533         $('enano_editor_preview').object.innerHTML = ajax.responseText;
   534         window.location.hash = '#ajax_preview';
   534         window.location.hash = '#ajax_preview';
   549 function ajaxEditorRevertToLatestReal()
   549 function ajaxEditorRevertToLatestReal()
   550 {
   550 {
   551   ajaxSetEditorLoading();
   551   ajaxSetEditorLoading();
   552   ajaxGet(stdAjaxPrefix + '&_mode=getsource', function()
   552   ajaxGet(stdAjaxPrefix + '&_mode=getsource', function()
   553     {
   553     {
   554       if ( ajax.readyState == 4 )
   554       if ( ajax.readyState == 4 && ajax.status == 200 )
   555       {
   555       {
   556         ajaxUnSetEditorLoading();
   556         ajaxUnSetEditorLoading();
   557         
   557         
   558         var response = String(ajax.responseText + '');
   558         var response = String(ajax.responseText + '');
   559         if ( response.substr(0, 1) != '{' )
   559         if ( response.substr(0, 1) != '{' )
   599   {
   599   {
   600     opacity('enano_editor_preview', 100, 0, 500);
   600     opacity('enano_editor_preview', 100, 0, 500);
   601   }
   601   }
   602   ajaxPost(stdAjaxPrefix + '&_mode=diff_cur', 'text=' + ta_content, function()
   602   ajaxPost(stdAjaxPrefix + '&_mode=diff_cur', 'text=' + ta_content, function()
   603     {
   603     {
   604       if ( ajax.readyState == 4 )
   604       if ( ajax.readyState == 4 && ajax.status == 200 )
   605       {
   605       {
   606         ajaxUnSetEditorLoading();
   606         ajaxUnSetEditorLoading();
   607         changeOpac(0, 'enano_editor_preview');
   607         changeOpac(0, 'enano_editor_preview');
   608         $('enano_editor_preview').object.innerHTML = ajax.responseText;
   608         $('enano_editor_preview').object.innerHTML = ajax.responseText;
   609         window.location.hash = '#ajax_preview';
   609         window.location.hash = '#ajax_preview';