0

拡張機能からブラウザーの設定にオーバーレイを追加しようとしていますが、成功しません。プラグインをインストールしても何も表示されません。他の xul ファイルは正しく表示されます (たとえば、プラグインの設定ダイアログなど)。このチュートリアルを自分のニーズに合わせようとしました。

オーバーレイを chrome.manifest に登録します。

content smime chrome/content/
overlay chrome://browser/content/preferences/preferences.xul chrome://smime/content/preferences.xul

Preferences.xul:

<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<!-- Merge with the BrowserPreferences Window -->
<prefwindow id="BrowserPreferences">

  <!-- Create a new pane (tab) for HP Scheduler. -->
  <prefpane id="hpschedPane" label="&prefpane.label;"
            image="chrome://smime/content/sogo-48.png">

    <!-- Intermediary between GUI and preferences system -->
    <preferences>
    <preference id="sodgeItSmimeKeyfile" name="extensions.sodgeItSmime.keyfile" type="text"/>

    </preferences>
    <!-- GUI Elements... -->
    <groupbox>
        <caption label="Settings"/>
        <grid>
            <columns>
                <column flex="4"/>

                <column flex="1"/>
            </columns>
            <rows>
                <row>
                    <label control="keyfile" value="Keyfile"/>
                    <textbox id="keyfile" preference="sodgeItSmimeKeyfile"/>

                </row>
            </rows>
        </grid>
    </groupbox>
    </prefpane>
</prefwindow>
</overlay>

これが私がやりたいことです - Firefoxの設定ダイアログにタブを追加してください。

ここに画像の説明を入力

編集:私がやろうとしていることを説明するために画像を追加しました

4

1 に答える 1

3

これを機能させるのは、本来あるべきよりもトリッキーです。FireTorrent 拡張機能で使用している次のアプローチを試すことができます。

  1. 次のように Firefox 設定ウィンドウをオーバーレイします。

    <?xml version="1.0"?>
    
    <?xml-stylesheet href="chrome://firetorrent/skin/firetorrent-prefs.css" type="text/css"?>
    
    <overlay id="FiretorrentPaneOverlay"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    
        <prefwindow id="BrowserPreferences">
            <prefpane id="paneFiretorrent" label="FireTorrent"
                src="chrome://firetorrent/content/optionsOverlay.xul"/>
        </prefwindow>
    </overlay>
    
  2. 以下を CSS ファイルに追加します (firetorrent-prefs.css例)。

    #BrowserPreferences radio[pane="paneFiretorrent"] {
      list-style-image: url("chrome://firetorrent/skin/firetorrent-icon-32.png");
    }
    
  3. の内容は次のoptionsOverlay.xulとおりです。

    <?xml version="1.0"?>
    
    <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
    <?xml-stylesheet href="chrome://global/skin/preferences.css" type="text/css"?>
    <?xml-stylesheet href="chrome://firetorrent/skin/options.css" type="text/css"?>
    
    <!DOCTYPE overlay SYSTEM "chrome://firetorrent/locale/optionsOverlay.dtd">
    
    <overlay id="firetorrentOptionsOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    
        <prefpane id="paneFiretorrent" onpaneload="loadOptions();" flex="1">
    
            <preferences>
                <preference id="firetorrent.options.port" name="extensions.firetorrent.port" type="int"/>
                ...etc...
            </preferences>
    
            <script type="application/x-javascript" src="chrome://firetorrent/content/optionsOverlay.js"/>
    
            ...all your prefpane XUL here...
        </prefpane>
    </overlay>
    

これを書いてから長い時間が経ちましたが、注目すべき重要なことは、preferences.xul(私の例のポイント 1) のオーバーレイが、実際の prefpane ( ) を含む別の XUL オーバーレイを参照し、そのスタイルoptionsOverlay.xulを使用する必要があることです。list-style-image新しいタブのアイコンを指定する CSS。

于 2012-11-12T14:07:24.420 に答える