aboutsummaryrefslogtreecommitdiff
path: root/files/ja/code_snippets/sidebar/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/code_snippets/sidebar/index.html')
-rw-r--r--files/ja/code_snippets/sidebar/index.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/files/ja/code_snippets/sidebar/index.html b/files/ja/code_snippets/sidebar/index.html
new file mode 100644
index 0000000000..769a24197a
--- /dev/null
+++ b/files/ja/code_snippets/sidebar/index.html
@@ -0,0 +1,44 @@
+---
+title: Sidebar
+slug: Code_snippets/Sidebar
+tags:
+ - Add-ons
+ - Extensions
+translation_of: Archive/Add-ons/Code_snippets/Sidebar
+---
+<p>
+</p><p>Firefox サイドバー拡張機能の作成に関するステップバイステップの説明は <a href="ja/Creating_a_Firefox_sidebar">Firefox のサイドバーの作成</a>チュートリアルを参照してください。
+</p><p><br>
+</p><p>著者: もっとサイドバー関連のコンテンツを追加してください
+</p><p>{{ 英語版章題("Resizing the sidebar programmatically") }}
+</p>
+<h3 id=".E3.82.B5.E3.82.A4.E3.83.89.E3.83.90.E3.83.BC.E3.82.92.E3.83.97.E3.83.AD.E3.82.B0.E3.83.A9.E3.83.A0.E3.81.8B.E3.82.89.E3.83.AA.E3.82.B5.E3.82.A4.E3.82.BA">サイドバーをプログラムからリサイズ</h3>
+<p>サイドバーの幅を変更したい場合は以下のコードを使ってください
+</p>
+<pre class="eval">function setSidebarWidth(newwidth) {
+ var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIWebNavigation)
+ .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIDOMWindow);
+ mainWindow.document.getElementById("sidebar-box").width=newwidth;
+}
+</pre>
+<p>あるいは
+</p>
+<pre class="eval">function setSidebarWidth(newwidth) {
+ window.top.document.getElementById("sidebar-box").width=newwidth;
+}
+</pre>
+<p>サイドバーのスピリッタを隠すことで、マウスを使った手動のリサイズを無効にすることができます。このコードの断片を動くようにするには、前のコードブロックで書いたように mainWindow を宣言しなくてはなりません:
+</p>
+<pre class="eval">mainWindow.document.getElementById("sidebar-splitter").hidden = true;
+</pre>
+<p>スピリッタの hidden 属性を変更するときは注意してください。サイドバーが閉じられるあるいは他のサイドバーで置き換えられるときにそれらを安全な値にリセットする必要があります。例えば、これをサイドバーの Unload イベントハンドラで使用してください:
+</p>
+<pre class="eval">mainWindow.document.getElementById("sidebar-splitter").hidden = mainWindow.document.getElementById("sidebar-box").hidden;
+</pre>
+<div class="noinclude">
+</div>
+{{ languages( { "en": "en/Code_snippets/Sidebar" } ) }}