Add-ons Manager - Scriptish Screenshot

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

/*  This Source Code Form is subject to the terms of the Mozilla Public
 *  License, v. 2.0. If a copy of the MPL was not distributed with this
 *  file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// ==UserScript==
// @id              addons-manager-scriptish-screenshot@loucypher
// @name            Add-ons Manager - Scriptish Screenshot
// @namespace       https://github.com/LouCypher/userscripts
// @description     [Scriptish only] Show screenshot on Scriptish user script page in Add-ons Manager.
// @version         1.0
// @author          LouCypher
// @license         MPL 2.0
// @icon            https://addons.cdn.mozilla.net/media/img/addon-icons/default-32.png
// @icon64URL       https://addons.cdn.mozilla.net/media/img/addon-icons/default-64.png
// @contributionURL http://loucypher.github.io/userscripts/donate.html?Add-ons+Manager+-+Scriptish+Screenshot
// @homepageURL     https://greasyfork.org/scripts/183
// @supportURL      https://greasyfork.org/scripts/183/feedback
// @screenshot      https://raw.github.com/LouCypher/userscripts/master/scriptish/addons-manager-scriptish-screenshot/screenshot.png
// @resource        CHANGELOG https://raw.github.com/LouCypher/userscripts/master/scriptish/addons-manager-scriptish-screenshot/CHANGELOG.txt
// @resource        LICENSE https://raw.github.com/LouCypher/userscripts/master/licenses/MPL/LICENSE.txt
// @run-at          document-start
// @include         about:addons
// @include         chrome://mozapps/content/extensions/extensions.xul
// ==/UserScript==

function getXPCOMInterface(aClass, aInterface) {
  return Components.classes["@mozilla.org/" + aClass].
         getService(Components.interfaces[aInterface]);
}

const iOService = getXPCOMInterface("network/io-service;1", "nsIIOService");
const styleSheetService= getXPCOMInterface("content/style-sheet-service;1",
                                           "nsIStyleSheetService");

let css = "/* Add-ons Manager Scriptish Screenshot\n\
   by LouCypher */\n\n\
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);\
\n@-moz-document url(about:addons),\
\n               url(chrome://mozapps/content/extensions/extensions.xul){\
\n  #detail-view[type=userscript] #detail-screenshot[width=null][height=null]{\
\n    min-width: 200px;\n    min-height: 150px;\n  }\n}\n";

let uri = iOService.newURI("data:text/css," + encodeURIComponent(css), null, null);
styleSheetService.loadAndRegisterSheet(uri, styleSheetService.AGENT_SHEET);

window.addEventListener("unload", function() {
  styleSheetService.unregisterSheet(uri, styleSheetService.AGENT_SHEET);
});