Have all sidebar titles at the top. Requested by jevering.

This commit is contained in:
slamm%netscape.com 2006-07-27 14:47:36 +00:00
Родитель 4b8bbd86b8
Коммит e5b6354735
3 изменённых файлов: 67 добавлений и 5 удалений

Просмотреть файл

@ -125,3 +125,8 @@ titledbutton.panel-bar {
padding-right: 5px;
font-size: smaller;
}
titledbutton.panel-bar[selected="1"] {
background-color: #98CCF8;
}

Просмотреть файл

@ -120,7 +120,7 @@ function sidebarOverlayInit() {
}
}
function sidebarOpenDefaultPanel(wait, tries) {
function oldsidebarOpenDefaultPanel(wait, tries) {
var parent = document.getElementById('sidebar-panels');
var target = parent.getAttribute('open-panel-src');
var children = parent.childNodes;
@ -151,7 +151,42 @@ function sidebarOpenDefaultPanel(wait, tries) {
}
}
function sidebarOpenClosePanel(titledbutton) {
function sidebarOpenDefaultPanel(wait, tries) {
var parent = document.getElementById('sidebar-panels');
var target = parent.getAttribute('open-panel-src');
var children = parent.childNodes;
var iframe = document.getElementById('sidebar-content');
debug("sidebarOpenDefaultPanel("+wait+","+tries+")");
debug(" target="+target);
if (children.length < 3) {
if (tries < 5) {
// No children yet, try again later
setTimeout('sidebarOpenDefaultPanel('+(wait*2)+','+(tries+1)+')',wait);
}
return;
}
if (target && target != '') {
iframe.setAttribute('src', target);
for (var ii=0; ii < children.length; ii++) {
if (children.item(ii).getAttribute('iframe-src') == target) {
children.item(ii).setAttribute('selected','1');
return;
}
}
}
// Pick the first one
var first_button = children.item(1);
if (first_button) {
first_button.setAttribute('selected','1');
target = first_button.getAttribute('iframe-src');
parent.setAttribute('open-panel-src', target);
iframe.setAttribute('src', target);
}
}
function oldsidebarOpenClosePanel(titledbutton) {
var target = titledbutton.getAttribute('iframe-src');
var last_src = titledbutton.parentNode.getAttribute('open-panel-src');
var children = titledbutton.parentNode.childNodes;
@ -173,6 +208,25 @@ function sidebarOpenClosePanel(titledbutton) {
}
}
function sidebarOpenClosePanel(titledbutton) {
var target = titledbutton.getAttribute('iframe-src');
var last_src = titledbutton.parentNode.getAttribute('open-panel-src');
var children = titledbutton.parentNode.childNodes;
var iframe = document.getElementById('sidebar-content');
if (target == last_src) {
return;
}
titledbutton.parentNode.setAttribute('open-panel-src',target);
titledbutton.setAttribute('selected','1');
iframe.setAttribute('src',target);
for (var ii=0; ii < children.length; ii++) {
if (children.item(ii).getAttribute('iframe-src')== last_src) {
children.item(ii).removeAttribute('selected');
}
}
}
function sidebarReload() {
sidebarOverlayInit(sidebar);
}

Просмотреть файл

@ -39,24 +39,27 @@
onclick="sidebarCustomize();" />
</splitter>
<box id="sidebar-panels" align="vertical" flex="1*"
<box id="sidebar-panels" align="vertical"
datasources="chrome://sidebar/content/local-panels.rdf
chrome://sidebar/content/remote-panels.rdf"
ref="urn:sidebar:current-panel-list"
persist='open-panel-src'>
<template>
<rule>
<titledbutton uri="rdf:*" align="left"
<titledbutton uri="rdf:*" align="left"
value="rdf:http://home.netscape.com/NC-rdf#title"
class="panel-bar borderless"
onclick="sidebarOpenClosePanel(this)"
iframe-src="rdf:http://home.netscape.com/NC-rdf#content" />
<html:iframe uri="rdf:*" content="true"
<!-- <html:iframe uri="rdf:*" content="true"
src="rdf:http://home.netscape.com/NC-rdf#content"
class="panel-frame" collapsed='true' flex='1*'/>
-->
</rule>
</template>
</box>
<html:iframe id="sidebar-content" content="true" src="about:blank"
class="panel-frame" flex='1*'/>
</box>
<!-- Splitter on the right of sidebar -->