Open
Merge Request #957 · created by Mangaldeep Patel


Aia bugs 21022019


From AIA_BUGS_21022019 into Develop
This can't be merged automatically, even if it could be merged you don't have the permission to do so.
This can be merged automatically but you don't have the permission to do so.
2 participants

400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js
... ... @@ -631,7 +631,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
631 631 title: $rootScope.getLocalStorageValue("currentViewTitle"),
632 632 position: {
633 633 top: 70,
634   - left: 20,
  634 + left: 2,
635 635 },
636 636  
637 637 size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 110 },
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -5426,9 +5426,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
5426 5426 imageToPrint.src = dataURL;
5427 5427  
5428 5428 OpenJSPanel(); // open jsPanel here
5429   - if ($('#jsPanel-1').length > 0) {
5430   - $('.jsPanel-btn-norm').attr('style', 'display: block');
5431   - }
  5429 +
5432 5430  
5433 5431 console.log('jsPanel loaded exist= ' + document.getElementById('jsPanel-1')); // document.getElementsByClassName('ppImagePanel'));
5434 5432  
... ... @@ -5476,7 +5474,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
5476 5474 $("#canvas").css("display", "none");
5477 5475 }
5478 5476 $(".currentyear").html($rootScope.current_year);
5479   - }, 320);
  5477 + }, 520);
5480 5478 }
5481 5479  
5482 5480 }
... ...
400-SOURCECODE/AIAHTML5.Web/libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js
1   -/// <reference path="../vendor/mobile-detect.js" />
2   -/// <reference path="../../../../../index.html" />
3   -/// <reference path="../../../../../index.html" />
4   -/* global console, MobileDetect, jQuery */
5   -/* jQuery Plugin jsPanel
6   - Dependencies:
7   - jQuery library ( > 1.9.1 incl. 2.1.3 )
8   - jQuery.UI library ( > 1.9.2 ) - (at least UI Core, Mouse, Widget, Draggable, Resizable)
9   - HTML5/CSS3 compatible browser
10   -
11   - Copyright (c) 2014-15 Stefan Sträßer, <http://stefanstraesser.eu/>
12   -
13   - Permission is hereby granted, free of charge, to any person obtaining a copy
14   - of this software and associated documentation files (the "Software"), to deal
15   - in the Software without restriction, including without limitation the rights
16   - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17   - copies of the Software, and to permit persons to whom the Software is
18   - furnished to do so, subject to the following conditions:
19   -
20   - The above copyright notice and this permission notice shall be included in
21   - all copies or substantial portions of the Software.
22   -
23   - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24   - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25   - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26   - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27   - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28   - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29   - THE SOFTWARE.
30   -
31   - <http://opensource.org/licenses/MIT>.
32   -
33   - CHANGES IN 2.6.0:
34   - + new options onbeforeclose, onclosed
35   - + new options onbeforemaximize, onmaximized
36   - + new options onbeforeminimize, onminimized
37   - + new options onbefornormalize, onnormalized
38   - */
39   -
40   -"use strict";
41   -// check for jQuery and jQuery UI components
42   -if (!$.fn.jquery || !$.fn.uniqueId || !$.widget || !$.ui.mouse || !$.ui.draggable || !$.ui.resizable) {
43   - console.log("Error: jQuery or at least one jQuery UI component is not loaded! You need at least jQuery 1.9.1 and jQuery UI 1.9.2 (modules Core, Mouse, Widget, Draggable and Resizable).");
44   -} else {
45   - console.log("Loaded: jQuery " + $.fn.jquery + ", jQuery UI " + $.ui.version +
46   - "\nUI core: " + $.isFunction($.fn.uniqueId) + ", UI widget: " + $.isFunction($.widget) + ", UI mouse: " + $.isFunction($.ui.mouse) +
47   - ", UI draggable: " + $.isFunction($.ui.draggable) + ", UI resizable: " + $.isFunction($.ui.resizable));
48   -}
49   -
50   -var jsPanel = {
51   -
52   - version: '2.6.0 2015-12-04 14:15',
53   - device: (function () {
54   - try {
55   - var imported = document.createElement('script');
56   - //imported.src = '//vendor/mobile-detect.js';
57   - imported.src = '~/../libs/jquery/jquery_plugin/jsPanel/vendor/mobile-detect.js';
58   - document.head.appendChild(imported);
59   -
60   - // requires "mobile-detect.js" to be loaded
61   - var md = new MobileDetect(window.navigator.userAgent),
62   - mobile = md.mobile(),
63   - phone = md.phone(),
64   - tablet = md.tablet(),
65   - os = md.os(),
66   - userAgent = md.userAgent();
67   - return { mobile: mobile, tablet: tablet, phone: phone, os: os, userAgent: userAgent };
68   - } catch (e) {
69   - console.log(e + "; Seems like mobile-detect.js is not loaded");
70   - return { mobile: undefined, tablet: undefined, phone: undefined, os: undefined, userAgent: undefined };
71   - }
72   - })(),
73   - ID: 0, // kind of a counter to add to automatically generated id attribute
74   - widthForMinimized: 180, // default width of minimized panels
75   - template: '<div class="jsPanel jsPanel-theme-default jsPanel-state-initialized">' +
76   - '<div class="jsPanel-hdr jsPanel-theme-default">' +
77   - '<h3 class="jsPanel-title"></h3>' +
78   - '<div class="jsPanel-hdr-r">' +
79   - '<div class="jsPanel-btn-close "><span class="jsglyph jsglyph-remove"></span></div>' +
80   - '<div class="jsPanel-btn-max"><span class="jsglyph jsglyph-maximize"></span></div>' +
81   - '<div class="jsPanel-btn-norm"><span class="jsglyph jsglyph-normalize"></span></div>' +
82   - '<div class="jsPanel-btn-min"><span id="minSpan" class="fa fa-minus"></span></div>' +
83   -
84   - //'<div class="jsPanel-btn-min"><span class="jsglyph jsglyph-minimize"></span></div>' +
85   - //'<div class="jsPanel-btn-small"><span class="jsglyph jsglyph-chevron-up"></span></div>' +
86   - //'<div class="jsPanel-btn-smallrev"><span class="jsglyph jsglyph-chevron-down"></span></div>' +
87   - '</div>' +
88   - '<div class="jsPanel-hdr-toolbar jsPanel-clearfix"></div>' +
89   - '</div>' +
90   - '<div class="jsPanel-content jsPanel-theme-default"></div>' +
91   - '<div class="jsPanel-ftr jsPanel-theme-default jsPanel-clearfix"></div>' +
92   - '</div>',
93   -
94   - // add toolbar
95   - addToolbar: function (panel, place, items) {
96   - if (place === 'header') {
97   - this.configToolbar(items, panel.header.toolbar, panel);
98   - } else if (place === 'footer') {
99   - panel.footer.css({ display: 'block' });
100   - this.configToolbar(items, panel.footer, panel);
101   - }
102   - // give toolbar the same font-family as title
103   - panel.header.toolbar.css("font-family", panel.header.title.css("font-family"));
104   - return panel;
105   - },
106   -
107   - // loads content using jQuery.ajax();
108   - ajax: function (panel) {
109   - var oAjax = panel.option.ajax,
110   - pc = panel.content;
111   - $.ajax(oAjax)
112   - .done(function (data, textStatus, jqXHR) {
113   - if (oAjax.autoload && oAjax.url) {
114   - pc.empty().append(data);
115   - }
116   - if ($.isFunction(oAjax.done)) {
117   - oAjax.done.call(pc, data, textStatus, jqXHR, panel);
118   - }
119   - })
120   - .fail(function (jqXHR, textStatus, errorThrown) {
121   - if ($.isFunction(oAjax.fail)) {
122   - oAjax.fail.call(pc, jqXHR, textStatus, errorThrown, panel);
123   - }
124   - })
125   - .always(function (arg1, textStatus, arg3) {
126   - //In response to a successful request, the function's arguments are the same as those of .done(): data(hier: arg1), textStatus, and the jqXHR object(hier: arg3)
127   - //For failed requests the arguments are the same as those of .fail(): the jqXHR object(hier: arg1), textStatus, and errorThrown(hier: arg3)
128   - // fix for a bug in jQuery-UI draggable? that causes the jsPanel to reduce width when dragged beyond boundary of containing element and option.size.width is 'auto'
129   - pc.css('width', function () {
130   - return pc.outerWidth();
131   - });
132   - if ($.isFunction(oAjax.always)) {
133   - oAjax.always.call(pc, arg1, textStatus, arg3, panel);
134   - }
135   - // title h3 might be to small: load() is async!
136   - jsPanel.resizeTitle(panel);
137   - // update option.size (content might come delayed)
138   - jsPanel.updateOptionSize(panel, panel.option.size);
139   - })
140   - .then(function (data, textStatus, jqXHR) {
141   - if (oAjax.then && $.isArray(oAjax.then)) {
142   - if ($.isFunction(oAjax.then[0])) {
143   - oAjax.then[0].call(pc, data, textStatus, jqXHR, panel);
144   - }
145   - // title h3 might be to small: load() is async!
146   - jsPanel.resizeTitle(panel);
147   - // update option.size (content might come delayed)
148   - jsPanel.updateOptionSize(panel, panel.option.size);
149   - }
150   - }, function (jqXHR, textStatus, errorThrown) {
151   - if (oAjax.then && $.isArray(oAjax.then)) {
152   - if ($.isFunction(oAjax.then[1])) {
153   - oAjax.then[1].call(pc, jqXHR, textStatus, errorThrown, panel);
154   - }
155   - // title h3 might be to small: load() is async!
156   - jsPanel.resizeTitle(panel);
157   - }
158   - }
159   - );
160   - panel.data("ajaxURL", oAjax.url); // needed for exportPanels()
161   - },
162   -
163   - // used in option.autoclose and checks prior use of .close() whether the panel is still there
164   - autoclose: function (panel) {
165   - window.setTimeout(function () {
166   - if (panel) {
167   - panel.fadeOut('slow', function () {
168   - panel.close();
169   - });
170   - }
171   - }, panel.option.autoclose);
172   - },
173   -
174   - calcPanelposition: function (jsP) {
175   - // when using option.size = 'auto' and option.position = 'center' consider use of option.ajax with
176   - // async: false -> size will be known when position is calculated
177   - // value "center" not allowed for option.position.bottom & option.position.right -> use top and/or left
178   - var panelpos = {};
179   - // get px values for panel size in case option.size is 'auto' - results will be incorrect whenever content
180   - // is not loaded yet ( e.g. option.load, option.ajax ) -> centering can't work correctly
181   - jsP.option.size.width = $(jsP).outerWidth();
182   - jsP.option.size.height = $(jsP).innerHeight();
183   - // delete option.position.top and/or left if option.position.bottom and/or right (top & left values come from defaults object)
184   - if (jsP.option.position.bottom) {
185   - delete jsP.option.position.top;
186   - }
187   - if (jsP.option.position.right) {
188   - delete jsP.option.position.left;
189   - }
190   - // calculate top | bottom values != center
191   - // if not checked for 0 as well code would not be executed!
192   - if (jsP.option.position.bottom || jsP.option.position.bottom === 0) {
193   - this.calcPos('bottom', jsP);
194   - } else if (jsP.option.position.top || jsP.option.position.top === 0) {
195   - if (jsP.option.position.top === 'center') {
196   - jsP.option.position.top = this.calcPosCenter(jsP.option).top;
197   - } else {
198   - panelpos.top = this.calcPos('top', jsP); // change in 2.5.4
199   - }
200   - }
201   - // calculate left | right values != center
202   - if (jsP.option.position.right || jsP.option.position.right === 0) {
203   - this.calcPos('right', jsP);
204   - } else if (jsP.option.position.left || jsP.option.position.left === 0) {
205   - if (jsP.option.position.left === 'center') {
206   - jsP.option.position.left = this.calcPosCenter(jsP.option).left;
207   - } else {
208   - panelpos.left = this.calcPos('left', jsP); // change in 2.5.4
209   - }
210   - }
211   - if (jsP.option.position.top) {
212   - panelpos.top = parseInt(jsP.option.position.top, 10) + jsP.option.offset.top;
213   - } else {
214   - panelpos.bottom = parseInt(jsP.option.position.bottom, 10) + jsP.option.offset.top;
215   - }
216   - if (jsP.option.position.left) {
217   - panelpos.left = parseInt(jsP.option.position.left, 10) + jsP.option.offset.left;
218   - } else {
219   - panelpos.right = parseInt(jsP.option.position.right, 10) + jsP.option.offset.left;
220   - }
221   - jsP.css(panelpos);
222   - jsP.option.position = {
223   - top: jsP.css('top'),
224   - left: jsP.css('left')
225   - };
226   - },
227   -
228   - // used in calcPanelposition
229   - calcPos: function (prop, panel) {
230   - var optPosition = panel.option.position;
231   - if (optPosition[prop] === 'auto') {
232   - panel.option.position[prop] = panel.count * 30;
233   - } else if ($.isFunction(optPosition[prop])) {
234   - panel.option.position[prop] = optPosition[prop](panel);
235   - } else if (optPosition[prop] === 0) {
236   - panel.option.position[prop] = '0';
237   - } else {
238   - panel.option.position[prop] = parseInt(optPosition[prop], 10);
239   - }
240   - // corrections if jsPanel is appended to the body element
241   - if (panel.option.selector === 'body') {
242   - if (prop === 'top') {
243   - panel.option.position.top = parseInt(optPosition.top, 10) + $(window).scrollTop();
244   - } else if (prop === 'bottom') {
245   - panel.option.position.bottom = parseInt(optPosition.bottom, 10) - $(window).scrollTop();
246   - } else if (prop === 'left') {
247   - panel.option.position.left = parseInt(optPosition.left, 10) + $(window).scrollLeft();
248   - } else if (prop === 'right') {
249   - panel.option.position.right = parseInt(optPosition.right, 10) - $(window).scrollLeft();
250   - }
251   - }
252   - return panel.option.position[prop];
253   - },
254   -
255   - // calculate position center for option.position == 'center'
256   - calcPosCenter: function (option) {
257   - var optSelector = option.selector,
258   - optSize = option.size,
259   - posL = ($(optSelector).outerWidth() / 2) - ((parseInt(optSize.width, 10) / 2)),
260   - posT;
261   - if (optSelector === 'body') {
262   - posT = ($(window).outerHeight() / 2) - ((parseInt(optSize.height, 10) / 2) - $(window).scrollTop());
263   - } else {
264   - posT = ($(optSelector).outerHeight() / 2) - ((parseInt(optSize.height, 10) / 2));
265   - }
266   - return { top: posT, left: posL };
267   - },
268   -
269   - // calculate position for maximized panels using option.controls.maxtoScreen (for devmondo)
270   - calcPosmaxtoScreen: function (panel) {
271   - var offset = panel.offset();
272   - return {
273   - top: parseInt(panel.css('top')) - (offset.top - $(document).scrollTop()) + 5,
274   - left: parseInt(panel.css('left')) - (offset.left - $(document).scrollLeft()) + 5
275   - };
276   - },
277   -
278   - // calculates css left for tooltips
279   - calcPosTooltipLeft: function (jsPparent, option) {
280   - // width of element serving as trigger for the tooltip
281   - var parW = jsPparent.outerWidth(),
282   - // check possible margins of trigger
283   - mL = parseInt(jsPparent.css('margin-left')),
284   - // check whether offset is set
285   - oX = option.offset.left || 0,
286   - optptPosition = option.paneltype.position;
287   - if (optptPosition === 'top' || optptPosition === 'bottom') {
288   - return (parW - option.size.width) / 2 + mL + oX;
289   - } else if (optptPosition === 'left') {
290   - return -(option.size.width) + mL + oX;
291   - } else if (optptPosition === 'right') {
292   - return parW + mL + oX;
293   - }
294   - return false;
295   - },
296   -
297   - // calculates css top for tooltips
298   - calcPosTooltipTop: function (jsPparent, option) {
299   - var parH = jsPparent.innerHeight(),
300   - mT = parseInt(jsPparent.css('margin-top')),
301   - oY = option.offset.top || 0,
302   - optptPosition = option.paneltype.position;
303   - if (optptPosition === 'left' || optptPosition === 'right') {
304   - return -(option.size.height / 2) + (parH / 2) + mT + oY;
305   - } else if (optptPosition === 'top') {
306   - return -(option.size.height + oY) + mT;
307   - } else if (optptPosition === 'bottom') {
308   - return parH + mT + oY;
309   - }
310   - return false;
311   - },
312   -
313   - // calculate final tooltip position
314   - calcToooltipPosition: function (jsPparent, option) {
315   - return {
316   - top: this.calcPosTooltipTop(jsPparent, option),
317   - left: this.calcPosTooltipLeft(jsPparent, option)
318   - };
319   - },
320   -
321   - calcVerticalOffset: function (panel) {
322   - return Math.floor(panel.offset().top - $(window).scrollTop());
323   - },
324   -
325   - // closes a jsPanel and removes it from the DOM
326   - close: function (panel) {
327   - // alert('jspanel closed')
328   - // get parent-element of jsPanel
329   - var context = panel.parent(),
330   - panelID = panel.attr('id');
331   - panel.trigger('jspanelbeforeclose', panelID);
332   - if ($.isFunction(panel.option.onbeforeclose)) {
333   - var close = panel.option.onbeforeclose.call(panel, panel);
334   - if (close === false) {
335   - return panel;
336   - }
337   - }
338   - // delete childpanels ...
339   - this.closeChildpanels(panel);
340   - // if present remove tooltip wrapper
341   - if (context.hasClass('jsPanel-tooltip-wrapper')) {
342   - panel.unwrap();
343   - }
344   - // remove the jsPanel itself
345   - panel.remove();
346   - $('body').trigger('jspanelclosed', panelID);
347   - // remove backdrop only when modal jsPanel is closed
348   - if (panel.option.paneltype.type === 'modal') {
349   - $('.jsPanel-backdrop').remove();
350   - }
351   - // reposition minimized panels
352   - this.reposMinimized(this.widthForMinimized);
353   - // reposition hints
354   - if (panel.option.paneltype.type === 'hint') {
355   - if (panel.hasClass("jsPanel-hint-tl")) {
356   - jsPanel.reposHints("jsPanel-hint-tl", panel.parentElmtTagname);
357   - } else if (panel.hasClass("jsPanel-hint-tc")) {
358   - jsPanel.reposHints("jsPanel-hint-tc", panel.parentElmtTagname);
359   - } else if (panel.hasClass("jsPanel-hint-tr")) {
360   - jsPanel.reposHints("jsPanel-hint-tr", panel.parentElmtTagname);
361   - }
362   - }
363   - if ($.isFunction(panel.option.onclosed)) {
364   - panel.option.onclosed.call(panel, panel);
365   - }
366   - return context;
367   - },
368   -
369   - // close all tooltips
370   - closeallTooltips: function () {
371   - $('.jsPanel-tt').each(function () {
372   - // remove tooltip wrapper and than remove tooltip
373   - $(this).unwrap().remove();
374   - $('body').trigger('jspanelclosed', $(this).attr('id'));
375   - });
376   - },
377   -
378   - // closes/removes all childpanels within the parent jsPanel
379   - closeChildpanels: function (panel) {
380   - $('.jsPanel', panel).each(function () {
381   - panel.trigger('jspanelbeforeclose', $(this).attr('id'));
382   - $(this).remove();
383   - $('body').trigger('jspanelclosed', $(this).attr('id'));
384   - });
385   - return panel;
386   - },
387   -
388   - // configure controls
389   - configControls: function (panel) {
390   - var controls = ["close", "maximize", "minimize", "normalize", "smallify"];
391   - if (panel.option.controls.buttons === 'closeonly') {
392   - $("div:not('.jsPanel-btn-close')", panel.header.controls).remove(); // change in 2.5.3
393   - panel.header.title.css("width", "calc(100% - 30px)");
394   - } else if (panel.option.controls.buttons === 'none') {
395   - $('*', panel.header.controls).remove();
396   - panel.header.title.css("width", "100%");
397   - }
398   - // disable controls individually
399   - controls.forEach(function (ctrl) {
400   - if (panel.option.controls[ctrl]) { panel.control('disable', ctrl); }
401   - });
402   - },
403   -
404   - // configure iconfonts
405   - configIconfont: function (panel) {
406   - var controlsArray = ["close", "max", "norm", "min", "small", "smallrev"],
407   - bootstrapArray = ["remove", "fullscreen", "resize-full", "minus", "chevron-up", "chevron-down"],
408   - fontawesomeArray = ["times", "arrows-alt", "expand", "minus", "chevron-up", "chevron-down"],
409   - optIconfont = panel.option.controls.iconfont,
410   - controls = panel.header.controls;
411   - // remove icon sprites
412   - $('*', controls).css('background-image', 'none');
413   - // set icons
414   - if (optIconfont === 'bootstrap') {
415   - controlsArray.forEach(function (item, i) {
416   - $('.jsPanel-btn-' + item, controls).empty().append('<span class="glyphicon glyphicon-' + bootstrapArray[i] + '"></span>');
417   - });
418   - } else if (optIconfont === 'font-awesome') {
419   - controlsArray.forEach(function (item, i) {
420   - $('.jsPanel-btn-' + item, controls).empty().append('<span class="fa fa-' + fontawesomeArray[i] + '"></span>');
421   - });
422   - }
423   - },
424   -
425   - // builds toolbar
426   - configToolbar: function (toolbaritems, toolbarplace, panel) {
427   - var el;
428   - toolbaritems.forEach(function (item) {
429   - if (typeof item === "object") {
430   - el = $(item.item);
431   - // add text to button
432   - if (typeof item.btntext === 'string') {
433   - el.append(item.btntext);
434   - }
435   - // add class to button
436   - if (typeof item.btnclass === 'string') {
437   - el.addClass(item.btnclass);
438   - }
439   - toolbarplace.append(el);
440   - // bind handler to the item
441   - if ($.isFunction(item.callback)) {
442   - el.on(item.event, panel, item.callback);
443   - // jsP is accessible in the handler as "event.data"
444   - }
445   - }
446   - });
447   - },
448   -
449   - // disable/enable individual controls
450   - control: function (panel, action, btn) {
451   - var controls = panel.header.controls,
452   - controlbtn;
453   - if (arguments.length === 3) {
454   - if (arguments[1] === 'disable') {
455   - if (btn === 'close') {
456   - controlbtn = $('.jsPanel-btn-close', controls);
457   - } else if (btn === 'maximize') {
458   - controlbtn = $('.jsPanel-btn-max', controls);
459   - } else if (btn === 'minimize') {
460   - controlbtn = $('.jsPanel-btn-min', controls);
461   - } else if (btn === 'normalize') {
462   - controlbtn = $('.jsPanel-btn-norm', controls);
463   - } else if (btn === 'smallify') {
464   - controlbtn = $('.jsPanel-btn-small', controls);
465   - }
466   - // unbind handler and set styles
467   - controlbtn.off().css({ opacity: 0.5, cursor: 'default' });
468   - } else if (arguments[1] === 'enable') {
469   - if (btn === 'close') {
470   - controlbtn = $('.jsPanel-btn-close', controls);
471   - } else if (btn === 'maximize') {
472   - controlbtn = $('.jsPanel-btn-max', controls);
473   - } else if (btn === 'minimize') {
474   - controlbtn = $('.jsPanel-btn-min', controls);
475   - } else if (btn === 'normalize') {
476   - controlbtn = $('.jsPanel-btn-norm', controls);
477   - } else if (btn === 'smallify') {
478   - controlbtn = $('.jsPanel-btn-small', controls);
479   - }
480   - // enable control and reset styles
481   - controlbtn.on('click', function (e) {
482   - e.preventDefault();
483   - panel[btn]();
484   - }).css({ opacity: 1, cursor: 'pointer' });
485   - }
486   - }
487   - return panel;
488   - },
489   -
490   - // helper function for the doubleclick handlers (title, content, footer)
491   - dblclickhelper: function (odcs, panel) {
492   - if (typeof odcs === 'string') {
493   - if (odcs === "maximize" || odcs === "normalize") {
494   - if (panel.status === "normalized" || panel.option.panelstatus === "normalized") {
495   - panel.maximize();
496   - } else {
497   - panel.normalize();
498   - }
499   - } else if (odcs === "minimize" || odcs === "smallify" || odcs === "close") {
500   - panel[odcs]();
501   - }
502   - }
503   - },
504   -
505   - // export a panel layout to localStorage and returns array with an object for each panel
506   - exportPanels: function () {
507   - var elmtOffset, elmtPosition, elmtTop, elmtLeft, elmtWidth, elmtHeight, elmtStatus, panelParent,
508   - panelArr = [], exportedPanel,
509   - panels = $(".jsPanel").not(".jsPanel-tt, .jsPanel-hint, .jsPanel-modal");
510   - panels.each(function (index, elmt) {
511   - exportedPanel = {
512   - panelstatus: $(elmt).data("panelstatus"),
513   - id: $(elmt).prop("id"),
514   - title: $(".jsPanel-title", elmt).html(),
515   - custom: $(elmt).data("custom"),
516   - offset: { top: 0, left: 0 },
517   - content: $(elmt).data("content")
518   - };
519   - // normalize minimized/maximized panels before export
520   - // status to restore is saved in exportedPanel.panelstatus
521   - if ($(elmt).data("panelstatus") !== "normalized") {
522   - $(".jsPanel-btn-norm", elmt).trigger("click");
523   - }
524   - panelParent = $(elmt).data("selector");
525   - elmtOffset = $(elmt).offset();
526   - elmtPosition = $(elmt).position();
527   - if (elmtStatus === "minimized") {
528   - if (panelParent.toLowerCase() === "body") {
529   - elmtTop = $(elmt).data("paneltop") - $(window).scrollTop() + "px";
530   - elmtLeft = $(elmt).data("panelleft") - $(window).scrollLeft() + "px";
531   - } else {
532   - elmtTop = $(elmt).data("paneltop") + "px";
533   - elmtLeft = $(elmt).data("panelleft") + "px";
534   - }
535   - elmtWidth = $(elmt).data("panelwidth") + "px";
536   - elmtHeight = $(elmt).data("panelheight") + "px";
537   - } else {
538   - if (panelParent.toLowerCase() === "body") {
539   - elmtTop = Math.floor(elmtOffset.top - $(window).scrollTop()) + "px";
540   - elmtLeft = Math.floor(elmtOffset.left - $(window).scrollLeft()) + "px";
541   - } else {
542   - elmtTop = Math.floor(elmtPosition.top) + "px";
543   - elmtLeft = Math.floor(elmtPosition.left) + "px";
544   - }
545   - elmtWidth = $(elmt).css("width");
546   - elmtHeight = $(".jsPanel-content", elmt).css("height");
547   - }
548   - exportedPanel.size = {
549   - width: elmtWidth,
550   - height: elmtHeight
551   - };
552   - exportedPanel.position = {
553   - top: elmtTop,
554   - left: elmtLeft
555   - };
556   - if ($(elmt).data("loadURL")) {
557   - exportedPanel.load = {};
558   - exportedPanel.load.url = $(elmt).data("loadURL");
559   - }
560   - if ($(elmt).data("ajaxURL")) {
561   - exportedPanel.ajax = {};
562   - exportedPanel.ajax.url = $(elmt).data("ajaxURL");
563   - }
564   - if ($(elmt).data("iframeDOC") || $(elmt).data("iframeSRC")) {
565   - exportedPanel.iframe = {};
566   - if ($(elmt).data("iframeDOC")) {
567   - exportedPanel.iframe.srcdoc = $(elmt).data("iframeDOC");
568   - }
569   - if ($(elmt).data("iframeSRC")) {
570   - exportedPanel.iframe.src = $(elmt).data("iframeSRC");
571   - }
572   - }
573   - panelArr.push(exportedPanel);
574   - // restore status that is saved
575   - switch (exportedPanel.panelstatus) {
576   - case "minimized":
577   - $(".jsPanel-btn-min", elmt).trigger("click");
578   - break;
579   - case "maximized":
580   - $(".jsPanel-btn-max", elmt).trigger("click");
581   - break;
582   - case "smallified":
583   - $(".jsPanel-btn-small", elmt).trigger("click");
584   - break;
585   - case "smallifiedMax":
586   - $(".jsPanel-btn-small", elmt).trigger("click");
587   - break;
588   - }
589   - });
590   - //window.localStorage.setItem("jspanels", panelArr);
591   - window.localStorage.setItem("jspanels", JSON.stringify(panelArr));
592   - return panelArr;
593   - },
594   -
595   - // imports panel layout from localStorage.jspanels and restores panels
596   - importPanels: function (predefinedConfigs) {
597   - /* panelConfig needs to be an object with predefined configs.
598   - * A config named "default" will be applied to ALL panels
599   - *
600   - * panelConfig = { default: { } [, config1 [, config2 [, configN ]]] };
601   - */
602   - var savedPanels, restoredConfig, defaultConfig;
603   - savedPanels = JSON.parse(localStorage.jspanels) || {};
604   - defaultConfig = predefinedConfigs["default"] || {};
605   - savedPanels.forEach(function (savedconfig) {
606   - // safedconfig represents one item in safedPanels
607   - if (typeof savedconfig.custom.config === "string") {
608   - restoredConfig = $.extend(true, {}, defaultConfig, predefinedConfigs[savedconfig.custom.config], savedconfig);
609   - } else {
610   - restoredConfig = $.extend(true, {}, defaultConfig, savedconfig);
611   - }
612   - // restore panel
613   - $.jsPanel(restoredConfig);
614   - });
615   - },
616   -
617   - // maintains panel position relative to window on scroll of page
618   - fixPosition: function (panel) {
619   - var jspaneldiff = panel.offset().top - $(window).scrollTop();
620   - panel.jsPanelfixPos = function () {
621   - panel.css('top', $(window).scrollTop() + jspaneldiff);
622   - };
623   - $(window).on('scroll', panel.jsPanelfixPos);
624   - },
625   -
626   - // calculate panel margins
627   - getMargins: function (panel) {
628   - var off, elmtOff, mR, mL, mB, mT,
629   - selector = panel.option.paneltype.shiftwithin,
630   - winWidth = $(window).outerWidth(),
631   - winHeight = $(window).outerHeight(),
632   - panelWidth = panel.outerWidth(),
633   - panelHeight = panel.outerHeight();
634   - if (!selector || selector === "body") {
635   - // panel margins relative to browser viewport
636   - off = panel.offset();
637   - mR = winWidth - off.left - panelWidth + $(window).scrollLeft();
638   - mL = winWidth - panelWidth - mR;
639   - mB = winHeight - off.top - panelHeight + $(window).scrollTop();
640   - mT = winHeight - panelHeight - mB;
641   - } else {
642   - // panel margins relative to element matching selector "selector"
643   - elmtOff = $(selector).offset();
644   - off = panel.offset();
645   - mR = $(selector).outerWidth() - parseInt(panel.css('width')) - (off.left - elmtOff.left);
646   - mL = off.left - elmtOff.left;
647   - mB = $(selector).outerHeight() - (off.top - elmtOff.top) - parseInt(panel.css('height'));
648   - mT = off.top - elmtOff.top;
649   - }
650   - return { marginTop: parseInt(mT), marginRight: parseInt(mR), marginBottom: parseInt(mB), marginLeft: parseInt(mL) };
651   - },
652   -
653   - // return max value of an array with numbers
654   - getMaxOfArray: function (numArray) {
655   - return Math.max.apply(null, numArray);
656   - },
657   -
658   - // calculate max horizontal and vertical tooltip shift
659   - getMaxpanelshift: function (panel) {
660   - var panelWidth = panel.outerWidth(),
661   - panelHeight = panel.outerHeight(),
662   - horiz = parseInt(panelWidth / 2) + parseInt(panel.parent().outerWidth() / 2) - 20,
663   - vert = parseInt(panelHeight / 2) + parseInt(panel.parent().outerHeight() / 2) - 20,
664   - cornerHoriz = parseInt(panelWidth / 2) - 16,
665   - cornerVert = parseInt(panelHeight / 2) - 16;
666   - return { maxshiftH: horiz, maxshiftV: vert, maxCornerH: cornerHoriz, maxCornerV: cornerVert };
667   - },
668   -
669   - // hide controls specified by param "sel" of the jsPanel "panel"
670   - hideControls: function (sel, panel) {
671   - var controls = panel.header.controls;
672   - $("*", controls).css('display', 'block');
673   - $('#minSpan').css({ 'display': '' });
674   -
675   - $(sel, controls).css('display', 'none');
676   - },
677   -
678   - // calculates option.position for hints using 'top left', 'top center' or 'top right'
679   - hintTop: function (hintGroup) {
680   - var hintH = 0;
681   - $("." + hintGroup).each(function () {
682   - hintH += $(this).outerHeight(true);
683   - });
684   - if (hintGroup === "jsPanel-hint-tr") {
685   - return { top: hintH, right: 0 };
686   - } else if (hintGroup === "jsPanel-hint-tl") {
687   - return { top: hintH, left: 0 };
688   - } else if (hintGroup === "jsPanel-hint-tc") {
689   - return { top: hintH, left: 'center' };
690   - }
691   - return { top: 0, left: 0 };
692   - },
693   -
694   - // loads content in an iFrame
695   - iframe: function (panel) {
696   - var iFrame = $("<iframe></iframe>");
697   - // iframe content
698   - if (panel.option.iframe.srcdoc) {
699   - iFrame.prop("srcdoc", panel.option.iframe.srcdoc);
700   - panel.data("iframeDOC", panel.option.iframe.srcdoc); // needed for exportPanels()
701   - }
702   - if (panel.option.iframe.src) {
703   - iFrame.prop("src", panel.option.iframe.src);
704   - panel.data("iframeSRC", panel.option.iframe.src); // needed for exportPanels()
705   - }
706   - //iframe size
707   - if (panel.option.size.width !== "auto" && !panel.option.iframe.width) {
708   - iFrame.prop("width", "100%");
709   - } else if (typeof panel.option.iframe.width === 'string' && panel.option.iframe.width.slice(-1) === '%') {
710   - iFrame.prop("width", panel.option.iframe.width);
711   - } else {
712   - iFrame.prop("width", parseInt(panel.option.iframe.width) + 'px');
713   - }
714   - if (panel.option.size.height !== "auto" && !panel.option.iframe.height) {
715   - iFrame.prop("height", "100%");
716   - } else if (typeof panel.option.iframe.height === 'string' && panel.option.iframe.height.slice(-1) === '%') {
717   - iFrame.prop("height", panel.option.iframe.height);
718   - } else {
719   - iFrame.prop("height", parseInt(panel.option.iframe.height) + 'px');
720   - }
721   - //iframe name
722   - if (typeof panel.option.iframe.name === 'string') {
723   - iFrame.prop("name", panel.option.iframe.name);
724   - }
725   - //iframe id
726   - if (typeof panel.option.iframe.id === 'string') {
727   - iFrame.prop("id", panel.option.iframe.id);
728   - }
729   - //iframe seamless (not yet supported by any browser)
730   - if (panel.option.iframe.seamless) {
731   - iFrame.prop("seamless", "seamless");
732   - }
733   - //iframe sandbox
734   - if (typeof panel.option.iframe.sandbox === 'string') {
735   - iFrame.prop("sandox", panel.option.iframe.sandbox);
736   - }
737   - //iframe style
738   - if ($.isPlainObject(panel.option.iframe.style)) {
739   - iFrame.css(panel.option.iframe.style);
740   - }
741   - //iframe css classes
742   - if (typeof panel.option.iframe.classname === 'string') {
743   - iFrame.addClass(panel.option.iframe.classname);
744   - } else if ($.isFunction(panel.option.iframe.classname)) {
745   - iFrame.addClass(panel.option.iframe.classname());
746   - }
747   - panel.content.empty().append(iFrame);
748   - },
749   -
750   - // append modal backdrop
751   - insertModalBackdrop: function () {
752   - var backdrop = '<div class="jsPanel-backdrop" style="height:' + $(document).outerHeight() + 'px;"></div>';
753   - $('body').append(backdrop);
754   - /*$(document).on("keydown", ".jsPanel-backdrop", function(e){
755   - e.preventDefault();
756   - return false;
757   - });*/
758   - },
759   -
760   - // check whether a bootstrap compatible theme is used
761   - isBootstrapTheme: function (optionBootstrap) {
762   - if ($.inArray(optionBootstrap, ["default", "primary", "info", "success", "warning", "danger"]) > -1) {
763   - return optionBootstrap;
764   - }
765   - return "default";
766   - },
767   -
768   - // loads content using jQuery.load()
769   - load: function (panel) {
770   - // alert('pppp')
771   - panel.content.load(panel.option.load.url, panel.option.load.data || undefined, function (responseText, textStatus, jqXHR) {
772   - if ($.isFunction(panel.option.load.complete)) {
773   - panel.option.load.complete.call(panel.content, responseText, textStatus, jqXHR, panel);
774   - }
775   - // title h3 might be to small: load() is async!
776   - jsPanel.resizeTitle(panel);
777   - // update option.size (content might come delayed)
778   - jsPanel.updateOptionSize(panel, panel.option.size);
779   - // fix for a bug in jQuery-UI draggable? that causes the jsPanel to reduce width when dragged beyond boundary of containing element and option.size.width is 'auto'
780   - panel.content.css('width', function () {
781   - return panel.content.outerWidth();
782   - });
783   - });
784   - panel.data("loadURL", panel.option.load.url); // needed for exportPanels()
785   -
786   -
787   -
788   - },
789   -
790   - // maximizes a panel within the body element
791   - maxWithinBody: function (panel) {
792   - var newPos, newTop, newLeft, newRight;
793   - if ((panel.status !== "maximized" || panel.option.panelstatus !== "maximized") && panel.option.paneltype.mode !== 'default') {
794   - // remove window.scroll handler, is added again later in this function
795   - $(window).off('scroll', panel.jsPanelfixPos);
796   - // restore minimized panel to initial container if necessary
797   - if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
798   - this.restoreFromMinimized(panel);
799   - }
800   - // test to enable fullscreen maximize for panels in a parent other than body
801   - if (panel.option.controls.maxtoScreen === true) {
802   - newPos = this.calcPosmaxtoScreen(panel);
803   - newTop = newPos.top + parseInt(panel.option.maximizedMargin.top);
804   - newLeft = newPos.left + parseInt(panel.option.maximizedMargin.left);
805   - } else {
806   - //nikita
807   - //newTop = $(window).scrollTop() + parseInt(panel.option.maximizedMargin.top);
808   - //newLeft = $(window).scrollLeft() + parseInt(panel.option.maximizedMargin.left);
809   - newTop = 70;
810   - newLeft = 0;
811   - //nikita
812   - newRight = 15;
813   - }
814   - panel.css({
815   - top: newTop,
816   - left: newLeft,
817   - //nikita
818   - right: newRight,
819   - width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 90
820   -
821   - //width: $(window).outerWidth() - parseInt(panel.option.maximizedMargin.left) - parseInt(panel.option.maximizedMargin.right),
822   - //height: $(window).outerHeight() - parseInt(panel.option.maximizedMargin.top) - parseInt(panel.option.maximizedMargin.bottom)
823   - });
824   - if ($('.tools') != null) {
825   - //nikita
826   - if ($('#canvasDiv') != null) {
827   - if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) {
828   - // alert('if')
829   - $('#canvasDiv').css('height', panel.outerHeight() - 75)
830   - $('#canvasDiv').css('width', panel.outerWidth() - 100)
831   - $('#canvasDiv').css('overflow', 'scroll')
832   - }
833   - else {
834   - // alert('else')
835   - $('#canvasDiv').css('height', panel.outerHeight() - 110)
836   - $('#canvasDiv').css('width', panel.outerWidth() - 90)
837   - $('#canvasDiv').css('overflow', 'scroll')
838   - }
839   - }
840   - }
841   - //nikita
842   - if (!panel.option.controls.maxtoScreen || (panel.option.controls.maxtoScreen && panel.option.selector === 'body')) {
843   - // test to enable fullscreen maximize for panels in a parent other than body
844   - this.fixPosition(panel);
845   - }
846   - }
847   - },
848   -
849   - // maximizes a panel within an element other than body
850   - maxWithinElement: function (panel) {
851   - // debugger;
852   - if ((panel.status !== "maximized" || panel.option.panelstatus !== "maximized") && panel.option.paneltype.mode !== 'default') {
853   - // restore minimized panel to initial container if necessary
854   - if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
855   - this.restoreFromMinimized(panel);
856   - }
857   - panel.css({
858   - top: parseInt(70),//panel.option.maximizedMargin.top),
859   - left: parseInt(panel.option.maximizedMargin.left),
860   - width: parseInt(panel.parent().outerWidth(), 10) - parseInt(panel.option.maximizedMargin.left) - parseInt(panel.option.maximizedMargin.right),
861   - height: parseInt(panel.parent().outerHeight()) - parseInt(panel.option.maximizedMargin.top) - parseInt(panel.option.maximizedMargin.bottom) - 65
862   - });
863   - }
864   - if ($('.tools').length> 0) {
865   - //nikita
866   - if ($('#canvasDiv') != null) {
867   - if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) {
868   - //alert('if')
869   - // debugger;
870   - $('#canvasDiv').css('height', panel.outerHeight() - 85)
871   - $('#canvasDiv').css('width', panel.outerWidth() - 90)
872   - $('#canvasDiv').css('overflow', 'scroll')
873   - }
874   - else {
875   - // alert('else')
876   - $('#canvasDiv').css('height', panel.outerHeight() - 105)
877   - $('#canvasDiv').css('width', panel.outerWidth() - 80)
878   - $('#canvasDiv').css('overflow', 'scroll')
879   -
880   - }
881   - }
882   - }
883   - //nikita
884   - // debugger;
885   - // $(".fa-minus").removeClass('display');
886   - $('#minSpan').css({ 'display': '' });
887   - },
888   -
889   - // calls functions to maximize a jsPanel
890   - maximize: function (panel) {
891   - // debugger;
892   - panel.trigger('jspanelbeforemaximize', panel.attr('id'));
893   - if ($.isFunction(panel.option.onbeforemaximize)) {
894   - var maximize = panel.option.onbeforemaximize.call(panel, panel);
895   - if (maximize === false) {
896   - return panel;
897   - }
898   - }
899   - if (panel.parentElmtTagname === 'body' || panel.option.controls.maxtoScreen === true) {
900   - this.maxWithinBody(panel);
901   - } else {
902   - this.maxWithinElement(panel);
903   - }
904   - panel.trigger('jspanelmaximized', panel.attr('id'));
905   - panel.trigger('jspanelstatechange', panel.attr('id'));
906   - if ($.isFunction(panel.option.onmaximized)) {
907   - panel.option.onmaximized.call(panel, panel);
908   - }
909   - return panel;
910   - },
911   -
912   - // minimizes a jsPanel to the lower left corner of the browser viewport
913   - minimize: function (panel) {
914   - panel.trigger('jspanelbeforeminimize', panel.attr('id'));
915   - if ($.isFunction(panel.option.onbeforeminimize)) {
916   - var minimize = panel.option.onbeforeminimize.call(panel, panel);
917   - if (minimize === false) {
918   - return panel;
919   - }
920   - }
921   - panel.data({ // needed for method exportPanels()
922   - "paneltop": parseInt(panel.option.position.top),
923   - "panelleft": parseInt(panel.option.position.left),
924   - "panelwidth": parseInt(panel.option.size.width),
925   - "panelheight": parseInt($(".jsPanel-content", panel).css("height"))
926   - });
927   - // update panel size to have correct values when normalizing again
928   - if (panel.status === "normalized" || panel.option.panelstatus === "normalized") {
929   - panel.option.size.width = panel.outerWidth();
930   - panel.option.size.height = panel.outerHeight();
931   - }
932   - panel.animate({
933   - opacity: 0
934   - }, {
935   - duration: 400, // fade out speed when minimizing
936   - complete: function () {
937   - panel.animate({
938   - width: jsPanel.widthForMinimized + "px",
939   - height: '28px'
940   - }, {
941   - duration: 100,
942   - complete: function () {
943   - jsPanel.movetoMinified(panel);
944   - jsPanel.resizeTitle(panel);
945   - panel.css('opacity', 1);
946   - }
947   - });
948   - }
949   - });
950   - if ($.isFunction(panel.option.onminimized)) {
951   - panel.option.onminimized.call(panel, panel);
952   - }
953   - return panel;
954   - },
955   -
956   - // moves a panel to the minimized container
957   - movetoMinified: function (panel) {
958   - // wenn der Container für die minimierten jsPanels noch nicht existiert -> erstellen
959   - if ($('#jsPanel-min-container').length === 0) {
960   - $('body').append('<div id="jsPanel-min-container"></div>');
961   - }
962   - if (panel.status !== "minimized" || panel.option.panelstatus !== "minimized") {
963   - // jsPanel in vorgesehenen Container verschieben
964   - panel.css({
965   - left: ($('.jsPanel', '#jsPanel-min-container').length * jsPanel.widthForMinimized),
966   - top: 0,
967   - opacity: 1
968   - })
969   - .appendTo('#jsPanel-min-container')
970   - .resizable({ disabled: true })
971   - .draggable({ disabled: true });
972   - panel.trigger('jspanelminimized', panel.attr('id'));
973   - panel.trigger('jspanelstatechange', panel.attr('id'));
974   - }
975   - },
976   -
977   - // restores a panel to its "normalized" (not minimized, maximized or smallified) position & size
978   - normalize: function (panel) {
979   - // debugger;
980   - var panelTop,
981   - interactions = ["resizable", "draggable"];
982   - panel.trigger('jspanelbeforenormalize', panel.attr('id'));
983   - if ($.isFunction(panel.option.onbeforenormalize)) {
984   - var normalize = panel.option.onbeforenormalize.call(panel, panel);
985   - if (normalize === false) {
986   - return panel;
987   - }
988   - }
989   - // remove window.scroll handler, is added again later in this function
990   - $(window).off('scroll', panel.jsPanelfixPos);
991   - // restore minimized panel to initial container if necessary
992   - if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
993   - this.restoreFromMinimized(panel);
994   - }
995   - // correction for panels maximized in body after page was scrolled
996   - if (panel.parentElmtTagname === 'body') {
997   - panelTop = $(window).scrollTop() + panel.verticalOffset;
998   - } else {
999   - panelTop = panel.option.position.top;
1000   - }
1001   - panel.css({
1002   - width: panel.option.size.width,
1003   - height: panel.option.size.height + 10,
1004   - top: panelTop,
1005   - left: panel.option.position.left
1006   - });
1007   - interactions.forEach(function (action) {
1008   - if (panel.option[action] !== "disabled") {
1009   - panel[action]("enable");
1010   - // get resizer and cursor for resizable back
1011   - $('.ui-icon-gripsmall-diagonal-se', panel).css({ 'background-image': 'none', 'text-indent': 0 });
1012   - $('.ui-resizable-handle', panel).css({ 'cursor': '' });
1013   - }
1014   - });
1015   - panel.trigger('jspanelnormalized', panel.attr('id'));
1016   - panel.trigger('jspanelstatechange', panel.attr('id'));
1017   - if (panel.parentElmtTagname === 'body') {
1018   - this.fixPosition(panel);
1019   - }
1020   - if ($.isFunction(panel.option.onnormalized)) {
1021   - panel.option.onnormalized.call(panel, panel);
1022   - }
1023   - return panel;
1024   - },
1025   -
1026   - // replace bottom/right values with corresponding top/left values if necessary and update option.position
1027   - replaceCSSBottomRight: function (panel) {
1028   - var panelPosition = panel.position();
1029   - if (panel.css('bottom')) {
1030   - panel.css({
1031   - 'top': parseInt(panelPosition.top, 10),
1032   - 'bottom': ''
1033   - });
1034   - panel.option.position.top = parseInt(panelPosition.top, 10);
1035   - }
1036   - if (panel.css('right')) {
1037   - panel.css({
1038   - 'left': parseInt(panelPosition.left, 10),
1039   - 'right': ''
1040   - });
1041   - panel.option.position.left = parseInt(panelPosition.left, 10);
1042   - }
1043   - },
1044   -
1045   - // reposition hint upon closing
1046   - reposHints: function (hintGroup, jsPtagname) {
1047   - var hintH;
1048   - if (jsPtagname === 'body') {
1049   - hintH = $(window).scrollTop();
1050   - } else {
1051   - hintH = 0;
1052   - }
1053   - $("." + hintGroup).each(function () {
1054   - $(this).animate({
1055   - top: hintH
1056   - });
1057   - hintH += $(this).outerHeight(true);
1058   - });
1059   - },
1060   -
1061   - // reposition hints on window scroll
1062   - reposHintsScroll: function (panel) {
1063   - var dif = panel.offset().top - $(window).scrollTop();
1064   - // with window.onscroll only the last added hint would stay in position
1065   - $(window).scroll(function () {
1066   - panel.css('top', $(window).scrollTop() + dif);
1067   - });
1068   - },
1069   -
1070   - // repositions a panel and optionally moves it to another container
1071   - reposition: function (panel, position, selector) {
1072   - //alert('reposition')
1073   - if (selector && typeof selector === "string") {
1074   - panel.option.selector = selector;
1075   - panel.appendTo(selector);
1076   - panel.parentElmt = $(selector).first();
1077   - panel.parentElmtTagname = panel.parentElmt[0].tagName.toLowerCase();
1078   - }
1079   - if (panel.option.paneltype.type !== 'tooltip' && panel.option.paneltype.type !== 'hint') {
1080   - // rewrite passed position to be a proper object
1081   - panel.option.position = jsPanel.rewriteOPosition(position);
1082   - // delete element styles concerning position, otherwise you might end up with left &right and/or top & bottom values
1083   - panel.css({ top: "", right: "", bottom: "", left: "" });
1084   - this.calcPanelposition(panel);
1085   - panel.verticalOffset = jsPanel.calcVerticalOffset(panel) || 0;
1086   - this.replaceCSSBottomRight(panel);
1087   - if (panel.parentElmtTagname === "body") {
1088   - this.fixPosition(panel);
1089   - } else {
1090   - $(window).off('scroll', panel.jsPanelfixPos);
1091   - }
1092   - this.updateOptionPosition(panel);
1093   - }
1094   - return panel;
1095   - },
1096   -
1097   - // repositions minimized jsPanels
1098   - reposMinimized: function () {
1099   - $('.jsPanel', '#jsPanel-min-container').each(function (index, elmt) {
1100   - $(elmt).animate({
1101   - left: (index * jsPanel.widthForMinimized)
1102   - });
1103   - });
1104   - },
1105   -
1106   - // resize exsisting jsPanel; resizes the full panel (not content section only)
1107   - resize: function (panel, width, height) {
1108   - // debugger;
1109   - if (panel.option.panelstatus !== "minimized") { // v2.4.1 don't call resize() on minimized panels
1110   - if (width && width !== null) {
1111   - panel.css("width", width);
1112   - } else {
1113   - panel.css("width", panel.content.css("width"));
1114   - }
1115   - if (height && height !== null) {
1116   - panel.css("height", height);
1117   - }
1118   - this.resizeContent(panel);
1119   - this.resizeTitle(panel);
1120   - }
1121   -
1122   - if ($('#canvasDiv') != null) {
1123   - $('#canvasDiv').css('height', $(window).outerHeight() - 120)
1124   - $('#leftToolBar').css('height', $(window).outerHeight() - 120)
1125   -
1126   - }
1127   - },
1128   -
1129   - // reset dimensions of content section after resize and so on
1130   - resizeContent: function (panel) {
1131   - var hdrftr;
1132   - if (panel.footer.css('display') === 'none') {
1133   - hdrftr = panel.header.outerHeight();
1134   - } else {
1135   - hdrftr = panel.header.outerHeight() + panel.footer.outerHeight();
1136   - }
1137   - panel.content.css({
1138   - height: (panel.outerHeight() - hdrftr),
1139   - //nikita
1140   - width: panel.outerWidth()
1141   - });
1142   - return panel;
1143   - },
1144   -
1145   - // resize the title h3 to use full width minus controls width (and prevent being longer than panel)
1146   - resizeTitle: function (panel) {
1147   - var titleWidth = (panel.outerWidth() - $(panel.header.controls).outerWidth() - 15);
1148   - panel.header.title.css('width', titleWidth);
1149   - },
1150   -
1151   - // restores minimized panels to their initial container, reenables resizable and draggable, repositions minimized panels
1152   - restoreFromMinimized: function (panel) {
1153   - var interactions = ["resizable", "draggable"];
1154   - // restore minimized panel to initial container
1155   - if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
1156   - panel.appendTo(panel.option.selector);
1157   - }
1158   - interactions.forEach(function (action) {
1159   - if (panel.option[action] !== "disabled") {
1160   - panel[action]("enable");
1161   - // get resizer and cursor for resizable back
1162   - $('.ui-icon-gripsmall-diagonal-se', panel).css({ 'background-image': 'none', 'text-indent': 0 });
1163   - $('.ui-resizable-handle', panel).css({ 'cursor': '' });
1164   - }
1165   - });
1166   - // reposition minimized panels
1167   - this.reposMinimized(jsPanel.widthForMinimized);
1168   - },
1169   -
1170   - // rewrite option.paneltype strings to objects and set defaults for option.paneltype
1171   - rewriteOPaneltype: function (optionPaneltype) {
1172   - var op = optionPaneltype;
1173   - if (op === 'modal') {
1174   - return { type: 'modal', mode: 'default' };
1175   - } else if (op === 'tooltip') {
1176   - return { type: 'tooltip', position: 'top' };
1177   - } else if (op === 'hint') {
1178   - return { type: 'hint' };
1179   - } else if (op.type === 'modal') {
1180   - return { type: 'modal', mode: op.mode || 'default' };
1181   - } else if (op.type === 'tooltip') {
1182   - return {
1183   - type: 'tooltip',
1184   - mode: op.mode || false,
1185   - position: op.position || false,
1186   - shiftwithin: op.shiftwithin || "body",
1187   - solo: op.solo || false,
1188   - cornerBG: op.cornerBG || false,
1189   - cornerOX: op.cornerOX || false,
1190   - cornerOY: op.cornerOY || false
1191   - };
1192   - } else {
1193   - return { paneltype: false };
1194   - }
1195   - },
1196   -
1197   - // converts option.position string to object
1198   - rewriteOPosition: function (optionPosition) {
1199   - var op = optionPosition;
1200   - if (op === 'center') {
1201   - return { top: 'center', left: 'center' };
1202   - } else if (op === 'auto') {
1203   - return { top: 'auto', left: 'auto' };
1204   - } else if (op === 'top left') {
1205   - return { top: '0', left: '0' };
1206   - } else if (op === 'top center') {
1207   - return { top: '0', left: 'center' };
1208   - } else if (op === 'top right') {
1209   - return { top: '0', right: '0' };
1210   - } else if (op === 'center right') {
1211   - return { top: 'center', right: '0' };
1212   - } else if (op === 'bottom right') {
1213   - return { bottom: '0', right: '0' };
1214   - } else if (op === 'bottom center') {
1215   - return { bottom: '0', left: 'center' };
1216   - } else if (op === 'bottom left') {
1217   - return { bottom: '0', left: '0' };
1218   - } else if (op === 'center left') {
1219   - return { top: 'center', left: '0' };
1220   - }
1221   - // if bottom and/or right is set to "center" change that to top and/or left set to "center"
1222   - if (op.bottom === "center") {
1223   - delete op.bottom;
1224   - op.top = "center";
1225   - }
1226   - if (op.right === "center") {
1227   - delete op.right;
1228   - op.left = "center";
1229   - }
1230   - return optionPosition;
1231   - },
1232   -
1233   - // converts option.size string to object
1234   - rewriteOSize: function (optionSize) {
1235   - var oSize = optionSize;
1236   - if (typeof oSize === 'string' && oSize === 'auto') {
1237   - oSize = {
1238   - width: 'auto',
1239   - height: 'auto'
1240   - };
1241   - }
1242   - return oSize;
1243   - },
1244   -
1245   - // set default options for hints and add necessary classes
1246   - setHintDefaults: function (panel) {
1247   - panel.option.resizable = false;
1248   - panel.option.draggable = false;
1249   - panel.option.removeHeader = true;
1250   - panel.option.toolbarFooter = false;
1251   - panel.option.show = 'fadeIn';
1252   - panel.addClass('jsPanel-hint');
1253   - panel.content.addClass('jsPanel-hint-content');
1254   - // autoclose default 8 sec | or -1 to deactivate
1255   - if (!panel.option.autoclose) {
1256   - panel.option.autoclose = 8000;
1257   - } else if (panel.option.autoclose < 0) {
1258   - panel.option.autoclose = false;
1259   - }
1260   - // add class according option.theme to color the hint background
1261   - panel.content.addClass('jsPanel-hint-' + panel.option.theme);
1262   - panel.content.append('<div class="jsPanel-hint-close jsglyph jsglyph-remove"></div>');
1263   - },
1264   -
1265   - // set default options for standard modal
1266   - setModalDefaults: function (panel) {
1267   - panel.option.selector = 'body';
1268   - panel.option.show = 'fadeIn';
1269   - panel.addClass('jsPanel-modal');
1270   - if (panel.option.paneltype.mode === 'default') {
1271   - panel.option.resizable = false;
1272   - panel.option.draggable = false;
1273   - panel.option.removeHeader = false;
1274   - panel.option.position = { top: 'center', left: 'center' };
1275   - panel.option.offset = { top: 0, left: 0 };
1276   - panel.option.controls.buttons = 'closeonly'; //do not delete else "modal" with no close button possible
1277   - $(".jsPanel-btn-min, .jsPanel-btn-norm, .jsPanel-btn-max, .jsPanel-btn-small, .jsPanel-btn-smallrev", panel).remove();
1278   - $(panel.header, panel.header.title, panel.footer).css('cursor', 'default');
1279   - $('.jsPanel-title', panel).css('cursor', 'inherit');
1280   - }
1281   - },
1282   -
1283   - // set right-to-left text direction and language; set styles and reoorder controls for rtl
1284   - setRTL: function (panel) {
1285   - var elmts = [panel.header.title, panel.content, panel.header.toolbar, panel.footer];
1286   - elmts.forEach(function (item) {
1287   - item.prop('dir', 'rtl');
1288   - if (panel.option.rtl.lang) {
1289   - item.prop('lang', panel.option.rtl.lang);
1290   - }
1291   - });
1292   - panel.header.title.css('text-align', 'right');
1293   - $('.jsPanel-btn-close', panel.header.controls).insertAfter($('.jsPanel-btn-min', panel.header.controls));
1294   - $('.jsPanel-btn-max', panel.header.controls).insertAfter($('.jsPanel-btn-min', panel.header.controls));
1295   - $('.jsPanel-btn-small', panel.header.controls).insertBefore($('.jsPanel-btn-min', panel.header.controls));
1296   - $('.jsPanel-btn-smallrev', panel.header.controls).insertBefore($('.jsPanel-btn-min', panel.header.controls));
1297   - $('.jsPanel-hdr-r', panel).css({ left: '0px', right: '', position: 'relative', 'float': 'left' });
1298   - $('.jsPanel-hint-close', panel).css('float', 'left');
1299   - $('.jsPanel-title', panel).css('float', 'right');
1300   - $('.jsPanel-ftr', panel).append('<div style="clear:both;height:0;"></div>');
1301   - $('button', panel.footer).css('float', 'left');
1302   - },
1303   -
1304   - // set default options for tooltips
1305   - setTooltipDefaults: function (panel) {
1306   - panel.option.position = {};
1307   - panel.option.resizable = false;
1308   - panel.option.draggable = false;
1309   - panel.option.show = 'fadeIn';
1310   - panel.option.controls.buttons = 'closeonly';
1311   - panel.header.title.css('cursor', 'inherit');
1312   - panel.footer.css('cursor', 'inherit');
1313   - panel.addClass('jsPanel-tt');
1314   - },
1315   -
1316   - // returns a z-index value for a panel in order to have it on top
1317   - setZi: function (panel) {
1318   - var jspanel, allZi = [], maxZi;
1319   - if (typeof panel === "string") {
1320   - jspanel = $(panel);
1321   - } else {
1322   - jspanel = panel;
1323   - }
1324   - // build array with all z-index values
1325   - $(".jsPanel:not('.jsPanel-modal, .jsPanel-nofront')").each(function (i, elmt) {
1326   - if (jspanel.attr("id") !== $(elmt).attr("id")) {
1327   - allZi.push($(elmt).css("z-index"));
1328   - }
1329   - });
1330   - //allZi.sort(function(a, b) {return a - b}); // sort array ascending
1331   - //console.log(allZi);
1332   - maxZi = this.getMaxOfArray(allZi);
1333   - return maxZi + 1;
1334   - },
1335   -
1336   - // shift tooltip left/right if it overflows window; when using horizontal offsets of panel and/or corner result might be not as expected
1337   - shiftTooltipHorizontal: function (panel) {
1338   - var margins = this.getMargins(panel),
1339   - leftShiftRequired,
1340   - maxShift = this.getMaxpanelshift(panel),
1341   - maxLeftShift = maxShift.maxshiftH,
1342   - shift,
1343   - maxCornerLeft = maxShift.maxCornerH,
1344   - cornerShift,
1345   - newPanelLeft = 0,
1346   - newCornerLeft = 0;
1347   - if (margins.marginLeft < 0 && margins.marginRight > 0) {
1348   - // if panel overflows left window border
1349   - leftShiftRequired = Math.abs(margins.marginLeft) + 5 || 0;
1350   - shift = Math.min(leftShiftRequired, maxLeftShift) || 0;
1351   - cornerShift = Math.min(maxCornerLeft, shift) || 0;
1352   - newPanelLeft = parseInt(panel.css('left')) + shift + "px";
1353   - newCornerLeft = parseInt($('.jsPanel-corner', panel).css('left')) - cornerShift + "px";
1354   - } else if (margins.marginRight < 0 && margins.marginLeft > 0) {
1355   - // if panel overflows right window border
1356   - leftShiftRequired = Math.abs(margins.marginRight) + 5 || 0;
1357   - shift = Math.min(leftShiftRequired, maxLeftShift) || 0;
1358   - cornerShift = Math.min(maxCornerLeft, shift) || 0;
1359   - newPanelLeft = parseInt(panel.css('left')) - shift + "px";
1360   - newCornerLeft = parseInt($('.jsPanel-corner', panel).css('left')) + cornerShift + "px";
1361   - }
1362   - if ((margins.marginLeft < 0 && margins.marginRight > 0) || (margins.marginRight < 0 && margins.marginLeft > 0)) {
1363   - // shift panel
1364   - panel.animate({
1365   - "left": newPanelLeft
1366   - }, { queue: false /* to have both animation run simultaneously */ });
1367   -
1368   - // shift corner if present
1369   - if ($('.jsPanel-corner', panel)) {
1370   - $('.jsPanel-corner', panel).animate({
1371   - "left": newCornerLeft
1372   - }, { queue: false /* to have both animation run simultaneously */ });
1373   - }
1374   - }
1375   - },
1376   -
1377   - // shift tooltip up/down if it overflows window; when using vertical offsets of panel and/or corner result might be not as expected
1378   - shiftTooltipVertical: function (panel) {
1379   - //console.log( parseInt($('*:first-child', panel.parent()).css('margin-left')) );
1380   - var margins = this.getMargins(panel),
1381   - topShiftRequired,
1382   - maxShift = this.getMaxpanelshift(panel),
1383   - maxTopShift = maxShift.maxshiftV,
1384   - shift,
1385   - maxCornerTop = maxShift.maxCornerV,
1386   - cornerShift,
1387   - newPanelTop = 0,
1388   - newCornerTop = 0;
1389   - if (margins.marginTop < 0 && margins.marginBottom > 0) {
1390   - // if panel overflows top window border
1391   - topShiftRequired = Math.abs(margins.marginTop) + 5 || 0;
1392   - shift = Math.min(topShiftRequired, maxTopShift) || 0;
1393   - cornerShift = Math.min(maxCornerTop, shift) || 0;
1394   - newPanelTop = parseInt(panel.css('top')) + shift + "px";
1395   - newCornerTop = parseInt($('.jsPanel-corner', panel).css('top')) - cornerShift + "px";
1396   - } else if (margins.marginBottom < 0 && margins.marginTop > 0) {
1397   - // if panel overflows bottom window border
1398   - topShiftRequired = Math.abs(margins.marginBottom) + 5 || 0;
1399   - shift = Math.min(topShiftRequired, maxTopShift) || 0;
1400   - cornerShift = Math.min(maxCornerTop, shift) || 0;
1401   - newPanelTop = parseInt(panel.css('top')) - shift + "px";
1402   - newCornerTop = parseInt($('.jsPanel-corner', panel).css('top')) + cornerShift + "px";
1403   - }
1404   - if ((margins.marginTop < 0 && margins.marginBottom > 0) || (margins.marginBottom < 0 && margins.marginTop > 0)) {
1405   - // shift panel
1406   - panel.animate({
1407   - "top": newPanelTop
1408   - }, { queue: false /* to have both animation run simultaneously */ });
1409   -
1410   - // shift corner if present
1411   - if ($('.jsPanel-corner', panel)) {
1412   - $('.jsPanel-corner', panel).animate({
1413   - "top": newCornerTop
1414   - }, { queue: false /* to have both animation run simultaneously */ });
1415   - }
1416   - }
1417   - },
1418   -
1419   - smallify: function (panel) {
1420   - var statusNew;
1421   - if ((panel.status !== "smallified" || panel.option.panelstatus !== "smallified") && (panel.status !== "smallifiedMax" || panel.option.panelstatus !== "smallifiedMax")) {
1422   - if (panel.status === "maximized" || panel.option.panelstatus === "maximized") {
1423   - statusNew = "smallifiedMax";
1424   - } else {
1425   - statusNew = "smallified";
1426   - }
1427   - // store panel height in function property
1428   - panel.smallify.height = panel.outerHeight();
1429   - panel.panelheaderheight = panel.header.outerHeight() - 2;
1430   - panel.panelfooterheight = panel.footer.outerHeight();
1431   - panel.panelcontentheight = panel.content.outerHeight();
1432   - panel.animate({
1433   - height: panel.panelheaderheight
1434   - },
1435   - {
1436   - done: function () {
1437   - if (panel.status === 'maximized' || panel.option.panelstatus === 'maximized') {
1438   - jsPanel.hideControls(".jsPanel-btn-max, .jsPanel-btn-small", panel);
1439   - } else {
1440   - jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-small", panel);
1441   - }
1442   - jsPanel.updateStateProps(panel, statusNew);
1443   - panel.trigger('jspanel' + statusNew, panel.attr('id'));
1444   - panel.trigger('jspanelstatechange', panel.attr('id'));
1445   - }
1446   - });
1447   - }
1448   - },
1449   -
1450   - unsmallify: function (panel) {
1451   - panel.animate({
1452   - height: panel.smallify.height
1453   - },
1454   - {
1455   - done: function () {
1456   - if (panel.status === 'smallified' || panel.option.panelstatus === 'smallified') {
1457   - jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-smallrev", panel);
1458   - jsPanel.updateStateProps(panel, "normalized");
1459   - panel.trigger('jspanelnormalized', panel.attr('id'));
1460   - panel.trigger('jspanelstatechange', panel.attr('id'));
1461   - } else {
1462   - jsPanel.hideControls(".jsPanel-btn-max, .jsPanel-btn-smallrev", panel);
1463   - jsPanel.updateStateProps(panel, "maximized");
1464   - panel.trigger('jspanelmaximized', panel.attr('id'));
1465   - panel.trigger('jspanelstatechange', panel.attr('id'));
1466   - }
1467   - }
1468   - }
1469   - );
1470   - },
1471   -
1472   - // updates option.position to hold actual values
1473   - updateOptionPosition: function (panel) {
1474   - panel.option.position.top = panel.css('top');
1475   - panel.option.position.left = panel.css('left');
1476   - },
1477   -
1478   - // updates option.size to hold actual values
1479   - updateOptionSize: function (panel) {
1480   - panel.option.size.width = panel.css('width');
1481   - panel.option.size.height = $(".jsPanel-content", panel).css("height");
1482   - },
1483   -
1484   - updateCustomData: function (panel, key, val) {
1485   - var custom = panel.data("custom");
1486   - custom[key] = val;
1487   - panel.data("custom", custom);
1488   - },
1489   -
1490   - updateStateProps: function (panel, status) {
1491   - panel.status = status;
1492   - panel.option.panelstatus = status;
1493   - panel.data("panelstatus", status);
1494   - panel.alterClass("jsPanel-state-*", "jsPanel-state-" + status);
1495   - },
1496   -
1497   - getScope: function (ctrlName) {
1498   - var sel = 'div[ng-controller="' + ctrlName + '"]';
1499   - return angular.element(sel).scope();
1500   - },
1501   -
1502   - getRootScope: function (controllerName) {
1503   - var $body = angular.element(document.body); // 1
1504   - return $body.scope().$root;
1505   -
1506   - }
1507   -};
1508   -
1509   -console.log("jsPanel version: " + jsPanel.version);
1510   -
1511   -(function ($) {
1512   - $.jsPanel = function (config) {
1513   -
1514   -
1515   - var jsP, template, id,
1516   - panelconfig = config || {},
1517   - optConfig = panelconfig.config || {};
1518   -
1519   - // use custom jsPanel template if present else standard template
1520   - template = panelconfig.template || jsPanel.template;
1521   - jsP = $(template);
1522   -
1523   - // Extend our default config with those provided. Note that the first arg to extend is an empty object - this is to keep from overriding our "defaults" object.
1524   - jsP.option = $.extend(true, {}, $.jsPanel.defaults, optConfig, panelconfig);
1525   -
1526   - // option.id ---------------------------------------------------------------------------------------------------
1527   - if (typeof jsP.option.id === "string") {
1528   - id = jsP.option.id;
1529   - } else if ($.isFunction(jsP.option.id)) {
1530   - id = jsP.option.id();
1531   - } else {
1532   - jsPanel.ID += 1;
1533   - id = jsPanel.ID;
1534   - }
1535   - if ($("#" + id).length > 0) {
1536   - alert("jsPanel Error: No jsPanel created - id attribute passed with option.id already exists in document");
1537   - return false;
1538   - } else {
1539   - jsP.attr("id", id);
1540   - }
1541   -
1542   - jsP.data("custom", jsP.option.custom);
1543   -
1544   - jsP.verticalOffset = 0; // always use 0 ... not "0" !
1545   -
1546   - try {
1547   - jsP.parentElmt = $(jsP.option.selector).first();
1548   - jsP.parentElmtTagname = jsP.parentElmt[0].tagName.toLowerCase();
1549   - jsP.count = jsP.parentElmt.children('.jsPanel').length;
1550   - } catch (e) {
1551   - alert(e + "\n\nThe element you want to append the jsPanel to does not exist!\n\n The jsPanel will be appended to the body element instead.");
1552   - jsP.option.selector = 'body';
1553   - jsP.parentElmt = $('body');
1554   - jsP.parentElmtTagname = 'body';
1555   - jsP.count = jsP.parentElmt.children('.jsPanel').length;
1556   - }
1557   -
1558   - jsP.status = "initialized";
1559   -
1560   - jsP.header = $('.jsPanel-hdr', jsP);
1561   -
1562   - jsP.header.title = $('.jsPanel-title', jsP.header);
1563   -
1564   - jsP.header.controls = $('.jsPanel-hdr-r', jsP.header);
1565   -
1566   - jsP.header.toolbar = $('.jsPanel-hdr-toolbar', jsP.header);
1567   -
1568   - jsP.content = $('.jsPanel-content', jsP);
1569   -
1570   - jsP.footer = $('.jsPanel-ftr', jsP);
1571   -
1572   - jsP.normalize = function () {
1573   - jsPanel.normalize(jsP);
1574   - return jsP;
1575   - };
1576   -
1577   - jsP.close = function () {
1578   - // alert('1')
1579   - jsPanel.close(jsP);
1580   - // no need to return something
1581   - };
1582   -
1583   - jsP.closeChildpanels = function () {
1584   - jsPanel.closeChildpanels(jsP);
1585   - return jsP;
1586   - };
1587   -
1588   - jsP.minimize = function () {
1589   - jsPanel.minimize(jsP);
1590   - return jsP;
1591   - };
1592   -
1593   - jsP.maximize = function () {
1594   - jsPanel.maximize(jsP);
1595   - return jsP;
1596   - };
1597   -
1598   - jsP.smallify = function () {
1599   - if ((jsP.status === "normalized" || jsP.option.panelstatus === "normalized") || (jsP.status === "maximized" || jsP.option.panelstatus === "maximized")) {
1600   - jsPanel.smallify(jsP);
1601   - } else if ((jsP.status !== "minimized" || jsP.option.panelstatus !== "minimized")) {
1602   - jsPanel.unsmallify(jsP);
1603   - }
1604   - return jsP;
1605   - };
1606   -
1607   - jsP.front = function () {
1608   - jsP.css('z-index', jsPanel.setZi(jsP));
1609   - return jsP;
1610   - };
1611   -
1612   - jsP.title = function (text) {
1613   - if (text && typeof text === "string") {
1614   - jsP.header.title.html(text);
1615   - return jsP;
1616   - } else if (arguments.length === 0) {
1617   - return jsP.header.title.html();
1618   - }
1619   - };
1620   -
1621   - jsP.addToolbar = function (place, items) {
1622   - jsPanel.addToolbar(jsP, place, items);
1623   - return jsP;
1624   - };
1625   -
1626   - jsP.control = function (action, btn) {
1627   - jsPanel.control(jsP, action, btn);
1628   - return jsP;
1629   - };
1630   -
1631   - jsP.resize = function (width, height) {
1632   - // alert('jsP.resize')
1633   - // method resizes the full panel (not content section only)
1634   - jsPanel.resize(jsP, width, height);
1635   - return jsP;
1636   - };
1637   -
1638   - jsP.reposition = function (position, selector) {
1639   - jsPanel.reposition(jsP, position, selector);
1640   - return jsP;
1641   - };
1642   -
1643   - jsP.reloadContent = function () {
1644   - if (jsP.option.content) {
1645   - jsP.content.empty().append(jsP.option.content);
1646   - } else if (jsP.option.load) {
1647   - jsP.content.empty();
1648   - jsPanel.load(jsP);
1649   - } else if (jsP.option.ajax) {
1650   - jsPanel.ajax(jsP);
1651   - } else if (jsP.option.iframe) {
1652   - jsPanel.iframe(jsP);
1653   - }
1654   - };
1655   -
1656   - // handler to move panel to foreground on click
1657   - jsP.on('click', function (e) {
1658   - //alert('1')
1659   - // use of e.preventDefault(); would prevent events from inside a panel from firing properly
1660   - if (!$(e.target).is("a[href], button, .jsPanel-nofront, .jsPanel-nofront *")) {
1661   - if (!jsP.hasClass("jsPanel-modal")) {
1662   - jsP.css('z-index', jsPanel.setZi(jsP));
1663   - }
1664   - }
1665   - });
1666   -
1667   - // jsPanel close
1668   - $('.jsPanel-btn-close', jsP).on('click', function (e) {
1669   - // alert('2')
1670   - e.preventDefault();
1671   - //if (!jsP.option.controls.confirmClose) {
1672   - // jsPanel.close(jsP, jsP.parentElmtTagname);
1673   - //} else {
1674   - // if (window.confirm(jsP.option.controls.confirmClose) === true) {
1675   - // jsPanel.close(jsP, jsP.parentElmtTagname);
1676   - // }
1677   - //}
1678   -
1679   -
1680   - var $scope = jsPanel.getRootScope('HomeController');
1681   - $scope.openParent(jsP.option.parentSlug);
1682   - $scope.$apply();
1683   - });
1684   -
1685   -
1686   -
1687   -
1688   - // jsPanel minimize
1689   - $('.jsPanel-btn-min', jsP).on('click', function (e) {
1690   - // alert('minimized')
1691   -
1692   - e.preventDefault();
1693   - jsPanel.minimize(jsP);
1694   - // debugger;
1695   - var headerTitle = $('.jsPanel-title');
1696   - var title = headerTitle[0].innerHTML;
1697   -
1698   - var $rootscope = jsPanel.getRootScope('HomeController');
1699   - //$rootscope.openParent(jsP.option.parentSlug);
1700   - $rootscope.setState('min', title);
1701   - $rootscope.$apply();
1702   -
1703   - var currentController = jsP.option.currentController;
1704   - if (currentController == 'DAController') {
1705   - var $scope = jsPanel.getScope(currentController);
1706   - var canvasDiv = document.getElementById('canvasDiv');
1707   - $scope.imageVerticalScrollPosition = canvasDiv.scrollTop;
1708   - $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft;
1709   - $scope.$apply();
1710   - }
1711   - });
1712   -
1713   - // jsPanel maximize
1714   - $('.jsPanel-btn-max', jsP).on('click', function (e) {
1715   - // debugger;
1716   - e.preventDefault();
1717   - jsPanel.maximize(jsP);
1718   -
1719   - $('.jsPanel-btn-min').css('display', 'initial');
1720   - $('.fa fa-minus').css('display', 'initial');
1721   -
1722   -
1723   -
1724   - var headerTitle = $('.jsPanel-title');
1725   - var title = headerTitle[0].innerHTML;
1726   - var $rootscope = jsPanel.getRootScope('HomeController');
1727   - $rootscope.setState('max', title);
1728   - $rootscope.$apply();
1729   - });
1730   -
1731   - // jsPanel normalize
1732   - $('.jsPanel-btn-norm', jsP).on('click', function (e) {
1733   - // debugger;
1734   - e.preventDefault();
1735   - jsPanel.normalize(jsP);
1736   -
1737   - var currentController = jsP.option.currentController;
1738   - if (currentController == 'DAController') {
1739   - var $scope = jsPanel.getScope(currentController);
1740   -
1741   -
1742   - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
1743   - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition)
1744   -
1745   - $scope.$apply();
1746   - }
1747   - });
1748   -
1749   - // jsPanel smallify
1750   - $('.jsPanel-btn-small', jsP).on('click', function (e) {
1751   - e.preventDefault();
1752   - jsPanel.smallify(jsP);
1753   - });
1754   -
1755   - // jsPanel unsmallify
1756   - $('.jsPanel-btn-smallrev', jsP).on('click', function (e) {
1757   - e.preventDefault();
1758   - jsPanel.unsmallify(jsP);
1759   - });
1760   -
1761   - // rewrite option.paneltype strings to objects and set defaults for option.paneltype
1762   - jsP.option.paneltype = jsPanel.rewriteOPaneltype(jsP.option.paneltype);
1763   -
1764   - // converts option.position string to object
1765   - jsP.option.position = jsPanel.rewriteOPosition(jsP.option.position);
1766   -
1767   - // converts option.size string to object
1768   - jsP.option.size = jsPanel.rewriteOSize(jsP.option.size);
1769   -
1770   - /* option.paneltype - override or set various settings depending on option.paneltype ------------------------ */
1771   - if (jsP.option.paneltype.type === 'modal') {
1772   - // set defaults for standard modal
1773   - jsPanel.setModalDefaults(jsP);
1774   - // insert backdrop
1775   - if ($('.jsPanel-backdrop').length < 1) {
1776   - jsPanel.insertModalBackdrop();
1777   - }
1778   - } else if (jsP.option.paneltype.type === 'tooltip') {
1779   - jsPanel.setTooltipDefaults(jsP);
1780   - // optionally remove all other tooltips
1781   - if (jsP.option.paneltype.solo) {
1782   - jsPanel.closeallTooltips();
1783   - }
1784   - // calc top & left for the various tooltip positions
1785   - jsP.option.position = jsPanel.calcToooltipPosition(jsP.parentElmt, jsP.option);
1786   - // position the tooltip & add tooltip class
1787   - jsP.css({
1788   - top: jsP.option.position.top,
1789   - left: jsP.option.position.left
1790   - });
1791   - if (!jsP.parentElmt.parent().hasClass('jsPanel-tooltip-wrapper')) {
1792   - // wrap element serving as trigger in a div - will take the tooltip
1793   - jsP.parentElmt.wrap('<div class="jsPanel-tooltip-wrapper">');
1794   - // append tooltip (jsPanel) to the wrapper div
1795   - jsP.parentElmt.parent().append(jsP);
1796   - if (jsP.option.paneltype.mode === 'semisticky') {
1797   - jsP.hover(
1798   - function () {
1799   - $.noop();
1800   - },
1801   - function () {
1802   - jsPanel.close(jsP);
1803   - }
1804   - );
1805   - } else if (jsP.option.paneltype.mode === 'sticky') {
1806   - $.noop();
1807   - } else {
1808   - jsP.option.controls.buttons = 'none';
1809   - // tooltip will be removed whenever mouse leaves trigger
1810   - jsP.parentElmt.off('mouseout'); // to prevent mouseout from firing several times
1811   - jsP.parentElmt.mouseout(function () {
1812   - jsPanel.close(jsP);
1813   - });
1814   - }
1815   - }
1816   - // corners
1817   - jsP.css('overflow', 'visible');
1818   - if (jsP.option.paneltype.cornerBG) {
1819   - var corner = $("<div></div>"),
1820   - cornerLoc = "jsPanel-corner-" + jsP.option.paneltype.position,
1821   - cornerPos,
1822   - cornerOX = parseInt(jsP.option.paneltype.cornerOX) || 0,
1823   - cornerOY = parseInt(jsP.option.paneltype.cornerOY) || 0,
1824   - cornerBG = jsP.option.paneltype.cornerBG;
1825   - if (jsP.option.paneltype.position !== "bottom") {
1826   - corner.addClass("jsPanel-corner " + cornerLoc).appendTo(jsP);
1827   - } else {
1828   - corner.addClass("jsPanel-corner " + cornerLoc).prependTo(jsP);
1829   - }
1830   - if (jsP.option.paneltype.position === "top") {
1831   - cornerPos = parseInt(jsP.option.size.width) / 2 - 12 + (cornerOX) + "px";
1832   - corner.css({ borderTopColor: cornerBG, left: cornerPos });
1833   - } else if (jsP.option.paneltype.position === "right") {
1834   - cornerPos = parseInt(jsP.option.size.height) / 2 - 12 + (cornerOY) + "px";
1835   - corner.css({ borderRightColor: cornerBG, left: "-22px", top: cornerPos });
1836   - } else if (jsP.option.paneltype.position === "bottom") {
1837   - cornerPos = parseInt(jsP.option.size.width) / 2 - 12 + (cornerOX) + "px";
1838   - corner.css({ borderBottomColor: cornerBG, left: cornerPos, top: "-22px" });
1839   - } else if (jsP.option.paneltype.position === "left") {
1840   - cornerPos = parseInt(jsP.option.size.height) / 2 - 12 + (cornerOY) + "px";
1841   - corner.css({ borderLeftColor: cornerBG, left: jsP.option.size.width, top: cornerPos });
1842   - }
1843   - }
1844   - } else if (jsP.option.paneltype.type === 'hint') {
1845   - jsPanel.setHintDefaults(jsP);
1846   - // bind callback for close button
1847   - $('.jsPanel-hint-close', jsP).on('click', jsP, function (event) {
1848   - event.data.close(jsP);
1849   - });
1850   - // set option.position for hints using 'top left', 'top center' or 'top right'
1851   - if (jsP.option.position.top === '0' && jsP.option.position.left === 'center') {
1852   - jsP.addClass("jsPanel-hint-tc");
1853   - if ($(".jsPanel-hint-tc").length > 0) {
1854   - jsP.option.position = jsPanel.hintTop("jsPanel-hint-tc");
1855   - }
1856   - } else if (jsP.option.position.top === '0' && jsP.option.position.left === '0') {
1857   - jsP.addClass("jsPanel-hint-tl");
1858   - if ($(".jsPanel-hint-tl").length > 0) {
1859   - jsP.option.position = jsPanel.hintTop("jsPanel-hint-tl");
1860   - }
1861   - } else if (jsP.option.position.top === '0' && jsP.option.position.right === '0') {
1862   - jsP.addClass("jsPanel-hint-tr");
1863   - if ($(".jsPanel-hint-tr").length > 0) {
1864   - jsP.option.position = jsPanel.hintTop("jsPanel-hint-tr");
1865   - }
1866   - }
1867   - }
1868   -
1869   - /* option.selector - append jsPanel only to the first object in selector ------------------------------------ */
1870   - jsP.data("selector", jsP.option.selector); // needed for exportPanels()
1871   - if (jsP.option.paneltype.type !== 'tooltip') {
1872   - jsP.appendTo(jsP.parentElmt);
1873   - }
1874   - if (jsP.option.paneltype.type === 'modal') {
1875   - jsP.css('zIndex', 10001);
1876   - if (jsP.option.paneltype.mode === 'extended') {
1877   - $('.jsPanel-backdrop').css('z-index', '9998');
1878   - }
1879   - } else {
1880   - if (!jsP.hasClass("jsPanel-modal")) {
1881   - jsP.css('z-index', jsPanel.setZi(jsP));
1882   - }
1883   - }
1884   -
1885   - /* option.bootstrap & option.theme -------------------------------------------------------------------------- */
1886   - if (jsP.option.bootstrap) {
1887   - // check whether a bootstrap compatible theme is used and set option.theme accordingly
1888   - jsP.option.theme = jsPanel.isBootstrapTheme(jsP.option.bootstrap);
1889   - jsP.option.controls.iconfont = 'bootstrap';
1890   - jsP.alterClass('jsPanel-theme-*', 'panel panel-' + jsP.option.theme);
1891   - jsP.header.alterClass('jsPanel-theme-*', 'panel-heading');
1892   - jsP.header.title.addClass('panel-title');
1893   - jsP.content.alterClass('jsPanel-theme-*', 'panel-body');
1894   - jsP.footer.addClass('panel-footer');
1895   - // fix css problems for panels nested in other bootstrap panels
1896   - jsP.header.title.css('color', function () {
1897   - return jsP.header.css('color');
1898   - });
1899   - jsP.content.css('border-top-color', function () {
1900   - return jsP.header.css('border-top-color');
1901   - });
1902   - } else {
1903   - // activate normal non bootstrap themes
1904   - var components = [jsP, jsP.header, jsP.content, jsP.footer];
1905   - components.forEach(function (elmt) {
1906   - $(elmt).alterClass('jsPanel-theme-*', 'jsPanel-theme-' + jsP.option.theme);
1907   - });
1908   - }
1909   -
1910   - /* option.removeHeader; option.controls (buttons in header right) ------------------------------------------- */
1911   - if (jsP.option.removeHeader) {
1912   - jsP.header.remove();
1913   - } else {
1914   - jsPanel.configControls(jsP);
1915   - }
1916   -
1917   - /* insert iconfonts if option.iconfont set (default is "jsglyph") */
1918   - if (jsP.option.controls.iconfont) {
1919   - jsPanel.configIconfont(jsP);
1920   - } else {
1921   - // if option.controls.iconfont === false restore old icon sprite
1922   - $('.jsPanel-btn-close, .jsPanel-btn-max, .jsPanel-btn-norm, .jsPanel-btn-min, .jsPanel-btn-small, .jsPanel-btn-smallrev', jsP.header.controls).empty();
1923   - }
1924   -
1925   - /* option.toolbarHeader | default: false -------------------------------------------------------------------- */
1926   - if (jsP.option.toolbarHeader && jsP.option.removeHeader === false) {
1927   - if (typeof jsP.option.toolbarHeader === 'string') {
1928   - jsP.header.toolbar.append(jsP.option.toolbarHeader);
1929   - } else if ($.isFunction(jsP.option.toolbarHeader)) {
1930   - jsP.header.toolbar.append(jsP.option.toolbarHeader(jsP.header));
1931   - } else if ($.isArray(jsP.option.toolbarHeader)) {
1932   - jsPanel.configToolbar(jsP.option.toolbarHeader, jsP.header.toolbar, jsP);
1933   - }
1934   - // give toolbar the same font-family as title
1935   - jsP.header.toolbar.css("font-family", jsP.header.title.css("font-family"));
1936   - }
1937   -
1938   - /* option.toolbarFooter | default: false -------------------------------------------------------------------- */
1939   - if (jsP.option.toolbarFooter) {
1940   - jsP.footer.css({
1941   - display: 'block'
1942   - });
1943   - if (typeof jsP.option.toolbarFooter === 'string') {
1944   - jsP.footer.append(jsP.option.toolbarFooter);
1945   - } else if ($.isFunction(jsP.option.toolbarFooter)) {
1946   - jsP.footer.append(jsP.option.toolbarFooter(jsP.footer));
1947   - } else if ($.isArray(jsP.option.toolbarFooter)) {
1948   - jsPanel.configToolbar(jsP.option.toolbarFooter, jsP.footer, jsP);
1949   - }
1950   - // give toolbar the same font-family as title
1951   - jsP.footer.css("font-family", jsP.header.title.css("font-family"));
1952   - }
1953   -
1954   - /* option.rtl | default: false ------------------------------------------------------------------------------ */
1955   - if (jsP.option.rtl.rtl === true) {
1956   - jsPanel.setRTL(jsP, jsP.option.rtl.lang);
1957   - }
1958   -
1959   - /* option.overflow | default: 'hidden' --------------------------------------------------------------------- */
1960   - if (typeof jsP.option.overflow === 'string') {
1961   - jsP.content.css('overflow', jsP.option.overflow);
1962   - } else if ($.isPlainObject(jsP.option.overflow)) {
1963   - jsP.content.css({
1964   - 'overflow-y': jsP.option.overflow.vertical,
1965   - 'overflow-x': jsP.option.overflow.horizontal
1966   - });
1967   - }
1968   -
1969   - /* option.draggable ----------------------------------------------------------------------------------------- */
1970   - if ($.isPlainObject(jsP.option.draggable)) {
1971   - // if jsPanel is childpanel
1972   - if (jsP.parent().hasClass('jsPanel-content')) {
1973   - jsP.option.draggable.containment = 'parent';
1974   - }
1975   - // merge draggable settings and apply
1976   - jsP.option.customdraggable = $.extend(true, {}, $.jsPanel.defaults.draggable, jsP.option.draggable);
1977   - jsP.draggable(jsP.option.customdraggable);
1978   - } else if (jsP.option.draggable === 'disabled') {
1979   - // reset cursor, draggable deactivated
1980   - $('.jsPanel-title, .jsPanel-ftr', jsP).css('cursor', 'inherit');
1981   - // jquery ui draggable initialize disabled to allow to query status
1982   - jsP.draggable({ disabled: true });
1983   - }
1984   -
1985   - /* option.resizable ----------------------------------------------------------------------------------------- */
1986   - if ($.isPlainObject(jsP.option.resizable)) {
1987   - jsP.option.customresizable = $.extend(true, {}, $.jsPanel.defaults.resizable, jsP.option.resizable);
1988   - jsP.resizable(jsP.option.customresizable);
1989   - } else if (jsP.option.resizable === 'disabled') {
1990   - // jquery ui resizable initialize disabled to allow to query status
1991   - jsP.resizable({ disabled: true });
1992   - $('.ui-icon-gripsmall-diagonal-se', jsP).css({ 'background-image': 'none', 'text-indent': -9999 });
1993   - $('.ui-resizable-handle', jsP).css({ 'cursor': 'inherit' });
1994   - }
1995   -
1996   - /* option.content ------------------------------------------------------------------------------------------- */
1997   - // option.content can be any valid argument for jQuery.append()
1998   - if (jsP.option.content) {
1999   - jsP.content.append(jsP.option.content);
2000   - jsP.data("content", jsP.option.content);
2001   - }
2002   -
2003   - /* option.load ---------------------------------------------------------------------------------------------- */
2004   - if ($.isPlainObject(jsP.option.load) && jsP.option.load.url) {
2005   - jsPanel.load(jsP);
2006   - }
2007   -
2008   - /* option.ajax ---------------------------------------------------------------------------------------------- */
2009   - if ($.isPlainObject(jsP.option.ajax) && jsP.option.ajax.url) {
2010   - jsPanel.ajax(jsP);
2011   - }
2012   -
2013   - /* option.size ---------------------------------------------------------------------------------------------- */
2014   - jsP.content.css({
2015   - width: jsP.option.size.width || 'auto',
2016   - height: jsP.option.size.height || 'auto'
2017   - });
2018   -
2019   - // Important! limit title width; final adjustment follows later; otherwise title might be longer than panel width
2020   - jsP.header.title.css('width', jsP.content.width() - 90);
2021   -
2022   - /* option.iframe -------------------------------------------------------------------------------------------- */
2023   - // implemented after option.size because option.size.width/height are either "auto" or pixel values already
2024   - if ($.isPlainObject(jsP.option.iframe) && (jsP.option.iframe.src || jsP.option.iframe.srcdoc)) {
2025   - jsPanel.iframe(jsP);
2026   - }
2027   -
2028   - /* option.position ------------------------------------------------------------------------------------------ */
2029   - if (jsP.option.paneltype.type !== 'tooltip') {
2030   - // value "center" not allowed for option.position.bottom & option.position.right -> use top and/or left
2031   - // finally calculate & position the jsPanel
2032   - jsPanel.calcPanelposition(jsP);
2033   - }
2034   -
2035   - /* option.addClass ------------------------------------------------------------------------------------------ */
2036   - if (typeof jsP.option.addClass.header === 'string') {
2037   - jsP.header.addClass(jsP.option.addClass.header);
2038   - }
2039   - if (typeof jsP.option.addClass.content === 'string') {
2040   - jsP.content.addClass(jsP.option.addClass.content);
2041   - }
2042   - if (typeof jsP.option.addClass.footer === 'string') {
2043   - jsP.footer.addClass(jsP.option.addClass.footer);
2044   - }
2045   -
2046   - // handlers for doubleclicks -----------------------------------------------------------------------------------
2047   - // dblclicks disabled for normal modals, hints and tooltips
2048   - if (jsP.option.paneltype.mode !== "default") {
2049   - if (jsP.option.dblclicks) {
2050   - if (jsP.option.dblclicks.title) {
2051   - jsP.header.title.on('dblclick', function (e) {
2052   - e.preventDefault();
2053   - jsPanel.dblclickhelper(jsP.option.dblclicks.title, jsP);
2054   - });
2055   - }
2056   - if (jsP.option.dblclicks.content) {
2057   - jsP.content.on('dblclick', function (e) {
2058   - e.preventDefault();
2059   - jsPanel.dblclickhelper(jsP.option.dblclicks.content, jsP);
2060   - });
2061   - }
2062   - if (jsP.option.dblclicks.footer) {
2063   - jsP.footer.on('dblclick', function (e) {
2064   - e.preventDefault();
2065   - jsPanel.dblclickhelper(jsP.option.dblclicks.footer, jsP);
2066   - });
2067   - }
2068   - }
2069   - }
2070   -
2071   - /* option.show ---------------------------------------------------------------------------------------------- */
2072   - if (!jsP.option.show) {
2073   - jsP.css({
2074   - display: 'block',
2075   - opacity: 1
2076   - });
2077   - $(jsP).trigger('jspanelloaded', jsP.attr('id'));
2078   - $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
2079   - jsP.option.size = {
2080   - width: jsP.outerWidth(),
2081   - height: jsP.outerHeight()
2082   - };
2083   - } else if (jsP.option.show.indexOf(" ") === -1) {
2084   - // if no space is found in "jsP.option.show" -> function anwenden
2085   - jsP[jsP.option.show]({
2086   - done: function () {
2087   - // trigger custom event
2088   - $(jsP).trigger('jspanelloaded', jsP.attr('id'));
2089   - $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
2090   - jsP.option.size = {
2091   - width: jsP.outerWidth(),
2092   - height: jsP.outerHeight()
2093   - };
2094   - }
2095   - });
2096   - } else {
2097   - // does not work with certain combinations of type of animation and positioning
2098   - jsP.css({
2099   - display: 'block',
2100   - opacity: 1
2101   - });
2102   - $(jsP).addClass(jsP.option.show);
2103   - $(jsP).trigger('jspanelloaded', jsP.attr('id'));
2104   - $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
2105   - jsP.option.size = {
2106   - width: jsP.outerWidth(),
2107   - height: jsP.outerHeight()
2108   - };
2109   - }
2110   -
2111   - /* needed if a maximized panel in body is normalized again -------------------------------------------------- */
2112   - // don't put this under $('body').on('jspanelloaded', function () { ... }
2113   - jsP.verticalOffset = jsPanel.calcVerticalOffset(jsP) || 0;
2114   -
2115   - /* replace bottom/right values with corresponding top/left values if necessary ------------------------------ */
2116   - jsPanel.replaceCSSBottomRight(jsP);
2117   -
2118   - /* option.title | needs to be late in the file! ------------------------------------------------------------- */
2119   - jsP.header.title.empty().prepend(jsP.option.title);
2120   - jsPanel.resizeTitle(jsP);
2121   -
2122   - /* reposition hints while scrolling window, must be after normalization of position ------------------------- */
2123   - if (jsP.option.paneltype.type === 'hint') {
2124   - jsPanel.reposHintsScroll(jsP);
2125   - }
2126   -
2127   - /* reposition jsPanel appended to body while scrolling window ----------------------------------------------- */
2128   - if (jsP.parentElmtTagname === 'body' && (jsP.option.paneltype.type !== 'tooltip' || jsP.option.paneltype.type !== 'hint')) {
2129   - jsPanel.fixPosition(jsP);
2130   - }
2131   -
2132   - /* resizestart & resizestop & dragstop callbacks ------------------------------------------------------------ */
2133   - if (!jsP.option.paneltype || jsP.option.paneltype.mode !== 'default') {
2134   - // not needed for modals, hints and tooltips
2135   - $(jsP).on("resizestart", function () {
2136   - $("iframe", jsP.content).css("display", "none"); // on test
2137   - });
2138   -
2139   - $(jsP).on("resize", function () {
2140   - // debugger;
2141   - // jquery ui resize event is also fired when panel is maximized or normalized (on request of Gareth Bult)
2142   - jsPanel.resizeContent(jsP);
2143   - jsPanel.resizeTitle(jsP);
2144   - });
2145   -
2146   - $(jsP).on("resizestop", function () {
2147   -
2148   - //alert('resized')
2149   - jsP.option.size = {
2150   - width: jsP.outerWidth(),
2151   - height: jsP.outerHeight()
2152   - };
2153   - if ($('.tools').length> 0) {
2154   - //nikita
2155   - if ($('#canvasDiv') != null) {
2156   - if (jsP.outerHeight() >= 435 && jsP.outerWidth() >= 650) {
2157   - // alert('resizestop')
2158   - $('#canvasDiv').css('height', jsP.outerHeight() - 85)
2159   - $('#canvasDiv').css('width', jsP.outerWidth() - 95)
2160   - $('#canvasDiv').css('overflow', 'scroll')
2161   - }
2162   - else {
2163   - $('#canvasDiv').css('height', jsP.outerHeight() - 110)
2164   - $('#canvasDiv').css('width', jsP.outerWidth() - 85)
2165   - $('#canvasDiv').css('overflow', 'scroll')
2166   - }
2167   - }
2168   - }
2169   - //nikita
2170   - // $('#leftToolBar').css('height', jsP.outerWidth())
2171   -
2172   - jsPanel.updateStateProps(jsP, "normalized");
2173   - $(jsP).trigger('jspanelnormalized', jsP.attr('id'));
2174   - $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
2175   - // controls und title zurücksetzen
2176   - jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-smallrev", jsP);
2177   - $("iframe", jsP.content).css("display", "block"); // on test
2178   - });
2179   -
2180   - $(jsP).on("dragstart", function () {
2181   - // alert("dragstart")
2182   - // debugger;
2183   - // remove window.scroll handler, is added again on dragstop
2184   - $(window).off('scroll', jsP.jsPanelfixPos);
2185   - if (jsP.option.paneltype.mode === 'extended') {
2186   - jsP.css('z-index', '1');
2187   - }
2188   - });
2189   -
2190   - $(jsP).on("dragstop", function () {
2191   - // alert("dragstop")
2192   - // debugger;
2193   - jsP.option.position = {
2194   - top: jsP.css('top'),
2195   - left: jsP.css('left')
2196   - };
2197   - jsP.verticalOffset = jsPanel.calcVerticalOffset(jsP) || 0;
2198   - if (jsP.parentElmtTagname === 'body') {
2199   - jsPanel.fixPosition(jsP);
2200   - }
2201   - });
2202   -
2203   - $(jsP).on("jspanelminimized", function () {
2204   - jsPanel.hideControls(".jsPanel-btn-min, .jsPanel-btn-small, .jsPanel-btn-smallrev, .jsPanel-btn-hide", jsP);
2205   - jsPanel.updateStateProps(jsP, "minimized");
2206   - $(window).off('scroll', jsP.jsPanelfixPos);
2207   - });
2208   -
2209   - $(jsP).on("jspanelmaximized", function () {
2210   - // debugger;
2211   - jsPanel.resizeContent(jsP);
2212   - jsPanel.resizeTitle(jsP);
2213   - jsPanel.hideControls(".jsPanel-btn-max, .jsPanel-btn-smallrev", jsP);
2214   - jsPanel.updateStateProps(jsP, "maximized");
2215   - // additionally trigger the jQuery UI resize event (on request of Gareth Bult)
2216   - jsP.trigger("resize");
2217   - });
2218   -
2219   - $(jsP).on("jspanelnormalized", function () {
2220   - jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-smallrev", jsP);
2221   - jsPanel.resizeTitle(jsP);
2222   - jsPanel.resizeContent(jsP);
2223   - jsPanel.updateStateProps(jsP, "normalized");
2224   - // additionally trigger the jQuery UI resize event (on request of Gareth Bult)
2225   - jsP.trigger("resize");
2226   - });
2227   -
2228   - }
2229   -
2230   - /* option.autoclose | default: false --------------------------------------- */
2231   - if (typeof jsP.option.autoclose === 'number' && jsP.option.autoclose > 0) {
2232   - jsPanel.autoclose(jsP);
2233   - }
2234   -
2235   - /* tooltip corrections ----------------------------------------------------- */
2236   - if (jsP.option.paneltype.type === "tooltip" && (jsP.option.paneltype.position === "top" || jsP.option.paneltype.position === "bottom")) {
2237   - jsPanel.shiftTooltipHorizontal(jsP, jsP.option.paneltype.shiftwithin);
2238   - } else if (jsP.option.paneltype.position === "left" || jsP.option.paneltype.position === "right") {
2239   - jsPanel.shiftTooltipVertical(jsP, jsP.option.paneltype.shiftwithin);
2240   - }
2241   -
2242   - /* option.panelstatus --------------------------------------------------------------------------------------- */
2243   - if (jsP.option.panelstatus) {
2244   - switch (jsP.option.panelstatus) {
2245   - case "minimized":
2246   - jsPanel.minimize(jsP);
2247   - break;
2248   - case "maximized":
2249   - jsPanel.maximize(jsP);
2250   - break;
2251   - case ("smallified"):
2252   - jsPanel.smallify(jsP);
2253   - break;
2254   - case ("smallifiedMax"):
2255   - jsPanel.maximize(jsP);
2256   - jsPanel.smallify(jsP);
2257   - break;
2258   - }
2259   - } else {
2260   - jsPanel.updateStateProps(jsP, "normalized");
2261   - }
2262   -
2263   - /* jsP.option.callback --------------------------------------------------------- */
2264   - if ($.isFunction(jsP.option.callback)) {
2265   - jsP.option.callback.call(jsP, jsP);
2266   - } else if ($.isArray(jsP.option.callback)) {
2267   - jsP.option.callback.forEach(function (item) {
2268   - if ($.isFunction(item)) {
2269   - item.call(jsP, jsP);
2270   - }
2271   - });
2272   - }
2273   -
2274   -
2275   - return jsP;
2276   - };
2277   -
2278   - /* jsPanel.defaults */
2279   - $.jsPanel.defaults = {
2280   - "addClass": {
2281   - header: false,
2282   - content: false,
2283   - footer: false
2284   - },
2285   - "ajax": {
2286   - autoload: true
2287   - },
2288   - "autoclose": false,
2289   - "bootstrap": false,
2290   - "callback": undefined,
2291   - "content": false,
2292   - "controls": {
2293   - buttons: true,
2294   - iconfont: 'jsglyph',
2295   - close: false,
2296   - confirmClose: false,
2297   - maximize: false,
2298   - minimize: false,
2299   - normalize: false,
2300   - smallify: false,
2301   - maxtoScreen: false
2302   - },
2303   - "custom": false,
2304   - "dblclicks": false,
2305   - "draggable": {
2306   - handle: 'div.jsPanel-hdr, div.jsPanel-ftr',
2307   - stack: '.jsPanel',
2308   - opacity: 0.7
2309   - },
2310   - "id": function () {
2311   - jsPanel.ID += 1;
2312   - return 'jsPanel-' + jsPanel.ID;
2313   - },
2314   - "iframe": false,
2315   - "load": false,
2316   - "maximizedMargin": {
2317   - top: 5,
2318   - right: 5,
2319   - bottom: 5,
2320   - left: 5
2321   - },
2322   - "offset": {
2323   - top: 0,
2324   - left: 0
2325   - },
2326   - "onbeforeclose": false,
2327   - "onbeforemaximize": false,
2328   - "onbeforeminimize": false,
2329   - "onbeforenormalize": false,
2330   - "onclosed": false,
2331   - "oncmaximized": false,
2332   - "onminimized": false,
2333   - "onnormalized": false,
2334   - "overflow": 'hidden',
2335   - "panelstatus": false,
2336   - "paneltype": false,
2337   - "position": 'auto',
2338   - "removeHeader": false,
2339   - "resizable": {
2340   - handles: 'n, e, s, w, ne, se, sw, nw',
2341   - autoHide: false,
2342   - minWidth: 150,
2343   - minHeight: 93
2344   - },
2345   - "rtl": false,
2346   - "selector": 'body',
2347   - "show": 'fadeIn',
2348   - "size": {
2349   - width: '400px',
2350   - height: '222px'
2351   - },
2352   - "template": false,
2353   - "theme": 'default',
2354   - "title": 'jsPanel',
2355   - "toolbarFooter": false,
2356   - "toolbarHeader": false,
2357   - "currentController": '',
2358   - "parentSlug": ''
2359   -
2360   - };
2361   -
2362   -
2363   - /*
2364   - * jQuery alterClass plugin
2365   - * Remove element classes with wildcard matching. Optionally add classes:
2366   - * $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
2367   - * Copyright (c) 2011 Pete Boere (the-echoplex.net)
2368   - * Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
2369   - */
2370   - $.fn.alterClass = function (removals, additions) {
2371   -
2372   - var self = this,
2373   - patt;
2374   - if (removals.indexOf('*') === -1) {
2375   - // Use native jQuery methods if there is no wildcard matching
2376   - self.removeClass(removals);
2377   - return !additions ? self : self.addClass(additions);
2378   - }
2379   - patt = new RegExp('\\s' +
2380   - removals.replace(/\*/g, '[A-Za-z0-9-_]+').split(' ').join('\\s|\\s') +
2381   - '\\s', 'g');
2382   - self.each(function (i, it) {
2383   - var cn = ' ' + it.className + ' ';
2384   - while (patt.test(cn)) {
2385   - cn = cn.replace(patt, ' ');
2386   - }
2387   - it.className = $.trim(cn);
2388   - });
2389   - return !additions ? self : self.addClass(additions);
2390   - };
2391   -
2392   - /* body click handler: remove all tooltips on click in body except click is inside tooltip */
2393   - $('body').click(function (e) {
2394   - var pID,
2395   - isTT = $(e.target).closest('.jsPanel-tt').length;
2396   - if (isTT < 1) {
2397   - $('.jsPanel-tt').each(function () {
2398   - pID = $(this).attr('id');
2399   - // if present remove tooltip wrapper and than remove tooltip
2400   - $('#' + pID).unwrap().remove();
2401   - $('body').trigger('jspanelclosed', pID);
2402   - });
2403   - }
2404   - });
2405   -
2406   -
2407   -
2408   -
2409   -}(jQuery));
2410   -
2411   -/*
2412   - :: Number.isInteger() polyfill ::
2413   - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
2414   -*/
2415   -if (!Number.isInteger) {
2416   - Number.isInteger = function isInteger(nVal) {
2417   - "use strict";
2418   - return typeof nVal === 'number' && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal;
2419   - };
  1 +/// <reference path="../vendor/mobile-detect.js" />
  2 +/// <reference path="../../../../../index.html" />
  3 +/// <reference path="../../../../../index.html" />
  4 +/* global console, MobileDetect, jQuery */
  5 +/* jQuery Plugin jsPanel
  6 + Dependencies:
  7 + jQuery library ( > 1.9.1 incl. 2.1.3 )
  8 + jQuery.UI library ( > 1.9.2 ) - (at least UI Core, Mouse, Widget, Draggable, Resizable)
  9 + HTML5/CSS3 compatible browser
  10 +
  11 + Copyright (c) 2014-15 Stefan Sträßer, <http://stefanstraesser.eu/>
  12 +
  13 + Permission is hereby granted, free of charge, to any person obtaining a copy
  14 + of this software and associated documentation files (the "Software"), to deal
  15 + in the Software without restriction, including without limitation the rights
  16 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17 + copies of the Software, and to permit persons to whom the Software is
  18 + furnished to do so, subject to the following conditions:
  19 +
  20 + The above copyright notice and this permission notice shall be included in
  21 + all copies or substantial portions of the Software.
  22 +
  23 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  26 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  27 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  28 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  29 + THE SOFTWARE.
  30 +
  31 + <http://opensource.org/licenses/MIT>.
  32 +
  33 + CHANGES IN 2.6.0:
  34 + + new options onbeforeclose, onclosed
  35 + + new options onbeforemaximize, onmaximized
  36 + + new options onbeforeminimize, onminimized
  37 + + new options onbefornormalize, onnormalized
  38 + */
  39 +
  40 +"use strict";
  41 +// check for jQuery and jQuery UI components
  42 +if (!$.fn.jquery || !$.fn.uniqueId || !$.widget || !$.ui.mouse || !$.ui.draggable || !$.ui.resizable) {
  43 + console.log("Error: jQuery or at least one jQuery UI component is not loaded! You need at least jQuery 1.9.1 and jQuery UI 1.9.2 (modules Core, Mouse, Widget, Draggable and Resizable).");
  44 +} else {
  45 + console.log("Loaded: jQuery " + $.fn.jquery + ", jQuery UI " + $.ui.version +
  46 + "\nUI core: " + $.isFunction($.fn.uniqueId) + ", UI widget: " + $.isFunction($.widget) + ", UI mouse: " + $.isFunction($.ui.mouse) +
  47 + ", UI draggable: " + $.isFunction($.ui.draggable) + ", UI resizable: " + $.isFunction($.ui.resizable));
  48 +}
  49 +
  50 +var jsPanel = {
  51 +
  52 + version: '2.6.0 2015-12-04 14:15',
  53 + device: (function () {
  54 + try {
  55 + var imported = document.createElement('script');
  56 + //imported.src = '//vendor/mobile-detect.js';
  57 + imported.src = '~/../libs/jquery/jquery_plugin/jsPanel/vendor/mobile-detect.js';
  58 + document.head.appendChild(imported);
  59 +
  60 + // requires "mobile-detect.js" to be loaded
  61 + var md = new MobileDetect(window.navigator.userAgent),
  62 + mobile = md.mobile(),
  63 + phone = md.phone(),
  64 + tablet = md.tablet(),
  65 + os = md.os(),
  66 + userAgent = md.userAgent();
  67 + return { mobile: mobile, tablet: tablet, phone: phone, os: os, userAgent: userAgent };
  68 + } catch (e) {
  69 + console.log(e + "; Seems like mobile-detect.js is not loaded");
  70 + return { mobile: undefined, tablet: undefined, phone: undefined, os: undefined, userAgent: undefined };
  71 + }
  72 + })(),
  73 + ID: 0, // kind of a counter to add to automatically generated id attribute
  74 + widthForMinimized: 180, // default width of minimized panels
  75 + template: '<div class="jsPanel jsPanel-theme-default jsPanel-state-initialized">' +
  76 + '<div class="jsPanel-hdr jsPanel-theme-default">' +
  77 + '<h3 class="jsPanel-title"></h3>' +
  78 + '<div class="jsPanel-hdr-r">' +
  79 + '<div class="jsPanel-btn-close "><span class="jsglyph jsglyph-remove"></span></div>' +
  80 + '<div class="jsPanel-btn-max"><span class="jsglyph jsglyph-maximize"></span></div>' +
  81 + '<div class="jsPanel-btn-norm"><span class="jsglyph jsglyph-normalize"></span></div>' +
  82 + '<div class="jsPanel-btn-min"><span id="minSpan" class="fa fa-minus"></span></div>' +
  83 +
  84 + //'<div class="jsPanel-btn-min"><span class="jsglyph jsglyph-minimize"></span></div>' +
  85 + //'<div class="jsPanel-btn-small"><span class="jsglyph jsglyph-chevron-up"></span></div>' +
  86 + //'<div class="jsPanel-btn-smallrev"><span class="jsglyph jsglyph-chevron-down"></span></div>' +
  87 + '</div>' +
  88 + '<div class="jsPanel-hdr-toolbar jsPanel-clearfix"></div>' +
  89 + '</div>' +
  90 + '<div class="jsPanel-content jsPanel-theme-default"></div>' +
  91 + '<div class="jsPanel-ftr jsPanel-theme-default jsPanel-clearfix"></div>' +
  92 + '</div>',
  93 +
  94 + // add toolbar
  95 + addToolbar: function (panel, place, items) {
  96 + if (place === 'header') {
  97 + this.configToolbar(items, panel.header.toolbar, panel);
  98 + } else if (place === 'footer') {
  99 + panel.footer.css({ display: 'block' });
  100 + this.configToolbar(items, panel.footer, panel);
  101 + }
  102 + // give toolbar the same font-family as title
  103 + panel.header.toolbar.css("font-family", panel.header.title.css("font-family"));
  104 + return panel;
  105 + },
  106 +
  107 + // loads content using jQuery.ajax();
  108 + ajax: function (panel) {
  109 + var oAjax = panel.option.ajax,
  110 + pc = panel.content;
  111 + $.ajax(oAjax)
  112 + .done(function (data, textStatus, jqXHR) {
  113 + if (oAjax.autoload && oAjax.url) {
  114 + pc.empty().append(data);
  115 + }
  116 + if ($.isFunction(oAjax.done)) {
  117 + oAjax.done.call(pc, data, textStatus, jqXHR, panel);
  118 + }
  119 + })
  120 + .fail(function (jqXHR, textStatus, errorThrown) {
  121 + if ($.isFunction(oAjax.fail)) {
  122 + oAjax.fail.call(pc, jqXHR, textStatus, errorThrown, panel);
  123 + }
  124 + })
  125 + .always(function (arg1, textStatus, arg3) {
  126 + //In response to a successful request, the function's arguments are the same as those of .done(): data(hier: arg1), textStatus, and the jqXHR object(hier: arg3)
  127 + //For failed requests the arguments are the same as those of .fail(): the jqXHR object(hier: arg1), textStatus, and errorThrown(hier: arg3)
  128 + // fix for a bug in jQuery-UI draggable? that causes the jsPanel to reduce width when dragged beyond boundary of containing element and option.size.width is 'auto'
  129 + pc.css('width', function () {
  130 + return pc.outerWidth();
  131 + });
  132 + if ($.isFunction(oAjax.always)) {
  133 + oAjax.always.call(pc, arg1, textStatus, arg3, panel);
  134 + }
  135 + // title h3 might be to small: load() is async!
  136 + jsPanel.resizeTitle(panel);
  137 + // update option.size (content might come delayed)
  138 + jsPanel.updateOptionSize(panel, panel.option.size);
  139 + })
  140 + .then(function (data, textStatus, jqXHR) {
  141 + if (oAjax.then && $.isArray(oAjax.then)) {
  142 + if ($.isFunction(oAjax.then[0])) {
  143 + oAjax.then[0].call(pc, data, textStatus, jqXHR, panel);
  144 + }
  145 + // title h3 might be to small: load() is async!
  146 + jsPanel.resizeTitle(panel);
  147 + // update option.size (content might come delayed)
  148 + jsPanel.updateOptionSize(panel, panel.option.size);
  149 + }
  150 + }, function (jqXHR, textStatus, errorThrown) {
  151 + if (oAjax.then && $.isArray(oAjax.then)) {
  152 + if ($.isFunction(oAjax.then[1])) {
  153 + oAjax.then[1].call(pc, jqXHR, textStatus, errorThrown, panel);
  154 + }
  155 + // title h3 might be to small: load() is async!
  156 + jsPanel.resizeTitle(panel);
  157 + }
  158 + }
  159 + );
  160 + panel.data("ajaxURL", oAjax.url); // needed for exportPanels()
  161 + },
  162 +
  163 + // used in option.autoclose and checks prior use of .close() whether the panel is still there
  164 + autoclose: function (panel) {
  165 + window.setTimeout(function () {
  166 + if (panel) {
  167 + panel.fadeOut('slow', function () {
  168 + panel.close();
  169 + });
  170 + }
  171 + }, panel.option.autoclose);
  172 + },
  173 +
  174 + calcPanelposition: function (jsP) {
  175 + // when using option.size = 'auto' and option.position = 'center' consider use of option.ajax with
  176 + // async: false -> size will be known when position is calculated
  177 + // value "center" not allowed for option.position.bottom & option.position.right -> use top and/or left
  178 + var panelpos = {};
  179 + // get px values for panel size in case option.size is 'auto' - results will be incorrect whenever content
  180 + // is not loaded yet ( e.g. option.load, option.ajax ) -> centering can't work correctly
  181 + jsP.option.size.width = $(jsP).outerWidth();
  182 + jsP.option.size.height = $(jsP).innerHeight();
  183 + // delete option.position.top and/or left if option.position.bottom and/or right (top & left values come from defaults object)
  184 + if (jsP.option.position.bottom) {
  185 + delete jsP.option.position.top;
  186 + }
  187 + if (jsP.option.position.right) {
  188 + delete jsP.option.position.left;
  189 + }
  190 + // calculate top | bottom values != center
  191 + // if not checked for 0 as well code would not be executed!
  192 + if (jsP.option.position.bottom || jsP.option.position.bottom === 0) {
  193 + this.calcPos('bottom', jsP);
  194 + } else if (jsP.option.position.top || jsP.option.position.top === 0) {
  195 + if (jsP.option.position.top === 'center') {
  196 + jsP.option.position.top = this.calcPosCenter(jsP.option).top;
  197 + } else {
  198 + panelpos.top = this.calcPos('top', jsP); // change in 2.5.4
  199 + }
  200 + }
  201 + // calculate left | right values != center
  202 + if (jsP.option.position.right || jsP.option.position.right === 0) {
  203 + this.calcPos('right', jsP);
  204 + } else if (jsP.option.position.left || jsP.option.position.left === 0) {
  205 + if (jsP.option.position.left === 'center') {
  206 + jsP.option.position.left = this.calcPosCenter(jsP.option).left;
  207 + } else {
  208 + panelpos.left = this.calcPos('left', jsP); // change in 2.5.4
  209 + }
  210 + }
  211 + if (jsP.option.position.top) {
  212 + panelpos.top = parseInt(jsP.option.position.top, 10) + jsP.option.offset.top;
  213 + } else {
  214 + panelpos.bottom = parseInt(jsP.option.position.bottom, 10) + jsP.option.offset.top;
  215 + }
  216 + if (jsP.option.position.left) {
  217 + panelpos.left = parseInt(jsP.option.position.left, 10) + jsP.option.offset.left;
  218 + } else {
  219 + panelpos.right = parseInt(jsP.option.position.right, 10) + jsP.option.offset.left;
  220 + }
  221 + jsP.css(panelpos);
  222 + jsP.option.position = {
  223 + top: jsP.css('top'),
  224 + left: jsP.css('left')
  225 + };
  226 + },
  227 +
  228 + // used in calcPanelposition
  229 + calcPos: function (prop, panel) {
  230 + var optPosition = panel.option.position;
  231 + if (optPosition[prop] === 'auto') {
  232 + panel.option.position[prop] = panel.count * 30;
  233 + } else if ($.isFunction(optPosition[prop])) {
  234 + panel.option.position[prop] = optPosition[prop](panel);
  235 + } else if (optPosition[prop] === 0) {
  236 + panel.option.position[prop] = '0';
  237 + } else {
  238 + panel.option.position[prop] = parseInt(optPosition[prop], 10);
  239 + }
  240 + // corrections if jsPanel is appended to the body element
  241 + if (panel.option.selector === 'body') {
  242 + if (prop === 'top') {
  243 + panel.option.position.top = parseInt(optPosition.top, 10) + $(window).scrollTop();
  244 + } else if (prop === 'bottom') {
  245 + panel.option.position.bottom = parseInt(optPosition.bottom, 10) - $(window).scrollTop();
  246 + } else if (prop === 'left') {
  247 + panel.option.position.left = parseInt(optPosition.left, 10) + $(window).scrollLeft();
  248 + } else if (prop === 'right') {
  249 + panel.option.position.right = parseInt(optPosition.right, 10) - $(window).scrollLeft();
  250 + }
  251 + }
  252 + return panel.option.position[prop];
  253 + },
  254 +
  255 + // calculate position center for option.position == 'center'
  256 + calcPosCenter: function (option) {
  257 + var optSelector = option.selector,
  258 + optSize = option.size,
  259 + posL = ($(optSelector).outerWidth() / 2) - ((parseInt(optSize.width, 10) / 2)),
  260 + posT;
  261 + if (optSelector === 'body') {
  262 + posT = ($(window).outerHeight() / 2) - ((parseInt(optSize.height, 10) / 2) - $(window).scrollTop());
  263 + } else {
  264 + posT = ($(optSelector).outerHeight() / 2) - ((parseInt(optSize.height, 10) / 2));
  265 + }
  266 + return { top: posT, left: posL };
  267 + },
  268 +
  269 + // calculate position for maximized panels using option.controls.maxtoScreen (for devmondo)
  270 + calcPosmaxtoScreen: function (panel) {
  271 + var offset = panel.offset();
  272 + return {
  273 + top: parseInt(panel.css('top')) - (offset.top - $(document).scrollTop()) + 5,
  274 + left: parseInt(panel.css('left')) - (offset.left - $(document).scrollLeft()) + 5
  275 + };
  276 + },
  277 +
  278 + // calculates css left for tooltips
  279 + calcPosTooltipLeft: function (jsPparent, option) {
  280 + // width of element serving as trigger for the tooltip
  281 + var parW = jsPparent.outerWidth(),
  282 + // check possible margins of trigger
  283 + mL = parseInt(jsPparent.css('margin-left')),
  284 + // check whether offset is set
  285 + oX = option.offset.left || 0,
  286 + optptPosition = option.paneltype.position;
  287 + if (optptPosition === 'top' || optptPosition === 'bottom') {
  288 + return (parW - option.size.width) / 2 + mL + oX;
  289 + } else if (optptPosition === 'left') {
  290 + return -(option.size.width) + mL + oX;
  291 + } else if (optptPosition === 'right') {
  292 + return parW + mL + oX;
  293 + }
  294 + return false;
  295 + },
  296 +
  297 + // calculates css top for tooltips
  298 + calcPosTooltipTop: function (jsPparent, option) {
  299 + var parH = jsPparent.innerHeight(),
  300 + mT = parseInt(jsPparent.css('margin-top')),
  301 + oY = option.offset.top || 0,
  302 + optptPosition = option.paneltype.position;
  303 + if (optptPosition === 'left' || optptPosition === 'right') {
  304 + return -(option.size.height / 2) + (parH / 2) + mT + oY;
  305 + } else if (optptPosition === 'top') {
  306 + return -(option.size.height + oY) + mT;
  307 + } else if (optptPosition === 'bottom') {
  308 + return parH + mT + oY;
  309 + }
  310 + return false;
  311 + },
  312 +
  313 + // calculate final tooltip position
  314 + calcToooltipPosition: function (jsPparent, option) {
  315 + return {
  316 + top: this.calcPosTooltipTop(jsPparent, option),
  317 + left: this.calcPosTooltipLeft(jsPparent, option)
  318 + };
  319 + },
  320 +
  321 + calcVerticalOffset: function (panel) {
  322 + return Math.floor(panel.offset().top - $(window).scrollTop());
  323 + },
  324 +
  325 + // closes a jsPanel and removes it from the DOM
  326 + close: function (panel) {
  327 + // alert('jspanel closed')
  328 + // get parent-element of jsPanel
  329 + var context = panel.parent(),
  330 + panelID = panel.attr('id');
  331 + panel.trigger('jspanelbeforeclose', panelID);
  332 + if ($.isFunction(panel.option.onbeforeclose)) {
  333 + var close = panel.option.onbeforeclose.call(panel, panel);
  334 + if (close === false) {
  335 + return panel;
  336 + }
  337 + }
  338 + // delete childpanels ...
  339 + this.closeChildpanels(panel);
  340 + // if present remove tooltip wrapper
  341 + if (context.hasClass('jsPanel-tooltip-wrapper')) {
  342 + panel.unwrap();
  343 + }
  344 + // remove the jsPanel itself
  345 + panel.remove();
  346 + $('body').trigger('jspanelclosed', panelID);
  347 + // remove backdrop only when modal jsPanel is closed
  348 + if (panel.option.paneltype.type === 'modal') {
  349 + $('.jsPanel-backdrop').remove();
  350 + }
  351 + // reposition minimized panels
  352 + this.reposMinimized(this.widthForMinimized);
  353 + // reposition hints
  354 + if (panel.option.paneltype.type === 'hint') {
  355 + if (panel.hasClass("jsPanel-hint-tl")) {
  356 + jsPanel.reposHints("jsPanel-hint-tl", panel.parentElmtTagname);
  357 + } else if (panel.hasClass("jsPanel-hint-tc")) {
  358 + jsPanel.reposHints("jsPanel-hint-tc", panel.parentElmtTagname);
  359 + } else if (panel.hasClass("jsPanel-hint-tr")) {
  360 + jsPanel.reposHints("jsPanel-hint-tr", panel.parentElmtTagname);
  361 + }
  362 + }
  363 + if ($.isFunction(panel.option.onclosed)) {
  364 + panel.option.onclosed.call(panel, panel);
  365 + }
  366 + return context;
  367 + },
  368 +
  369 + // close all tooltips
  370 + closeallTooltips: function () {
  371 + $('.jsPanel-tt').each(function () {
  372 + // remove tooltip wrapper and than remove tooltip
  373 + $(this).unwrap().remove();
  374 + $('body').trigger('jspanelclosed', $(this).attr('id'));
  375 + });
  376 + },
  377 +
  378 + // closes/removes all childpanels within the parent jsPanel
  379 + closeChildpanels: function (panel) {
  380 + $('.jsPanel', panel).each(function () {
  381 + panel.trigger('jspanelbeforeclose', $(this).attr('id'));
  382 + $(this).remove();
  383 + $('body').trigger('jspanelclosed', $(this).attr('id'));
  384 + });
  385 + return panel;
  386 + },
  387 +
  388 + // configure controls
  389 + configControls: function (panel) {
  390 + var controls = ["close", "maximize", "minimize", "normalize", "smallify"];
  391 + if (panel.option.controls.buttons === 'closeonly') {
  392 + $("div:not('.jsPanel-btn-close')", panel.header.controls).remove(); // change in 2.5.3
  393 + panel.header.title.css("width", "calc(100% - 30px)");
  394 + } else if (panel.option.controls.buttons === 'none') {
  395 + $('*', panel.header.controls).remove();
  396 + panel.header.title.css("width", "100%");
  397 + }
  398 + // disable controls individually
  399 + controls.forEach(function (ctrl) {
  400 + if (panel.option.controls[ctrl]) { panel.control('disable', ctrl); }
  401 + });
  402 + },
  403 +
  404 + // configure iconfonts
  405 + configIconfont: function (panel) {
  406 + var controlsArray = ["close", "max", "norm", "min", "small", "smallrev"],
  407 + bootstrapArray = ["remove", "fullscreen", "resize-full", "minus", "chevron-up", "chevron-down"],
  408 + fontawesomeArray = ["times", "arrows-alt", "expand", "minus", "chevron-up", "chevron-down"],
  409 + optIconfont = panel.option.controls.iconfont,
  410 + controls = panel.header.controls;
  411 + // remove icon sprites
  412 + $('*', controls).css('background-image', 'none');
  413 + // set icons
  414 + if (optIconfont === 'bootstrap') {
  415 + controlsArray.forEach(function (item, i) {
  416 + $('.jsPanel-btn-' + item, controls).empty().append('<span class="glyphicon glyphicon-' + bootstrapArray[i] + '"></span>');
  417 + });
  418 + } else if (optIconfont === 'font-awesome') {
  419 + controlsArray.forEach(function (item, i) {
  420 + $('.jsPanel-btn-' + item, controls).empty().append('<span class="fa fa-' + fontawesomeArray[i] + '"></span>');
  421 + });
  422 + }
  423 + },
  424 +
  425 + // builds toolbar
  426 + configToolbar: function (toolbaritems, toolbarplace, panel) {
  427 + var el;
  428 + toolbaritems.forEach(function (item) {
  429 + if (typeof item === "object") {
  430 + el = $(item.item);
  431 + // add text to button
  432 + if (typeof item.btntext === 'string') {
  433 + el.append(item.btntext);
  434 + }
  435 + // add class to button
  436 + if (typeof item.btnclass === 'string') {
  437 + el.addClass(item.btnclass);
  438 + }
  439 + toolbarplace.append(el);
  440 + // bind handler to the item
  441 + if ($.isFunction(item.callback)) {
  442 + el.on(item.event, panel, item.callback);
  443 + // jsP is accessible in the handler as "event.data"
  444 + }
  445 + }
  446 + });
  447 + },
  448 +
  449 + // disable/enable individual controls
  450 + control: function (panel, action, btn) {
  451 + var controls = panel.header.controls,
  452 + controlbtn;
  453 + if (arguments.length === 3) {
  454 + if (arguments[1] === 'disable') {
  455 + if (btn === 'close') {
  456 + controlbtn = $('.jsPanel-btn-close', controls);
  457 + } else if (btn === 'maximize') {
  458 + controlbtn = $('.jsPanel-btn-max', controls);
  459 + } else if (btn === 'minimize') {
  460 + controlbtn = $('.jsPanel-btn-min', controls);
  461 + } else if (btn === 'normalize') {
  462 + controlbtn = $('.jsPanel-btn-norm', controls);
  463 + } else if (btn === 'smallify') {
  464 + controlbtn = $('.jsPanel-btn-small', controls);
  465 + }
  466 + // unbind handler and set styles
  467 + controlbtn.off().css({ opacity: 0.5, cursor: 'default' });
  468 + } else if (arguments[1] === 'enable') {
  469 + if (btn === 'close') {
  470 + controlbtn = $('.jsPanel-btn-close', controls);
  471 + } else if (btn === 'maximize') {
  472 + controlbtn = $('.jsPanel-btn-max', controls);
  473 + } else if (btn === 'minimize') {
  474 + controlbtn = $('.jsPanel-btn-min', controls);
  475 + } else if (btn === 'normalize') {
  476 + controlbtn = $('.jsPanel-btn-norm', controls);
  477 + } else if (btn === 'smallify') {
  478 + controlbtn = $('.jsPanel-btn-small', controls);
  479 + }
  480 + // enable control and reset styles
  481 + controlbtn.on('click', function (e) {
  482 + e.preventDefault();
  483 + panel[btn]();
  484 + }).css({ opacity: 1, cursor: 'pointer' });
  485 + }
  486 + }
  487 + return panel;
  488 + },
  489 +
  490 + // helper function for the doubleclick handlers (title, content, footer)
  491 + dblclickhelper: function (odcs, panel) {
  492 + if (typeof odcs === 'string') {
  493 + if (odcs === "maximize" || odcs === "normalize") {
  494 + if (panel.status === "normalized" || panel.option.panelstatus === "normalized") {
  495 + panel.maximize();
  496 + } else {
  497 + panel.normalize();
  498 + }
  499 + } else if (odcs === "minimize" || odcs === "smallify" || odcs === "close") {
  500 + panel[odcs]();
  501 + }
  502 + }
  503 + },
  504 +
  505 + // export a panel layout to localStorage and returns array with an object for each panel
  506 + exportPanels: function () {
  507 + var elmtOffset, elmtPosition, elmtTop, elmtLeft, elmtWidth, elmtHeight, elmtStatus, panelParent,
  508 + panelArr = [], exportedPanel,
  509 + panels = $(".jsPanel").not(".jsPanel-tt, .jsPanel-hint, .jsPanel-modal");
  510 + panels.each(function (index, elmt) {
  511 + exportedPanel = {
  512 + panelstatus: $(elmt).data("panelstatus"),
  513 + id: $(elmt).prop("id"),
  514 + title: $(".jsPanel-title", elmt).html(),
  515 + custom: $(elmt).data("custom"),
  516 + offset: { top: 0, left: 0 },
  517 + content: $(elmt).data("content")
  518 + };
  519 + // normalize minimized/maximized panels before export
  520 + // status to restore is saved in exportedPanel.panelstatus
  521 + if ($(elmt).data("panelstatus") !== "normalized") {
  522 + $(".jsPanel-btn-norm", elmt).trigger("click");
  523 + }
  524 + panelParent = $(elmt).data("selector");
  525 + elmtOffset = $(elmt).offset();
  526 + elmtPosition = $(elmt).position();
  527 + if (elmtStatus === "minimized") {
  528 + if (panelParent.toLowerCase() === "body") {
  529 + elmtTop = $(elmt).data("paneltop") - $(window).scrollTop() + "px";
  530 + elmtLeft = $(elmt).data("panelleft") - $(window).scrollLeft() + "px";
  531 + } else {
  532 + elmtTop = $(elmt).data("paneltop") + "px";
  533 + elmtLeft = $(elmt).data("panelleft") + "px";
  534 + }
  535 + elmtWidth = $(elmt).data("panelwidth") + "px";
  536 + elmtHeight = $(elmt).data("panelheight") + "px";
  537 + } else {
  538 + if (panelParent.toLowerCase() === "body") {
  539 + elmtTop = Math.floor(elmtOffset.top - $(window).scrollTop()) + "px";
  540 + elmtLeft = Math.floor(elmtOffset.left - $(window).scrollLeft()) + "px";
  541 + } else {
  542 + elmtTop = Math.floor(elmtPosition.top) + "px";
  543 + elmtLeft = Math.floor(elmtPosition.left) + "px";
  544 + }
  545 + elmtWidth = $(elmt).css("width");
  546 + elmtHeight = $(".jsPanel-content", elmt).css("height");
  547 + }
  548 + exportedPanel.size = {
  549 + width: elmtWidth,
  550 + height: elmtHeight
  551 + };
  552 + exportedPanel.position = {
  553 + top: elmtTop,
  554 + left: elmtLeft
  555 + };
  556 + if ($(elmt).data("loadURL")) {
  557 + exportedPanel.load = {};
  558 + exportedPanel.load.url = $(elmt).data("loadURL");
  559 + }
  560 + if ($(elmt).data("ajaxURL")) {
  561 + exportedPanel.ajax = {};
  562 + exportedPanel.ajax.url = $(elmt).data("ajaxURL");
  563 + }
  564 + if ($(elmt).data("iframeDOC") || $(elmt).data("iframeSRC")) {
  565 + exportedPanel.iframe = {};
  566 + if ($(elmt).data("iframeDOC")) {
  567 + exportedPanel.iframe.srcdoc = $(elmt).data("iframeDOC");
  568 + }
  569 + if ($(elmt).data("iframeSRC")) {
  570 + exportedPanel.iframe.src = $(elmt).data("iframeSRC");
  571 + }
  572 + }
  573 + panelArr.push(exportedPanel);
  574 + // restore status that is saved
  575 + switch (exportedPanel.panelstatus) {
  576 + case "minimized":
  577 + $(".jsPanel-btn-min", elmt).trigger("click");
  578 + break;
  579 + case "maximized":
  580 + $(".jsPanel-btn-max", elmt).trigger("click");
  581 + break;
  582 + case "smallified":
  583 + $(".jsPanel-btn-small", elmt).trigger("click");
  584 + break;
  585 + case "smallifiedMax":
  586 + $(".jsPanel-btn-small", elmt).trigger("click");
  587 + break;
  588 + }
  589 + });
  590 + //window.localStorage.setItem("jspanels", panelArr);
  591 + window.localStorage.setItem("jspanels", JSON.stringify(panelArr));
  592 + return panelArr;
  593 + },
  594 +
  595 + // imports panel layout from localStorage.jspanels and restores panels
  596 + importPanels: function (predefinedConfigs) {
  597 + /* panelConfig needs to be an object with predefined configs.
  598 + * A config named "default" will be applied to ALL panels
  599 + *
  600 + * panelConfig = { default: { } [, config1 [, config2 [, configN ]]] };
  601 + */
  602 + var savedPanels, restoredConfig, defaultConfig;
  603 + savedPanels = JSON.parse(localStorage.jspanels) || {};
  604 + defaultConfig = predefinedConfigs["default"] || {};
  605 + savedPanels.forEach(function (savedconfig) {
  606 + // safedconfig represents one item in safedPanels
  607 + if (typeof savedconfig.custom.config === "string") {
  608 + restoredConfig = $.extend(true, {}, defaultConfig, predefinedConfigs[savedconfig.custom.config], savedconfig);
  609 + } else {
  610 + restoredConfig = $.extend(true, {}, defaultConfig, savedconfig);
  611 + }
  612 + // restore panel
  613 + $.jsPanel(restoredConfig);
  614 + });
  615 + },
  616 +
  617 + // maintains panel position relative to window on scroll of page
  618 + fixPosition: function (panel) {
  619 + var jspaneldiff = panel.offset().top - $(window).scrollTop();
  620 + panel.jsPanelfixPos = function () {
  621 + panel.css('top', $(window).scrollTop() + jspaneldiff);
  622 + };
  623 + $(window).on('scroll', panel.jsPanelfixPos);
  624 + },
  625 +
  626 + // calculate panel margins
  627 + getMargins: function (panel) {
  628 + var off, elmtOff, mR, mL, mB, mT,
  629 + selector = panel.option.paneltype.shiftwithin,
  630 + winWidth = $(window).outerWidth(),
  631 + winHeight = $(window).outerHeight(),
  632 + panelWidth = panel.outerWidth(),
  633 + panelHeight = panel.outerHeight();
  634 + if (!selector || selector === "body") {
  635 + // panel margins relative to browser viewport
  636 + off = panel.offset();
  637 + mR = winWidth - off.left - panelWidth + $(window).scrollLeft();
  638 + mL = winWidth - panelWidth - mR;
  639 + mB = winHeight - off.top - panelHeight + $(window).scrollTop();
  640 + mT = winHeight - panelHeight - mB;
  641 + } else {
  642 + // panel margins relative to element matching selector "selector"
  643 + elmtOff = $(selector).offset();
  644 + off = panel.offset();
  645 + mR = $(selector).outerWidth() - parseInt(panel.css('width')) - (off.left - elmtOff.left);
  646 + mL = off.left - elmtOff.left;
  647 + mB = $(selector).outerHeight() - (off.top - elmtOff.top) - parseInt(panel.css('height'));
  648 + mT = off.top - elmtOff.top;
  649 + }
  650 + return { marginTop: parseInt(mT), marginRight: parseInt(mR), marginBottom: parseInt(mB), marginLeft: parseInt(mL) };
  651 + },
  652 +
  653 + // return max value of an array with numbers
  654 + getMaxOfArray: function (numArray) {
  655 + return Math.max.apply(null, numArray);
  656 + },
  657 +
  658 + // calculate max horizontal and vertical tooltip shift
  659 + getMaxpanelshift: function (panel) {
  660 + var panelWidth = panel.outerWidth(),
  661 + panelHeight = panel.outerHeight(),
  662 + horiz = parseInt(panelWidth / 2) + parseInt(panel.parent().outerWidth() / 2) - 20,
  663 + vert = parseInt(panelHeight / 2) + parseInt(panel.parent().outerHeight() / 2) - 20,
  664 + cornerHoriz = parseInt(panelWidth / 2) - 16,
  665 + cornerVert = parseInt(panelHeight / 2) - 16;
  666 + return { maxshiftH: horiz, maxshiftV: vert, maxCornerH: cornerHoriz, maxCornerV: cornerVert };
  667 + },
  668 +
  669 + // hide controls specified by param "sel" of the jsPanel "panel"
  670 + hideControls: function (sel, panel) {
  671 + var controls = panel.header.controls;
  672 + $("*", controls).css('display', 'block');
  673 + $('#minSpan').css({ 'display': '' });
  674 +
  675 + $(sel, controls).css('display', 'none');
  676 + },
  677 +
  678 + // calculates option.position for hints using 'top left', 'top center' or 'top right'
  679 + hintTop: function (hintGroup) {
  680 + var hintH = 0;
  681 + $("." + hintGroup).each(function () {
  682 + hintH += $(this).outerHeight(true);
  683 + });
  684 + if (hintGroup === "jsPanel-hint-tr") {
  685 + return { top: hintH, right: 0 };
  686 + } else if (hintGroup === "jsPanel-hint-tl") {
  687 + return { top: hintH, left: 0 };
  688 + } else if (hintGroup === "jsPanel-hint-tc") {
  689 + return { top: hintH, left: 'center' };
  690 + }
  691 + return { top: 0, left: 0 };
  692 + },
  693 +
  694 + // loads content in an iFrame
  695 + iframe: function (panel) {
  696 + var iFrame = $("<iframe></iframe>");
  697 + // iframe content
  698 + if (panel.option.iframe.srcdoc) {
  699 + iFrame.prop("srcdoc", panel.option.iframe.srcdoc);
  700 + panel.data("iframeDOC", panel.option.iframe.srcdoc); // needed for exportPanels()
  701 + }
  702 + if (panel.option.iframe.src) {
  703 + iFrame.prop("src", panel.option.iframe.src);
  704 + panel.data("iframeSRC", panel.option.iframe.src); // needed for exportPanels()
  705 + }
  706 + //iframe size
  707 + if (panel.option.size.width !== "auto" && !panel.option.iframe.width) {
  708 + iFrame.prop("width", "100%");
  709 + } else if (typeof panel.option.iframe.width === 'string' && panel.option.iframe.width.slice(-1) === '%') {
  710 + iFrame.prop("width", panel.option.iframe.width);
  711 + } else {
  712 + iFrame.prop("width", parseInt(panel.option.iframe.width) + 'px');
  713 + }
  714 + if (panel.option.size.height !== "auto" && !panel.option.iframe.height) {
  715 + iFrame.prop("height", "100%");
  716 + } else if (typeof panel.option.iframe.height === 'string' && panel.option.iframe.height.slice(-1) === '%') {
  717 + iFrame.prop("height", panel.option.iframe.height);
  718 + } else {
  719 + iFrame.prop("height", parseInt(panel.option.iframe.height) + 'px');
  720 + }
  721 + //iframe name
  722 + if (typeof panel.option.iframe.name === 'string') {
  723 + iFrame.prop("name", panel.option.iframe.name);
  724 + }
  725 + //iframe id
  726 + if (typeof panel.option.iframe.id === 'string') {
  727 + iFrame.prop("id", panel.option.iframe.id);
  728 + }
  729 + //iframe seamless (not yet supported by any browser)
  730 + if (panel.option.iframe.seamless) {
  731 + iFrame.prop("seamless", "seamless");
  732 + }
  733 + //iframe sandbox
  734 + if (typeof panel.option.iframe.sandbox === 'string') {
  735 + iFrame.prop("sandox", panel.option.iframe.sandbox);
  736 + }
  737 + //iframe style
  738 + if ($.isPlainObject(panel.option.iframe.style)) {
  739 + iFrame.css(panel.option.iframe.style);
  740 + }
  741 + //iframe css classes
  742 + if (typeof panel.option.iframe.classname === 'string') {
  743 + iFrame.addClass(panel.option.iframe.classname);
  744 + } else if ($.isFunction(panel.option.iframe.classname)) {
  745 + iFrame.addClass(panel.option.iframe.classname());
  746 + }
  747 + panel.content.empty().append(iFrame);
  748 + },
  749 +
  750 + // append modal backdrop
  751 + insertModalBackdrop: function () {
  752 + var backdrop = '<div class="jsPanel-backdrop" style="height:' + $(document).outerHeight() + 'px;"></div>';
  753 + $('body').append(backdrop);
  754 + /*$(document).on("keydown", ".jsPanel-backdrop", function(e){
  755 + e.preventDefault();
  756 + return false;
  757 + });*/
  758 + },
  759 +
  760 + // check whether a bootstrap compatible theme is used
  761 + isBootstrapTheme: function (optionBootstrap) {
  762 + if ($.inArray(optionBootstrap, ["default", "primary", "info", "success", "warning", "danger"]) > -1) {
  763 + return optionBootstrap;
  764 + }
  765 + return "default";
  766 + },
  767 +
  768 + // loads content using jQuery.load()
  769 + load: function (panel) {
  770 + // alert('pppp')
  771 + panel.content.load(panel.option.load.url, panel.option.load.data || undefined, function (responseText, textStatus, jqXHR) {
  772 + if ($.isFunction(panel.option.load.complete)) {
  773 + panel.option.load.complete.call(panel.content, responseText, textStatus, jqXHR, panel);
  774 + }
  775 + // title h3 might be to small: load() is async!
  776 + jsPanel.resizeTitle(panel);
  777 + // update option.size (content might come delayed)
  778 + jsPanel.updateOptionSize(panel, panel.option.size);
  779 + // fix for a bug in jQuery-UI draggable? that causes the jsPanel to reduce width when dragged beyond boundary of containing element and option.size.width is 'auto'
  780 + panel.content.css('width', function () {
  781 + return panel.content.outerWidth();
  782 + });
  783 + });
  784 + panel.data("loadURL", panel.option.load.url); // needed for exportPanels()
  785 +
  786 +
  787 +
  788 + },
  789 +
  790 + // maximizes a panel within the body element
  791 + maxWithinBody: function (panel) {
  792 + var newPos, newTop, newLeft, newRight;
  793 + if ((panel.status !== "maximized" || panel.option.panelstatus !== "maximized") && panel.option.paneltype.mode !== 'default') {
  794 + // remove window.scroll handler, is added again later in this function
  795 + $(window).off('scroll', panel.jsPanelfixPos);
  796 + // restore minimized panel to initial container if necessary
  797 + if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
  798 + this.restoreFromMinimized(panel);
  799 + }
  800 + // test to enable fullscreen maximize for panels in a parent other than body
  801 + if (panel.option.controls.maxtoScreen === true) {
  802 + newPos = this.calcPosmaxtoScreen(panel);
  803 + newTop = newPos.top + parseInt(panel.option.maximizedMargin.top);
  804 + newLeft = newPos.left + parseInt(panel.option.maximizedMargin.left);
  805 + } else {
  806 + //nikita
  807 + //newTop = $(window).scrollTop() + parseInt(panel.option.maximizedMargin.top);
  808 + //newLeft = $(window).scrollLeft() + parseInt(panel.option.maximizedMargin.left);
  809 + newTop = 70;
  810 + newLeft = 0;
  811 + //nikita
  812 + newRight = 15;
  813 + }
  814 + panel.css({
  815 + top: newTop,
  816 + left: newLeft,
  817 + //nikita
  818 + right: newRight,
  819 + width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 90
  820 +
  821 + //width: $(window).outerWidth() - parseInt(panel.option.maximizedMargin.left) - parseInt(panel.option.maximizedMargin.right),
  822 + //height: $(window).outerHeight() - parseInt(panel.option.maximizedMargin.top) - parseInt(panel.option.maximizedMargin.bottom)
  823 + });
  824 + if ($('.tools') != null) {
  825 + //nikita
  826 + if ($('#canvasDiv') != null) {
  827 + if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) {
  828 + // alert('if')
  829 + $('#canvasDiv').css('height', panel.outerHeight() - 75)
  830 + $('#canvasDiv').css('width', panel.outerWidth() - 100)
  831 + $('#canvasDiv').css('overflow', 'scroll')
  832 + }
  833 + else {
  834 + // alert('else')
  835 + $('#canvasDiv').css('height', panel.outerHeight() - 110)
  836 + $('#canvasDiv').css('width', panel.outerWidth() - 90)
  837 + $('#canvasDiv').css('overflow', 'scroll')
  838 + }
  839 + }
  840 + }
  841 + //nikita
  842 + if (!panel.option.controls.maxtoScreen || (panel.option.controls.maxtoScreen && panel.option.selector === 'body')) {
  843 + // test to enable fullscreen maximize for panels in a parent other than body
  844 + this.fixPosition(panel);
  845 + }
  846 + }
  847 + },
  848 +
  849 + // maximizes a panel within an element other than body
  850 + maxWithinElement: function (panel) {
  851 + // debugger;
  852 + if ((panel.status !== "maximized" || panel.option.panelstatus !== "maximized") && panel.option.paneltype.mode !== 'default') {
  853 + // restore minimized panel to initial container if necessary
  854 + if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
  855 + this.restoreFromMinimized(panel);
  856 + }
  857 + panel.css({
  858 + top: parseInt(70),//panel.option.maximizedMargin.top),
  859 + left: parseInt(panel.option.maximizedMargin.left),
  860 + width: parseInt(panel.parent().outerWidth(), 10) - parseInt(panel.option.maximizedMargin.left) - parseInt(panel.option.maximizedMargin.right),
  861 + height: parseInt(panel.parent().outerHeight()) - parseInt(panel.option.maximizedMargin.top) - parseInt(panel.option.maximizedMargin.bottom) - 65
  862 + });
  863 + }
  864 + if ($('.tools').length> 0) {
  865 + //nikita
  866 + if ($('#canvasDiv') != null) {
  867 + if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) {
  868 + //alert('if')
  869 + // debugger;
  870 + $('#canvasDiv').css('height', panel.outerHeight() - 85)
  871 + $('#canvasDiv').css('width', panel.outerWidth() - 90)
  872 + $('#canvasDiv').css('overflow', 'scroll')
  873 + }
  874 + else {
  875 + // alert('else')
  876 + $('#canvasDiv').css('height', panel.outerHeight() - 105)
  877 + $('#canvasDiv').css('width', panel.outerWidth() - 80)
  878 + $('#canvasDiv').css('overflow', 'scroll')
  879 +
  880 + }
  881 + }
  882 + }
  883 + //nikita
  884 + // debugger;
  885 + // $(".fa-minus").removeClass('display');
  886 + $('#minSpan').css({ 'display': '' });
  887 + },
  888 +
  889 + // calls functions to maximize a jsPanel
  890 + maximize: function (panel) {
  891 + // debugger;
  892 + panel.trigger('jspanelbeforemaximize', panel.attr('id'));
  893 + if ($.isFunction(panel.option.onbeforemaximize)) {
  894 + var maximize = panel.option.onbeforemaximize.call(panel, panel);
  895 + if (maximize === false) {
  896 + return panel;
  897 + }
  898 + }
  899 + if (panel.parentElmtTagname === 'body' || panel.option.controls.maxtoScreen === true) {
  900 + this.maxWithinBody(panel);
  901 + } else {
  902 + this.maxWithinElement(panel);
  903 + }
  904 + panel.trigger('jspanelmaximized', panel.attr('id'));
  905 + panel.trigger('jspanelstatechange', panel.attr('id'));
  906 + if ($.isFunction(panel.option.onmaximized)) {
  907 + panel.option.onmaximized.call(panel, panel);
  908 + }
  909 + return panel;
  910 + },
  911 +
  912 + // minimizes a jsPanel to the lower left corner of the browser viewport
  913 + minimize: function (panel) {
  914 + panel.trigger('jspanelbeforeminimize', panel.attr('id'));
  915 + if ($.isFunction(panel.option.onbeforeminimize)) {
  916 + var minimize = panel.option.onbeforeminimize.call(panel, panel);
  917 + if (minimize === false) {
  918 + return panel;
  919 + }
  920 + }
  921 + panel.data({ // needed for method exportPanels()
  922 + "paneltop": parseInt(panel.option.position.top),
  923 + "panelleft": parseInt(panel.option.position.left),
  924 + "panelwidth": parseInt(panel.option.size.width),
  925 + "panelheight": parseInt($(".jsPanel-content", panel).css("height"))
  926 + });
  927 + // update panel size to have correct values when normalizing again
  928 + if (panel.status === "normalized" || panel.option.panelstatus === "normalized") {
  929 + panel.option.size.width = panel.outerWidth();
  930 + panel.option.size.height = panel.outerHeight();
  931 + }
  932 + panel.animate({
  933 + opacity: 0
  934 + }, {
  935 + duration: 400, // fade out speed when minimizing
  936 + complete: function () {
  937 + panel.animate({
  938 + width: jsPanel.widthForMinimized + "px",
  939 + height: '28px'
  940 + }, {
  941 + duration: 100,
  942 + complete: function () {
  943 + jsPanel.movetoMinified(panel);
  944 + jsPanel.resizeTitle(panel);
  945 + panel.css('opacity', 1);
  946 + }
  947 + });
  948 + }
  949 + });
  950 + if ($.isFunction(panel.option.onminimized)) {
  951 + panel.option.onminimized.call(panel, panel);
  952 + }
  953 + return panel;
  954 + },
  955 +
  956 + // moves a panel to the minimized container
  957 + movetoMinified: function (panel) {
  958 + // wenn der Container für die minimierten jsPanels noch nicht existiert -> erstellen
  959 + if ($('#jsPanel-min-container').length === 0) {
  960 + $('body').append('<div id="jsPanel-min-container"></div>');
  961 + }
  962 + if (panel.status !== "minimized" || panel.option.panelstatus !== "minimized") {
  963 + // jsPanel in vorgesehenen Container verschieben
  964 + panel.css({
  965 + left: ($('.jsPanel', '#jsPanel-min-container').length * jsPanel.widthForMinimized),
  966 + top: 0,
  967 + opacity: 1
  968 + })
  969 + .appendTo('#jsPanel-min-container')
  970 + .resizable({ disabled: true })
  971 + .draggable({ disabled: true });
  972 + panel.trigger('jspanelminimized', panel.attr('id'));
  973 + panel.trigger('jspanelstatechange', panel.attr('id'));
  974 + }
  975 + },
  976 +
  977 + // restores a panel to its "normalized" (not minimized, maximized or smallified) position & size
  978 + normalize: function (panel) {
  979 + // debugger;
  980 + var panelTop,
  981 + interactions = ["resizable", "draggable"];
  982 + panel.trigger('jspanelbeforenormalize', panel.attr('id'));
  983 + if ($.isFunction(panel.option.onbeforenormalize)) {
  984 + var normalize = panel.option.onbeforenormalize.call(panel, panel);
  985 + if (normalize === false) {
  986 + return panel;
  987 + }
  988 + }
  989 + // remove window.scroll handler, is added again later in this function
  990 + $(window).off('scroll', panel.jsPanelfixPos);
  991 + // restore minimized panel to initial container if necessary
  992 + if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
  993 + this.restoreFromMinimized(panel);
  994 + }
  995 + // correction for panels maximized in body after page was scrolled
  996 + if (panel.parentElmtTagname === 'body') {
  997 + panelTop = $(window).scrollTop() + panel.verticalOffset;
  998 + } else {
  999 + panelTop = panel.option.position.top;
  1000 + }
  1001 + panel.css({
  1002 + width: panel.option.size.width,
  1003 + height: panel.option.size.height + 10,
  1004 + top: panelTop,
  1005 + left: panel.option.position.left
  1006 + });
  1007 + interactions.forEach(function (action) {
  1008 + if (panel.option[action] !== "disabled") {
  1009 + panel[action]("enable");
  1010 + // get resizer and cursor for resizable back
  1011 + $('.ui-icon-gripsmall-diagonal-se', panel).css({ 'background-image': 'none', 'text-indent': 0 });
  1012 + $('.ui-resizable-handle', panel).css({ 'cursor': '' });
  1013 + }
  1014 + });
  1015 + panel.trigger('jspanelnormalized', panel.attr('id'));
  1016 + panel.trigger('jspanelstatechange', panel.attr('id'));
  1017 + if (panel.parentElmtTagname === 'body') {
  1018 + this.fixPosition(panel);
  1019 + }
  1020 + if ($.isFunction(panel.option.onnormalized)) {
  1021 + panel.option.onnormalized.call(panel, panel);
  1022 + }
  1023 + return panel;
  1024 + },
  1025 +
  1026 + // replace bottom/right values with corresponding top/left values if necessary and update option.position
  1027 + replaceCSSBottomRight: function (panel) {
  1028 + var panelPosition = panel.position();
  1029 + if (panel.css('bottom')) {
  1030 + panel.css({
  1031 + 'top': parseInt(panelPosition.top, 10),
  1032 + 'bottom': ''
  1033 + });
  1034 + panel.option.position.top = parseInt(panelPosition.top, 10);
  1035 + }
  1036 + if (panel.css('right')) {
  1037 + panel.css({
  1038 + 'left': parseInt(panelPosition.left, 10),
  1039 + 'right': ''
  1040 + });
  1041 + panel.option.position.left = parseInt(panelPosition.left, 10);
  1042 + }
  1043 + },
  1044 +
  1045 + // reposition hint upon closing
  1046 + reposHints: function (hintGroup, jsPtagname) {
  1047 + var hintH;
  1048 + if (jsPtagname === 'body') {
  1049 + hintH = $(window).scrollTop();
  1050 + } else {
  1051 + hintH = 0;
  1052 + }
  1053 + $("." + hintGroup).each(function () {
  1054 + $(this).animate({
  1055 + top: hintH
  1056 + });
  1057 + hintH += $(this).outerHeight(true);
  1058 + });
  1059 + },
  1060 +
  1061 + // reposition hints on window scroll
  1062 + reposHintsScroll: function (panel) {
  1063 + var dif = panel.offset().top - $(window).scrollTop();
  1064 + // with window.onscroll only the last added hint would stay in position
  1065 + $(window).scroll(function () {
  1066 + panel.css('top', $(window).scrollTop() + dif);
  1067 + });
  1068 + },
  1069 +
  1070 + // repositions a panel and optionally moves it to another container
  1071 + reposition: function (panel, position, selector) {
  1072 + //alert('reposition')
  1073 + if (selector && typeof selector === "string") {
  1074 + panel.option.selector = selector;
  1075 + panel.appendTo(selector);
  1076 + panel.parentElmt = $(selector).first();
  1077 + panel.parentElmtTagname = panel.parentElmt[0].tagName.toLowerCase();
  1078 + }
  1079 + if (panel.option.paneltype.type !== 'tooltip' && panel.option.paneltype.type !== 'hint') {
  1080 + // rewrite passed position to be a proper object
  1081 + panel.option.position = jsPanel.rewriteOPosition(position);
  1082 + // delete element styles concerning position, otherwise you might end up with left &right and/or top & bottom values
  1083 + panel.css({ top: "", right: "", bottom: "", left: "" });
  1084 + this.calcPanelposition(panel);
  1085 + panel.verticalOffset = jsPanel.calcVerticalOffset(panel) || 0;
  1086 + this.replaceCSSBottomRight(panel);
  1087 + if (panel.parentElmtTagname === "body") {
  1088 + this.fixPosition(panel);
  1089 + } else {
  1090 + $(window).off('scroll', panel.jsPanelfixPos);
  1091 + }
  1092 + this.updateOptionPosition(panel);
  1093 + }
  1094 + return panel;
  1095 + },
  1096 +
  1097 + // repositions minimized jsPanels
  1098 + reposMinimized: function () {
  1099 + $('.jsPanel', '#jsPanel-min-container').each(function (index, elmt) {
  1100 + $(elmt).animate({
  1101 + left: (index * jsPanel.widthForMinimized)
  1102 + });
  1103 + });
  1104 + },
  1105 +
  1106 + // resize exsisting jsPanel; resizes the full panel (not content section only)
  1107 + resize: function (panel, width, height) {
  1108 + // debugger;
  1109 + if (panel.option.panelstatus !== "minimized") { // v2.4.1 don't call resize() on minimized panels
  1110 + if (width && width !== null) {
  1111 + panel.css("width", width);
  1112 + } else {
  1113 + panel.css("width", panel.content.css("width"));
  1114 + }
  1115 + if (height && height !== null) {
  1116 + panel.css("height", height);
  1117 + }
  1118 + this.resizeContent(panel);
  1119 + this.resizeTitle(panel);
  1120 + }
  1121 +
  1122 + if ($('#canvasDiv') != null) {
  1123 + $('#canvasDiv').css('height', $(window).outerHeight() - 120)
  1124 + $('#leftToolBar').css('height', $(window).outerHeight() - 120)
  1125 +
  1126 + }
  1127 + },
  1128 +
  1129 + // reset dimensions of content section after resize and so on
  1130 + resizeContent: function (panel) {
  1131 + var hdrftr;
  1132 + if (panel.footer.css('display') === 'none') {
  1133 + hdrftr = panel.header.outerHeight();
  1134 + } else {
  1135 + hdrftr = panel.header.outerHeight() + panel.footer.outerHeight();
  1136 + }
  1137 + panel.content.css({
  1138 + height: (panel.outerHeight() - hdrftr),
  1139 + //nikita
  1140 + width: panel.outerWidth()
  1141 + });
  1142 + return panel;
  1143 + },
  1144 +
  1145 + // resize the title h3 to use full width minus controls width (and prevent being longer than panel)
  1146 + resizeTitle: function (panel) {
  1147 + var titleWidth = (panel.outerWidth() - $(panel.header.controls).outerWidth() - 15);
  1148 + panel.header.title.css('width', titleWidth);
  1149 + },
  1150 +
  1151 + // restores minimized panels to their initial container, reenables resizable and draggable, repositions minimized panels
  1152 + restoreFromMinimized: function (panel) {
  1153 + var interactions = ["resizable", "draggable"];
  1154 + // restore minimized panel to initial container
  1155 + if (panel.status === "minimized" || panel.option.panelstatus === "minimized") {
  1156 + panel.appendTo(panel.option.selector);
  1157 + }
  1158 + interactions.forEach(function (action) {
  1159 + if (panel.option[action] !== "disabled") {
  1160 + panel[action]("enable");
  1161 + // get resizer and cursor for resizable back
  1162 + $('.ui-icon-gripsmall-diagonal-se', panel).css({ 'background-image': 'none', 'text-indent': 0 });
  1163 + $('.ui-resizable-handle', panel).css({ 'cursor': '' });
  1164 + }
  1165 + });
  1166 + // reposition minimized panels
  1167 + this.reposMinimized(jsPanel.widthForMinimized);
  1168 + },
  1169 +
  1170 + // rewrite option.paneltype strings to objects and set defaults for option.paneltype
  1171 + rewriteOPaneltype: function (optionPaneltype) {
  1172 + var op = optionPaneltype;
  1173 + if (op === 'modal') {
  1174 + return { type: 'modal', mode: 'default' };
  1175 + } else if (op === 'tooltip') {
  1176 + return { type: 'tooltip', position: 'top' };
  1177 + } else if (op === 'hint') {
  1178 + return { type: 'hint' };
  1179 + } else if (op.type === 'modal') {
  1180 + return { type: 'modal', mode: op.mode || 'default' };
  1181 + } else if (op.type === 'tooltip') {
  1182 + return {
  1183 + type: 'tooltip',
  1184 + mode: op.mode || false,
  1185 + position: op.position || false,
  1186 + shiftwithin: op.shiftwithin || "body",
  1187 + solo: op.solo || false,
  1188 + cornerBG: op.cornerBG || false,
  1189 + cornerOX: op.cornerOX || false,
  1190 + cornerOY: op.cornerOY || false
  1191 + };
  1192 + } else {
  1193 + return { paneltype: false };
  1194 + }
  1195 + },
  1196 +
  1197 + // converts option.position string to object
  1198 + rewriteOPosition: function (optionPosition) {
  1199 + var op = optionPosition;
  1200 + if (op === 'center') {
  1201 + return { top: 'center', left: 'center' };
  1202 + } else if (op === 'auto') {
  1203 + return { top: 'auto', left: 'auto' };
  1204 + } else if (op === 'top left') {
  1205 + return { top: '0', left: '0' };
  1206 + } else if (op === 'top center') {
  1207 + return { top: '0', left: 'center' };
  1208 + } else if (op === 'top right') {
  1209 + return { top: '0', right: '0' };
  1210 + } else if (op === 'center right') {
  1211 + return { top: 'center', right: '0' };
  1212 + } else if (op === 'bottom right') {
  1213 + return { bottom: '0', right: '0' };
  1214 + } else if (op === 'bottom center') {
  1215 + return { bottom: '0', left: 'center' };
  1216 + } else if (op === 'bottom left') {
  1217 + return { bottom: '0', left: '0' };
  1218 + } else if (op === 'center left') {
  1219 + return { top: 'center', left: '0' };
  1220 + }
  1221 + // if bottom and/or right is set to "center" change that to top and/or left set to "center"
  1222 + if (op.bottom === "center") {
  1223 + delete op.bottom;
  1224 + op.top = "center";
  1225 + }
  1226 + if (op.right === "center") {
  1227 + delete op.right;
  1228 + op.left = "center";
  1229 + }
  1230 + return optionPosition;
  1231 + },
  1232 +
  1233 + // converts option.size string to object
  1234 + rewriteOSize: function (optionSize) {
  1235 + var oSize = optionSize;
  1236 + if (typeof oSize === 'string' && oSize === 'auto') {
  1237 + oSize = {
  1238 + width: 'auto',
  1239 + height: 'auto'
  1240 + };
  1241 + }
  1242 + return oSize;
  1243 + },
  1244 +
  1245 + // set default options for hints and add necessary classes
  1246 + setHintDefaults: function (panel) {
  1247 + panel.option.resizable = false;
  1248 + panel.option.draggable = false;
  1249 + panel.option.removeHeader = true;
  1250 + panel.option.toolbarFooter = false;
  1251 + panel.option.show = 'fadeIn';
  1252 + panel.addClass('jsPanel-hint');
  1253 + panel.content.addClass('jsPanel-hint-content');
  1254 + // autoclose default 8 sec | or -1 to deactivate
  1255 + if (!panel.option.autoclose) {
  1256 + panel.option.autoclose = 8000;
  1257 + } else if (panel.option.autoclose < 0) {
  1258 + panel.option.autoclose = false;
  1259 + }
  1260 + // add class according option.theme to color the hint background
  1261 + panel.content.addClass('jsPanel-hint-' + panel.option.theme);
  1262 + panel.content.append('<div class="jsPanel-hint-close jsglyph jsglyph-remove"></div>');
  1263 + },
  1264 +
  1265 + // set default options for standard modal
  1266 + setModalDefaults: function (panel) {
  1267 + panel.option.selector = 'body';
  1268 + panel.option.show = 'fadeIn';
  1269 + panel.addClass('jsPanel-modal');
  1270 + if (panel.option.paneltype.mode === 'default') {
  1271 + panel.option.resizable = false;
  1272 + panel.option.draggable = false;
  1273 + panel.option.removeHeader = false;
  1274 + panel.option.position = { top: 'center', left: 'center' };
  1275 + panel.option.offset = { top: 0, left: 0 };
  1276 + panel.option.controls.buttons = 'closeonly'; //do not delete else "modal" with no close button possible
  1277 + $(".jsPanel-btn-min, .jsPanel-btn-norm, .jsPanel-btn-max, .jsPanel-btn-small, .jsPanel-btn-smallrev", panel).remove();
  1278 + $(panel.header, panel.header.title, panel.footer).css('cursor', 'default');
  1279 + $('.jsPanel-title', panel).css('cursor', 'inherit');
  1280 + }
  1281 + },
  1282 +
  1283 + // set right-to-left text direction and language; set styles and reoorder controls for rtl
  1284 + setRTL: function (panel) {
  1285 + var elmts = [panel.header.title, panel.content, panel.header.toolbar, panel.footer];
  1286 + elmts.forEach(function (item) {
  1287 + item.prop('dir', 'rtl');
  1288 + if (panel.option.rtl.lang) {
  1289 + item.prop('lang', panel.option.rtl.lang);
  1290 + }
  1291 + });
  1292 + panel.header.title.css('text-align', 'right');
  1293 + $('.jsPanel-btn-close', panel.header.controls).insertAfter($('.jsPanel-btn-min', panel.header.controls));
  1294 + $('.jsPanel-btn-max', panel.header.controls).insertAfter($('.jsPanel-btn-min', panel.header.controls));
  1295 + $('.jsPanel-btn-small', panel.header.controls).insertBefore($('.jsPanel-btn-min', panel.header.controls));
  1296 + $('.jsPanel-btn-smallrev', panel.header.controls).insertBefore($('.jsPanel-btn-min', panel.header.controls));
  1297 + $('.jsPanel-hdr-r', panel).css({ left: '0px', right: '', position: 'relative', 'float': 'left' });
  1298 + $('.jsPanel-hint-close', panel).css('float', 'left');
  1299 + $('.jsPanel-title', panel).css('float', 'right');
  1300 + $('.jsPanel-ftr', panel).append('<div style="clear:both;height:0;"></div>');
  1301 + $('button', panel.footer).css('float', 'left');
  1302 + },
  1303 +
  1304 + // set default options for tooltips
  1305 + setTooltipDefaults: function (panel) {
  1306 + panel.option.position = {};
  1307 + panel.option.resizable = false;
  1308 + panel.option.draggable = false;
  1309 + panel.option.show = 'fadeIn';
  1310 + panel.option.controls.buttons = 'closeonly';
  1311 + panel.header.title.css('cursor', 'inherit');
  1312 + panel.footer.css('cursor', 'inherit');
  1313 + panel.addClass('jsPanel-tt');
  1314 + },
  1315 +
  1316 + // returns a z-index value for a panel in order to have it on top
  1317 + setZi: function (panel) {
  1318 + var jspanel, allZi = [], maxZi;
  1319 + if (typeof panel === "string") {
  1320 + jspanel = $(panel);
  1321 + } else {
  1322 + jspanel = panel;
  1323 + }
  1324 + // build array with all z-index values
  1325 + $(".jsPanel:not('.jsPanel-modal, .jsPanel-nofront')").each(function (i, elmt) {
  1326 + if (jspanel.attr("id") !== $(elmt).attr("id")) {
  1327 + allZi.push($(elmt).css("z-index"));
  1328 + }
  1329 + });
  1330 + //allZi.sort(function(a, b) {return a - b}); // sort array ascending
  1331 + //console.log(allZi);
  1332 + maxZi = this.getMaxOfArray(allZi);
  1333 + return maxZi + 1;
  1334 + },
  1335 +
  1336 + // shift tooltip left/right if it overflows window; when using horizontal offsets of panel and/or corner result might be not as expected
  1337 + shiftTooltipHorizontal: function (panel) {
  1338 + var margins = this.getMargins(panel),
  1339 + leftShiftRequired,
  1340 + maxShift = this.getMaxpanelshift(panel),
  1341 + maxLeftShift = maxShift.maxshiftH,
  1342 + shift,
  1343 + maxCornerLeft = maxShift.maxCornerH,
  1344 + cornerShift,
  1345 + newPanelLeft = 0,
  1346 + newCornerLeft = 0;
  1347 + if (margins.marginLeft < 0 && margins.marginRight > 0) {
  1348 + // if panel overflows left window border
  1349 + leftShiftRequired = Math.abs(margins.marginLeft) + 5 || 0;
  1350 + shift = Math.min(leftShiftRequired, maxLeftShift) || 0;
  1351 + cornerShift = Math.min(maxCornerLeft, shift) || 0;
  1352 + newPanelLeft = parseInt(panel.css('left')) + shift + "px";
  1353 + newCornerLeft = parseInt($('.jsPanel-corner', panel).css('left')) - cornerShift + "px";
  1354 + } else if (margins.marginRight < 0 && margins.marginLeft > 0) {
  1355 + // if panel overflows right window border
  1356 + leftShiftRequired = Math.abs(margins.marginRight) + 5 || 0;
  1357 + shift = Math.min(leftShiftRequired, maxLeftShift) || 0;
  1358 + cornerShift = Math.min(maxCornerLeft, shift) || 0;
  1359 + newPanelLeft = parseInt(panel.css('left')) - shift + "px";
  1360 + newCornerLeft = parseInt($('.jsPanel-corner', panel).css('left')) + cornerShift + "px";
  1361 + }
  1362 + if ((margins.marginLeft < 0 && margins.marginRight > 0) || (margins.marginRight < 0 && margins.marginLeft > 0)) {
  1363 + // shift panel
  1364 + panel.animate({
  1365 + "left": newPanelLeft
  1366 + }, { queue: false /* to have both animation run simultaneously */ });
  1367 +
  1368 + // shift corner if present
  1369 + if ($('.jsPanel-corner', panel)) {
  1370 + $('.jsPanel-corner', panel).animate({
  1371 + "left": newCornerLeft
  1372 + }, { queue: false /* to have both animation run simultaneously */ });
  1373 + }
  1374 + }
  1375 + },
  1376 +
  1377 + // shift tooltip up/down if it overflows window; when using vertical offsets of panel and/or corner result might be not as expected
  1378 + shiftTooltipVertical: function (panel) {
  1379 + //console.log( parseInt($('*:first-child', panel.parent()).css('margin-left')) );
  1380 + var margins = this.getMargins(panel),
  1381 + topShiftRequired,
  1382 + maxShift = this.getMaxpanelshift(panel),
  1383 + maxTopShift = maxShift.maxshiftV,
  1384 + shift,
  1385 + maxCornerTop = maxShift.maxCornerV,
  1386 + cornerShift,
  1387 + newPanelTop = 0,
  1388 + newCornerTop = 0;
  1389 + if (margins.marginTop < 0 && margins.marginBottom > 0) {
  1390 + // if panel overflows top window border
  1391 + topShiftRequired = Math.abs(margins.marginTop) + 5 || 0;
  1392 + shift = Math.min(topShiftRequired, maxTopShift) || 0;
  1393 + cornerShift = Math.min(maxCornerTop, shift) || 0;
  1394 + newPanelTop = parseInt(panel.css('top')) + shift + "px";
  1395 + newCornerTop = parseInt($('.jsPanel-corner', panel).css('top')) - cornerShift + "px";
  1396 + } else if (margins.marginBottom < 0 && margins.marginTop > 0) {
  1397 + // if panel overflows bottom window border
  1398 + topShiftRequired = Math.abs(margins.marginBottom) + 5 || 0;
  1399 + shift = Math.min(topShiftRequired, maxTopShift) || 0;
  1400 + cornerShift = Math.min(maxCornerTop, shift) || 0;
  1401 + newPanelTop = parseInt(panel.css('top')) - shift + "px";
  1402 + newCornerTop = parseInt($('.jsPanel-corner', panel).css('top')) + cornerShift + "px";
  1403 + }
  1404 + if ((margins.marginTop < 0 && margins.marginBottom > 0) || (margins.marginBottom < 0 && margins.marginTop > 0)) {
  1405 + // shift panel
  1406 + panel.animate({
  1407 + "top": newPanelTop
  1408 + }, { queue: false /* to have both animation run simultaneously */ });
  1409 +
  1410 + // shift corner if present
  1411 + if ($('.jsPanel-corner', panel)) {
  1412 + $('.jsPanel-corner', panel).animate({
  1413 + "top": newCornerTop
  1414 + }, { queue: false /* to have both animation run simultaneously */ });
  1415 + }
  1416 + }
  1417 + },
  1418 +
  1419 + smallify: function (panel) {
  1420 + var statusNew;
  1421 + if ((panel.status !== "smallified" || panel.option.panelstatus !== "smallified") && (panel.status !== "smallifiedMax" || panel.option.panelstatus !== "smallifiedMax")) {
  1422 + if (panel.status === "maximized" || panel.option.panelstatus === "maximized") {
  1423 + statusNew = "smallifiedMax";
  1424 + } else {
  1425 + statusNew = "smallified";
  1426 + }
  1427 + // store panel height in function property
  1428 + panel.smallify.height = panel.outerHeight();
  1429 + panel.panelheaderheight = panel.header.outerHeight() - 2;
  1430 + panel.panelfooterheight = panel.footer.outerHeight();
  1431 + panel.panelcontentheight = panel.content.outerHeight();
  1432 + panel.animate({
  1433 + height: panel.panelheaderheight
  1434 + },
  1435 + {
  1436 + done: function () {
  1437 + if (panel.status === 'maximized' || panel.option.panelstatus === 'maximized') {
  1438 + jsPanel.hideControls(".jsPanel-btn-max, .jsPanel-btn-small", panel);
  1439 + } else {
  1440 + jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-small", panel);
  1441 + }
  1442 + jsPanel.updateStateProps(panel, statusNew);
  1443 + panel.trigger('jspanel' + statusNew, panel.attr('id'));
  1444 + panel.trigger('jspanelstatechange', panel.attr('id'));
  1445 + }
  1446 + });
  1447 + }
  1448 + },
  1449 +
  1450 + unsmallify: function (panel) {
  1451 + panel.animate({
  1452 + height: panel.smallify.height
  1453 + },
  1454 + {
  1455 + done: function () {
  1456 + if (panel.status === 'smallified' || panel.option.panelstatus === 'smallified') {
  1457 + jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-smallrev", panel);
  1458 + jsPanel.updateStateProps(panel, "normalized");
  1459 + panel.trigger('jspanelnormalized', panel.attr('id'));
  1460 + panel.trigger('jspanelstatechange', panel.attr('id'));
  1461 + } else {
  1462 + jsPanel.hideControls(".jsPanel-btn-max, .jsPanel-btn-smallrev", panel);
  1463 + jsPanel.updateStateProps(panel, "maximized");
  1464 + panel.trigger('jspanelmaximized', panel.attr('id'));
  1465 + panel.trigger('jspanelstatechange', panel.attr('id'));
  1466 + }
  1467 + }
  1468 + }
  1469 + );
  1470 + },
  1471 +
  1472 + // updates option.position to hold actual values
  1473 + updateOptionPosition: function (panel) {
  1474 + panel.option.position.top = panel.css('top');
  1475 + panel.option.position.left = panel.css('left');
  1476 + },
  1477 +
  1478 + // updates option.size to hold actual values
  1479 + updateOptionSize: function (panel) {
  1480 + panel.option.size.width = panel.css('width');
  1481 + panel.option.size.height = $(".jsPanel-content", panel).css("height");
  1482 + },
  1483 +
  1484 + updateCustomData: function (panel, key, val) {
  1485 + var custom = panel.data("custom");
  1486 + custom[key] = val;
  1487 + panel.data("custom", custom);
  1488 + },
  1489 +
  1490 + updateStateProps: function (panel, status) {
  1491 + panel.status = status;
  1492 + panel.option.panelstatus = status;
  1493 + panel.data("panelstatus", status);
  1494 + panel.alterClass("jsPanel-state-*", "jsPanel-state-" + status);
  1495 + },
  1496 +
  1497 + getScope: function (ctrlName) {
  1498 + var sel = 'div[ng-controller="' + ctrlName + '"]';
  1499 + return angular.element(sel).scope();
  1500 + },
  1501 +
  1502 + getRootScope: function (controllerName) {
  1503 + var $body = angular.element(document.body); // 1
  1504 + return $body.scope().$root;
  1505 +
  1506 + }
  1507 +};
  1508 +
  1509 +console.log("jsPanel version: " + jsPanel.version);
  1510 +
  1511 +(function ($) {
  1512 + $.jsPanel = function (config) {
  1513 +
  1514 +
  1515 + var jsP, template, id,
  1516 + panelconfig = config || {},
  1517 + optConfig = panelconfig.config || {};
  1518 +
  1519 + // use custom jsPanel template if present else standard template
  1520 + template = panelconfig.template || jsPanel.template;
  1521 + jsP = $(template);
  1522 +
  1523 + // Extend our default config with those provided. Note that the first arg to extend is an empty object - this is to keep from overriding our "defaults" object.
  1524 + jsP.option = $.extend(true, {}, $.jsPanel.defaults, optConfig, panelconfig);
  1525 +
  1526 + // option.id ---------------------------------------------------------------------------------------------------
  1527 + if (typeof jsP.option.id === "string") {
  1528 + id = jsP.option.id;
  1529 + } else if ($.isFunction(jsP.option.id)) {
  1530 + id = jsP.option.id();
  1531 + } else {
  1532 + jsPanel.ID += 1;
  1533 + id = jsPanel.ID;
  1534 + }
  1535 + if ($("#" + id).length > 0) {
  1536 + alert("jsPanel Error: No jsPanel created - id attribute passed with option.id already exists in document");
  1537 + return false;
  1538 + } else {
  1539 + jsP.attr("id", id);
  1540 + }
  1541 +
  1542 + jsP.data("custom", jsP.option.custom);
  1543 +
  1544 + jsP.verticalOffset = 0; // always use 0 ... not "0" !
  1545 +
  1546 + try {
  1547 + jsP.parentElmt = $(jsP.option.selector).first();
  1548 + jsP.parentElmtTagname = jsP.parentElmt[0].tagName.toLowerCase();
  1549 + jsP.count = jsP.parentElmt.children('.jsPanel').length;
  1550 + } catch (e) {
  1551 + alert(e + "\n\nThe element you want to append the jsPanel to does not exist!\n\n The jsPanel will be appended to the body element instead.");
  1552 + jsP.option.selector = 'body';
  1553 + jsP.parentElmt = $('body');
  1554 + jsP.parentElmtTagname = 'body';
  1555 + jsP.count = jsP.parentElmt.children('.jsPanel').length;
  1556 + }
  1557 +
  1558 + jsP.status = "initialized";
  1559 +
  1560 + jsP.header = $('.jsPanel-hdr', jsP);
  1561 +
  1562 + jsP.header.title = $('.jsPanel-title', jsP.header);
  1563 +
  1564 + jsP.header.controls = $('.jsPanel-hdr-r', jsP.header);
  1565 +
  1566 + jsP.header.toolbar = $('.jsPanel-hdr-toolbar', jsP.header);
  1567 +
  1568 + jsP.content = $('.jsPanel-content', jsP);
  1569 +
  1570 + jsP.footer = $('.jsPanel-ftr', jsP);
  1571 +
  1572 + jsP.normalize = function () {
  1573 + jsPanel.normalize(jsP);
  1574 + return jsP;
  1575 + };
  1576 +
  1577 + jsP.close = function () {
  1578 + // alert('1')
  1579 + jsPanel.close(jsP);
  1580 + // no need to return something
  1581 + };
  1582 +
  1583 + jsP.closeChildpanels = function () {
  1584 + jsPanel.closeChildpanels(jsP);
  1585 + return jsP;
  1586 + };
  1587 +
  1588 + jsP.minimize = function () {
  1589 + jsPanel.minimize(jsP);
  1590 + return jsP;
  1591 + };
  1592 +
  1593 + jsP.maximize = function () {
  1594 + jsPanel.maximize(jsP);
  1595 + return jsP;
  1596 + };
  1597 +
  1598 + jsP.smallify = function () {
  1599 + if ((jsP.status === "normalized" || jsP.option.panelstatus === "normalized") || (jsP.status === "maximized" || jsP.option.panelstatus === "maximized")) {
  1600 + jsPanel.smallify(jsP);
  1601 + } else if ((jsP.status !== "minimized" || jsP.option.panelstatus !== "minimized")) {
  1602 + jsPanel.unsmallify(jsP);
  1603 + }
  1604 + return jsP;
  1605 + };
  1606 +
  1607 + jsP.front = function () {
  1608 + jsP.css('z-index', jsPanel.setZi(jsP));
  1609 + return jsP;
  1610 + };
  1611 +
  1612 + jsP.title = function (text) {
  1613 + if (text && typeof text === "string") {
  1614 + jsP.header.title.html(text);
  1615 + return jsP;
  1616 + } else if (arguments.length === 0) {
  1617 + return jsP.header.title.html();
  1618 + }
  1619 + };
  1620 +
  1621 + jsP.addToolbar = function (place, items) {
  1622 + jsPanel.addToolbar(jsP, place, items);
  1623 + return jsP;
  1624 + };
  1625 +
  1626 + jsP.control = function (action, btn) {
  1627 + jsPanel.control(jsP, action, btn);
  1628 + return jsP;
  1629 + };
  1630 +
  1631 + jsP.resize = function (width, height) {
  1632 + // alert('jsP.resize')
  1633 + // method resizes the full panel (not content section only)
  1634 + jsPanel.resize(jsP, width, height);
  1635 + return jsP;
  1636 + };
  1637 +
  1638 + jsP.reposition = function (position, selector) {
  1639 + jsPanel.reposition(jsP, position, selector);
  1640 + return jsP;
  1641 + };
  1642 +
  1643 + jsP.reloadContent = function () {
  1644 + if (jsP.option.content) {
  1645 + jsP.content.empty().append(jsP.option.content);
  1646 + } else if (jsP.option.load) {
  1647 + jsP.content.empty();
  1648 + jsPanel.load(jsP);
  1649 + } else if (jsP.option.ajax) {
  1650 + jsPanel.ajax(jsP);
  1651 + } else if (jsP.option.iframe) {
  1652 + jsPanel.iframe(jsP);
  1653 + }
  1654 + };
  1655 +
  1656 + // handler to move panel to foreground on click
  1657 + jsP.on('click', function (e) {
  1658 + //alert('1')
  1659 + // use of e.preventDefault(); would prevent events from inside a panel from firing properly
  1660 + if (!$(e.target).is("a[href], button, .jsPanel-nofront, .jsPanel-nofront *")) {
  1661 + if (!jsP.hasClass("jsPanel-modal")) {
  1662 + jsP.css('z-index', jsPanel.setZi(jsP));
  1663 + }
  1664 + }
  1665 + });
  1666 +
  1667 + // jsPanel close
  1668 + $('.jsPanel-btn-close', jsP).on('click', function (e) {
  1669 + // alert('2')
  1670 + e.preventDefault();
  1671 + //if (!jsP.option.controls.confirmClose) {
  1672 + // jsPanel.close(jsP, jsP.parentElmtTagname);
  1673 + //} else {
  1674 + // if (window.confirm(jsP.option.controls.confirmClose) === true) {
  1675 + // jsPanel.close(jsP, jsP.parentElmtTagname);
  1676 + // }
  1677 + //}
  1678 +
  1679 + //if ($('#jsPanel-1').length > 0) {
  1680 + // $('.jsPanel-btn-norm').attr('style', 'display: block');
  1681 + // $('.jsPanel-btn-max').attr('style', 'display: block');
  1682 + //}
  1683 +
  1684 + var $scope = jsPanel.getRootScope('HomeController');
  1685 + $scope.openParent(jsP.option.parentSlug);
  1686 + $scope.$apply();
  1687 + });
  1688 +
  1689 +
  1690 +
  1691 +
  1692 + // jsPanel minimize
  1693 + $('.jsPanel-btn-min', jsP).on('click', function (e) {
  1694 + // alert('minimized')
  1695 +
  1696 + e.preventDefault();
  1697 + jsPanel.minimize(jsP);
  1698 + // debugger;
  1699 + var headerTitle = $('.jsPanel-title');
  1700 + var title = headerTitle[0].innerHTML;
  1701 +
  1702 + var $rootscope = jsPanel.getRootScope('HomeController');
  1703 + //$rootscope.openParent(jsP.option.parentSlug);
  1704 + $rootscope.setState('min', title);
  1705 + $rootscope.$apply();
  1706 +
  1707 + var currentController = jsP.option.currentController;
  1708 + if (currentController == 'DAController') {
  1709 + var $scope = jsPanel.getScope(currentController);
  1710 + var canvasDiv = document.getElementById('canvasDiv');
  1711 + $scope.imageVerticalScrollPosition = canvasDiv.scrollTop;
  1712 + $scope.imageHorizontlScrollPosition = canvasDiv.scrollLeft;
  1713 + $scope.$apply();
  1714 + }
  1715 + });
  1716 +
  1717 + // jsPanel maximize
  1718 + $('.jsPanel-btn-max', jsP).on('click', function (e) {
  1719 + // debugger;
  1720 + e.preventDefault();
  1721 + jsPanel.maximize(jsP);
  1722 +
  1723 + $('.jsPanel-btn-min').css('display', 'initial');
  1724 + $('.fa fa-minus').css('display', 'initial');
  1725 + var headerTitle = $('.jsPanel-title');
  1726 + var title = headerTitle[0].innerHTML;
  1727 + var $rootscope = jsPanel.getRootScope('HomeController');
  1728 + //$rootscope.setState('max', title);
  1729 + $rootscope.$apply();
  1730 + });
  1731 +
  1732 + // jsPanel normalize
  1733 + $('.jsPanel-btn-norm', jsP).on('click', function (e) {
  1734 + // debugger;
  1735 + e.preventDefault();
  1736 + jsPanel.normalize(jsP);
  1737 +
  1738 + var currentController = jsP.option.currentController;
  1739 + if (currentController == 'DAController') {
  1740 + var $scope = jsPanel.getScope(currentController);
  1741 +
  1742 +
  1743 + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
  1744 + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition)
  1745 +
  1746 + $scope.$apply();
  1747 + }
  1748 + });
  1749 +
  1750 + // jsPanel smallify
  1751 + $('.jsPanel-btn-small', jsP).on('click', function (e) {
  1752 + e.preventDefault();
  1753 + jsPanel.smallify(jsP);
  1754 + });
  1755 +
  1756 + // jsPanel unsmallify
  1757 + $('.jsPanel-btn-smallrev', jsP).on('click', function (e) {
  1758 + e.preventDefault();
  1759 + jsPanel.unsmallify(jsP);
  1760 + });
  1761 +
  1762 + // rewrite option.paneltype strings to objects and set defaults for option.paneltype
  1763 + jsP.option.paneltype = jsPanel.rewriteOPaneltype(jsP.option.paneltype);
  1764 +
  1765 + // converts option.position string to object
  1766 + jsP.option.position = jsPanel.rewriteOPosition(jsP.option.position);
  1767 +
  1768 + // converts option.size string to object
  1769 + jsP.option.size = jsPanel.rewriteOSize(jsP.option.size);
  1770 +
  1771 + /* option.paneltype - override or set various settings depending on option.paneltype ------------------------ */
  1772 + if (jsP.option.paneltype.type === 'modal') {
  1773 + // set defaults for standard modal
  1774 + jsPanel.setModalDefaults(jsP);
  1775 + // insert backdrop
  1776 + if ($('.jsPanel-backdrop').length < 1) {
  1777 + jsPanel.insertModalBackdrop();
  1778 + }
  1779 + } else if (jsP.option.paneltype.type === 'tooltip') {
  1780 + jsPanel.setTooltipDefaults(jsP);
  1781 + // optionally remove all other tooltips
  1782 + if (jsP.option.paneltype.solo) {
  1783 + jsPanel.closeallTooltips();
  1784 + }
  1785 + // calc top & left for the various tooltip positions
  1786 + jsP.option.position = jsPanel.calcToooltipPosition(jsP.parentElmt, jsP.option);
  1787 + // position the tooltip & add tooltip class
  1788 + jsP.css({
  1789 + top: jsP.option.position.top,
  1790 + left: jsP.option.position.left
  1791 + });
  1792 + if (!jsP.parentElmt.parent().hasClass('jsPanel-tooltip-wrapper')) {
  1793 + // wrap element serving as trigger in a div - will take the tooltip
  1794 + jsP.parentElmt.wrap('<div class="jsPanel-tooltip-wrapper">');
  1795 + // append tooltip (jsPanel) to the wrapper div
  1796 + jsP.parentElmt.parent().append(jsP);
  1797 + if (jsP.option.paneltype.mode === 'semisticky') {
  1798 + jsP.hover(
  1799 + function () {
  1800 + $.noop();
  1801 + },
  1802 + function () {
  1803 + jsPanel.close(jsP);
  1804 + }
  1805 + );
  1806 + } else if (jsP.option.paneltype.mode === 'sticky') {
  1807 + $.noop();
  1808 + } else {
  1809 + jsP.option.controls.buttons = 'none';
  1810 + // tooltip will be removed whenever mouse leaves trigger
  1811 + jsP.parentElmt.off('mouseout'); // to prevent mouseout from firing several times
  1812 + jsP.parentElmt.mouseout(function () {
  1813 + jsPanel.close(jsP);
  1814 + });
  1815 + }
  1816 + }
  1817 + // corners
  1818 + jsP.css('overflow', 'visible');
  1819 + if (jsP.option.paneltype.cornerBG) {
  1820 + var corner = $("<div></div>"),
  1821 + cornerLoc = "jsPanel-corner-" + jsP.option.paneltype.position,
  1822 + cornerPos,
  1823 + cornerOX = parseInt(jsP.option.paneltype.cornerOX) || 0,
  1824 + cornerOY = parseInt(jsP.option.paneltype.cornerOY) || 0,
  1825 + cornerBG = jsP.option.paneltype.cornerBG;
  1826 + if (jsP.option.paneltype.position !== "bottom") {
  1827 + corner.addClass("jsPanel-corner " + cornerLoc).appendTo(jsP);
  1828 + } else {
  1829 + corner.addClass("jsPanel-corner " + cornerLoc).prependTo(jsP);
  1830 + }
  1831 + if (jsP.option.paneltype.position === "top") {
  1832 + cornerPos = parseInt(jsP.option.size.width) / 2 - 12 + (cornerOX) + "px";
  1833 + corner.css({ borderTopColor: cornerBG, left: cornerPos });
  1834 + } else if (jsP.option.paneltype.position === "right") {
  1835 + cornerPos = parseInt(jsP.option.size.height) / 2 - 12 + (cornerOY) + "px";
  1836 + corner.css({ borderRightColor: cornerBG, left: "-22px", top: cornerPos });
  1837 + } else if (jsP.option.paneltype.position === "bottom") {
  1838 + cornerPos = parseInt(jsP.option.size.width) / 2 - 12 + (cornerOX) + "px";
  1839 + corner.css({ borderBottomColor: cornerBG, left: cornerPos, top: "-22px" });
  1840 + } else if (jsP.option.paneltype.position === "left") {
  1841 + cornerPos = parseInt(jsP.option.size.height) / 2 - 12 + (cornerOY) + "px";
  1842 + corner.css({ borderLeftColor: cornerBG, left: jsP.option.size.width, top: cornerPos });
  1843 + }
  1844 + }
  1845 + } else if (jsP.option.paneltype.type === 'hint') {
  1846 + jsPanel.setHintDefaults(jsP);
  1847 + // bind callback for close button
  1848 + $('.jsPanel-hint-close', jsP).on('click', jsP, function (event) {
  1849 + event.data.close(jsP);
  1850 + });
  1851 + // set option.position for hints using 'top left', 'top center' or 'top right'
  1852 + if (jsP.option.position.top === '0' && jsP.option.position.left === 'center') {
  1853 + jsP.addClass("jsPanel-hint-tc");
  1854 + if ($(".jsPanel-hint-tc").length > 0) {
  1855 + jsP.option.position = jsPanel.hintTop("jsPanel-hint-tc");
  1856 + }
  1857 + } else if (jsP.option.position.top === '0' && jsP.option.position.left === '0') {
  1858 + jsP.addClass("jsPanel-hint-tl");
  1859 + if ($(".jsPanel-hint-tl").length > 0) {
  1860 + jsP.option.position = jsPanel.hintTop("jsPanel-hint-tl");
  1861 + }
  1862 + } else if (jsP.option.position.top === '0' && jsP.option.position.right === '0') {
  1863 + jsP.addClass("jsPanel-hint-tr");
  1864 + if ($(".jsPanel-hint-tr").length > 0) {
  1865 + jsP.option.position = jsPanel.hintTop("jsPanel-hint-tr");
  1866 + }
  1867 + }
  1868 + }
  1869 +
  1870 + /* option.selector - append jsPanel only to the first object in selector ------------------------------------ */
  1871 + jsP.data("selector", jsP.option.selector); // needed for exportPanels()
  1872 + if (jsP.option.paneltype.type !== 'tooltip') {
  1873 + jsP.appendTo(jsP.parentElmt);
  1874 + }
  1875 + if (jsP.option.paneltype.type === 'modal') {
  1876 + jsP.css('zIndex', 10001);
  1877 + if (jsP.option.paneltype.mode === 'extended') {
  1878 + $('.jsPanel-backdrop').css('z-index', '9998');
  1879 + }
  1880 + } else {
  1881 + if (!jsP.hasClass("jsPanel-modal")) {
  1882 + jsP.css('z-index', jsPanel.setZi(jsP));
  1883 + }
  1884 + }
  1885 +
  1886 + /* option.bootstrap & option.theme -------------------------------------------------------------------------- */
  1887 + if (jsP.option.bootstrap) {
  1888 + // check whether a bootstrap compatible theme is used and set option.theme accordingly
  1889 + jsP.option.theme = jsPanel.isBootstrapTheme(jsP.option.bootstrap);
  1890 + jsP.option.controls.iconfont = 'bootstrap';
  1891 + jsP.alterClass('jsPanel-theme-*', 'panel panel-' + jsP.option.theme);
  1892 + jsP.header.alterClass('jsPanel-theme-*', 'panel-heading');
  1893 + jsP.header.title.addClass('panel-title');
  1894 + jsP.content.alterClass('jsPanel-theme-*', 'panel-body');
  1895 + jsP.footer.addClass('panel-footer');
  1896 + // fix css problems for panels nested in other bootstrap panels
  1897 + jsP.header.title.css('color', function () {
  1898 + return jsP.header.css('color');
  1899 + });
  1900 + jsP.content.css('border-top-color', function () {
  1901 + return jsP.header.css('border-top-color');
  1902 + });
  1903 + } else {
  1904 + // activate normal non bootstrap themes
  1905 + var components = [jsP, jsP.header, jsP.content, jsP.footer];
  1906 + components.forEach(function (elmt) {
  1907 + $(elmt).alterClass('jsPanel-theme-*', 'jsPanel-theme-' + jsP.option.theme);
  1908 + });
  1909 + }
  1910 +
  1911 + /* option.removeHeader; option.controls (buttons in header right) ------------------------------------------- */
  1912 + if (jsP.option.removeHeader) {
  1913 + jsP.header.remove();
  1914 + } else {
  1915 + jsPanel.configControls(jsP);
  1916 + }
  1917 +
  1918 + /* insert iconfonts if option.iconfont set (default is "jsglyph") */
  1919 + if (jsP.option.controls.iconfont) {
  1920 + jsPanel.configIconfont(jsP);
  1921 + } else {
  1922 + // if option.controls.iconfont === false restore old icon sprite
  1923 + $('.jsPanel-btn-close, .jsPanel-btn-max, .jsPanel-btn-norm, .jsPanel-btn-min, .jsPanel-btn-small, .jsPanel-btn-smallrev', jsP.header.controls).empty();
  1924 + }
  1925 +
  1926 + /* option.toolbarHeader | default: false -------------------------------------------------------------------- */
  1927 + if (jsP.option.toolbarHeader && jsP.option.removeHeader === false) {
  1928 + if (typeof jsP.option.toolbarHeader === 'string') {
  1929 + jsP.header.toolbar.append(jsP.option.toolbarHeader);
  1930 + } else if ($.isFunction(jsP.option.toolbarHeader)) {
  1931 + jsP.header.toolbar.append(jsP.option.toolbarHeader(jsP.header));
  1932 + } else if ($.isArray(jsP.option.toolbarHeader)) {
  1933 + jsPanel.configToolbar(jsP.option.toolbarHeader, jsP.header.toolbar, jsP);
  1934 + }
  1935 + // give toolbar the same font-family as title
  1936 + jsP.header.toolbar.css("font-family", jsP.header.title.css("font-family"));
  1937 + }
  1938 +
  1939 + /* option.toolbarFooter | default: false -------------------------------------------------------------------- */
  1940 + if (jsP.option.toolbarFooter) {
  1941 + jsP.footer.css({
  1942 + display: 'block'
  1943 + });
  1944 + if (typeof jsP.option.toolbarFooter === 'string') {
  1945 + jsP.footer.append(jsP.option.toolbarFooter);
  1946 + } else if ($.isFunction(jsP.option.toolbarFooter)) {
  1947 + jsP.footer.append(jsP.option.toolbarFooter(jsP.footer));
  1948 + } else if ($.isArray(jsP.option.toolbarFooter)) {
  1949 + jsPanel.configToolbar(jsP.option.toolbarFooter, jsP.footer, jsP);
  1950 + }
  1951 + // give toolbar the same font-family as title
  1952 + jsP.footer.css("font-family", jsP.header.title.css("font-family"));
  1953 + }
  1954 +
  1955 + /* option.rtl | default: false ------------------------------------------------------------------------------ */
  1956 + if (jsP.option.rtl.rtl === true) {
  1957 + jsPanel.setRTL(jsP, jsP.option.rtl.lang);
  1958 + }
  1959 +
  1960 + /* option.overflow | default: 'hidden' --------------------------------------------------------------------- */
  1961 + if (typeof jsP.option.overflow === 'string') {
  1962 + jsP.content.css('overflow', jsP.option.overflow);
  1963 + } else if ($.isPlainObject(jsP.option.overflow)) {
  1964 + jsP.content.css({
  1965 + 'overflow-y': jsP.option.overflow.vertical,
  1966 + 'overflow-x': jsP.option.overflow.horizontal
  1967 + });
  1968 + }
  1969 +
  1970 + /* option.draggable ----------------------------------------------------------------------------------------- */
  1971 + if ($.isPlainObject(jsP.option.draggable)) {
  1972 + // if jsPanel is childpanel
  1973 + if (jsP.parent().hasClass('jsPanel-content')) {
  1974 + jsP.option.draggable.containment = 'parent';
  1975 + }
  1976 + // merge draggable settings and apply
  1977 + jsP.option.customdraggable = $.extend(true, {}, $.jsPanel.defaults.draggable, jsP.option.draggable);
  1978 + jsP.draggable(jsP.option.customdraggable);
  1979 + } else if (jsP.option.draggable === 'disabled') {
  1980 + // reset cursor, draggable deactivated
  1981 + $('.jsPanel-title, .jsPanel-ftr', jsP).css('cursor', 'inherit');
  1982 + // jquery ui draggable initialize disabled to allow to query status
  1983 + jsP.draggable({ disabled: true });
  1984 + }
  1985 +
  1986 + /* option.resizable ----------------------------------------------------------------------------------------- */
  1987 + if ($.isPlainObject(jsP.option.resizable)) {
  1988 + jsP.option.customresizable = $.extend(true, {}, $.jsPanel.defaults.resizable, jsP.option.resizable);
  1989 + jsP.resizable(jsP.option.customresizable);
  1990 + } else if (jsP.option.resizable === 'disabled') {
  1991 + // jquery ui resizable initialize disabled to allow to query status
  1992 + jsP.resizable({ disabled: true });
  1993 + $('.ui-icon-gripsmall-diagonal-se', jsP).css({ 'background-image': 'none', 'text-indent': -9999 });
  1994 + $('.ui-resizable-handle', jsP).css({ 'cursor': 'inherit' });
  1995 + }
  1996 +
  1997 + /* option.content ------------------------------------------------------------------------------------------- */
  1998 + // option.content can be any valid argument for jQuery.append()
  1999 + if (jsP.option.content) {
  2000 + jsP.content.append(jsP.option.content);
  2001 + jsP.data("content", jsP.option.content);
  2002 + }
  2003 +
  2004 + /* option.load ---------------------------------------------------------------------------------------------- */
  2005 + if ($.isPlainObject(jsP.option.load) && jsP.option.load.url) {
  2006 + jsPanel.load(jsP);
  2007 + }
  2008 +
  2009 + /* option.ajax ---------------------------------------------------------------------------------------------- */
  2010 + if ($.isPlainObject(jsP.option.ajax) && jsP.option.ajax.url) {
  2011 + jsPanel.ajax(jsP);
  2012 + }
  2013 +
  2014 + /* option.size ---------------------------------------------------------------------------------------------- */
  2015 + jsP.content.css({
  2016 + width: jsP.option.size.width || 'auto',
  2017 + height: jsP.option.size.height || 'auto'
  2018 + });
  2019 +
  2020 + // Important! limit title width; final adjustment follows later; otherwise title might be longer than panel width
  2021 + jsP.header.title.css('width', jsP.content.width() - 90);
  2022 +
  2023 + /* option.iframe -------------------------------------------------------------------------------------------- */
  2024 + // implemented after option.size because option.size.width/height are either "auto" or pixel values already
  2025 + if ($.isPlainObject(jsP.option.iframe) && (jsP.option.iframe.src || jsP.option.iframe.srcdoc)) {
  2026 + jsPanel.iframe(jsP);
  2027 + }
  2028 +
  2029 + /* option.position ------------------------------------------------------------------------------------------ */
  2030 + if (jsP.option.paneltype.type !== 'tooltip') {
  2031 + // value "center" not allowed for option.position.bottom & option.position.right -> use top and/or left
  2032 + // finally calculate & position the jsPanel
  2033 + jsPanel.calcPanelposition(jsP);
  2034 + }
  2035 +
  2036 + /* option.addClass ------------------------------------------------------------------------------------------ */
  2037 + if (typeof jsP.option.addClass.header === 'string') {
  2038 + jsP.header.addClass(jsP.option.addClass.header);
  2039 + }
  2040 + if (typeof jsP.option.addClass.content === 'string') {
  2041 + jsP.content.addClass(jsP.option.addClass.content);
  2042 + }
  2043 + if (typeof jsP.option.addClass.footer === 'string') {
  2044 + jsP.footer.addClass(jsP.option.addClass.footer);
  2045 + }
  2046 +
  2047 + // handlers for doubleclicks -----------------------------------------------------------------------------------
  2048 + // dblclicks disabled for normal modals, hints and tooltips
  2049 + if (jsP.option.paneltype.mode !== "default") {
  2050 + if (jsP.option.dblclicks) {
  2051 + if (jsP.option.dblclicks.title) {
  2052 + jsP.header.title.on('dblclick', function (e) {
  2053 + e.preventDefault();
  2054 + jsPanel.dblclickhelper(jsP.option.dblclicks.title, jsP);
  2055 + });
  2056 + }
  2057 + if (jsP.option.dblclicks.content) {
  2058 + jsP.content.on('dblclick', function (e) {
  2059 + e.preventDefault();
  2060 + jsPanel.dblclickhelper(jsP.option.dblclicks.content, jsP);
  2061 + });
  2062 + }
  2063 + if (jsP.option.dblclicks.footer) {
  2064 + jsP.footer.on('dblclick', function (e) {
  2065 + e.preventDefault();
  2066 + jsPanel.dblclickhelper(jsP.option.dblclicks.footer, jsP);
  2067 + });
  2068 + }
  2069 + }
  2070 + }
  2071 +
  2072 + /* option.show ---------------------------------------------------------------------------------------------- */
  2073 + if (!jsP.option.show) {
  2074 + jsP.css({
  2075 + display: 'block',
  2076 + opacity: 1
  2077 + });
  2078 + $(jsP).trigger('jspanelloaded', jsP.attr('id'));
  2079 + $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
  2080 + jsP.option.size = {
  2081 + width: jsP.outerWidth(),
  2082 + height: jsP.outerHeight()
  2083 + };
  2084 + } else if (jsP.option.show.indexOf(" ") === -1) {
  2085 + // if no space is found in "jsP.option.show" -> function anwenden
  2086 + jsP[jsP.option.show]({
  2087 + done: function () {
  2088 + // trigger custom event
  2089 + $(jsP).trigger('jspanelloaded', jsP.attr('id'));
  2090 + $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
  2091 + jsP.option.size = {
  2092 + width: jsP.outerWidth(),
  2093 + height: jsP.outerHeight()
  2094 + };
  2095 + }
  2096 + });
  2097 + } else {
  2098 + // does not work with certain combinations of type of animation and positioning
  2099 + jsP.css({
  2100 + display: 'block',
  2101 + opacity: 1
  2102 + });
  2103 + $(jsP).addClass(jsP.option.show);
  2104 + $(jsP).trigger('jspanelloaded', jsP.attr('id'));
  2105 + $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
  2106 + jsP.option.size = {
  2107 + width: jsP.outerWidth(),
  2108 + height: jsP.outerHeight()
  2109 + };
  2110 + }
  2111 +
  2112 + /* needed if a maximized panel in body is normalized again -------------------------------------------------- */
  2113 + // don't put this under $('body').on('jspanelloaded', function () { ... }
  2114 + jsP.verticalOffset = jsPanel.calcVerticalOffset(jsP) || 0;
  2115 +
  2116 + /* replace bottom/right values with corresponding top/left values if necessary ------------------------------ */
  2117 + jsPanel.replaceCSSBottomRight(jsP);
  2118 +
  2119 + /* option.title | needs to be late in the file! ------------------------------------------------------------- */
  2120 + jsP.header.title.empty().prepend(jsP.option.title);
  2121 + jsPanel.resizeTitle(jsP);
  2122 +
  2123 + /* reposition hints while scrolling window, must be after normalization of position ------------------------- */
  2124 + if (jsP.option.paneltype.type === 'hint') {
  2125 + jsPanel.reposHintsScroll(jsP);
  2126 + }
  2127 +
  2128 + /* reposition jsPanel appended to body while scrolling window ----------------------------------------------- */
  2129 + if (jsP.parentElmtTagname === 'body' && (jsP.option.paneltype.type !== 'tooltip' || jsP.option.paneltype.type !== 'hint')) {
  2130 + jsPanel.fixPosition(jsP);
  2131 + }
  2132 +
  2133 + /* resizestart & resizestop & dragstop callbacks ------------------------------------------------------------ */
  2134 + if (!jsP.option.paneltype || jsP.option.paneltype.mode !== 'default') {
  2135 + // not needed for modals, hints and tooltips
  2136 + $(jsP).on("resizestart", function () {
  2137 + $("iframe", jsP.content).css("display", "none"); // on test
  2138 + });
  2139 +
  2140 + $(jsP).on("resize", function () {
  2141 + // debugger;
  2142 + // jquery ui resize event is also fired when panel is maximized or normalized (on request of Gareth Bult)
  2143 + jsPanel.resizeContent(jsP);
  2144 + jsPanel.resizeTitle(jsP);
  2145 + });
  2146 +
  2147 + $(jsP).on("resizestop", function () {
  2148 +
  2149 + //alert('resized')
  2150 + jsP.option.size = {
  2151 + width: jsP.outerWidth(),
  2152 + height: jsP.outerHeight()
  2153 + };
  2154 + if ($('.tools').length> 0) {
  2155 + //nikita
  2156 + if ($('#canvasDiv') != null) {
  2157 + if (jsP.outerHeight() >= 435 && jsP.outerWidth() >= 650) {
  2158 + // alert('resizestop')
  2159 + $('#canvasDiv').css('height', jsP.outerHeight() - 85)
  2160 + $('#canvasDiv').css('width', jsP.outerWidth() - 95)
  2161 + $('#canvasDiv').css('overflow', 'scroll')
  2162 + }
  2163 + else {
  2164 + $('#canvasDiv').css('height', jsP.outerHeight() - 110)
  2165 + $('#canvasDiv').css('width', jsP.outerWidth() - 85)
  2166 + $('#canvasDiv').css('overflow', 'scroll')
  2167 + }
  2168 + }
  2169 + }
  2170 + //nikita
  2171 + // $('#leftToolBar').css('height', jsP.outerWidth())
  2172 +
  2173 + jsPanel.updateStateProps(jsP, "normalized");
  2174 + $(jsP).trigger('jspanelnormalized', jsP.attr('id'));
  2175 + $(jsP).trigger('jspanelstatechange', jsP.attr('id'));
  2176 + // controls und title zurücksetzen
  2177 + jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-smallrev", jsP);
  2178 + $("iframe", jsP.content).css("display", "block"); // on test
  2179 + });
  2180 +
  2181 + $(jsP).on("dragstart", function () {
  2182 + // alert("dragstart")
  2183 + // debugger;
  2184 + // remove window.scroll handler, is added again on dragstop
  2185 + $(window).off('scroll', jsP.jsPanelfixPos);
  2186 + if (jsP.option.paneltype.mode === 'extended') {
  2187 + jsP.css('z-index', '1');
  2188 + }
  2189 + });
  2190 +
  2191 + $(jsP).on("dragstop", function () {
  2192 + // alert("dragstop")
  2193 + // debugger;
  2194 + jsP.option.position = {
  2195 + top: jsP.css('top'),
  2196 + left: jsP.css('left')
  2197 + };
  2198 + jsP.verticalOffset = jsPanel.calcVerticalOffset(jsP) || 0;
  2199 + if (jsP.parentElmtTagname === 'body') {
  2200 + jsPanel.fixPosition(jsP);
  2201 + }
  2202 + });
  2203 +
  2204 + $(jsP).on("jspanelminimized", function () {
  2205 + jsPanel.hideControls(".jsPanel-btn-min, .jsPanel-btn-small, .jsPanel-btn-smallrev, .jsPanel-btn-hide", jsP);
  2206 + jsPanel.updateStateProps(jsP, "minimized");
  2207 + $(window).off('scroll', jsP.jsPanelfixPos);
  2208 + });
  2209 +
  2210 + $(jsP).on("jspanelmaximized", function () {
  2211 + // debugger;
  2212 + jsPanel.resizeContent(jsP);
  2213 + jsPanel.resizeTitle(jsP);
  2214 + jsPanel.hideControls(".jsPanel-btn-max, .jsPanel-btn-smallrev", jsP);
  2215 + jsPanel.updateStateProps(jsP, "maximized");
  2216 + // additionally trigger the jQuery UI resize event (on request of Gareth Bult)
  2217 + jsP.trigger("resize");
  2218 + });
  2219 +
  2220 + $(jsP).on("jspanelnormalized", function () {
  2221 + jsPanel.hideControls(".jsPanel-btn-norm, .jsPanel-btn-smallrev", jsP);
  2222 + jsPanel.resizeTitle(jsP);
  2223 + jsPanel.resizeContent(jsP);
  2224 + jsPanel.updateStateProps(jsP, "normalized");
  2225 + // additionally trigger the jQuery UI resize event (on request of Gareth Bult)
  2226 + jsP.trigger("resize");
  2227 + });
  2228 +
  2229 + }
  2230 +
  2231 + /* option.autoclose | default: false --------------------------------------- */
  2232 + if (typeof jsP.option.autoclose === 'number' && jsP.option.autoclose > 0) {
  2233 + jsPanel.autoclose(jsP);
  2234 + }
  2235 +
  2236 + /* tooltip corrections ----------------------------------------------------- */
  2237 + if (jsP.option.paneltype.type === "tooltip" && (jsP.option.paneltype.position === "top" || jsP.option.paneltype.position === "bottom")) {
  2238 + jsPanel.shiftTooltipHorizontal(jsP, jsP.option.paneltype.shiftwithin);
  2239 + } else if (jsP.option.paneltype.position === "left" || jsP.option.paneltype.position === "right") {
  2240 + jsPanel.shiftTooltipVertical(jsP, jsP.option.paneltype.shiftwithin);
  2241 + }
  2242 +
  2243 + /* option.panelstatus --------------------------------------------------------------------------------------- */
  2244 + if (jsP.option.panelstatus) {
  2245 + switch (jsP.option.panelstatus) {
  2246 + case "minimized":
  2247 + jsPanel.minimize(jsP);
  2248 + break;
  2249 + case "maximized":
  2250 + jsPanel.maximize(jsP);
  2251 + break;
  2252 + case ("smallified"):
  2253 + jsPanel.smallify(jsP);
  2254 + break;
  2255 + case ("smallifiedMax"):
  2256 + jsPanel.maximize(jsP);
  2257 + jsPanel.smallify(jsP);
  2258 + break;
  2259 + }
  2260 + } else {
  2261 + jsPanel.updateStateProps(jsP, "normalized");
  2262 + }
  2263 +
  2264 + /* jsP.option.callback --------------------------------------------------------- */
  2265 + if ($.isFunction(jsP.option.callback)) {
  2266 + jsP.option.callback.call(jsP, jsP);
  2267 + } else if ($.isArray(jsP.option.callback)) {
  2268 + jsP.option.callback.forEach(function (item) {
  2269 + if ($.isFunction(item)) {
  2270 + item.call(jsP, jsP);
  2271 + }
  2272 + });
  2273 + }
  2274 +
  2275 +
  2276 + return jsP;
  2277 + };
  2278 +
  2279 + /* jsPanel.defaults */
  2280 + $.jsPanel.defaults = {
  2281 + "addClass": {
  2282 + header: false,
  2283 + content: false,
  2284 + footer: false
  2285 + },
  2286 + "ajax": {
  2287 + autoload: true
  2288 + },
  2289 + "autoclose": false,
  2290 + "bootstrap": false,
  2291 + "callback": undefined,
  2292 + "content": false,
  2293 + "controls": {
  2294 + buttons: true,
  2295 + iconfont: 'jsglyph',
  2296 + close: false,
  2297 + confirmClose: false,
  2298 + maximize: false,
  2299 + minimize: false,
  2300 + normalize: false,
  2301 + smallify: false,
  2302 + maxtoScreen: false
  2303 + },
  2304 + "custom": false,
  2305 + "dblclicks": false,
  2306 + "draggable": {
  2307 + handle: 'div.jsPanel-hdr, div.jsPanel-ftr',
  2308 + stack: '.jsPanel',
  2309 + opacity: 0.7
  2310 + },
  2311 + "id": function () {
  2312 + jsPanel.ID += 1;
  2313 + return 'jsPanel-' + jsPanel.ID;
  2314 + },
  2315 + "iframe": false,
  2316 + "load": false,
  2317 + "maximizedMargin": {
  2318 + top: 5,
  2319 + right: 5,
  2320 + bottom: 5,
  2321 + left: 5
  2322 + },
  2323 + "offset": {
  2324 + top: 0,
  2325 + left: 0
  2326 + },
  2327 + "onbeforeclose": false,
  2328 + "onbeforemaximize": false,
  2329 + "onbeforeminimize": false,
  2330 + "onbeforenormalize": false,
  2331 + "onclosed": false,
  2332 + "oncmaximized": false,
  2333 + "onminimized": false,
  2334 + "onnormalized": false,
  2335 + "overflow": 'hidden',
  2336 + "panelstatus": false,
  2337 + "paneltype": false,
  2338 + "position": 'auto',
  2339 + "removeHeader": false,
  2340 + "resizable": {
  2341 + handles: 'n, e, s, w, ne, se, sw, nw',
  2342 + autoHide: false,
  2343 + minWidth: 150,
  2344 + minHeight: 93
  2345 + },
  2346 + "rtl": false,
  2347 + "selector": 'body',
  2348 + "show": 'fadeIn',
  2349 + "size": {
  2350 + width: '400px',
  2351 + height: '222px'
  2352 + },
  2353 + "template": false,
  2354 + "theme": 'default',
  2355 + "title": 'jsPanel',
  2356 + "toolbarFooter": false,
  2357 + "toolbarHeader": false,
  2358 + "currentController": '',
  2359 + "parentSlug": ''
  2360 +
  2361 + };
  2362 +
  2363 +
  2364 + /*
  2365 + * jQuery alterClass plugin
  2366 + * Remove element classes with wildcard matching. Optionally add classes:
  2367 + * $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
  2368 + * Copyright (c) 2011 Pete Boere (the-echoplex.net)
  2369 + * Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
  2370 + */
  2371 + $.fn.alterClass = function (removals, additions) {
  2372 +
  2373 + var self = this,
  2374 + patt;
  2375 + if (removals.indexOf('*') === -1) {
  2376 + // Use native jQuery methods if there is no wildcard matching
  2377 + self.removeClass(removals);
  2378 + return !additions ? self : self.addClass(additions);
  2379 + }
  2380 + patt = new RegExp('\\s' +
  2381 + removals.replace(/\*/g, '[A-Za-z0-9-_]+').split(' ').join('\\s|\\s') +
  2382 + '\\s', 'g');
  2383 + self.each(function (i, it) {
  2384 + var cn = ' ' + it.className + ' ';
  2385 + while (patt.test(cn)) {
  2386 + cn = cn.replace(patt, ' ');
  2387 + }
  2388 + it.className = $.trim(cn);
  2389 + });
  2390 + return !additions ? self : self.addClass(additions);
  2391 + };
  2392 +
  2393 + /* body click handler: remove all tooltips on click in body except click is inside tooltip */
  2394 + $('body').click(function (e) {
  2395 + var pID,
  2396 + isTT = $(e.target).closest('.jsPanel-tt').length;
  2397 + if (isTT < 1) {
  2398 + $('.jsPanel-tt').each(function () {
  2399 + pID = $(this).attr('id');
  2400 + // if present remove tooltip wrapper and than remove tooltip
  2401 + $('#' + pID).unwrap().remove();
  2402 + $('body').trigger('jspanelclosed', pID);
  2403 + });
  2404 + }
  2405 + });
  2406 +
  2407 +
  2408 +
  2409 +
  2410 +}(jQuery));
  2411 +
  2412 +/*
  2413 + :: Number.isInteger() polyfill ::
  2414 + https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
  2415 +*/
  2416 +if (!Number.isInteger) {
  2417 + Number.isInteger = function isInteger(nVal) {
  2418 + "use strict";
  2419 + return typeof nVal === 'number' && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal;
  2420 + };
2420 2421 }
2421 2422 \ No newline at end of file
... ...