fork download
  1.  
  2. $('#save').click(function(){
  3. save();
  4. });
  5.  
  6. var date=new Date();
  7. var m = $((date.getMonth()+1) + date.getDate());
  8.  
  9. for(var i =0; i<localStorage.length; i++){
  10. var key = localStorage.key(i);
  11. if(localStorage.key(i) =='sticky') continue;
  12. $('#localstorage').append($('<option>').html(key));
  13. }
  14.  
  15. //selectに合わせてページ変更
  16. $('#localstorage').change(function() {
  17. reload();
  18. });
  19.  
  20. //localstorageに保存
  21. function save() {
  22. var items2 = [];
  23. $('.sticky').each(function() {
  24. items.push({
  25. css:{
  26. left: $(this).css('left'),
  27. top: $(this).css('top'),
  28. backgroundColor: $(this).css('background-color')
  29.  
  30. },
  31. html: $(this).html()
  32. });
  33. });
  34. localStorage.setItem(m,JSON.stringify(items2));
  35. }
  36.  
  37. //保存読み出し
  38. function reload() {
  39. if($(this).val().length > 0){
  40. var key = $('#localstorage').children(':selected').text();
  41. var items = JSON.parse(localStorage.getItem(key));
  42. $.each(items, function(i, item) {
  43. make().css(item.css).html(item.html);
  44. });
  45. }
  46.  
  47. }
  48. // your code goes here
Runtime error #stdin #stdout #stderr 0.02s 4936KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.js:2: ReferenceError: $ is not defined