Write a note!

You can edit a note on all websites!

目前为 2014-03-09 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Write a note!
  3. // @version 0.2
  4. // @description You can edit a note on all websites!
  5. // @match http*
  6. // @copyright 2014+, ich01
  7. // @namespace https://greasyfork.org/scripts/92
  8. // ==/UserScript==
  9.  
  10.  
  11. if (navigator.language.indexOf("de")>-1) {
  12. var text1 = "Nach dem Neuladen geloescht!";
  13. var text2 = "Neue Notiz";
  14. var text3 = "Gib deine Notiz ein(Wird nach dem Neuladen angezeigt):";
  15. } else {
  16. var text1 = "Deleted after reload!";
  17. var text2 = "New Note";
  18. var text3 = "Enter your note (Appears after reload):";
  19. }
  20. var _url = document.location.toString();
  21. var _notes = "";
  22. if (_url.indexOf("?")) {
  23. _url = _url.slice(0,_url.indexOf("?"));
  24. }
  25. if (localStorage.getItem(_url + "__notf")!="null" && localStorage.getItem(_url + "__notf")!="undefined" && localStorage.getItem(_url + "__notf")!="" && localStorage.getItem(_url + "__notf")!=undefined) {
  26. _notes = localStorage.getItem(_url + "__notf");
  27. document.body.appendChild(document.createElement("wnote"));
  28. var notef = document.getElementsByTagName("wnote")[0];
  29. notef.setAttribute("urlnotef",_url);
  30. notef.style.textAlign="left";
  31. notef.style.lineHeight="14px";
  32. notef.style.color="black";
  33. notef.style.position="fixed";
  34. notef.style.zIndex="9999999999999";
  35. notef.style.fontSize="14px";
  36. notef.style.top="0px";
  37. notef.style.left="0px";
  38. notef.style.background="yellow";
  39. notef.style.border="2px solid black";
  40. notef.style.display="block";
  41. notef.style.padding="5px";
  42. notef.style.maxHeight="30px";
  43. notef.style.maxWidth="175px";
  44. notef.style.textOverflow="ellipsis";
  45. notef.style.cursor="pointer";
  46. notef.style.borderBottomRightRadius="3px";
  47. notef.innerHTML="<span onclick=\"localStorage.setItem((document.getElementsByTagName('wnote')[0].getAttribute('urlnotef'))+'__notf','undefined');\" onmousedown=\"alert('"+text1+"');\">X</span>&nbsp;&nbsp;|&nbsp;&nbsp;<span onclick=\"localStorage.setItem((document.getElementsByTagName('wnote')[0].getAttribute('urlnotef'))+'__notf',prompt('"+text3+"',''));\">E</span>&nbsp;&nbsp;|&nbsp;&nbsp<span onclick=\"alert('"+_notes+"');\" oncontextmenu=\"this.parentNode.style.display='none';\">"+_notes.slice(0,20)+"</span>";
  48. } else {
  49. document.body.appendChild(document.createElement("wnote"));
  50. var notef = document.getElementsByTagName("wnote")[0];
  51. notef.setAttribute("urlnotef",_url);
  52. notef.style.textAlign="left";
  53. notef.style.lineHeight="14px";
  54. notef.style.color="black";
  55. notef.style.position="fixed";
  56. notef.style.zIndex="9999999999999";
  57. notef.style.fontSize="14px";
  58. notef.style.top="0px";
  59. notef.style.left="0px";
  60. notef.style.background="yellow";
  61. notef.style.border="2px solid black";
  62. notef.style.display="block";
  63. notef.style.padding="5px";
  64. notef.style.maxHeight="30px";
  65. notef.style.maxWidth="175px";
  66. notef.style.textOverflow="ellipsis";
  67. notef.style.cursor="pointer";
  68. notef.style.borderBottomRightRadius="3px";
  69. notef.innerHTML="<span onclick=\"localStorage.setItem((document.getElementsByTagName('wnote')[0].getAttribute('urlnotef'))+'__notf',prompt('"+text3+"','"+_notes+"'));\" oncontextmenu=\"this.parentNode.style.display='none';\">"+text2+"</span>";
  70. }