Guest User

Untitled

a guest
Apr 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. /**
  2. * 以下のコードを .keysnail.js 内の PRESERVE エリアへペーストすることで
  3. * 編集メニューと KeySnail のエクステに「userchrome.css を編集」が追加される
  4. */
  5. (function () {
  6. const MENU_ITEM_ID = "edit-userchrome-css";
  7. var description = M({ja: "userChrome.css を編集", en: "Edit userChrome.css"});
  8. var menu = document.getElementById("edit-menu");
  9.  
  10. if (!menu)
  11. return;
  12.  
  13. var item = document.getElementById(MENU_ITEM_ID);
  14. if (!item) {
  15. item = menu.appendItem(description);
  16. item.id = MENU_ITEM_ID;
  17. item.setAttribute("class", "menuitem-iconic");
  18. item.setAttribute("src", "chrome://keysnail/skin/icon/edit.png");
  19. }
  20.  
  21. if (my.savedEditUserChromeCSS)
  22. item.removeEventListener("command", my.savedEditUserChromeCSS, false);
  23.  
  24. my.savedEditUserChromeCSS = function () {
  25. var file = util.getSpecialDir("UChrm");
  26. file.append("userChrome.css");
  27. userscript.editFile(file.path);
  28. };
  29.  
  30. ext.add("edit-userchrome-css", my.savedEditUserChromeCSS, description);
  31. item.addEventListener("command", my.savedEditUserChromeCSS, false);
  32. })();
Add Comment
Please, Sign In to add comment