From 92abac377668b1a2c22aafb99eb02377e38ff56b Mon Sep 17 00:00:00 2001 From: piro Date: Wed, 15 Sep 2010 04:51:50 +0000 Subject: [PATCH] =?UTF-8?q?Minefield=E3=81=A7=E3=83=95=E3=83=A9=E3=82=B0?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E4=BB=98=E3=81=8D=E3=81=AE=E3=82=A6=E3=82=A3?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=82=A6=E3=82=92=E9=96=8B=E3=81=84=E3=81=9F?= =?UTF-8?q?=E6=99=82=E3=81=AB=E3=80=81=E5=88=9D=E6=9C=9F=E5=8C=96=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=81=8C=E9=80=94=E4=B8=AD=E3=81=A7=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=97=E3=81=BE=E3=81=86=E3=81=9B=E3=81=84?= =?UTF-8?q?=E3=81=A7=E3=80=81=E9=96=8B=E3=81=8B=E3=82=8C=E3=81=9F=E3=82=A6?= =?UTF-8?q?=E3=82=A3=E3=83=B3=E3=83=89=E3=82=A6=E3=81=AE=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=EF=BC=88=20http:/?= =?UTF-8?q?/twitter.com/piro=5For/status/24478427114=20=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@7208 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletabbrowser.js | 56 ++++++++++--------- .../treestyletabbrowser_autoHide.js | 2 + 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index ea09a611..1ac2e8f1 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -810,20 +810,17 @@ TreeStyleTabBrowser.prototype = { initTabContents : function TSTBrowser_initTabContents(aTab) { var icon = document.getAnonymousElementByAttribute(aTab, 'class', 'tab-icon'); - var label = this.getTabLabel(aTab); - var close = this.getTabClosebox(aTab); - var counter = document.getAnonymousElementByAttribute(aTab, 'class', this.kCOUNTER_CONTAINER); - - if (!document.getAnonymousElementByAttribute(aTab, 'class', this.kTWISTY)) { - var twisty = document.createElement('image'); + var twisty = document.getAnonymousElementByAttribute(aTab, 'class', this.kTWISTY); + if (icon && !twisty) { + twisty = document.createElement('image'); twisty.setAttribute('class', this.kTWISTY); - var container = document.createElement('hbox'); + let container = document.createElement('hbox'); container.setAttribute('class', this.kTWISTY_CONTAINER); container.appendChild(twisty); icon.appendChild(container); - var marker = document.createElement('image'); + let marker = document.createElement('image'); marker.setAttribute('class', this.kDROP_MARKER); container = document.createElement('hbox'); container.setAttribute('class', this.kDROP_MARKER_CONTAINER); @@ -832,26 +829,27 @@ TreeStyleTabBrowser.prototype = { icon.appendChild(container); } - if (!counter) { - var counter = document.createElement('hbox'); + var label = this.getTabLabel(aTab); + var counter = document.getAnonymousElementByAttribute(aTab, 'class', this.kCOUNTER_CONTAINER); + if (label && label.parentNode != aTab && !counter) { + counter = document.createElement('hbox'); counter.setAttribute('class', this.kCOUNTER_CONTAINER); - counter.appendChild(document.createElement('label')); - counter.lastChild.setAttribute('class', this.kCOUNTER_PAREN); - counter.lastChild.setAttribute('value', '('); + let startParen = counter.appendChild(document.createElement('label')); + startParen.setAttribute('class', this.kCOUNTER_PAREN); + startParen.setAttribute('value', '('); - counter.appendChild(document.createElement('label')); - counter.lastChild.setAttribute('class', this.kCOUNTER); - counter.lastChild.setAttribute('value', '0'); + let counterLabel = counter.appendChild(document.createElement('label')); + counterLabel.setAttribute('class', this.kCOUNTER); + counterLabel.setAttribute('value', '0'); - counter.appendChild(document.createElement('label')); - counter.lastChild.setAttribute('class', this.kCOUNTER_PAREN); - counter.lastChild.setAttribute('value', ')'); + let endParen = counter.appendChild(document.createElement('label')); + endParen.setAttribute('class', this.kCOUNTER_PAREN); + endParen.setAttribute('value', ')'); - if (label) { - label.parentNode.insertBefore(counter, label.nextSibling); - } + label.parentNode.insertBefore(counter, label.nextSibling); } + this.initTabContentsOrder(aTab); }, @@ -859,7 +857,6 @@ TreeStyleTabBrowser.prototype = { { var label = this.getTabLabel(aTab); var close = this.getTabClosebox(aTab); - var counter = document.getAnonymousElementByAttribute(aTab, 'class', this.kCOUNTER_CONTAINER); var inverted = this.mTabBrowser.getAttribute(this.kTAB_CONTENTS_INVERTED) == 'true'; var nodes = Array.slice(document.getAnonymousNodes(aTab)); @@ -891,9 +888,16 @@ TreeStyleTabBrowser.prototype = { // rearrange contents in "tab-image-middle" nodes = Array.slice(label.parentNode.childNodes); - nodes.splice(nodes.indexOf(counter), 1); - if (inverted) nodes.reverse(); - nodes.splice(nodes.indexOf(label)+1, 0, counter); + + if (inverted) + nodes.reverse(); + + var counter = document.getAnonymousElementByAttribute(aTab, 'class', this.kCOUNTER_CONTAINER); + if (counter) { + nodes.splice(nodes.indexOf(counter), 1); + nodes.splice(nodes.indexOf(label)+1, 0, counter); + } + count = nodes.length; nodes.reverse().forEach(function(aNode, aIndex) { if (aNode.getAttribute('class') == 'informationaltab-thumbnail-container') diff --git a/content/treestyletab/treestyletabbrowser_autoHide.js b/content/treestyletab/treestyletabbrowser_autoHide.js index 08c6cc98..2000d14e 100644 --- a/content/treestyletab/treestyletabbrowser_autoHide.js +++ b/content/treestyletab/treestyletabbrowser_autoHide.js @@ -415,6 +415,8 @@ TreeStyleTabBrowserAutoHide.prototype = { updateMenuItem : function TSTAutoHide_updateMenuItem(aNode) { + if (!aNode) return; + if (this.mode != this.kMODE_DISABLED) aNode.setAttribute('checked', true); else