Rolling back auto-save

git-svn-id: https://develop.svn.wordpress.org/trunk@2559 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2005-04-20 19:19:07 +00:00
parent beb8bbab56
commit ce64ce057d
2 changed files with 0 additions and 80 deletions

View File

@ -9,11 +9,5 @@
<?php do_action('admin_footer', ''); ?>
<?php if ( isset( $editing ) ) : ?>
<script type="text/javascript">
WhenLoaded();
</script>
<?php endif; ?>
</body>
</html>

View File

@ -78,80 +78,6 @@ function blurry() {
window.onload = blurry;
<?php endif; ?>
<?php if ( isset( $editing ) ) : ?>
var elem;
var eID = 'content';
var cID = 'twWPAutoSave';
function createCookie(name,value,days){
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + escape(value ) + expires + "; path=/";
}
function eraseCookie(name){
createCookie(name,"",-1);
}
function readCookie(name)
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1)
{
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
function KeyPressEvent(event){
if (document.all) {
event = window.event;
}
if (event.which){
key = event.which;
} else {
key = event.keyCode;
}
createCookie(cID,elem.value, 7)
}
function WhenLoaded(){
var postdiv;
if (postdiv = document.getElementById('poststuff')){
var data = postdiv.innerHTML
var index = data.indexOf('<p class="submit">') + 18;
var after = data.substring(index);
var before = data.substring(0, index);
postdiv.innerHTML = before + '<input type="submit" id="AutoRestore" value="Restore" onclick="restoreData(); return false;" />' + after;
edCanvas = document.getElementById('content'); //re-enable quicktags with correct element (original content element was overwritten).
elem = document.getElementById('content');
elem.onkeyup = KeyPressEvent;
}
}
function restoreData(){
elem.value = readCookie(cID);
}
<?php endif; ?>
//]]>
</script>