[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

(no description)

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

Defines 29 functions

  autosave()
  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.

returns: {Object}
since: 3.9.0

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

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

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

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

disableButtons()   X-Ref
Disables save buttons.

returns: {void}
since: 3.9.0

enableButtons()   X-Ref
Enables save buttons.

returns: {void}
since: 3.9.0

getEditor()   X-Ref
Gets the content editor.

returns: {boolean|*} Returns either false if the editor is undefined,
since: 4.6.0

autosaveLocal()   X-Ref
Autosave in localStorage.

returns: {
since: 3.9.0

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

returns: {boolean} True if the sessionStorage is supported and enabled.
since: 3.9.0

getStorage()   X-Ref
Initializes the local storage.

returns: {boolean|Object} False if no sessionStorage in the browser or an Object
since: 3.9.0

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

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

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

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

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.

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

suspend()   X-Ref
Sets isSuspended to true.

returns: {void}
since: 3.9.0

resume()   X-Ref
Sets isSuspended to false.

returns: {void}
since: 3.9.0

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

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

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

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.

returns: {void}
since: 3.9.0

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

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

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.

returns: {void}
since: 3.9.0

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

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

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

returns: {Object} {
since: 3.9.0

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

returns: {void}
since: 3.9.0

suspend()   X-Ref
Sets isSuspended to true.

returns: {void}
since: 3.9.0

resume()   X-Ref
Sets isSuspended to false.

returns: {void}
since: 3.9.0

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

returns: {void}
since: 3.9.0
param: {Object} data The post data.

triggerSave()   X-Ref
Saves immediately.

Resets the timing and tells heartbeat to connect now.

returns: {void}
since: 3.9.0

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.
since: 3.9.0

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.

returns: {Object} Returns the post data.
since: 3.9.0

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

returns: {void}
since: 3.9.0



Generated: Mon Sep 16 01:00:03 2019 Cross-referenced by PHPXref 0.7.1