From 32d71fb1f125379d4b041e3810fc9a7dc6136d79 Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Sat, 5 Mar 2016 14:47:55 +0900 Subject: [PATCH] Make column width configurable --- defaults/preferences/treestyletab.js | 2 ++ modules/fullTooltip.js | 1 + modules/groupTab.js | 4 +++- modules/pseudoTreeBuilder.js | 4 +++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index 04db6447..82920270 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -346,6 +346,7 @@ pref("extensions.treestyletab.tooltip.fullTooltipDelay", 2000); * If true, too many items are shown in multiple columns. */ pref("extensions.treestyletab.tooltip.columnize", true); +pref("extensions.treestyletab.tooltip.columnize.width", "20em"); /** * Visibility of extra menu items for the context menu on tabs, inserted by TST. @@ -662,6 +663,7 @@ pref("extensions.treestyletab.pinnedTab.faviconized", true); * If true, too many items are shown in multiple columns in a dummy (group) tab. */ pref("extensions.treestyletab.groupTab.columnize", true); +pref("extensions.treestyletab.groupTab.columnize.width", "20em"); /** * Compatibility hack flags for other addons. They can be disabled by each diff --git a/modules/fullTooltip.js b/modules/fullTooltip.js index 9704fd72..68fd9230 100644 --- a/modules/fullTooltip.js +++ b/modules/fullTooltip.js @@ -574,6 +574,7 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, { var columnize = utils.getTreePref('tooltip.columnize'); if (columnize) { PseudoTreeBuilder.columnizeTree(tree, { + columnWidth : utils.getTreePref('tooltip.columnize.width'), containerBox : { width : this.lastScreen.allowedWidth, height : this.lastScreen.allowedHeight diff --git a/modules/groupTab.js b/modules/groupTab.js index fba531fb..51d38929 100644 --- a/modules/groupTab.js +++ b/modules/groupTab.js @@ -411,7 +411,9 @@ GroupTab.prototype = inherit(TreeStyleTabBase, { return; var container = this.document.getElementById('tree'); var tree = container.firstChild; - PseudoTreeBuilder.columnizeTree(tree); + PseudoTreeBuilder.columnizeTree(tree, { + columnWidth : utils.getTreePref('groupTab.columnize.width') + }); }, onTabAttached : function GT_onTabAttached(aEvent) diff --git a/modules/pseudoTreeBuilder.js b/modules/pseudoTreeBuilder.js index 127567eb..f493d597 100644 --- a/modules/pseudoTreeBuilder.js +++ b/modules/pseudoTreeBuilder.js @@ -152,9 +152,11 @@ var PseudoTreeBuilder = { return; aOptions = aOptions || {}; + aOptions.width = aOptions.width || '20em'; + var style = aTree.style; - style.columnWidth = style.MozColumnWidth = 'calc(20em)'; + style.columnWidth = style.MozColumnWidth = 'calc(' + aOptions.width + ')'; { let computedStyle = aTree.ownerDocument.defaultView.getComputedStyle(aTree, null) aTree.columnWidth = Number((computedStyle.MozColumnWidth || computedStyle.columnWidth).replace(/px/, ''));