Reload userChromeES

[userChromeES] Adds the menu item that reloads the userChromeES to the popup menu of the toolbar button and the sidebar menu.

  1. // ==UserScript==
  2. // @name Reload userChromeES
  3. // @name:ja userChromeESを再読み込み
  4. // @description [userChromeES] Adds the menu item that reloads the userChromeES to the popup menu of the toolbar button and the sidebar menu.
  5. // @description:ja 【userChromeES】userChromeESを再読み込みするメニューアイテムを、ツールバーボタンのポップアップメニューとサイドバーメニューに追加します。
  6. // @namespace https://greasyfork.org/users/137
  7. // @version 0.1.0
  8. // @include popup
  9. // @include sidebar
  10. // @license Mozilla Public License Version 2.0 (MPL 2.0); https://www.mozilla.org/MPL/2.0/
  11. // @compatible Firefox userChromeES用スクリプトです (※GreasemonkeyスクリプトでもuserChromeJS用スクリプトでもありません) / This script is for userChromeES (* neither Greasemonkey nor userChromeJS)
  12. // @author 100の人
  13. // @homepage https://greasyfork.org/users/137
  14. // ==/UserScript==
  15.  
  16. (function () {
  17. 'use strict';
  18.  
  19. if (location.pathname === '/sidebar/sidebar.xhtml') {
  20. document.head.insertAdjacentHTML('beforeend', `<style>
  21. [name="reload-user-chrome-es"] {
  22. cursor: pointer;
  23. }
  24. </style>`);
  25. }
  26.  
  27. document.getElementsByTagName('menu')[0].insertAdjacentHTML('beforeend', `
  28. <li><button type="button" name="reload-user-chrome-es">
  29. <img src="chrome://browser/content/extension.svg" alt="" />
  30. ${browser.i18n.getUILanguage() === 'ja' ? 'userChromeESを再読み込みする' : 'Reload userChromeES'}
  31. </button></li>
  32. `);
  33.  
  34. document.getElementsByName('reload-user-chrome-es')[0].addEventListener('click', () => browser.runtime.reload());
  35.  
  36. })();