Make WordPress Core

Changeset 23683 for trunk/wp-login.php


Ignore:
Timestamp:
03/13/2013 10:08:16 AM (12 years ago)
Author:
azaozz
Message:

Autosave to the browser's sessionStorage, compare this autosave to the post content on page load and let the user restore it when the data is not the same. First run, see #23220

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r23625 r23683  
    6767    if ( wp_is_mobile() ) { ?>
    6868        <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" /><?php
     69    }
     70
     71    // Remove all stored post data on logging out.
     72    // This could be added by add_action('login_head'...) like wp_shake_js()
     73    // but maybe better if it's not removable by plugins
     74    if ( 'loggedout' == $wp_error->get_error_code() ) {
     75        ?>
     76        <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
     77        <?php
    6978    }
    7079
Note: See TracChangeset for help on using the changeset viewer.