Add-ons Manager - Scriptish Screenshot

[Scriptish only] Show screenshot on Scriptish user script page in Add-ons Manager.

  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4.  
  5. // ==UserScript==
  6. // @id addons-manager-scriptish-screenshot@loucypher
  7. // @name Add-ons Manager - Scriptish Screenshot
  8. // @namespace https://github.com/LouCypher/userscripts
  9. // @description [Scriptish only] Show screenshot on Scriptish user script page in Add-ons Manager.
  10. // @version 1.0
  11. // @author LouCypher
  12. // @license MPL 2.0
  13. // @icon https://addons.cdn.mozilla.net/media/img/addon-icons/default-32.png
  14. // @icon64URL https://addons.cdn.mozilla.net/media/img/addon-icons/default-64.png
  15. // @contributionURL http://loucypher.github.io/userscripts/donate.html?Add-ons+Manager+-+Scriptish+Screenshot
  16. // @homepageURL https://gf.qytechs.cn/scripts/183
  17. // @supportURL https://gf.qytechs.cn/scripts/183/feedback
  18. // @screenshot https://raw.github.com/LouCypher/userscripts/master/scriptish/addons-manager-scriptish-screenshot/screenshot.png
  19. // @resource CHANGELOG https://raw.github.com/LouCypher/userscripts/master/scriptish/addons-manager-scriptish-screenshot/CHANGELOG.txt
  20. // @resource LICENSE https://raw.github.com/LouCypher/userscripts/master/licenses/MPL/LICENSE.txt
  21. // @run-at document-start
  22. // @include about:addons
  23. // @include chrome://mozapps/content/extensions/extensions.xul
  24. // ==/UserScript==
  25.  
  26. function getXPCOMInterface(aClass, aInterface) {
  27. return Components.classes["@mozilla.org/" + aClass].
  28. getService(Components.interfaces[aInterface]);
  29. }
  30.  
  31. const iOService = getXPCOMInterface("network/io-service;1", "nsIIOService");
  32. const styleSheetService= getXPCOMInterface("content/style-sheet-service;1",
  33. "nsIStyleSheetService");
  34.  
  35. let css = "/* Add-ons Manager Scriptish Screenshot\n\
  36. by LouCypher */\n\n\
  37. @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);\
  38. \n@-moz-document url(about:addons),\
  39. \n url(chrome://mozapps/content/extensions/extensions.xul){\
  40. \n #detail-view[type=userscript] #detail-screenshot[width=null][height=null]{\
  41. \n min-width: 200px;\n min-height: 150px;\n }\n}\n";
  42.  
  43. let uri = iOService.newURI("data:text/css," + encodeURIComponent(css), null, null);
  44. styleSheetService.loadAndRegisterSheet(uri, styleSheetService.AGENT_SHEET);
  45.  
  46. window.addEventListener("unload", function() {
  47. styleSheetService.unregisterSheet(uri, styleSheetService.AGENT_SHEET);
  48. });

QingJ © 2025

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