Skip to content

Instantly share code, notes, and snippets.

@snaka
Created February 8, 2009 23:22
Show Gist options
  • Save snaka/60557 to your computer and use it in GitHub Desktop.
Save snaka/60557 to your computer and use it in GitHub Desktop.
// ==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