ZwiiCampus/core/vendor/filemanager/js/plugins.js

3 lines
91 KiB
JavaScript
Raw Permalink Normal View History

!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e,t=document.createElement("bootstrap"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(e in n)if(void 0!==t.style[e])return n[e]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t,n=e(document).height(),o=this.$window.scrollTop(),i=this.$element.offset(),a=this.options.offset,r=a.bottom,s=a.top,c="affix affix-top affix-bottom";"object"!=typeof a&&(r=s=a),"function"==typeof s&&(s=a.top()),"function"==typeof r&&(r=a.bottom()),t=!(null!=this.unpin&&o+this.unpin<=i.top)&&(null!=r&&i.top+this.$element.height()>=n-r?"bottom":null!=s&&o<=s&&"top"),this.affixed!==t&&(this.affixed=t,this.unpin="bottom"==t?i.top-o:null,this.$element.removeClass(c).addClass("affix"+(t?"-"+t:"")))}};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var o=e(this),i=o.data("affix"),a="object"==typeof n&&n;i||o.data("affix",i=new t(this,a)),"string"==typeof n&&i[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery),!function(e){"use strict";function t(){e(".dropdown-backdrop").remove(),e(o).each(function(){n(e(this)).removeClass("open")})}function n(t){var n,o=t.attr("data-target");return o||(o=t.attr("href"),o=o&&/#/.test(o)&&o.replace(/.*(?=#[^\s]*$)/,"")),n=o&&e(o),n&&n.length||(n=t.parent()),n}var o="[data-toggle=dropdown]",i=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};i.prototype={constructor:i,toggle:function(o){var i,a,r=e(this);if(!r.is(".disabled, :disabled"))return i=n(r),a=i.hasClass("open"),t(),a||("ontouchstart"in document.documentElement&&e('<div class="dropdown-backdrop"/>').insertBefore(e(this)).on("click",t),i.toggleClass("open")),r.focus(),!1},keydown:function(t){var i,a,r,s,c;if(/(38|40|27)/.test(t.keyCode)&&(i=e(this),t.preventDefault(),t.stopPropagation(),!i.is(".disabled, :disabled"))){if(r=n(i),s=r.hasClass("open"),!s||s&&27==t.keyCode)return 27==t.which&&r.find(o).focus(),i.click();a=e("[role=menu] li:not(.divider):visible a",r),a.length&&(c=a.index(a.filter(":focus")),38==t.keyCode&&c>0&&c--,40==t.keyCode&&c<a.length-1&&c++,~c||(c=0),a.eq(c).focus())}}};var a=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var n=e(this),o=n.data("dropdown");o||n.data("dropdown",o=new i(this)),"string"==typeof t&&o[t].call(n)})},e.fn.dropdown.Constructor=i,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=a,this},e(document).on("click.dropdown.data-api",t).on("click.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",o,i.prototype.toggle).on("keydown.dropdown.data-api",o+", [role=menu]",i.prototype.keydown)}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function n(){o.trigger("closed").remove()}var o,i=e(this),a=i.attr("data-target");a||(a=i.attr("href"),a=a&&a.replace(/.*(?=#[^\s]*$)/,"")),o=e(a),t&&t.preventDefault(),o.length||(o=i.hasClass("alert")?i:i.parent()),o.trigger(t=e.Event("close")),t.isDefaultPrevented()||(o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.on(e.support.transition.end,n):n())};var o=e.fn.alert;e.fn.alert=function(t){return this.each(function()
"shared"===u.persist?a=u:u.persist!==!1&&c.data("featherlight-persisted",u),l.$currentTarget.blur&&l.$currentTarget.blur(),u.open(r)};return t.on(s.openTrigger+"."+s.namespace,s.filter,c),{filter:s.filter,handler:c}},current:function(){var e=this.opened();return e[e.length-1]||null},opened:function(){var t=this;return a(),e.grep(i,function(e){return e instanceof t})},close:function(e){var t=this.current();if(t)return t.close(e)},_onReady:function(){var t=this;if(t.autoBind){var n=e(t.autoBind);n.each(function(){t.attach(e(this))}),e(document).on("click",t.autoBind,function(o){if(!o.isDefaultPrevented()){var i=e(o.currentTarget),a=n.length;if(n=n.add(i),a!==n.length){var r=t.attach(i);(!r.filter||e(o.target).parentsUntil(i,r.filter).length>0)&&r.handler(o)}}})}},_callbackChain:{onKeyUp:function(t,n){return 27===n.keyCode?(this.closeOnEsc&&e.featherlight.close(n),!1):t(n)},beforeOpen:function(t,n){return e(document.documentElement).addClass("with-featherlight"),this._previouslyActive=document.activeElement,this._$previouslyTabbable=e("a, input, select, textarea, iframe, button, iframe, [contentEditable=true]").not("[tabindex]").not(this.$instance.find("button")),this._$previouslyWithTabIndex=e("[tabindex]").not('[tabindex="-1"]'),this._previousWithTabIndices=this._$previouslyWithTabIndex.map(function(t,n){return e(n).attr("tabindex")}),this._$previouslyWithTabIndex.add(this._$previouslyTabbable).attr("tabindex",-1),document.activeElement.blur&&document.activeElement.blur(),t(n)},afterClose:function(n,o){var i=n(o),a=this;return this._$previouslyTabbable.removeAttr("tabindex"),this._$previouslyWithTabIndex.each(function(t,n){e(n).attr("tabindex",a._previousWithTabIndices[t])}),this._previouslyActive.focus(),0===t.opened().length&&e(document.documentElement).removeClass("with-featherlight"),i},onResize:function(e,t){return this.resize(this.$content.naturalWidth,this.$content.naturalHeight),e(t)},afterContent:function(e,t){var n=e(t);return this.$instance.find("[autofocus]:not([disabled])").focus(),this.onResize(t),n}}}),e.featherlight=t,e.fn.featherlight=function(e,n){return t.attach(this,e,n),this},e(document).ready(function(){t._onReady()})}(jQuery),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";function t(e){for(var t,n=e.split(/\s+/),o=[],i=0;t=n[i];i++)t=t.charAt(0).toUpperCase(),o.push(t);return o}function n(t){return t.id&&e('label[for="'+t.id+'"]').val()||t.name}function o(t,i,a){return a||(a=0),i.each(function(){var i,r,s=e(this),c=this,l=this.nodeName.toLowerCase();switch("label"===l&&s.find("input, textarea, select").length&&(i=s.text(),s=s.children().first(),c=s.get(0),l=c.nodeName.toLowerCase()),l){case"menu":r={name:s.attr("label"),items:{}},a=o(r.items,s.children(),a);break;case"a":case"button":r={name:s.text(),disabled:!!s.attr("disabled"),callback:function(){return function(){s.click()}}()};break;case"menuitem":case"command":switch(s.attr("type")){case void 0:case"command":case"menuitem":r={name:s.attr("label"),disabled:!!s.attr("disabled"),icon:s.attr("icon"),callback:function(){return function(){s.click()}}()};break;case"checkbox":r={type:"checkbox",disabled:!!s.attr("disabled"),name:s.attr("label"),selected:!!s.attr("checked")};break;case"radio":r={type:"radio",disabled:!!s.attr("disabled"),name:s.attr("label"),radio:s.attr("radiogroup"),value:s.attr("id"),selected:!!s.attr("checked")};break;default:r=void 0}break;case"hr":r="-------";break;case"input":switch(s.attr("type")){case"text":r={type:"text",name:i||n(c),disabled:!!s.attr("disabled"),value:s.val()};break;case"checkbox":r={type:"checkbox",name:i||n(c),disabled:!!s.attr("disabled"),selected:!!s.attr("checked")};break;case"radio":r={type:"radio",name:i||n(c),disabled:!!s.attr("disabled"),radio:!!s.attr("name"),value:s.val(),selected:!!s.attr("checked")};break;default:r=void 0}break;case"select":r={type:"select",name:i||n(c),disabled:!!s.attr("disabled"),selected:s.val(),options:{}},s.children().each(function(){r.options[this.value]=e(this).text()}
}(function(e){var t=e.event.dispatch||e.event.handle,n=e.event.special,o="D"+ +new Date,i="D"+(+new Date+1);n.scrollstart={setup:function(i){var a,r=e.extend({latency:n.scrollstop.latency},i),s=function(e){var n=this,o=arguments;a?clearTimeout(a):(e.type="scrollstart",t.apply(n,o)),a=setTimeout(function(){a=null},r.latency)};e(this).bind("scroll",s).data(o,s)},teardown:function(){e(this).unbind("scroll",e(this).data(o))}},n.scrollstop={latency:250,setup:function(o){var a,r=e.extend({latency:n.scrollstop.latency},o),s=function(e){var n=this,o=arguments;a&&clearTimeout(a),a=setTimeout(function(){a=null,e.type="scrollstop",t.apply(n,o)},r.latency)};e(this).bind("scroll",s).data(i,s)},teardown:function(){e(this).unbind("scroll",e(this).data(i))}}});var bootbox=window.bootbox||function(e,t){function n(e,t){return"undefined"==typeof t&&(t=o),"string"==typeof f[t][e]?f[t][e]:t!=i?n(e,i):e}var o="en",i="en",a=!0,r="static",s="javascript:;",c="",l={},u={},d={};d.setLocale=function(e){for(var t in f)if(t==e)return void(o=e);throw new Error("Invalid locale: "+e)},d.addLocale=function(e,t){"undefined"==typeof f[e]&&(f[e]={});for(var n in t)f[e][n]=t[n]},d.setIcons=function(e){u=e,"object"==typeof u&&null!==u||(u={})},d.setBtnClasses=function(e){l=e,"object"==typeof l&&null!==l||(l={})},d.alert=function(){var e="",t=n("OK"),o=null;switch(arguments.length){case 1:e=arguments[0];break;case 2:e=arguments[0],"function"==typeof arguments[1]?o=arguments[1]:t=arguments[1];break;case 3:e=arguments[0],t=arguments[1],o=arguments[2];break;default:throw new Error("Incorrect number of arguments: expected 1-3")}return d.dialog(e,{label:t,icon:u.OK,"class":l.OK,callback:o},{onEscape:o||!0})},d.confirm=function(){var e="",t=n("CANCEL"),o=n("CONFIRM"),i=null;switch(arguments.length){case 1:e=arguments[0];break;case 2:e=arguments[0],"function"==typeof arguments[1]?i=arguments[1]:t=arguments[1];break;case 3:e=arguments[0],t=arguments[1],"function"==typeof arguments[2]?i=arguments[2]:o=arguments[2];break;case 4:e=arguments[0],t=arguments[1],o=arguments[2],i=arguments[3];break;default:throw new Error("Incorrect number of arguments: expected 1-4")}var a=function(){if("function"==typeof i)return i(!1)},r=function(){if("function"==typeof i)return i(!0)};return d.dialog(e,[{label:t,icon:u.CANCEL,"class":l.CANCEL,callback:a},{label:o,icon:u.CONFIRM,"class":l.CONFIRM,callback:r}],{onEscape:a})},d.prompt=function(){var e="",o=n("CANCEL"),i=n("CONFIRM"),a=null,r="";switch(arguments.length){case 1:e=arguments[0];break;case 2:e=arguments[0],"function"==typeof arguments[1]?a=arguments[1]:o=arguments[1];break;case 3:e=arguments[0],o=arguments[1],"function"==typeof arguments[2]?a=arguments[2]:i=arguments[2];break;case 4:e=arguments[0],o=arguments[1],i=arguments[2],a=arguments[3];break;case 5:e=arguments[0],o=arguments[1],i=arguments[2],a=arguments[3],r=arguments[4];break;default:throw new Error("Incorrect number of arguments: expected 1-5")}var s=e,c=t("<form></form>");c.append("<input class='input-block-level' autocomplete=off type=text value='"+r+"' />");var f=function(){if("function"==typeof a)return a(null)},h=function(){if("function"==typeof a)return a(c.find("input[type=text]").val())},p=d.dialog(c,[{label:o,icon:u.CANCEL,"class":l.CANCEL,callback:f},{label:i,icon:u.CONFIRM,"class":l.CONFIRM,callback:h}],{header:s,show:!1,onEscape:f});return p.on("shown",function(){c.find("input[type=text]").focus(),c.on("submit",function(e){e.preventDefault(),p.find(".btn-primary").click()})}),p.modal("show"),p},d.dialog=function(n,o,i){function l(e){var t=null;"function"==typeof i.onEscape&&(t=i.onEscape()),t!==!1&&$.modal("hide")}var u="",d=[];i||(i={}),"undefined"==typeof o?o=[]:"undefined"==typeof o.length&&(o=[o]);for(var f=o.length;f--;){var h=null,p=null,m=null,v="",g=null;if("undefined"==typeof o[f].label&&"undefined"==typeof o[f]["class"]&&"undefined"==typeof o[f].callback){var y=0,b=null;for(var x in o[f])if(b=x,++y>1)break;1==y&&"function"==typeof o[f][x]&&(o[f].label=b,o[f].callback=o[f][x])}"function"==typeof o[f].callback&&(g=o[f].callback),o[f]["class"]?m=o[f][