ZwiiCMS/core/vendor/filemanager/js/plugins.js

3 lines
93 KiB
JavaScript
Raw Normal View History

2018-04-02 08:29:19 +02:00
!function(t){"use strict";t(function(){t.support.transition=function(){var t=function(){var t,e=document.createElement("bootstrap"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(t in n)if(void 0!==e.style[t])return n[t]}();return t&&{end:t}}()})}(window.jQuery),!function(t){"use strict";var e=function(e,n){this.options=t.extend({},t.fn.affix.defaults,n),this.$window=t(window).on("scroll.affix.data-api",t.proxy(this.checkPosition,this)).on("click.affix.data-api",t.proxy(function(){setTimeout(t.proxy(this.checkPosition,this),1)},this)),this.$element=t(e),this.checkPosition()};e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e,n=t(document).height(),o=this.$window.scrollTop(),i=this.$element.offset(),a=this.options.offset,s=a.bottom,r=a.top,l="affix affix-top affix-bottom";"object"!=typeof a&&(s=r=a),"function"==typeof r&&(r=a.top()),"function"==typeof s&&(s=a.bottom()),e=!(null!=this.unpin&&o+this.unpin<=i.top)&&(null!=s&&i.top+this.$element.height()>=n-s?"bottom":null!=r&&o<=r&&"top"),this.affixed!==e&&(this.affixed=e,this.unpin="bottom"==e?i.top-o:null,this.$element.removeClass(l).addClass("affix"+(e?"-"+e:"")))}};var n=t.fn.affix;t.fn.affix=function(n){return this.each(function(){var o=t(this),i=o.data("affix"),a="object"==typeof n&&n;i||o.data("affix",i=new e(this,a)),"string"==typeof n&&i[n]()})},t.fn.affix.Constructor=e,t.fn.affix.defaults={offset:0},t.fn.affix.noConflict=function(){return t.fn.affix=n,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var e=t(this),n=e.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),e.affix(n)})})}(window.jQuery),!function(t){"use strict";function e(){t(o).each(function(){n(t(this)).removeClass("open")})}function n(e){var n,o=e.attr("data-target");return o||(o=e.attr("href"),o=o&&/#/.test(o)&&o.replace(/.*(?=#[^\s]*$)/,"")),n=o&&t(o),n&&n.length||(n=e.parent()),n}var o="[data-toggle=dropdown]",i=function(e){var n=t(e).on("click.dropdown.data-api",this.toggle);t("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};i.prototype={constructor:i,toggle:function(o){var i,a,s=t(this);if(!s.is(".disabled, :disabled"))return i=n(s),a=i.hasClass("open"),e(),a||i.toggleClass("open"),s.focus(),!1},keydown:function(e){var i,a,s,r,l;if(/(38|40|27)/.test(e.keyCode)&&(i=t(this),e.preventDefault(),e.stopPropagation(),!i.is(".disabled, :disabled"))){if(s=n(i),r=s.hasClass("open"),!r||r&&27==e.keyCode)return 27==e.which&&s.find(o).focus(),i.click();a=t("[role=menu] li:not(.divider):visible a",s),a.length&&(l=a.index(a.filter(":focus")),38==e.keyCode&&l>0&&l--,40==e.keyCode&&l<a.length-1&&l++,~l||(l=0),a.eq(l).focus())}}};var a=t.fn.dropdown;t.fn.dropdown=function(e){return this.each(function(){var n=t(this),o=n.data("dropdown");o||n.data("dropdown",o=new i(this)),"string"==typeof e&&o[e].call(n)})},t.fn.dropdown.Constructor=i,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=a,this},t(document).on("click.dropdown.data-api",e).on("click.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.dropdown-menu",function(t){t.stopPropagation()}).on("click.dropdown.data-api",o,i.prototype.toggle).on("keydown.dropdown.data-api",o+", [role=menu]",i.prototype.keydown)}(window.jQuery),!function(t){"use strict";var e='[data-dismiss="alert"]',n=function(n){t(n).on("click",e,this.close)};n.prototype.close=function(e){function n(){o.trigger("closed").remove()}var o,i=t(this),a=i.attr("data-target");a||(a=i.attr("href"),a=a&&a.replace(/.*(?=#[^\s]*$)/,"")),o=t(a),e&&e.preventDefault(),o.length||(o=i.hasClass("alert")?i:i.parent()),o.trigger(e=t.Event("close")),e.isDefaultPrevented()||(o.removeClass("in"),t.support.transition&&o.hasClass("fade")?o.on(t.support.transition.end,n):n())};var o=t.fn.alert;t.fn.alert=function(e){return this.each(function(){var o=t(this),i=o.data("alert");i||o.data("alert",i=new n(this)),"string"==typeof e&&i[e].ca
2018-11-13 18:33:22 +01:00
return e},g={abortevent:function(t){t.preventDefault(),t.stopImmediatePropagation()},contextmenu:function(e){var n=t(this);if(e.preventDefault(),e.stopImmediatePropagation(),!("right"!=e.data.trigger&&e.originalEvent||n.hasClass("context-menu-active")||n.hasClass("context-menu-disabled"))){if(s=n,e.data.build){var o=e.data.build(s,e);if(o===!1)return;if(e.data=t.extend(!0,{},f,e.data,o||{}),!e.data.items||t.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log)("No items specified to show in contextMenu"),new Error("No Items specified");e.data.$trigger=s,v.create(e.data)}v.show.call(n,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopImmediatePropagation(),t(this).trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var n=t(this);s&&s.length&&!s.is(n)&&s.data("contextMenu").$menu.trigger("contextmenu:hide"),2==e.button&&(s=n.data("contextMenuActive",!0))},mouseup:function(e){var n=t(this);n.data("contextMenuActive")&&s&&s.length&&s.is(n)&&!n.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),s=n,n.trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),n.removeData("contextMenuActive")},mouseenter:function(e){var n=t(this),o=t(e.relatedTarget),i=t(document);o.is(".context-menu-list")||o.closest(".context-menu-list").length||s&&s.length||(p.pageX=e.pageX,p.pageY=e.pageY,p.data=e.data,i.on("mousemove.contextMenuShow",g.mousemove),p.timer=setTimeout(function(){p.timer=null,i.off("mousemove.contextMenuShow"),s=n,n.trigger(t.Event("contextmenu",{data:p.data,pageX:p.pageX,pageY:p.pageY}))},e.data.delay))},mousemove:function(t){p.pageX=t.pageX,p.pageY=t.pageY},mouseleave:function(e){var n=t(e.relatedTarget);if(!n.is(".context-menu-list")&&!n.closest(".context-menu-list").length){try{clearTimeout(p.timer)}catch(e){}p.timer=null}},layerClick:function(e){var n,o,i=t(this),a=i.data("contextMenuRoot"),s=e.button,r=e.pageX,c=e.pageY;e.preventDefault(),e.stopImmediatePropagation(),setTimeout(function(){var i,u="left"==a.trigger&&0===s||"right"==a.trigger&&2===s;if(document.elementFromPoint&&(a.$layer.hide(),n=document.elementFromPoint(r-l.scrollLeft(),c-l.scrollTop()),a.$layer.show()),a.reposition&&u)if(document.elementFromPoint){if(a.$trigger.is(n)||a.$trigger.has(n).length)return void a.position.call(a.$trigger,a,r,c)}else if(o=a.$trigger.offset(),i=t(window),o.top+=i.scrollTop(),o.top<=e.pageY&&(o.left+=i.scrollLeft(),o.left<=e.pageX&&(o.bottom=o.top+a.$trigger.outerHeight(),o.bottom>=e.pageY&&(o.right=o.left+a.$trigger.outerWidth(),o.right>=e.pageX))))return void a.position.call(a.$trigger,a,r,c);n&&u&&a.$trigger.one("contextmenu:hidden",function(){t(n).contextMenu({x:r,y:c})}),a.$menu.trigger("contextmenu:hide")},50)},keyStop:function(t,e){e.isInput||t.preventDefault(),t.stopPropagation()},key:function(t){var e=s.data("contextMenu")||{};switch(t.keyCode){case 9:case 38:if(g.keyStop(t,e),e.isInput){if(9==t.keyCode&&t.shiftKey)return t.preventDefault(),e.$selected&&e.$selected.find("input, textarea, select").blur(),void e.$menu.trigger("prevcommand");if(38==t.keyCode&&"checkbox"==e.$selected.find("input, textarea, select").prop("type"))return void t.preventDefault()}else if(9!=t.keyCode||t.shiftKey)return void e.$menu.trigger("prevcommand");case 40:if(g.keyStop(t,e),!e.isInput)return void e.$menu.trigger("nextcommand");if(9==t.keyCode)return t.preventDefault(),e.$selected&&e.$selected.find("input, textarea, select").blur(),void e.$menu.trigger("nextcommand");if(40==t.keyCode&&"checkbox"==e.$selected.find("input, textarea, select").prop("type"))return void t.preventDefault();break;case 37:if(g.keyStop(t,e),e.isInput||!e.$selected||!e.$selected.length)break;if(!e.$selected.parent().hasClass("context-menu-root")){var n=e.$selected.parent().parent();return e.$selected.trigger("contextmenu:blur"),void(e.$selected=n)}break;case 39:if(g.keyStop(t,e),e.isInput||!e.$selected||!e.$selected.length)break;var o=e.$selected.data("contextMenu")||{};if(o.$menu&&e.$selected.hasClass("context-menu-submenu"))retu
break;case a:Yt.trigger("swipeUp",[Nt,Pt,jt,qt,Qt]),n.swipeUp&&(g=n.swipeUp.call(Yt,e,Nt,Pt,jt,qt,Qt));break;case s:Yt.trigger("swipeDown",[Nt,Pt,jt,qt,Qt]),n.swipeDown&&(g=n.swipeDown.call(Yt,e,Nt,Pt,jt,qt,Qt))}}}if(u==h){if(Yt.trigger("pinchStatus",[c,zt||null,Kt||0,jt||0,qt,Ft,Qt]),n.pinchStatus&&(g=n.pinchStatus.call(Yt,e,c,zt||null,Kt||0,jt||0,qt,Ft,Qt),g===!1))return!1;if(c==$&&z())switch(zt){case r:Yt.trigger("pinchIn",[zt||null,Kt||0,jt||0,qt,Ft,Qt]),n.pinchIn&&(g=n.pinchIn.call(Yt,e,zt||null,Kt||0,jt||0,qt,Ft,Qt));break;case l:Yt.trigger("pinchOut",[zt||null,Kt||0,jt||0,qt,Ft,Qt]),n.pinchOut&&(g=n.pinchOut.call(Yt,e,zt||null,Kt||0,jt||0,qt,Ft,Qt))}}return u==f?c!==k&&c!==$||(clearTimeout(Jt),clearTimeout(te),G()&&!tt()?(Zt=Mt(),Jt=setTimeout(t.proxy(function(){Zt=null,Yt.trigger("tap",[e.target]),n.tap&&(g=n.tap.call(Yt,e,e.target))},this),n.doubleTapThreshold)):(Zt=null,Yt.trigger("tap",[e.target]),n.tap&&(g=n.tap.call(Yt,e,e.target)))):u==p?c!==k&&c!==$||(clearTimeout(Jt),Zt=null,Yt.trigger("doubletap",[e.target]),n.doubleTap&&(g=n.doubleTap.call(Yt,e,e.target))):u==m&&(c!==k&&c!==$||(clearTimeout(Jt),Zt=null,Yt.trigger("longtap",[e.target]),n.longTap&&(g=n.longTap.call(Yt,e,e.target)))),g}function j(){var t=!0;return null!==n.threshold&&(t=Pt>=n.threshold),t}function R(){var t=!1;return null!==n.cancelThreshold&&null!==Nt&&(t=gt(Nt)-Pt>=n.cancelThreshold),t}function H(){return null===n.pinchThreshold||Kt>=n.pinchThreshold}function F(){var t;return t=!n.maxTimeThreshold||!(jt>=n.maxTimeThreshold)}function K(t,e){if(n.preventDefaultEvents!==!1)if(n.allowPageScroll===c)t.preventDefault();else{var r=n.allowPageScroll===u;switch(e){case o:(n.swipeLeft&&r||!r&&n.allowPageScroll!=g)&&t.preventDefault();break;case i:(n.swipeRight&&r||!r&&n.allowPageScroll!=g)&&t.preventDefault();break;case a:(n.swipeUp&&r||!r&&n.allowPageScroll!=v)&&t.preventDefault();break;case s:(n.swipeDown&&r||!r&&n.allowPageScroll!=v)&&t.preventDefault()}}}function z(){var t=U(),e=B(),n=H();return t&&e&&n}function W(){return!!(n.pinchStatus||n.pinchIn||n.pinchOut)}function Y(){return!(!z()||!W())}function X(){var t=F(),e=j(),n=U(),o=B(),i=R(),a=!i&&o&&n&&e&&t;return a}function q(){return!!(n.swipe||n.swipeStatus||n.swipeLeft||n.swipeRight||n.swipeUp||n.swipeDown)}function Q(){return!(!X()||!q())}function U(){return qt===n.fingers||n.fingers===b||!C}function B(){return 0!==Qt[0].end.x}function V(){return!!n.tap}function G(){return!!n.doubleTap}function Z(){return!!n.longTap}function J(){if(null==Zt)return!1;var t=Mt();return G()&&t-Zt<=n.doubleTapThreshold}function tt(){return J()}function et(){return(1===qt||!C)&&(isNaN(Pt)||Pt<n.threshold)}function nt(){return jt>n.longTapThreshold&&Pt<y}function ot(){return!(!et()||!V())}function it(){return!(!J()||!G())}function at(){return!(!nt()||!Z())}function st(){Vt=Mt(),Gt=event.touches.length+1}function rt(){Vt=0,Gt=0}function lt(){var t=!1;if(Vt){var e=Mt()-Vt;e<=n.fingerReleaseThreshold&&(t=!0)}return t}function ct(){return!(Yt.data(E+"_intouch")!==!0)}function ut(t){t===!0?(Yt.bind(_t,O),Yt.bind(It,L),At&&Yt.bind(At,I)):(Yt.unbind(_t,O,!1),Yt.unbind(It,L,!1),At&&Yt.unbind(At,I,!1)),Yt.data(E+"_intouch",t===!0)}function dt(t,e){var n=void 0!==e.identifier?e.identifier:0;return Qt[t].identifier=n,Qt[t].start.x=Qt[t].end.x=e.pageX||e.clientX,Qt[t].start.y=Qt[t].end.y=e.pageY||e.clientY,Qt[t]}function ht(t){var e=void 0!==t.identifier?t.identifier:0,n=ft(e);return n.end.x=t.pageX||t.clientX,n.end.y=t.pageY||t.clientY,n}function ft(t){for(var e=0;e<Qt.length;e++)if(Qt[e].identifier==t)return Qt[e]}function pt(){for(var t=[],e=0;e<=5;e++)t.push({start:{x:0,y:0},end:{x:0,y:0},identifier:0});return t}function mt(t,e){e=Math.max(e,gt(t)),Wt[t].distance=e}function gt(t){if(Wt[t])return Wt[t].distance}function vt(){var t={};return t[o]=bt(o),t[i]=bt(i),t[a]=bt(a),t[s]=bt(s),t}function bt(t){return{direction:t,distance:0}}function yt(){return Bt-Ut}function wt(t,e){var n=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);return Math.round(Math.sqrt(n*n+o*o))}function xt(t,e){var n=e/t*1;return n.toFixed(2)}function $t(){re