--- a/src/pyams_skin/resources/js/myams-widgets.min.js Tue Dec 20 14:18:35 2016 +0100
+++ b/src/pyams_skin/resources/js/myams-widgets.min.js Tue Dec 20 18:42:48 2016 +0100
@@ -1,1 +1,1 @@
-(function(f,e){function c(h){if(h<10){h="0"+h}return h}function a(o,p){var h=new Date(o);var j=c(h.getMonth()+1);var l=c(h.getDate());var k=c(h.getFullYear());var m=c(h.getHours());var i=c(h.getMinutes());var n=c(h.getSeconds());return p.timestampFormat.replace(/%d%/g,l).replace(/%m%/g,j).replace(/%y%/g,k).replace(/%h%/g,m).replace(/%i%/g,i).replace(/%s%/g,n)}var g=e.MyAMS;function d(i,h){this.widget=i;this.options=f.extend({},b.defaults,h);this.grid=this.widget.parents(this.options.grid);this.hasGrid=this.grid.exists();this.gridId=this.grid.attr("id");this.controls=this.options.controls;this.toggleClass=this.options.toggleClass.split("|");this.editClass=this.options.editClass.split("|");this.fullscreenClass=this.options.fullscreenClass.split("|");this.customClass=this.options.customClass.split("|");this.init()}d.prototype={init:function(){var p=this;var j;if(p.options.rtl===true){f("body").addClass("rtl")}p.grid.each(function(){f(this).addClass("sortable-grid")});p._getSettings();if(p.hasGrid&&p.storage){var E;if(p.position){var C=JSON.parse(p.position);for(E in C.grid){if(!C.grid.hasOwnProperty(E)){continue}var A=p.grid.find(p.options.subgrid+".sortable-grid").eq(E);for(var B in C.grid[E].section){if(!C.grid[E].section.hasOwnProperty(B)){continue}A.append(f("#"+C.grid[E].section[B].id))}}}if(p.settings){var z=JSON.parse(p.settings);for(E in z.widget){if(!z.widget.hasOwnProperty(E)){continue}j=z.widget[E];var y=f("#"+j.id);if(j.style){y.removeClassPrefix("ams-widget-color-").addClass(j.style).attr("data-widget-attstyle",j.style)}if(j.hidden===1){y.hide(1)}else{y.show(1).removeAttr("data-widget-hidden")}if(j.collapsed===1){y.addClass("ams-widget-collapsed").children("div").hide(1)}var F=y.children("header").children("h2");if(F.text()!==j.title){F.text(j.title)}}}}j=p.widget;var D=j.data();var q={grid:D.amsWidgetGrid,subgrid:D.amsWudgetSubgrid,widgets:D.amsWidgetWidgets,controls:D.amsWidgetControls,storage:D.amsWidgetStorage,deleteSettingsKey:D.amsWidgetDeleteSettingsKey,deletePositionKey:D.amsWidgetDeletePositionKey,sortable:D.amsWidgetSortable,hiddenButtons:D.amsWidgetHiddenButtons,toggleButton:D.amsWidgetToggleButton,toggleClass:D.amsWidgetToggleClass,onToggle:g.getFunctionByName(D.amsWidgetToggleCallback),deleteButton:D.amsWidgetDeleteButton,deleteClass:D.amsWidgetDeleteClass,onDelete:g.getFunctionByName(D.amsWidgetDeleteCallback),editButton:D.amsWidgetEditButton,editPlaceholder:D.amsWidgetEditPlaceholder,editClass:D.amsWidgetEditClass,onEdit:g.getFunctionByName(D.amsWidgetEditCallback),fullscreenButton:D.amsWidgetFullscreenButton,fullscreenClass:D.amsWidgetFullscreenClass,fullscreenDiff:D.amsWidgetFullscreenDiff,onFullscreen:g.getFunctionByName(D.amsWidgetFullscreenCallback),customButton:D.amsWidgetCustomButton,customClass:D.amsWidgetCustomClass,customStart:g.getFunctionByName(D.amsWidgetCustomStartCallback),customEnd:g.getFunctionByName(D.amsWidgetCustomEndCallback),buttonsOrder:D.amsWidgetButtonsOrder,opacity:D.amsWidgetOpacity,dragHandle:D.amsWidgetDragHandle,placeholderClass:D.amsWidgetPlaceholderClass,indicator:D.amsWidgetIndicator,indicatorTime:D.amsWidgetIndicatorTime,ajax:D.amsWidgetAjax,timestampPlaceholder:D.amsWidgetTimestampPlaceholder,timestampFormat:D.amsWidgetTimestampFormat,refreshButton:D.amsWidgetRefreshButton,refreshClass:D.amsWidgetRefreshClass,errorLabel:D.amsWidgetErrorLabel,updatedLabel:D.amsWidgetUpdatedLabel,refreshLabel:D.amsWidgetRefreshLabel,deleteLabel:D.amsWidgetDeleteLabel,afterLoad:g.getFunctionByName(D.amsWidgetAfterLoadCallback),rtl:D.amsWidgetRtl,onChange:g.getFunctionByName(D.amsWidgetChangeCallback),onSave:g.getFunctionByName(D.amsWidgetSaveCallback),ajax_nav:g.ajax_nav};var x=f.extend({},p.options,q);var v=j.children("header");if(!v.parent().attr("role")){var u,r,m,i,o,t;if(D.widgetHidden===true){j.hide()}if(D.widgetCollapsed===true){j.addClass("ams-widget-collapsed").children("div").hide()}if(x.customButton&&(D.widgetCustombutton===undefined)&&(p.customClass[0].length!==0)){u='<a href="#" class="button-icon ams-widget-custom-btn"><i class="'+p.customClass[0]+'"></i></a>'}else{u=""}if(x.deleteButton&&(D.widgetDeleteButton===undefined)){r='<a href="#" class="button-icon ams-widget-delete-btn hint" title="'+b.i18n.DELETE_BTN+'" data-ams-hint-gravity="se"><i class="'+x.deleteClass+'"></i></a>'}else{r=""}if(x.editButton&&(D.widgetEditButton===undefined)){var k=x.editClass.split("|")[0];m='<a href="#" class="button-icon ams-widget-edit-btn hint" title="'+b.i18n.EDIT_BTN+'" data-ams-hint-gravity="se"><i class="'+k+'"></i></a>'}else{m=""}if(x.fullscreenButton&&(D.widgetFullscreenButton===undefined)){var n=x.fullscreenClass.split("|")[0];i='<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="'+b.i18n.FULLSCREEN_BTN+'" data-ams-hint-gravity="se"><i class="'+n+'"></i></a>'}else{i=""}if(x.toggleButton&&(D.widgetToggleButton===undefined)){var s=x.toggleClass.split("|");var h;if((j.dataWidgetCollapsed===true)||j.hasClass("ams-widget-collapsed")){h=s[1]}else{h=s[0]}o='<a href="#" class="button-icon ams-widget-toggle-btn hint" title="'+b.i18n.COLLAPSE_BTN+'" data-ams-hint-gravity="se"><i class="'+h+'"></i></a>'}else{o=""}if(x.refreshButton&&(D.widgetRefreshButton===undefined)&&D.widgetLoad){t='<a href="#" class="button-icon ams-widget-refresh-btn hint" title="'+b.i18n.REFRESH_BTN+'" data-loading-text=" '+b.i18n.LOADING_MSG+' " data-ams-hint-gravity="se"><i class="'+x.refreshClass+'"></i></a>'}else{t=""}var w=x.buttonsOrder.replace(/%refresh%/,t).replace(/%custom%/,u).replace(/%edit%/,m).replace(/%toggle%/,o).replace(/%fullscreen%/,i).replace(/%delete%/,r);if(t||u||m||o||i||r){v.prepend('<div class="ams-widget-ctrls">'+w+"</div>")}if(x.sortable&&(D.widgetSortable===undefined)){j.addClass("ams-widget-sortable")}var l=j.find(x.editPlaceholder);if(l.length>0){l.find("input").val(f.trim(v.children("h2").text()))}v.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>');j.attr("role","widget").children("div").attr("role","content").prev("header").attr("role","heading").children("div").attr("role","menu");g.plugins.enabled.hint(v)}j.data("widget-options",x);if(p.options.hiddenButtons){f(p.controls).hide()}j.find("[data-widget-load]").each(function(){var I=f(this),K=I.children(),J=I.data("widget-load"),H=I.data("widget-refresh")*1000,G=K;if(I.find(".ams-widget-ajax-placeholder").length<=0){I.children("widget-body").append('<div class="ams-widget-ajax-placeholder">'+p.options.loadingLabel+"</div>");if(H>0){p.loadAjaxFile(I,J,K);setInterval(function(){p._loadAjaxFile(I,J,K)},H)}else{p._loadAjaxFile(I,J,K)}}});if(p.options.hiddenButtons){p.widget.children("header").hover(function(){f(this).children(p.controls).stop(true,true).fadeTo(100,1)},function(){f(this).children(p.controls).stop(true,true).fadeTo(100,0)})}p._setClickEvents();f(p.options.deleteSettingsKey).on(p.clickEvent,this,function(H){if(p.storage&&e.confirm){var G=e.confirm(p.options.settingsKeyLabel);if(G){p.storage.removeItem(p.settingsKey)}}H.preventDefault()});f(p.options.deletePositionKey).on(p.clickEvent,this,function(H){if(p.storage&&e.confirm){var G=e.confirm(p.options.positionKeyLabel);if(G){p.storage.removeItem(p.positionKey)}}H.preventDefault()});if(p.storage){if(p.settingsKey===null||p.settingsKey.length<1){p._saveWidgetSettings()}if(p.positionKey===null||p.positionKey.length<1){p._saveWidgetPosition()}}p.grid.data("ams-widgets-loaded",true)},destroy:function(){var h=this;h.widgets.off("click",h._setClickEvents());h.element.removeData("AMSWidget")},_getSettings:function(){var i=this;if(!i.hasGrid||!i.gridId){i.storage=null}else{switch(i.options.storage){case"local":i.storage=localStorage;break;case"session":i.storage=sessionStorage;break;default:i.storage=null}}var h=(i.storage!==null)&&function(){var j,k=+new Date();try{i.storage.setItem(k,k);j=i.storage.getItem(k)===k;i.storage.removeItem(k);return j}catch(l){}}();if(h){i.settingsKey="AMS_settings_"+location.pathname+location.hash+"_"+i.gridId;i.settings=i.storage.getItem(i.settingsKey);i.positionKey="AMS_position_"+location.pathname+location.hash+"_"+i.gridId;i.position=i.storage.getItem(i.positionKey)}if(("ontouchstart" in e)||e.DocumentTouch&&e.document instanceof e.DocumentTouch){i.clickEvent="touchstart"}else{i.clickEvent="click"}},_runLoaderWidget:function(i){var h=this;if(h.options.indicator){i.find(".ams-widget-loader").stop(true,true).fadeIn(100).delay(h.options.indicatorTime).fadeOut(100)}},_loadAjaxFile:function(i,j,h){g.skin.loadURL(i,j.find(".widget-body"))},_saveWidgetSettings:function(){var i=this;i._getSettings();if(i.storage){var h=[];i.grid.find(i.options.widgets).each(function(){var l=f(this);var k={};k.id=l.attr("id");k.style=l.attr("data-widget-attstyle");k.title=l.children("header").children("h2").text();k.hidden=l.is(":hidden")?1:0;k.collapsed=l.hasClass("ams-widget-collapsed")?1:0;h.push(k)});var j=JSON.stringify({widget:h});if(i.settings!==j){i.storage.setItem(i.settingsKey,j)}if(typeof(i.options.onSave)==="function"){i.options.onSave.call(this,null,h)}}},_saveWidgetPosition:function(){var i=this;i._getSettings();if(i.storage){var j=[];i.grid.find(i.options.subgrid+".sortable-grid").each(function(){var k=[];f(this).children(i.options.widgets).each(function(){var m={};m.id=f(this).attr("id");k.push(m)});var l={section:k};j.push(l)});var h=JSON.stringify({grid:j});if(i.position!==h){i.storage.setItem(i.positionKey,h)}if(typeof(i.options.onSave)==="function"){i.options.onSave.call(this,null,j)}}},_setClickEvents:function(){function i(){var l=f("#ams-widget-fullscreen-mode");if(l.length>0){var k=l.find(h.options.widgets);var m=f(window).height();var j=k.children("header").height();k.children("div").height(m-j-15)}}var h=this;h._getSettings();h.widget.on(h.clickEvent,".ams-widget-toggle-btn",function(n){n.preventDefault();var k=f(this);var l=k.parents(h.options.widgets).first();var o=l.data("widget-options");var j=o.toggleClass.split("|");h._runLoaderWidget(l);var m=true;if(l.hasClass("ams-widget-collapsed")){if(o.onToggle){m=o.onToggle.call(this,l,"expand")}if(m!==false){k.children().removeClass(j[1]).addClass(j[0]);l.removeClass("ams-widget-collapsed").children("[role=content]").slideDown(o.toggleSpeed,function(){h._saveWidgetSettings()})}}else{if(o.onToggle){m=o.onToggle.call(this,l,"collapse")}if(m!==false){k.children().removeClass(j[0]).addClass(j[1]);l.addClass("ams-widget-collapsed").children("[role=content]").slideUp(o.toggleSpeed,function(){h._saveWidgetSettings()})}}});h.widget.on("dblclick","header",function(j){f(".ams-widget-toggle-btn",this).click()});h.widget.on(h.clickEvent,".ams-widget-fullscreen-btn",function(n){n.preventDefault();var k=f(this);var m=k.parents(h.options.widgets);var o=m.data("widget-options");var j=o.fullscreenClass.split("|");var l=m.children("div");h._runLoaderWidget(m);if(f("#ams-widget-fullscreen-mode").length>0){f(".nooverflow").removeClass("nooverflow");m.unwrap("<div>").children("div").removeAttr("style").end().find(".ams-widget-fullscreen-btn").children().removeClass(j[1]).addClass(j[0]).parents(h.controls).children("a").show();if(l.hasClass("ams-widget-visible")){l.hide().removeClass("ams-widget-visible")}}else{f("body").addClass("nooverflow");m.wrap('<div id="ams-widget-fullscreen-mode"></div>').parent().find(".ams-widget-fullscreen-btn").children().removeClass(j[0]).addClass(j[1]).parents(h.controls).children("a:not(.ams-widget-fullscreen-btn)").hide();if(l.is(":hidden")){l.show().addClass("ams-widget-visible")}}i();if(typeof(o.onFullscreen)==="function"){o.onFullscreen.call(this,m)}});f(window).resize(function(){i()});h.widget.on(h.clickEvent,".ams-widget-edit-btn",function(m){m.preventDefault();var k=f(this);var l=k.parents(h.options.widgets);var o=l.data("widget-options");var j=o.editClass.split("|");h._runLoaderWidget(l);var n=l.find(o.editPlaceholder);if(n.is(":visible")){k.children().removeClass(j[1]).addClass(j[0]);n.slideUp(o.editSpeed,function(){h._saveWidgetSettings()})}else{k.children().removeClass(j[0]).addClass(j[1]);n.slideDown(o.editSpeed)}if(typeof(o.onEdit)==="function"){o.onEdit.call(this,l)}});f(h.options.editPlaceholder).find("input").keyup(function(){f(this).parents(h.options.widgets).children("header").children("h2").text(f(this).val())});h.widget.on(h.clickEvent,".ams-widget-custom-btn",function(m){m.preventDefault();var j=f(this);var l=j.parents(h.options.widgets);var n=l.data("widget-options");var k=n.customClass.split("|");h._runLoaderWidget(l);if(j.children("."+k[0]).length>0){j.children().removeClass(k[0]).addClass(k[1]);if(typeof(n.customStart)==="function"){n.customStart.call(this,l)}}else{j.children("."+k[1]).addClass(k[0]);if(typeof(n.customEnd)==="function"){n.customEnd.call(this,l)}}h._saveWidgetSettings()});h.widget.on(h.clickEvent,".ams-widget-delete-btn",function(l){l.preventDefault();var j=f(this);var k=j.parents(h.options.widgets);var o=k.data("widget-options");var n=k.attr("id");var m=k.children("header").children("h2").text();g.ajax.check(g.notify,g.baseURL+"myams-notify"+(g.devmode?".js":".min.js"),function(){g.notify.messageBox({title:'<i class="fa fa-times" style="color: #ed1c24;"></i> '+o.deleteLabel+' "'+m+'"',content:b.i18n.DELETE_MSG,buttons:"["+g.i18n.BTN_OK+"]["+g.i18n.BTN_CANCEL+"]"},function(p){if(p===g.i18n.BTN_OK){h._runLoaderWidget(k);f("#"+n).fadeOut(o.deleteSpeed,function(){j.remove();if(typeof(o.onDelete)==="function"){o.onDelete.call(this,k)}})}})})});h.widget.on(h.clickEvent,".ams-widget-refresh-btn",function(n){n.preventDefault();var k=f(this);var l=k.parents(h.options.widgets);var m=l.data("widget-load");var j=l.children();k.button("loading");j.addClass("widget-body-ajax-loading");setTimeout(function(){k.button("reset");j.removeClass("widget-body-ajax-loading");h._loadAjaxFile(l,m,j)},1000)})}};var b={i18n:f.extend({SETTINGS_KEY_LABEL:"Reset settings?",POSITION_KEY_LABEL:"Reset position?",TIMESTAMP_FORMAT:"Last update: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"An error occured: ",UPDATED_LABEL:"Last update: ",REFRESH_LABEL:"Refresh",EDIT_BTN:"Edit title",DELETE_BTN:"Delete",DELETE_LABEL:"Remove component: ",DELETE_MSG:"WARNING: this action can't be undone!",FULLSCREEN_BTN:"Fullscreen",COLLAPSE_BTN:"Collapse",REFRESH_BTN:"Reload content",LOADING_MSG:"Loading..."},g.plugins.i18n.widgets),initWidgetsGrid:function(i){if(!i.exists()){return}var h=f(".ams-widget:first",i).data("AMSWidget").options;if(h.sortable&&f.ui){var j=i.find(".sortable-grid").not("[data-widget-excludegrid]");j.sortable({items:j.find(".ams-widget-sortable"),connectWith:j,placeholder:h.placeholderClass,cursor:"move",revert:true,opacity:h.opacity,delay:200,cancel:".button-icon, #ams-widget-fullscreen-mode >div",zIndex:10000,handle:h.dragHandle,forcePlaceholderSize:true,forceHelperSize:true,update:function(k,m){var l=m.item.data("AMSWidget");l._runLoaderWidget(l.widget);l._saveWidgetPosition();if(typeof(h.onChange)==="function"){h.onChange.call(this,m.item)}}})}}};b.defaults={grid:".ams-widget-grid",subgrid:"section",widgets:".ams-widget",controls:".ams-widget-ctrls",storage:"local",deleteSettingsKey:"",settingsKeyLabel:b.i18n.SETTINGS_KEY_LABEL,deletePositionKey:"",positionKeyLabel:b.i18n.POSITION_KEY_LABEL,sortable:true,hiddenButtons:false,toggleButton:true,toggleClass:"fa fa-minus|fa fa-plus",toggleSpeed:200,onToggle:null,deleteButton:false,deleteClass:"fa fa-times",deleteSpeed:200,onDelete:null,editButton:false,editPlaceholder:".ams-widget-editbox",editClass:"fa fa-cog|fa fa-save",editSpeed:200,onEdit:null,fullscreenButton:false,fullscreenClass:"fa fa-expand|fa fa-compress",fullscreenDiff:3,onFullscreen:null,customButton:false,customClass:"folder-10|next-10",customStart:null,customEnd:null,buttonsOrder:"%refresh% %custom% %edit% %toggle% %fullscreen% %delete%",opacity:1,dragHandle:"> header",placeholderClass:"ams-widget-placeholder",indicator:true,indicatorTime:600,ajax:true,timestampPlaceholder:".ams-widget-timestamp",timestampFormat:b.i18n.TIMESTAMP_FORMAT,refreshButton:true,refreshButtonClass:"fa fa-refresh",errorLabel:b.i18n.ERROR_LABEL,updatedLabel:b.i18n.UPDATED_LABEL,refreshLabel:b.i18n.REFRESH_LABEL,deleteLabel:b.i18n.DELETE_LABEL,afterLoad:null,rtl:false,onChange:null,onSave:null,ajax_nav:g.ajax_nav};e.MyAMSWidget=b;f.fn.extend({MyAMSWidget:function(h){return this.each(function(){var n=f(this);var m=n.data("AMSWidget");if(!m){var j=n.parents(h.grid||b.defaults.grid);var l={};if(j.exists()){var i=j.data();l={grid:i.amsWidgetGrid,subgrid:i.amsWidgetSubgrid,controls:i.amsWidgetControls,storage:i.amsWidgetStorage,deleteSettingsKey:i.amsWidgetDeleteSettingsKey,deletePositionKey:i.amsWidgetDeletePositionKey,sortable:i.amsWidgetSortable,hiddenButtons:i.amsWidgetHiddenButtons,toggleButton:i.amsWidgetToggleButton,toggleClass:i.amsWidgetToggleClass,onToggle:g.getFunctionByName(i.amsWidgetToggleCallback),deleteButton:i.amsWidgetDeleteButton,deleteClass:i.amsWidgetDeleteClass,onDelete:g.getFunctionByName(i.amsWidgetDeleteCallback),editButton:i.amsWidgetEditButton,editPlaceholder:i.amsWidgetEditPlaceholder,editClass:i.amsWidgetEditClass,onEdit:g.getFunctionByName(i.amsWidgetEditCallback),fullscreenButton:i.amsWidgetFullscreenButton,fullscreenClass:i.amsWidgetFullscreenClass,fullscreenDiff:i.amsWidgetFullscreenDiff,onFullscreen:g.getFunctionByName(i.amsWidgetFullscreenCallback),customButton:i.amsWidgetCustomButton,customClass:i.amsWidgetCustomClass,customStart:g.getFunctionByName(i.amsWidgetCustomStartCallback),customEnd:g.getFunctionByName(i.amsWidgetCustomStartCallback),buttonsOrder:i.amsWidgetButtonsOrder,opacity:i.amsWidgetOpacity,dragHandle:i.amsWidgetDragHandle,placeholderClass:i.amsWidgetPlaceholderClass,indicator:i.amsWidgetIndicator,indicatorTime:i.amsWidgetIndicatorTime,ajax:i.amsWidgetAjax,timestampPlaceholder:i.amsWidgetTimestampPlaceholder,timestampFormat:i.amsWidgetTimestampFormat,refreshButton:i.amsWidgetRefreshButton,refreshClass:i.amsWidgetRefreshClass,errorLabel:i.amsWidgetErrorLabel,updatedLabel:i.amsWidgetUpdatedLabel,refreshLabel:i.amsWidgetRefreshLabel,deleteLabel:i.amsWidgetDeleteLabel,afterLoad:g.getFunctionByName(i.amsWidgetAfterLoadCallback),rtl:i.amsWidgetRtl,onChange:g.getFunctionByName(i.amsWidgetChangeCallback),onSave:g.getFunctionByName(i.amsWidgetSaveCallback),ajax_nav:g.ajax_nav}}var k=f.fn.extend({},l,n.data("ams-widget-options")||{},h);n.data("AMSWidget",new d(n,k))}})}})})(jQuery,this);
\ No newline at end of file
+(function(f,e){function c(h){if(h<10){h="0"+h}return h}function a(o,p){var h=new Date(o);var j=c(h.getMonth()+1);var l=c(h.getDate());var k=c(h.getFullYear());var m=c(h.getHours());var i=c(h.getMinutes());var n=c(h.getSeconds());return p.timestampFormat.replace(/%d%/g,l).replace(/%m%/g,j).replace(/%y%/g,k).replace(/%h%/g,m).replace(/%i%/g,i).replace(/%s%/g,n)}var g=e.MyAMS;function d(i,h){this.widget=i;this.options=f.extend({},b.defaults,h);this.grid=this.widget.parents(this.options.grid);this.hasGrid=this.grid.exists();this.gridId=this.grid.attr("id");this.controls=this.options.controls;this.toggleClass=this.options.toggleClass.split("|");this.editClass=this.options.editClass.split("|");this.fullscreenClass=this.options.fullscreenClass.split("|");this.customClass=this.options.customClass.split("|");this.init()}d.prototype={init:function(){var p=this;var j;if(p.options.rtl===true){f("body").addClass("rtl")}p.grid.each(function(){f(this).addClass("sortable-grid")});p._getSettings();if(p.hasGrid&&p.storage){var E;if(p.position){var C=JSON.parse(p.position);for(E in C.grid){if(!C.grid.hasOwnProperty(E)){continue}var A=p.grid.find(p.options.subgrid+".sortable-grid").eq(E);for(var B in C.grid[E].section){if(!C.grid[E].section.hasOwnProperty(B)){continue}A.append(f("#"+C.grid[E].section[B].id))}}}if(p.settings){var z=JSON.parse(p.settings);for(E in z.widget){if(!z.widget.hasOwnProperty(E)){continue}j=z.widget[E];if(!j.id){continue}var x=f("#"+j.id);if(!x.exists()){continue}if(j.style){x.removeClassPrefix("ams-widget-color-").addClass(j.style).attr("data-widget-attstyle",j.style)}if(j.hidden===1){x.hide(1)}else{x.show(1).removeAttr("data-widget-hidden")}if(j.collapsed===1){x.addClass("ams-widget-collapsed").children("div").hide(1)}var F=x.children("header").children("h2");if(F.text()!==j.title){F.text(j.title)}}}}j=p.widget;var D=j.data();var q={grid:D.amsWidgetGrid,subgrid:D.amsWudgetSubgrid,widgets:D.amsWidgetWidgets,controls:D.amsWidgetControls,storage:D.amsWidgetStorage,deleteSettingsKey:D.amsWidgetDeleteSettingsKey,deletePositionKey:D.amsWidgetDeletePositionKey,sortable:D.amsWidgetSortable,hiddenButtons:D.amsWidgetHiddenButtons,toggleButton:D.amsWidgetToggleButton,toggleClass:D.amsWidgetToggleClass,onToggle:g.getFunctionByName(D.amsWidgetToggleCallback),deleteButton:D.amsWidgetDeleteButton,deleteClass:D.amsWidgetDeleteClass,onDelete:g.getFunctionByName(D.amsWidgetDeleteCallback),editButton:D.amsWidgetEditButton,editPlaceholder:D.amsWidgetEditPlaceholder,editClass:D.amsWidgetEditClass,onEdit:g.getFunctionByName(D.amsWidgetEditCallback),fullscreenButton:D.amsWidgetFullscreenButton,fullscreenClass:D.amsWidgetFullscreenClass,fullscreenDiff:D.amsWidgetFullscreenDiff,onFullscreen:g.getFunctionByName(D.amsWidgetFullscreenCallback),customButton:D.amsWidgetCustomButton,customClass:D.amsWidgetCustomClass,customStart:g.getFunctionByName(D.amsWidgetCustomStartCallback),customEnd:g.getFunctionByName(D.amsWidgetCustomEndCallback),buttonsOrder:D.amsWidgetButtonsOrder,opacity:D.amsWidgetOpacity,dragHandle:D.amsWidgetDragHandle,placeholderClass:D.amsWidgetPlaceholderClass,indicator:D.amsWidgetIndicator,indicatorTime:D.amsWidgetIndicatorTime,ajax:D.amsWidgetAjax,timestampPlaceholder:D.amsWidgetTimestampPlaceholder,timestampFormat:D.amsWidgetTimestampFormat,refreshButton:D.amsWidgetRefreshButton,refreshClass:D.amsWidgetRefreshClass,errorLabel:D.amsWidgetErrorLabel,updatedLabel:D.amsWidgetUpdatedLabel,refreshLabel:D.amsWidgetRefreshLabel,deleteLabel:D.amsWidgetDeleteLabel,afterLoad:g.getFunctionByName(D.amsWidgetAfterLoadCallback),rtl:D.amsWidgetRtl,onChange:g.getFunctionByName(D.amsWidgetChangeCallback),onSave:g.getFunctionByName(D.amsWidgetSaveCallback),ajax_nav:g.ajax_nav};var y=f.extend({},p.options,q);var v=j.children("header");if(!v.parent().attr("role")){var u,r,m,i,o,t;if(D.widgetHidden===true){j.hide()}if(D.widgetCollapsed===true){j.addClass("ams-widget-collapsed").children("div").hide()}if(y.customButton&&(D.widgetCustombutton===undefined)&&(p.customClass[0].length!==0)){u='<a href="#" class="button-icon ams-widget-custom-btn"><i class="'+p.customClass[0]+'"></i></a>'}else{u=""}if(y.deleteButton&&(D.widgetDeleteButton===undefined)){r='<a href="#" class="button-icon ams-widget-delete-btn hint" title="'+b.i18n.DELETE_BTN+'" data-ams-hint-gravity="se"><i class="'+y.deleteClass+'"></i></a>'}else{r=""}if(y.editButton&&(D.widgetEditButton===undefined)){var k=y.editClass.split("|")[0];m='<a href="#" class="button-icon ams-widget-edit-btn hint" title="'+b.i18n.EDIT_BTN+'" data-ams-hint-gravity="se"><i class="'+k+'"></i></a>'}else{m=""}if(y.fullscreenButton&&(D.widgetFullscreenButton===undefined)){var n=y.fullscreenClass.split("|")[0];i='<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="'+b.i18n.FULLSCREEN_BTN+'" data-ams-hint-gravity="se"><i class="'+n+'"></i></a>'}else{i=""}if(y.toggleButton&&(D.widgetToggleButton===undefined)){var s=y.toggleClass.split("|");var h;if((j.dataWidgetCollapsed===true)||j.hasClass("ams-widget-collapsed")){h=s[1]}else{h=s[0]}o='<a href="#" class="button-icon ams-widget-toggle-btn hint" title="'+b.i18n.COLLAPSE_BTN+'" data-ams-hint-gravity="se"><i class="'+h+'"></i></a>'}else{o=""}if(y.refreshButton&&(D.widgetRefreshButton===undefined)&&D.widgetLoad){t='<a href="#" class="button-icon ams-widget-refresh-btn hint" title="'+b.i18n.REFRESH_BTN+'" data-loading-text=" '+b.i18n.LOADING_MSG+' " data-ams-hint-gravity="se"><i class="'+y.refreshClass+'"></i></a>'}else{t=""}var w=y.buttonsOrder.replace(/%refresh%/,t).replace(/%custom%/,u).replace(/%edit%/,m).replace(/%toggle%/,o).replace(/%fullscreen%/,i).replace(/%delete%/,r);if(t||u||m||o||i||r){v.prepend('<div class="ams-widget-ctrls">'+w+"</div>")}if(y.sortable&&(D.widgetSortable===undefined)){j.addClass("ams-widget-sortable")}var l=j.find(y.editPlaceholder);if(l.length>0){l.find("input").val(f.trim(v.children("h2").text()))}v.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>');j.attr("role","widget").children("div").attr("role","content").prev("header").attr("role","heading").children("div").attr("role","menu");g.plugins.enabled.hint(v)}j.data("widget-options",y);if(p.options.hiddenButtons){f(p.controls).hide()}j.find("[data-widget-load]").each(function(){var I=f(this),K=I.children(),J=I.data("widget-load"),H=I.data("widget-refresh")*1000,G=K;if(I.find(".ams-widget-ajax-placeholder").length<=0){I.children("widget-body").append('<div class="ams-widget-ajax-placeholder">'+p.options.loadingLabel+"</div>");if(H>0){p.loadAjaxFile(I,J,K);setInterval(function(){p._loadAjaxFile(I,J,K)},H)}else{p._loadAjaxFile(I,J,K)}}});if(p.options.hiddenButtons){p.widget.children("header").hover(function(){f(this).children(p.controls).stop(true,true).fadeTo(100,1)},function(){f(this).children(p.controls).stop(true,true).fadeTo(100,0)})}p._setClickEvents();f(p.options.deleteSettingsKey).on(p.clickEvent,this,function(H){if(p.storage&&e.confirm){var G=e.confirm(p.options.settingsKeyLabel);if(G){p.storage.removeItem(p.settingsKey)}}H.preventDefault()});f(p.options.deletePositionKey).on(p.clickEvent,this,function(H){if(p.storage&&e.confirm){var G=e.confirm(p.options.positionKeyLabel);if(G){p.storage.removeItem(p.positionKey)}}H.preventDefault()});if(p.storage){if(p.settingsKey===null||p.settingsKey.length<1){p._saveWidgetSettings()}if(p.positionKey===null||p.positionKey.length<1){p._saveWidgetPosition()}}p.grid.data("ams-widgets-loaded",true)},destroy:function(){var h=this;h.widgets.off("click",h._setClickEvents());h.element.removeData("AMSWidget")},_getSettings:function(){var i=this;if(!i.hasGrid||!i.gridId){i.storage=null}else{switch(i.options.storage){case"local":i.storage=localStorage;break;case"session":i.storage=sessionStorage;break;default:i.storage=null}}var h=(i.storage!==null)&&function(){var j,k=+new Date();try{i.storage.setItem(k,k);j=parseInt(i.storage.getItem(k))===k;i.storage.removeItem(k);return j}catch(l){}}();if(h){i.settingsKey="AMS_settings_"+location.pathname+location.hash+"_"+i.gridId;i.settings=i.storage.getItem(i.settingsKey);i.positionKey="AMS_position_"+location.pathname+location.hash+"_"+i.gridId;i.position=i.storage.getItem(i.positionKey)}if(("ontouchstart" in e)||e.DocumentTouch&&e.document instanceof e.DocumentTouch){i.clickEvent="touchstart"}else{i.clickEvent="click"}},_runLoaderWidget:function(i){var h=this;if(h.options.indicator){i.find(".ams-widget-loader").stop(true,true).fadeIn(100).delay(h.options.indicatorTime).fadeOut(100)}},_loadAjaxFile:function(i,j,h){g.skin.loadURL(i,j.find(".widget-body"))},_saveWidgetSettings:function(){var i=this;i._getSettings();if(i.storage){var h=[];i.grid.find(i.options.widgets).each(function(){var l=f(this);var k={};k.id=l.attr("id");k.style=l.attr("data-widget-attstyle");k.title=l.children("header").children("h2").text();k.hidden=l.is(":hidden")?1:0;k.collapsed=l.hasClass("ams-widget-collapsed")?1:0;h.push(k)});var j=JSON.stringify({widget:h});if(i.settings!==j){i.storage.setItem(i.settingsKey,j)}if(typeof(i.options.onSave)==="function"){i.options.onSave.call(this,null,h)}}},_saveWidgetPosition:function(){var i=this;i._getSettings();if(i.storage){var j=[];i.grid.find(i.options.subgrid+".sortable-grid").each(function(){var k=[];f(this).children(i.options.widgets).each(function(){var m={};m.id=f(this).attr("id");k.push(m)});var l={section:k};j.push(l)});var h=JSON.stringify({grid:j});if(i.position!==h){i.storage.setItem(i.positionKey,h)}if(typeof(i.options.onSave)==="function"){i.options.onSave.call(this,null,j)}}},_setClickEvents:function(){function i(){var l=f("#ams-widget-fullscreen-mode");if(l.length>0){var k=l.find(h.options.widgets);var m=f(window).height();var j=k.children("header").height();k.children("div").height(m-j-15)}}var h=this;h._getSettings();h.widget.on(h.clickEvent,".ams-widget-toggle-btn",function(n){n.preventDefault();var k=f(this);var l=k.parents(h.options.widgets).first();var o=l.data("widget-options");var j=o.toggleClass.split("|");h._runLoaderWidget(l);var m=true;if(l.hasClass("ams-widget-collapsed")){if(o.onToggle){m=o.onToggle.call(this,l,"expand")}if(m!==false){k.children().removeClass(j[1]).addClass(j[0]);l.removeClass("ams-widget-collapsed").children("[role=content]").slideDown(o.toggleSpeed,function(){h._saveWidgetSettings()})}}else{if(o.onToggle){m=o.onToggle.call(this,l,"collapse")}if(m!==false){k.children().removeClass(j[0]).addClass(j[1]);l.addClass("ams-widget-collapsed").children("[role=content]").slideUp(o.toggleSpeed,function(){h._saveWidgetSettings()})}}});h.widget.on("dblclick","header",function(j){f(".ams-widget-toggle-btn",this).click()});h.widget.on(h.clickEvent,".ams-widget-fullscreen-btn",function(n){n.preventDefault();var k=f(this);var m=k.parents(h.options.widgets);var o=m.data("widget-options");var j=o.fullscreenClass.split("|");var l=m.children("div");h._runLoaderWidget(m);if(f("#ams-widget-fullscreen-mode").length>0){f(".nooverflow").removeClass("nooverflow");m.unwrap("<div>").children("div").removeAttr("style").end().find(".ams-widget-fullscreen-btn").children().removeClass(j[1]).addClass(j[0]).parents(h.controls).children("a").show();if(l.hasClass("ams-widget-visible")){l.hide().removeClass("ams-widget-visible")}}else{f("body").addClass("nooverflow");m.wrap('<div id="ams-widget-fullscreen-mode"></div>').parent().find(".ams-widget-fullscreen-btn").children().removeClass(j[0]).addClass(j[1]).parents(h.controls).children("a:not(.ams-widget-fullscreen-btn)").hide();if(l.is(":hidden")){l.show().addClass("ams-widget-visible")}}i();if(typeof(o.onFullscreen)==="function"){o.onFullscreen.call(this,m)}});f(window).resize(function(){i()});h.widget.on(h.clickEvent,".ams-widget-edit-btn",function(m){m.preventDefault();var k=f(this);var l=k.parents(h.options.widgets);var o=l.data("widget-options");var j=o.editClass.split("|");h._runLoaderWidget(l);var n=l.find(o.editPlaceholder);if(n.is(":visible")){k.children().removeClass(j[1]).addClass(j[0]);n.slideUp(o.editSpeed,function(){h._saveWidgetSettings()})}else{k.children().removeClass(j[0]).addClass(j[1]);n.slideDown(o.editSpeed)}if(typeof(o.onEdit)==="function"){o.onEdit.call(this,l)}});f(h.options.editPlaceholder).find("input").keyup(function(){f(this).parents(h.options.widgets).children("header").children("h2").text(f(this).val())});h.widget.on(h.clickEvent,".ams-widget-custom-btn",function(m){m.preventDefault();var j=f(this);var l=j.parents(h.options.widgets);var n=l.data("widget-options");var k=n.customClass.split("|");h._runLoaderWidget(l);if(j.children("."+k[0]).length>0){j.children().removeClass(k[0]).addClass(k[1]);if(typeof(n.customStart)==="function"){n.customStart.call(this,l)}}else{j.children("."+k[1]).addClass(k[0]);if(typeof(n.customEnd)==="function"){n.customEnd.call(this,l)}}h._saveWidgetSettings()});h.widget.on(h.clickEvent,".ams-widget-delete-btn",function(l){l.preventDefault();var j=f(this);var k=j.parents(h.options.widgets);var o=k.data("widget-options");var n=k.attr("id");var m=k.children("header").children("h2").text();g.ajax.check(g.notify,g.baseURL+"myams-notify"+(g.devmode?".js":".min.js"),function(){g.notify.messageBox({title:'<i class="fa fa-times" style="color: #ed1c24;"></i> '+o.deleteLabel+' "'+m+'"',content:b.i18n.DELETE_MSG,buttons:"["+g.i18n.BTN_OK+"]["+g.i18n.BTN_CANCEL+"]"},function(p){if(p===g.i18n.BTN_OK){h._runLoaderWidget(k);f("#"+n).fadeOut(o.deleteSpeed,function(){j.remove();if(typeof(o.onDelete)==="function"){o.onDelete.call(this,k)}})}})})});h.widget.on(h.clickEvent,".ams-widget-refresh-btn",function(n){n.preventDefault();var k=f(this);var l=k.parents(h.options.widgets);var m=l.data("widget-load");var j=l.children();k.button("loading");j.addClass("widget-body-ajax-loading");setTimeout(function(){k.button("reset");j.removeClass("widget-body-ajax-loading");h._loadAjaxFile(l,m,j)},1000)})}};var b={i18n:f.extend({SETTINGS_KEY_LABEL:"Reset settings?",POSITION_KEY_LABEL:"Reset position?",TIMESTAMP_FORMAT:"Last update: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"An error occured: ",UPDATED_LABEL:"Last update: ",REFRESH_LABEL:"Refresh",EDIT_BTN:"Edit title",DELETE_BTN:"Delete",DELETE_LABEL:"Remove component: ",DELETE_MSG:"WARNING: this action can't be undone!",FULLSCREEN_BTN:"Fullscreen",COLLAPSE_BTN:"Collapse",REFRESH_BTN:"Reload content",LOADING_MSG:"Loading..."},g.plugins.i18n.widgets),initWidgetsGrid:function(i){if(!i.exists()){return}var h=f(".ams-widget:first",i).data("AMSWidget").options;if(h.sortable&&f.ui){var j=i.find(".sortable-grid").not("[data-widget-excludegrid]");j.sortable({items:j.find(".ams-widget-sortable"),connectWith:j,placeholder:h.placeholderClass,cursor:"move",revert:true,opacity:h.opacity,delay:200,cancel:".button-icon, #ams-widget-fullscreen-mode >div",zIndex:10000,handle:h.dragHandle,forcePlaceholderSize:true,forceHelperSize:true,update:function(k,m){var l=m.item.data("AMSWidget");l._runLoaderWidget(l.widget);l._saveWidgetPosition();if(typeof(h.onChange)==="function"){h.onChange.call(this,m.item)}}})}}};b.defaults={grid:".ams-widget-grid",subgrid:"section",widgets:".ams-widget",controls:".ams-widget-ctrls",storage:"local",deleteSettingsKey:"",settingsKeyLabel:b.i18n.SETTINGS_KEY_LABEL,deletePositionKey:"",positionKeyLabel:b.i18n.POSITION_KEY_LABEL,sortable:true,hiddenButtons:false,toggleButton:true,toggleClass:"fa fa-minus|fa fa-plus",toggleSpeed:200,onToggle:null,deleteButton:false,deleteClass:"fa fa-times",deleteSpeed:200,onDelete:null,editButton:false,editPlaceholder:".ams-widget-editbox",editClass:"fa fa-cog|fa fa-save",editSpeed:200,onEdit:null,fullscreenButton:false,fullscreenClass:"fa fa-expand|fa fa-compress",fullscreenDiff:3,onFullscreen:null,customButton:false,customClass:"folder-10|next-10",customStart:null,customEnd:null,buttonsOrder:"%refresh% %custom% %edit% %toggle% %fullscreen% %delete%",opacity:1,dragHandle:"> header",placeholderClass:"ams-widget-placeholder",indicator:true,indicatorTime:600,ajax:true,timestampPlaceholder:".ams-widget-timestamp",timestampFormat:b.i18n.TIMESTAMP_FORMAT,refreshButton:true,refreshButtonClass:"fa fa-refresh",errorLabel:b.i18n.ERROR_LABEL,updatedLabel:b.i18n.UPDATED_LABEL,refreshLabel:b.i18n.REFRESH_LABEL,deleteLabel:b.i18n.DELETE_LABEL,afterLoad:null,rtl:false,onChange:null,onSave:null,ajax_nav:g.ajax_nav};e.MyAMSWidget=b;f.fn.extend({MyAMSWidget:function(h){return this.each(function(){var n=f(this);var m=n.data("AMSWidget");if(!m){var j=n.parents(h.grid||b.defaults.grid);var l={};if(j.exists()){var i=j.data();l={grid:i.amsWidgetGrid,subgrid:i.amsWidgetSubgrid,controls:i.amsWidgetControls,storage:i.amsWidgetStorage,deleteSettingsKey:i.amsWidgetDeleteSettingsKey,deletePositionKey:i.amsWidgetDeletePositionKey,sortable:i.amsWidgetSortable,hiddenButtons:i.amsWidgetHiddenButtons,toggleButton:i.amsWidgetToggleButton,toggleClass:i.amsWidgetToggleClass,onToggle:g.getFunctionByName(i.amsWidgetToggleCallback),deleteButton:i.amsWidgetDeleteButton,deleteClass:i.amsWidgetDeleteClass,onDelete:g.getFunctionByName(i.amsWidgetDeleteCallback),editButton:i.amsWidgetEditButton,editPlaceholder:i.amsWidgetEditPlaceholder,editClass:i.amsWidgetEditClass,onEdit:g.getFunctionByName(i.amsWidgetEditCallback),fullscreenButton:i.amsWidgetFullscreenButton,fullscreenClass:i.amsWidgetFullscreenClass,fullscreenDiff:i.amsWidgetFullscreenDiff,onFullscreen:g.getFunctionByName(i.amsWidgetFullscreenCallback),customButton:i.amsWidgetCustomButton,customClass:i.amsWidgetCustomClass,customStart:g.getFunctionByName(i.amsWidgetCustomStartCallback),customEnd:g.getFunctionByName(i.amsWidgetCustomStartCallback),buttonsOrder:i.amsWidgetButtonsOrder,opacity:i.amsWidgetOpacity,dragHandle:i.amsWidgetDragHandle,placeholderClass:i.amsWidgetPlaceholderClass,indicator:i.amsWidgetIndicator,indicatorTime:i.amsWidgetIndicatorTime,ajax:i.amsWidgetAjax,timestampPlaceholder:i.amsWidgetTimestampPlaceholder,timestampFormat:i.amsWidgetTimestampFormat,refreshButton:i.amsWidgetRefreshButton,refreshClass:i.amsWidgetRefreshClass,errorLabel:i.amsWidgetErrorLabel,updatedLabel:i.amsWidgetUpdatedLabel,refreshLabel:i.amsWidgetRefreshLabel,deleteLabel:i.amsWidgetDeleteLabel,afterLoad:g.getFunctionByName(i.amsWidgetAfterLoadCallback),rtl:i.amsWidgetRtl,onChange:g.getFunctionByName(i.amsWidgetChangeCallback),onSave:g.getFunctionByName(i.amsWidgetSaveCallback),ajax_nav:g.ajax_nav}}var k=f.fn.extend({},l,n.data("ams-widget-options")||{},h);n.data("AMSWidget",new d(n,k))}})}})})(jQuery,this);
\ No newline at end of file