Write a note!

You can edit a note on all websites!

  1. // ==UserScript==
  2. // @name Write a note!
  3. // @version 2.3.2
  4. // @description You can edit a note on all websites!
  5. // @match http://*/*
  6. // @match https://*/*
  7. // @exclude https://apis.google.com/*
  8. // @exclude https://evernote.com/Home*
  9. // @exclude http://mail.google.com/tasks/canvas*
  10. // @exclude https://talkgadget.google.com/u/0/talkgadget*
  11. // @exclude http*://www.facebook.com/plugins/*
  12. // @copyright 2014+, ich01
  13. // @namespace https://gf.qytechs.cn/scripts/92
  14. // @grant GM_registerMenuCommand
  15. // @grant GM_setValue
  16. // @grant GM_getValue
  17. // ==/UserScript==
  18. var uw = (this.unsafeWindow) ? this.unsafeWindow : window;
  19. uw.WriteANote = {
  20. langArray: [],
  21. pageURL: "",
  22. littleNote: false,
  23. init: function() {
  24. WriteANote.addGMMenuItem();
  25. WriteANote.initLittleNote();
  26. WriteANote.insertStyles();
  27. WriteANote.initLanguage();
  28. //Getting formatted url for localStorage saving
  29. var _url = document.location.toString();
  30. if (_url.indexOf("?")) {
  31. _url = _url.slice(0,_url.indexOf("?"));
  32. }
  33. WriteANote.pageURL=_url;
  34. WriteANote.checkForLittleNote();
  35. },
  36. addGMMenuItem: function() {
  37. GM_registerMenuCommand("Write A Note",function() {WriteANote.openPopup();});
  38. },
  39. initLanguage: function() {
  40. WriteANote.langArray[0] = "Your Note";
  41. WriteANote.langArray[1] = "Save";
  42. WriteANote.langArray[2] = "Delete";
  43. WriteANote.langArray[3] = "Settings";
  44. WriteANote.langArray[4] = "Your note was saved!";
  45. WriteANote.langArray[5] = "Your note was deleted!";
  46. WriteANote.langArray[6] = "Close";
  47. WriteANote.langArray[7] = "Enable little note in top-left page-corner";
  48. if (navigator.language.toString().toLowerCase().indexOf("de")>-1) {
  49. WriteANote.langArray[0] = "Deine Notiz";
  50. WriteANote.langArray[1] = "Speichern";
  51. WriteANote.langArray[2] = "Löschen";
  52. WriteANote.langArray[3] = "Einstellungen";
  53. WriteANote.langArray[4] = "Deine Notiz wurde gespeichert!";
  54. WriteANote.langArray[5] = "Deine Notiz wurde geloescht!";
  55. WriteANote.langArray[6] = "Schließen";
  56. WriteANote.langArray[7] = "Mini-Notiz in Ecke links-oben aktivieren";
  57. }
  58. },
  59. openPopup: function() {
  60. if (document.getElementsByTagName("writeanotepopup").length==0) {
  61. var xyElement = document.createElement("writeanotepopup");
  62. xyElement.style.position="fixed";
  63. xyElement.style.borderRadius="3px";
  64. xyElement.style.minWidth="500px";
  65. xyElement.style.minHeight="350px";
  66. var leftAbstand = (window.innerWidth-500)/2;
  67. var topAbstand = (window.innerHeight-350)/2;
  68. xyElement.style.left=leftAbstand+"px";
  69. xyElement.style.top=topAbstand+"px";
  70. xyElement.style.zIndex="9999999999999";
  71. xyElement.style.border="1px solid black";
  72. xyElement.style.backgroundColor="rgba(200,200,200,0.9)";
  73. xyElement.style.display="block";
  74. xyElement.style.overflow="scroll";
  75. xyElement.style.textAlign="left";
  76. xyElement.style.color="black";
  77. var string1 = "<span style='left:-1px;background:rgb(245,233,237);width:97%;margin-left:0px;position:absolute;padding:7px;font-family:Arial;font-size:16px;font-weight:bold;color:black;'>Write A Note!</span>";
  78. string1+="<span style='right:0px;position:absolute;cursor:pointer;top:0px;font-family:Arial;' onclick=WriteANote.closePopup();>"+WriteANote.langArray[6]+"</span>";
  79. string1+="<br><br><br>";
  80. string1+="<span style='background-color:rgba(118,105,199,0.7);color:black;font-weight:bold;font-family:Arial;width:50%;border-radius:3px;padding:1px;position:absolute;'>"+WriteANote.langArray[0]+"</span><br>";
  81. string1+="<textarea id=writeanotetextarea placeholder='"+WriteANote.langArray[0]+"' rows=4 cols=45 style='font-family:Tahoma;color:black;border:1px solid rgb(140,250,106);'>"+WriteANote.getSavedNote()+"</textarea><br>";
  82. string1+="<table border=0 cellpadding=1 cellpadding=1><tr><td><button onclick=WriteANote.saveNote();>"+WriteANote.langArray[1]+"</button></td><td><button onclick=WriteANote.deleteNote();>"+WriteANote.langArray[2]+"</td></tr></table><br>";
  83. string1+="<span style='background-color:rgba(118,105,199,0.7);color:black;font-weight:bold;font-family:Arial;width:50%;border-radius:3px;padding:1px;position:absolute;'>"+WriteANote.langArray[3]+"</span><br>";
  84. var littleNoteChecked = "";
  85. if (WriteANote.littleNote==true) {
  86. littleNoteChecked = "checked";
  87. }
  88. string1+="<input type=checkbox onchange=WriteANote.gmChangeNoteStatus(); "+littleNoteChecked+">"+WriteANote.langArray[7]+"</input><br>";
  89. xyElement.innerHTML=string1;
  90. document.body.appendChild(xyElement);
  91. } else {
  92. document.getElementsByTagName("writeanotepopup")[0].style.display="block";
  93. }
  94. },
  95. saveNote: function() {
  96. var newNote = document.getElementById("writeanotetextarea").value;
  97. localStorage.setItem(WriteANote.pageURL+"_notf",newNote);
  98. alert(WriteANote.langArray[4]);
  99. },
  100. deleteNote: function() {
  101. localStorage.removeItem(WriteANote.pageURL+"_notf");
  102. document.getElementById("writeanotetextarea").value="";
  103. alert(WriteANote.langArray[5]);
  104. },
  105. getSavedNote: function() {
  106. if (localStorage.getItem(WriteANote.pageURL+"_notf")!=null) {
  107. return localStorage.getItem(WriteANote.pageURL+"_notf");
  108. } else {
  109. return "";
  110. }
  111. },
  112. closePopup: function() {
  113. if (document.getElementsByTagName("writeanotepopup").length==1) {
  114. document.getElementsByTagName("writeanotepopup")[0].outerHTML="";
  115. }
  116. },
  117. gmChangeNoteStatus: function() {
  118. if (WriteANote.littleNote==true) {
  119. WriteANote.gmDisableNote();
  120. } else {
  121. WriteANote.gmEnableNote();
  122. }
  123. },
  124. gmEnableNote: function() {
  125. setTimeout(function() {
  126. GM_setValue("littleNote", "true");
  127. }, 0);
  128. },
  129. gmDisableNote: function() {
  130. setTimeout(function() {
  131. GM_setValue("littleNote", "false");
  132. }, 0);
  133. },
  134. initLittleNote: function() {
  135. if (GM_getValue("littleNote")=="true") {
  136. WriteANote.littleNote = true;
  137. } else {
  138. WriteANote.littleNote = false;
  139. }
  140. },
  141. insertStyles: function() {
  142. var myStyle = document.createElement("style");
  143. myStyle.setAttribute("type", "text/css");
  144. document.getElementsByTagName("head")[0].appendChild(myStyle);
  145. var styles = document.styleSheets.length;
  146. myStyle = document.styleSheets[styles-1];
  147. if (document.styleSheets[0].cssRules) {
  148. myStyle.insertRule("writeanotelittle {font-family:Tahoma; font-size:0px; cursor:pointer; z-index:9999999999999; white-space:nowrap; text-align:left; color:black;transition:all 0.3s ease; overflow:hidden; width:10px; min-width:10px; min-height:10px; height:10px; background-color:yellow; position:fixed; top:0px; left:0px; text-overflow:ellipsis; opacity:0.8; border:1px solid black; border-radius:3px;}", 0);
  149. myStyle.insertRule("writeanotelittle:hover {font-size:14px; width:100px; height:20px;}", 0);
  150. } else {
  151. if (document.styleSheets[0].rules) {
  152. myStyle.addRule("writeanotelittle", "font-family:Tahoma; font-size:0px; cursor:pointer; z-index:9999999999999; white-space:nowrap; text-align:left; color:black; transition:all 0.3s ease; overflow:hidden; width:10px; min-width:10px; min-height:10px; height:10px; background-color:yellow; position:fixed; top:0px; left:0px; text-overflow:ellipsis; opacity:0.8; border:1px solid black; border-radius:3px;");
  153. myStyle.addRule("writeanotelittle:hover", "font-size:14px; width:100px; height:20px;");
  154. }
  155. }
  156. },
  157. checkForLittleNote: function() {
  158. if (WriteANote.littleNote==true) {
  159. var littleNote = document.createElement("writeanotelittle");
  160. littleNote.setAttribute("id","writeanotelittle");
  161. littleNote.setAttribute("onclick","WriteANote.openPopup();");
  162. document.body.appendChild(littleNote);
  163. document.getElementById("writeanotelittle").innerHTML=WriteANote.getSavedNote();
  164. }
  165. }
  166. };
  167. if (navigator.userAgent.toLowerCase().indexOf("firefox")>-1) {
  168. window.WriteANote = uw.WriteANote;
  169. console.log("Firefox detected. Compatibility mode enabled.");
  170. }
  171. WriteANote.init();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址