Skip to content

Commit

Permalink
version 2.6.0 release
Browse files Browse the repository at this point in the history
new options add callbacks for before/after jsPanel
close/maximize/minimize/normalize actions
  • Loading branch information
Flyer53 committed Dec 4, 2015
1 parent a966617 commit 78e8924
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 44 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## CHANGELOG

### Version 2.6.0

+ **new option.onbeforeclose** takes a function to execute before the jsPanel closes. If function returns *false* panel will not close.
+ **new option.onbeforemaximize** takes a function to execute before the jsPanel maximizes. If function returns *false* panel will not maximize.
+ **new option.onbeforeminimize** takes a function to execute before the jsPanel minimizes. If function returns *false* panel will not minimize.
+ **new option.onbeforenormalize** takes a function to execute before the jsPanel normalizes. If function returns *false* panel will not normalize.
+ **new option.onclosed** takes a function to execute after the jsPanel closed.
+ **new option.onmaximized** takes a function to execute after the jsPanel maximized.
+ **new option.onminimized** takes a function to execute after the jsPanel minimized.
+ **new option.onnormalized** takes a function to execute after the jsPanel normalized.

---

### Version 2.5.5

+ bugfix **option.ajax** (causing unnecesary get requests whenever a jsPanel is created)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## [jsPanel 2.5.5 released 2015-10-08](#)
## [jsPanel 2.6.0 released 2015-12-14](#)

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

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jspanel",
"version": "v2.5.5",
"version": "v2.6.0",
"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 ...",
"keywords": [
"jQuery",
Expand Down
2 changes: 1 addition & 1 deletion jsPanel.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"hint",
"bootstrap"
],
"version": "2.5.5",
"version": "2.6.0",
"author": {
"name": "Stefan Straesser",
"url": "http://jspanel.de/",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jspanel",
"version": "2.5.5",
"version": "2.6.0",
"description": "A jQuery Plugin to create highly configurable floating panels for use in a backend solution and other web applications",
"main": [
"source/jquery.jspanel.js",
Expand Down
1 change: 0 additions & 1 deletion source/jquery.jspanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
}
.jsPanel{
box-sizing: border-box;
/*display: none; // check bolg entry for jQuery 3.0.0 !! */
overflow: hidden;
position: absolute;
border-radius: 3px;
Expand Down
63 changes: 55 additions & 8 deletions source/jquery.jspanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
<http://opensource.org/licenses/MIT>.
CHANGES IN 2.5.5:
+ option.ajax bugfix (unnecessary get requests)
CHANGES IN 2.6.0:
+ new options onbeforeclose, onclosed
+ new options onbeforemaximize, onmaximized
+ new options onbeforeminimize, onminimized
+ new options onbefornormalize, onnormalized
*/

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

var jsPanel = {
version: '2.5.5 2015-10-08 15:47',
version: '2.6.0 2015-12-04 14:15',
device: (function(){
try {
// requires "mobile-detect.js" to be loaded
Expand Down Expand Up @@ -314,6 +317,12 @@ var jsPanel = {
var context = panel.parent(),
panelID = panel.attr('id');
panel.trigger('jspanelbeforeclose', panelID);
if ($.isFunction(panel.option.onbeforeclose)) {
var close = panel.option.onbeforeclose.call(panel, panel);
if (close === false) {
return panel;
}
}
// delete childpanels ...
this.closeChildpanels(panel);
// if present remove tooltip wrapper
Expand All @@ -339,6 +348,9 @@ var jsPanel = {
jsPanel.reposHints("jsPanel-hint-tr", panel.parentElmtTagname);
}
}
if ($.isFunction(panel.option.onclosed)) {
panel.option.onclosed.call(panel, panel);
}
return context;
},

Expand Down Expand Up @@ -808,19 +820,34 @@ var jsPanel = {
// calls functions to maximize a jsPanel
maximize: function (panel) {
panel.trigger('jspanelbeforemaximize', panel.attr('id'));
if ($.isFunction(panel.option.onbeforemaximize)) {
var maximize = panel.option.onbeforemaximize.call(panel, panel);
if (maximize === false) {
return panel;
}
}
if (panel.parentElmtTagname === 'body' || panel.option.controls.maxtoScreen === true) {
this.maxWithinBody(panel);
} else {
this.maxWithinElement(panel);
}
panel.trigger('jspanelmaximized', panel.attr('id'));
panel.trigger('jspanelstatechange', panel.attr('id'));
if ($.isFunction(panel.option.onmaximized)) {
panel.option.onmaximized.call(panel, panel);
}
return panel;
},

// minimizes a jsPanel to the lower left corner of the browser viewport
minimize: function (panel) {
panel.trigger('jspanelbeforeminimize', panel.attr('id'));
if ($.isFunction(panel.option.onbeforeminimize)) {
var minimize = panel.option.onbeforeminimize.call(panel, panel);
if (minimize === false) {
return panel;
}
}
panel.data({ // needed for method exportPanels()
"paneltop": parseInt(panel.option.position.top),
"panelleft": parseInt(panel.option.position.left),
Expand Down Expand Up @@ -850,6 +877,9 @@ var jsPanel = {
});
}
});
if ($.isFunction(panel.option.onminimized)) {
panel.option.onminimized.call(panel, panel);
}
return panel;
},

Expand Down Expand Up @@ -879,6 +909,12 @@ var jsPanel = {
var panelTop,
interactions = ["resizable", "draggable"];
panel.trigger('jspanelbeforenormalize', panel.attr('id'));
if ($.isFunction(panel.option.onbeforenormalize)) {
var normalize = panel.option.onbeforenormalize.call(panel, panel);
if (normalize === false) {
return panel;
}
}
// remove window.scroll handler, is added again later in this function
$(window).off('scroll', panel.jsPanelfixPos);
// restore minimized panel to initial container if necessary
Expand Down Expand Up @@ -910,6 +946,9 @@ var jsPanel = {
if (panel.parentElmtTagname === 'body') {
this.fixPosition(panel);
}
if ($.isFunction(panel.option.onnormalized)) {
panel.option.onnormalized.call(panel, panel);
}
return panel;
},

Expand Down Expand Up @@ -1889,7 +1928,7 @@ console.log("jsPanel version: " + jsPanel.version);
display: 'block',
opacity: 1
});
$(jsP).trigger('jspanelloaded', jsP.attr('id'))
$(jsP).trigger('jspanelloaded', jsP.attr('id'));
$(jsP).trigger('jspanelstatechange', jsP.attr('id'));
jsP.option.size = {
width: jsP.outerWidth(),
Expand All @@ -1914,8 +1953,8 @@ console.log("jsPanel version: " + jsPanel.version);
display: 'block',
opacity: 1
});
$(jsP).addClass(jsP.option.show)
$(jsP) .trigger('jspanelloaded', jsP.attr('id'))
$(jsP).addClass(jsP.option.show);
$(jsP) .trigger('jspanelloaded', jsP.attr('id'));
$(jsP).trigger('jspanelstatechange', jsP.attr('id'));
jsP.option.size = {
width: jsP.outerWidth(),
Expand Down Expand Up @@ -2027,7 +2066,7 @@ console.log("jsPanel version: " + jsPanel.version);
jsPanel.shiftTooltipVertical(jsP, jsP.option.paneltype.shiftwithin);
}

/* option.panelstatus -------------------------------------------------------------------------------------------- */
/* option.panelstatus --------------------------------------------------------------------------------------- */
if (jsP.option.panelstatus) {
switch (jsP.option.panelstatus) {
case "minimized":
Expand Down Expand Up @@ -2110,9 +2149,17 @@ console.log("jsPanel version: " + jsPanel.version);
top: 0,
left: 0
},
"onbeforeclose": false,
"onbeforemaximize": false,
"onbeforeminimize": false,
"onbeforenormalize": false,
"onclosed": false,
"oncmaximized": false,
"onminimized": false,
"onnormalized": false,
"overflow": 'hidden',
"panelstatus": false,
"paneltype": false,
"overflow": 'hidden',
"position": 'auto',
"removeHeader": false,
"resizable": {
Expand Down
3 changes: 2 additions & 1 deletion source/jquery.jspanel.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 78e8924

Please sign in to comment.