Skip to content

Commit 78e8924

Browse files
committed
version 2.6.0 release
new options add callbacks for before/after jsPanel close/maximize/minimize/normalize actions
1 parent a966617 commit 78e8924

File tree

9 files changed

+104
-44
lines changed

9 files changed

+104
-44
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
## CHANGELOG
22

3+
### Version 2.6.0
4+
5+
+ **new option.onbeforeclose** takes a function to execute before the jsPanel closes. If function returns *false* panel will not close.
6+
+ **new option.onbeforemaximize** takes a function to execute before the jsPanel maximizes. If function returns *false* panel will not maximize.
7+
+ **new option.onbeforeminimize** takes a function to execute before the jsPanel minimizes. If function returns *false* panel will not minimize.
8+
+ **new option.onbeforenormalize** takes a function to execute before the jsPanel normalizes. If function returns *false* panel will not normalize.
9+
+ **new option.onclosed** takes a function to execute after the jsPanel closed.
10+
+ **new option.onmaximized** takes a function to execute after the jsPanel maximized.
11+
+ **new option.onminimized** takes a function to execute after the jsPanel minimized.
12+
+ **new option.onnormalized** takes a function to execute after the jsPanel normalized.
13+
14+
---
15+
316
### Version 2.5.5
417

518
+ bugfix **option.ajax** (causing unnecesary get requests whenever a jsPanel is created)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## [jsPanel 2.5.5 released 2015-10-08](#)
1+
## [jsPanel 2.6.0 released 2015-12-14](#)
22

33
**A jQuery plugin to create multifunctional floating panels.**
44

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspanel",
3-
"version": "v2.5.5",
3+
"version": "v2.6.0",
44
"description": "A jQuery Plugin to create highly configurable multifunctional floating panels for use in backend solutions and other web applications. Also usable as modal panel, tooltip or hint. With built in support for bootstrap, right-to-left text direction and more ...",
55
"keywords": [
66
"jQuery",

jsPanel.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"hint",
1616
"bootstrap"
1717
],
18-
"version": "2.5.5",
18+
"version": "2.6.0",
1919
"author": {
2020
"name": "Stefan Straesser",
2121
"url": "http://jspanel.de/",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspanel",
3-
"version": "2.5.5",
3+
"version": "2.6.0",
44
"description": "A jQuery Plugin to create highly configurable floating panels for use in a backend solution and other web applications",
55
"main": [
66
"source/jquery.jspanel.js",

source/jquery.jspanel.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@
104104
}
105105
.jsPanel{
106106
box-sizing: border-box;
107-
/*display: none; // check bolg entry for jQuery 3.0.0 !! */
108107
overflow: hidden;
109108
position: absolute;
110109
border-radius: 3px;

source/jquery.jspanel.js

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727
2828
<http://opensource.org/licenses/MIT>.
2929
30-
CHANGES IN 2.5.5:
31-
+ option.ajax bugfix (unnecessary get requests)
30+
CHANGES IN 2.6.0:
31+
+ new options onbeforeclose, onclosed
32+
+ new options onbeforemaximize, onmaximized
33+
+ new options onbeforeminimize, onminimized
34+
+ new options onbefornormalize, onnormalized
3235
*/
3336

3437
"use strict";
@@ -42,7 +45,7 @@ if (!$.fn.jquery || !$.fn.uniqueId || !$.widget || !$.ui.mouse || !$.ui.draggabl
4245
}
4346

4447
var jsPanel = {
45-
version: '2.5.5 2015-10-08 15:47',
48+
version: '2.6.0 2015-12-04 14:15',
4649
device: (function(){
4750
try {
4851
// requires "mobile-detect.js" to be loaded
@@ -314,6 +317,12 @@ var jsPanel = {
314317
var context = panel.parent(),
315318
panelID = panel.attr('id');
316319
panel.trigger('jspanelbeforeclose', panelID);
320+
if ($.isFunction(panel.option.onbeforeclose)) {
321+
var close = panel.option.onbeforeclose.call(panel, panel);
322+
if (close === false) {
323+
return panel;
324+
}
325+
}
317326
// delete childpanels ...
318327
this.closeChildpanels(panel);
319328
// if present remove tooltip wrapper
@@ -339,6 +348,9 @@ var jsPanel = {
339348
jsPanel.reposHints("jsPanel-hint-tr", panel.parentElmtTagname);
340349
}
341350
}
351+
if ($.isFunction(panel.option.onclosed)) {
352+
panel.option.onclosed.call(panel, panel);
353+
}
342354
return context;
343355
},
344356

@@ -808,19 +820,34 @@ var jsPanel = {
808820
// calls functions to maximize a jsPanel
809821
maximize: function (panel) {
810822
panel.trigger('jspanelbeforemaximize', panel.attr('id'));
823+
if ($.isFunction(panel.option.onbeforemaximize)) {
824+
var maximize = panel.option.onbeforemaximize.call(panel, panel);
825+
if (maximize === false) {
826+
return panel;
827+
}
828+
}
811829
if (panel.parentElmtTagname === 'body' || panel.option.controls.maxtoScreen === true) {
812830
this.maxWithinBody(panel);
813831
} else {
814832
this.maxWithinElement(panel);
815833
}
816834
panel.trigger('jspanelmaximized', panel.attr('id'));
817835
panel.trigger('jspanelstatechange', panel.attr('id'));
836+
if ($.isFunction(panel.option.onmaximized)) {
837+
panel.option.onmaximized.call(panel, panel);
838+
}
818839
return panel;
819840
},
820841

821842
// minimizes a jsPanel to the lower left corner of the browser viewport
822843
minimize: function (panel) {
823844
panel.trigger('jspanelbeforeminimize', panel.attr('id'));
845+
if ($.isFunction(panel.option.onbeforeminimize)) {
846+
var minimize = panel.option.onbeforeminimize.call(panel, panel);
847+
if (minimize === false) {
848+
return panel;
849+
}
850+
}
824851
panel.data({ // needed for method exportPanels()
825852
"paneltop": parseInt(panel.option.position.top),
826853
"panelleft": parseInt(panel.option.position.left),
@@ -850,6 +877,9 @@ var jsPanel = {
850877
});
851878
}
852879
});
880+
if ($.isFunction(panel.option.onminimized)) {
881+
panel.option.onminimized.call(panel, panel);
882+
}
853883
return panel;
854884
},
855885

@@ -879,6 +909,12 @@ var jsPanel = {
879909
var panelTop,
880910
interactions = ["resizable", "draggable"];
881911
panel.trigger('jspanelbeforenormalize', panel.attr('id'));
912+
if ($.isFunction(panel.option.onbeforenormalize)) {
913+
var normalize = panel.option.onbeforenormalize.call(panel, panel);
914+
if (normalize === false) {
915+
return panel;
916+
}
917+
}
882918
// remove window.scroll handler, is added again later in this function
883919
$(window).off('scroll', panel.jsPanelfixPos);
884920
// restore minimized panel to initial container if necessary
@@ -910,6 +946,9 @@ var jsPanel = {
910946
if (panel.parentElmtTagname === 'body') {
911947
this.fixPosition(panel);
912948
}
949+
if ($.isFunction(panel.option.onnormalized)) {
950+
panel.option.onnormalized.call(panel, panel);
951+
}
913952
return panel;
914953
},
915954

@@ -1889,7 +1928,7 @@ console.log("jsPanel version: " + jsPanel.version);
18891928
display: 'block',
18901929
opacity: 1
18911930
});
1892-
$(jsP).trigger('jspanelloaded', jsP.attr('id'))
1931+
$(jsP).trigger('jspanelloaded', jsP.attr('id'));
18931932
$(jsP).trigger('jspanelstatechange', jsP.attr('id'));
18941933
jsP.option.size = {
18951934
width: jsP.outerWidth(),
@@ -1914,8 +1953,8 @@ console.log("jsPanel version: " + jsPanel.version);
19141953
display: 'block',
19151954
opacity: 1
19161955
});
1917-
$(jsP).addClass(jsP.option.show)
1918-
$(jsP) .trigger('jspanelloaded', jsP.attr('id'))
1956+
$(jsP).addClass(jsP.option.show);
1957+
$(jsP) .trigger('jspanelloaded', jsP.attr('id'));
19191958
$(jsP).trigger('jspanelstatechange', jsP.attr('id'));
19201959
jsP.option.size = {
19211960
width: jsP.outerWidth(),
@@ -2027,7 +2066,7 @@ console.log("jsPanel version: " + jsPanel.version);
20272066
jsPanel.shiftTooltipVertical(jsP, jsP.option.paneltype.shiftwithin);
20282067
}
20292068

2030-
/* option.panelstatus -------------------------------------------------------------------------------------------- */
2069+
/* option.panelstatus --------------------------------------------------------------------------------------- */
20312070
if (jsP.option.panelstatus) {
20322071
switch (jsP.option.panelstatus) {
20332072
case "minimized":
@@ -2110,9 +2149,17 @@ console.log("jsPanel version: " + jsPanel.version);
21102149
top: 0,
21112150
left: 0
21122151
},
2152+
"onbeforeclose": false,
2153+
"onbeforemaximize": false,
2154+
"onbeforeminimize": false,
2155+
"onbeforenormalize": false,
2156+
"onclosed": false,
2157+
"oncmaximized": false,
2158+
"onminimized": false,
2159+
"onnormalized": false,
2160+
"overflow": 'hidden',
21132161
"panelstatus": false,
21142162
"paneltype": false,
2115-
"overflow": 'hidden',
21162163
"position": 'auto',
21172164
"removeHeader": false,
21182165
"resizable": {

source/jquery.jspanel.min.css

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)