$('#save').click(function(){
save();
});
var date=new Date();
var m = $((date.getMonth()+1) + date.getDate());
for(var i =0; i<localStorage.length; i++){
var key = localStorage.key(i);
if(localStorage.key(i) =='sticky') continue;
$('#localstorage').append($('<option>').html(key));
}
//selectに合わせてページ変更
$('#localstorage').change(function() {
reload();
});
//localstorageに保存
function save() {
var items2 = [];
$('.sticky').each(function() {
items.push({
css:{
left: $(this).css('left'),
top: $(this).css('top'),
backgroundColor: $(this).css('background-color')
},
html: $(this).html()
});
});
localStorage.setItem(m,JSON.stringify(items2));
}
//保存読み出し
function reload() {
if($(this).val().length > 0){
var key = $('#localstorage').children(':selected').text();
var items = JSON.parse(localStorage.getItem(key));
$.each(items, function(i, item) {
make().css(item.css).html(item.html);
});
}
}
// your code goes here
CgkkKCcjc2F2ZScpLmNsaWNrKGZ1bmN0aW9uKCl7CglzYXZlKCk7CQkKCX0pOwoJCgl2YXIgZGF0ZT1uZXcgRGF0ZSgpOwoJdmFyIG0gPSAkKChkYXRlLmdldE1vbnRoKCkrMSkgKyBkYXRlLmdldERhdGUoKSk7CgkKCWZvcih2YXIgaSA9MDsgaTxsb2NhbFN0b3JhZ2UubGVuZ3RoOyBpKyspewoJdmFyIGtleSA9IGxvY2FsU3RvcmFnZS5rZXkoaSk7CglpZihsb2NhbFN0b3JhZ2Uua2V5KGkpID09J3N0aWNreScpIGNvbnRpbnVlOyAKCSQoJyNsb2NhbHN0b3JhZ2UnKS5hcHBlbmQoJCgnPG9wdGlvbj4nKS5odG1sKGtleSkpOwkJCgl9CgkKCS8vc2VsZWN044Gr5ZCI44KP44Gb44Gm44Oa44O844K45aSJ5pu0CgkkKCcjbG9jYWxzdG9yYWdlJykuY2hhbmdlKGZ1bmN0aW9uKCkgewoJcmVsb2FkKCk7Cgl9KTsKCQoJLy9sb2NhbHN0b3JhZ2Xjgavkv53lrZgKCWZ1bmN0aW9uIHNhdmUoKSB7CiAgICB2YXIgaXRlbXMyID0gW107CiAgICAkKCcuc3RpY2t5JykuZWF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