Created
February 8, 2009 23:22
-
-
Save snaka/60557 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name OndemandBackupHatenaDiary | |
// @namespace http://d.hatena.ne.jp/snaka72/ | |
// @description Backup editing diary on demand in hatena diary. | |
// @include http://d.hatena.ne.jp/*/edit | |
// ==/UserScript== | |
// *** WARN: NOW ON PROGRESS!!!!!!!! *** | |
(function() { | |
const STORE_KEY="SAVED_DIARY_ENTRY"; | |
var edit = document.getElementById('textarea-edit'); | |
//add RESTORE button | |
var button = document.createElement('button'); | |
button.innerHTML = "RESTORE"; | |
button.addEventListener("click", function() { | |
alert("click"); | |
GM_log(GM_getValue(STORE_KEY)); | |
}, false); | |
var header = document.getElementById("diary-edit-header"); | |
header.firstChild.appendChild(button); | |
GM_log(header); | |
GM_log(edit); | |
edit.addEventListener("change", function(e) { | |
GM_log(e); | |
GM_setValue(STORE_KEY, edit.value); | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment