Last active
January 10, 2023 03:14
-
-
Save esperecyan/5b9f957abf64749cc9529e130b655d64 to your computer and use it in GitHub Desktop.
これは古いやり方です。次のWikiを参照してください。 http://wiki.nothing.sh/page?userChrome.js%CD%D1%A5%B9%A5%AF%A5%EA%A5%D7%A5%C8#m5c944e2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // -*- mode: javascript;-*- | |
| /** | |
| * @file 「mozilla.cfg」(autoconfig.cfg) として動作するよう修正した簡易版userChromeJS。 | |
| * The simplified version of userChromeJS which modified to run as “mozilla.cfg” (autoconfig.cfg). | |
| * @version 3.0.2 | |
| * @see [Deploying Firefox in an enterprise environment — Mozilla | MDN]{@link https://developer.mozilla.org/Firefox/Enterprise_deployment#Configuration} | |
| * @see [mozdev.org — userchromejs: index]{@link http://userchromejs.mozdev.org/} | |
| * @see [[Ext] userChromeJS 2.0 [2015-08-02] • mozillaZine Forums]{@link http://forums.mozillazine.org/viewtopic.php?p=14747866#p14747866} | |
| * @see [設定の管理 | 技術的なよくある質問 | 法人向け情報 | Mozilla Japan コミュニティポータル]{@link https://www.mozilla.jp/business/faq/tech/setting-management/#mcd} | |
| * @see [userChrome.js/userChrome.js at master · alice0775/userChrome.js]{@link https://github.com/alice0775/userChrome.js/blob/master/userChrome.js} | |
| * @license | |
| * ***** BEGIN LICENSE BLOCK ***** | |
| * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |
| * | |
| * The contents of this file are subject to the Mozilla Public License Version | |
| * 1.1 (the 'License'); you may not use this file except in compliance with | |
| * the License. You may obtain a copy of the License at | |
| * http://www.mozilla.org/MPL/ | |
| * | |
| * Software distributed under the License is distributed on an 'AS IS' basis, | |
| * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
| * for the specific language governing rights and limitations under the | |
| * License. | |
| * | |
| * The Original Code is the userChrome.js component. | |
| * | |
| * The Initial Developer of the Original Code is | |
| * Simon Bünzli <[email protected]> | |
| * | |
| * Portions created by the Initial Developer are Copyright (C) 2007 | |
| * the Initial Developer. All Rights Reserved. | |
| * | |
| * Contributor(s): | |
| * alta88 <[email protected]> | |
| * | |
| * Alternatively, the contents of this file may be used under the terms of | |
| * either the GNU General Public License Version 2 or later (the 'GPL'), or | |
| * the GNU Lesser General Public License Version 2.1 or later (the 'LGPL'), | |
| * in which case the provisions of the GPL or the LGPL are applicable instead | |
| * of those above. If you wish to allow use of your version of this file only | |
| * under the terms of either the GPL or the LGPL, and not to allow others to | |
| * use your version of this file under the terms of the MPL, indicate your | |
| * decision by deleting the provisions above and replace them with the notice | |
| * and other provisions required by the GPL or the LGPL. If you do not delete | |
| * the provisions above, a recipient may use your version of this file under | |
| * the terms of any one of the MPL, the GPL or the LGPL. | |
| * | |
| * ***** END LICENSE BLOCK ***** | |
| * @author 100の人 | |
| * @see {@link https://gist.github.com/esperecyan/5b9f957abf64749cc9529e130b655d64} | |
| */ | |
| try { | |
| Components.utils.import('resource://gre/modules/Services.jsm'); | |
| new class { | |
| constructor() | |
| { | |
| Services.obs.addObserver(this, 'profile-after-change', false); | |
| } | |
| observe(aSubject, aTopic, aData) | |
| { | |
| switch (aTopic) { | |
| case 'profile-after-change': | |
| Services.obs.addObserver(this, 'final-ui-startup', false); | |
| break; | |
| case 'final-ui-startup': { | |
| const file = Services.dirsvc.get('UChrm', Components.interfaces.nsIFile); | |
| file.append('userChrome.js'); | |
| if (!Services.appinfo.inSafeMode) { | |
| this.mFileURL = Services.io.getProtocolHandler('file') | |
| .QueryInterface(Components.interfaces.nsIFileProtocolHandler) | |
| .getURLSpecFromFile(file); | |
| Services.obs.addObserver(this, 'domwindowopened', false); | |
| } | |
| break; | |
| } | |
| case 'domwindowopened': | |
| aSubject.addEventListener('load', this, true); | |
| break; | |
| } | |
| } | |
| handleEvent(aEvent) | |
| { | |
| const document = aEvent.originalTarget; | |
| if (document.location && document.location.protocol === 'chrome:') { | |
| try { | |
| Services.scriptloader.loadSubScript(this.mFileURL, document.defaultView, 'UTF-8'); | |
| } catch (ex) { | |
| Components.utils.reportError(ex); | |
| } | |
| } | |
| } | |
| }(); | |
| } catch (exception) { | |
| displayError(exception); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment