[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/ -> autosave.js (summary)

(no description)

File Size: 903 lines (22 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 30 functions

  autosave()
  setInitialCompare()
  getPostData()
  getCompareString()
  disableButtons()
  enableButtons()
  getEditor()
  autosaveLocal()
  checkStorage()
  getStorage()
  setStorage()
  getSavedPostData()
  setData()
  suspend()
  resume()
  save()
  run()
  compare()
  removeSpaces()
  checkPost()
  restorePost()
  autosaveServer()
  tempBlockSave()
  suspend()
  resume()
  response()
  triggerSave()
  postChanged()
  save()
  _schedule()

Functions
Functions that are not part of a class:

autosave()   X-Ref
Auto saves the post.

return: {Object}

setInitialCompare()   X-Ref
Sets the initial compare data.


getPostData( type )   X-Ref
Returns the data saved in both local and remote autosave.

param: {string} type The type of autosave either local or remote.
return: {Object} Object containing the post data.

getCompareString( postData )   X-Ref
Concatenates the title, content and excerpt. This is used to track changes
when auto-saving.

param: {Object} postData The object containing the post data.
return: {string} A concatenated string with title, content and excerpt.

disableButtons()   X-Ref
Disables save buttons.

return: {void}

enableButtons()   X-Ref
Enables save buttons.

return: {void}

getEditor()   X-Ref
Gets the content editor.

return: {boolean|*} Returns either false if the editor is undefined,

autosaveLocal()   X-Ref
Autosave in localStorage.

return: {

checkStorage()   X-Ref
Checks if the browser supports sessionStorage and it's not disabled.

return: {boolean} True if the sessionStorage is supported and enabled.

getStorage()   X-Ref
Initializes the local storage.

return: {boolean|Object} False if no sessionStorage in the browser or an Object

setStorage( stored_obj )   X-Ref
Sets the storage for this blog. Confirms that the data was saved
successfully.

return: {boolean} True if the data was saved successfully, false if it wasn't saved.

getSavedPostData()   X-Ref
Gets the saved post data for the current post.

return: {boolean|Object} False if no storage or no data or the postData as an Object.

setData( stored_data )   X-Ref
Sets (save or delete) post data in the storage.

If stored_data evaluates to 'false' the storage key for the current post will be removed.

param: {Object|boolean|null} stored_data The post data to store or null/false/empty to delete the key.
return: {boolean} True if data is stored, false if data was removed.

suspend()   X-Ref
Sets isSuspended to true.

return: {void}

resume()   X-Ref
Sets isSuspended to false.

return: {void}

save( data )   X-Ref
Saves post data for the current post.

Runs on a 15 seconds interval, saves when there are differences in the post title or content.
When the optional data is provided, updates the last saved post data.

param: {Object} data The post data for saving, minimum 'post_title' and 'content'.
return: {boolean} Returns true when data has been saved, otherwise it returns false.

run()   X-Ref
Initializes the auto save function.

Checks whether the editor is active or not to use the editor events
to autosave, or uses the values from the elements to autosave.

Runs on DOM ready.

return: {void}

compare( str1, str2 )   X-Ref
Compares 2 strings. Removes whitespaces in the strings before comparing them.

param: {string} str1 The first string.
param: {string} str2 The second string.
return: {boolean} True if the strings are the same.

removeSpaces( string )   X-Ref
No description

checkPost()   X-Ref
Checks if the saved data for the current post (if any) is different than the
loaded post data on the screen.

Shows a standard message letting the user restore the post data if different.

return: {void}

restorePost( postData )   X-Ref
Restores the current title, content and excerpt from postData.

param: {Object} postData The object containing all post data.
return: {boolean} True if the post is restored.

autosaveServer()   X-Ref
Auto saves the post on the server.

return: {Object} {

tempBlockSave()   X-Ref
Blocks saving for the next 10 seconds.

return: {void}

suspend()   X-Ref
Sets isSuspended to true.

return: {void}

resume()   X-Ref
Sets isSuspended to false.

return: {void}

response( data )   X-Ref
Triggers the autosave with the post data.

param: {Object} data The post data.
return: {void}

triggerSave()   X-Ref
Saves immediately.

Resets the timing and tells heartbeat to connect now.

return: {void}

postChanged()   X-Ref
Checks if the post content in the textarea has changed since page load.

This also happens when TinyMCE is active and editor.save() is triggered by
wp.autosave.getPostData().

return: {boolean} True if the post has been changed.

save()   X-Ref
Checks if the post can be saved or not.

If the post hasn't changed or it cannot be updated,
because the autosave is blocked or suspended, the function returns false.

return: {Object} Returns the post data.

_schedule()   X-Ref
Sets the next run, based on the autosave interval.

return: {void}



Generated : Thu Mar 28 08:20:01 2024 Cross-referenced by PHPXref