User Tools

Site Tools


developer_center:recipe_book:extensions_and_core:display_panes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer_center:recipe_book:extensions_and_core:display_panes [2013/12/28 08:32] (current)
geekshadow created
Line 1: Line 1:
 +====== Display Panes ======
 +
 +===== Determing the size of the display pane you're in =====
 +
 +<​code>​
 +var width = document.documentElement.boxObject.width;​
 +var height = document.documentElement.boxObject.height;​
 +</​code>​
 +
 +===== Auto toggling visibility of a display pane =====
 +
 +<​code>​
 +function tabSelectListener(e)
 +{
 + var browser = window.top.gBrowser.selectedTab.linkedBrowser;​
 + var split = window.top.document.getElementById("​displaypane_right_sidebar_splitter"​);​
 + if (browser.contentDocument.location.toString().indexOf(
 + "​chrome://​songbird/​content/​xul/​sbLibraryPage.xul"​) != -1)
 + {
 + split.setAttribute("​state",​ "​open"​);​
 + } else {
 + split.setAttribute("​state",​ "​collapsed"​);​
 + }
 +}
 +
 +function realLoad(e) {
 + var tabContainer = window.top.gBrowser.tabContainer;​
 + tabSelectListener();​
 + tabContainer.addEventListener("​TabSelect",​ tabSelectListener,​ false);
 +}
 +
 +window.addEventListener("​load",​
 + function(e) {
 + window.top.gBrowser.addEventListener("​load",​ function(e) {
 + realLoad(e);​
 + }, false);
 + }, false);
 +
 +var paneMgr = Components.classes["​@songbirdnest.com/​Songbird/​DisplayPane/​Manager;​1"​]
 + .getService(Components.interfaces.sbIDisplayPaneManager); ​   ​
 +
 +paneMgr.registerContent("​chrome://​test-stevel/​content/​whizzy.xul", ​
 +                        "​Whizzy",​
 +                        "​http://​wikipedia.org/​favicon.ico",​
 +                        350,
 +                        300,
 +                        "​sidebar",​
 +                        true);
 +</​code>​
 +
  
developer_center/recipe_book/extensions_and_core/display_panes.txt ยท Last modified: 2013/12/28 08:32 by geekshadow