Skip to content

Commit

Permalink
Item14573: fix auto-height calculation of tabpane
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Dec 11, 2017
1 parent 9a5bb7e commit 062c9f2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 45 deletions.
3 changes: 2 additions & 1 deletion JQueryPlugin/data/System/JQueryPlugin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ required for Foswiki 1.1 or later.
Item14572: upgraded jquery.livequery |
| 11 Dec 2017: | (7.25) - Item14565: bundle jquery.validate js files into one <br /> \
Item14566: don't cache a null result in foswiki.getPreference() <br /> \
Item14570: add "use strict" to farbtastic's init and fix js errors |
Item14570: add "use strict" to farbtastic's init and fix js errors <br /> \
Item14573: fixed auto-height calculation of tabpane |
| 8 Dec 2017: | (7.24) - Released with Foswiki 2.1.5<br />\
Item14518: JQueryPlugin should warn configure if an older version of jquery is selected.<br />\
Item14555: make build work with latest uglifyjs 3.<br />\
Expand Down
6 changes: 3 additions & 3 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/TABPANE.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sub new {
my $this = bless(
$class->SUPER::new(
name => 'Tabpane',
version => '2.00',
version => '2.01',
author => 'Michael Daum',
homepage => 'http://foswiki.org/Extensions/JQueryPlugin',
tags => 'TABPABNE, ENDTABPANE, TAB, ENDTAB',
Expand All @@ -56,7 +56,7 @@ sub handleTabPane {

my $select = $params->{select} || 1;
my $autoMaxExpand = $params->{automaxexpand} || 'off';
my $minHeight = $params->{minheight} || 230;
my $minHeight = $params->{minheight} || 0;
my $animate = $params->{animate} || 'off';
my $class = $params->{class} || 'jqTabPaneDefault';

Expand Down Expand Up @@ -168,7 +168,7 @@ sub handleEndTabPane {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2010-2016 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2010-2017 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.foswikiFormSteps .jqTabPane {
margin:0px;
margin:0;
}
.jqTabLabel {
display:none;
}
.jqTabPane form {
margin:0px;
padding:0px;
margin:0;
padding:0;
}
.jqTab {
display:none;
border:1px solid #BDBEC5;
padding:0px;
margin:0px;
padding:0;
margin:0;
}
.foswikiNoJs .jqTab {
display:block;
Expand All @@ -28,31 +28,37 @@
padding:0;
}
ul.jqTabGroup {
margin:0px;
padding:0px;
margin:0;
padding:0;
list-style:none;
display:block;
float:left;
overflow:visible !important;
position:relative;
bottom:-1px;
}
ul.jqTabGroup li {
float:left;
list-style:none;
position:relative;
}
ul.jqTabGroup li.current {
z-index:1;
}
ul.jqTabGroup a:hover,
ul.jqTabGroup a {
text-decoration: none;
white-space:nowrap;
float:left;
display:block;
text-shadow:0px 1px #fff;
text-shadow:0 1px #fff;
}
.foswikiFormSteps ul.jqTabGroup li.current {
background-color: inherit;
}

.jqTabPane .fltMakeIndexWrapper {
margin:0px;
margin:0;
}

.jqAjaxLoader {
Expand All @@ -68,9 +74,9 @@ ul.jqTabGroup a {
background-image: url('tab_right.png');
background-repeat: no-repeat;
background-position: right top;
padding:0px 3px 0px 0px;
margin:0px 4px -1px 0px;
*margin:5px 4px -6px 0px; /* IE7 */
padding:0 3px 0 0;
margin:0 4px 0 0;
*margin:5px 4px -6px 0; /* IE7 */
height:28px;
}
.jqTabPaneDefault > .jqTabGroup a:hover,
Expand All @@ -80,8 +86,8 @@ ul.jqTabGroup a {
background-repeat: no-repeat;
background-position: left top;
color:#111;
margin:0px 0px 0px 0px;
padding:5px 8px 0px 18px;
margin:0 0 0 0;
padding:5px 8px 0 18px;
height:23px;
font-size:12px;
line-height:100%;
Expand Down Expand Up @@ -148,7 +154,7 @@ ul.jqTabGroup a {
.jqTabPanePlain > .jqTabGroup li,
.jqTabPaneSimple > .jqTabGroup li {
background:transparent;
margin:0px 0.4615em -1px 0; /* 0px 6px ... */
margin:0 0.4615em 0 0; /* 0 6px ... */
*height:2.3077em; /* IE7 ... 30px */
}
.jqTabPanePlain > .jqTabGroup li.current a,
Expand All @@ -173,9 +179,9 @@ ul.jqTabGroup a {

/* plain theme */
.jqTabPanePlain .jqTab {
border-left:0px;
border-right:0px;
border-bottom:0px;
border-left:0;
border-right:0;
border-bottom:0;
border-top-color:#ccc;
}
.jqTabPanePlain .jqTabContents {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jQuery Tabpane plugin 2.00
* jQuery Tabpane plugin 2.01
*
* Copyright (c) 2008-2016 Foswiki Contributors http://foswiki.org
* Copyright (c) 2008-2017 Foswiki Contributors http://foswiki.org
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
Expand All @@ -17,7 +17,7 @@ var bottomBarHeight = -1;
select: 1,
animate: false,
autoMaxExpand: false,
minHeight: 230
minHeight: 0
};

/* plugin constructor *****************************************************/
Expand Down Expand Up @@ -346,42 +346,32 @@ var bottomBarHeight = -1;
*/
TabPane.prototype.fixHeight = function() {
var self = this,
$container = self.elem.find("> .jqTab.current .jqTabContents:first"),
paneOffset = $container.offset(),
paneTop, windowHeight, height, $debug;
elem = self.elem.find("> .jqTab.current .jqTabContents:first"),
windowHeight = $(window).height() || window.innerHeight,
newHeight;

//$.log("TABPANE: called fixHeight()");

if (typeof(paneOffset) === 'undefined' || $container.is(".jqTabDisableMaxExpand")) {
if (elem.is(".jqTabDisableMaxExpand")) {
return;
}

paneTop = paneOffset.top; // || $container[0].offsetTop;
if (bottomBarHeight <= 0) {
bottomBarHeight = $('.natEditBottomBar').outerHeight(true) + parseInt($container.css('padding-bottom'), 10) *2.5;
bottomBarHeight = $(".natEditBottomBar").outerHeight(true) + elem.outerHeight(true) - elem.height();
}

windowHeight = $(window).height();
if (!windowHeight) {
windowHeight = window.innerHeight; // woops, jquery, whats up for konqi
}
newHeight = windowHeight - elem.offset().top - bottomBarHeight - 2;

height = windowHeight - paneTop - bottomBarHeight;
$debug = $("#DEBUG");
if ($debug.length) {
height -= $debug.outerHeight(true);
}
if (self.opts && self.opts.minHeight && height < self.opts.minHeight) {
if (self.opts && self.opts.minHeight && newHeight < self.opts.minHeight) {
//$.log("tabpane: minHeight reached");
height = self.opts.minHeight;
newHeight = self.opts.minHeight;
}

if (height < 0) {
if (newHeight < 0) {
return;
}

$.log("TABPANE: fixHeight height=",height);
$container.height(height);
elem.height(newHeight);
};

$.fn.tabpane = function (opts) {
Expand Down

0 comments on commit 062c9f2

Please sign in to comment.