mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function d(a){a.fn.perfectScrollbar=function(b){return this.each(function(){if("object"==typeof b||"undefined"==typeof b){var c=b;f.get(this)||e.initialize(this,c)}else{var d=b;"update"===d?e.update(this):"destroy"===d&&e.destroy(this)}return a(this)})}}var e=a("../main"),f=a("../plugin/instances");if("function"==typeof define&&define.amd)define(["jquery"],d);else{var g=window.jQuery?window.jQuery:window.$;"undefined"!=typeof g&&d(g)}b.exports=d},{"../main":7,"../plugin/instances":18}],2:[function(a,b,c){"use strict";function d(a,b){var c=a.className.split(" ");c.indexOf(b)<0&&c.push(b),a.className=c.join(" ")}function e(a,b){var c=a.className.split(" "),d=c.indexOf(b);d>=0&&c.splice(d,1),a.className=c.join(" ")}c.add=function(a,b){a.classList?a.classList.add(b):d(a,b)},c.remove=function(a,b){a.classList?a.classList.remove(b):e(a,b)},c.list=function(a){return a.classList?a.classList:a.className.split(" ")}},{}],3:[function(a,b,c){"use strict";function d(a,b){return window.getComputedStyle(a)[b]}function e(a,b,c){return"number"==typeof c&&(c=c.toString()+"px"),a.style[b]=c,a}function f(a,b){for(var c in b){var d=b[c];"number"==typeof d&&(d=d.toString()+"px"),a.style[c]=d}return a}c.e=function(a,b){var c=document.createElement(a);return c.className=b,c},c.appendTo=function(a,b){return b.appendChild(a),a},c.css=function(a,b,c){return"object"==typeof b?f(a,b):"undefined"==typeof c?d(a,b):e(a,b,c)},c.matches=function(a,b){return"undefined"!=typeof a.matches?a.matches(b):"undefined"!=typeof a.matchesSelector?a.matchesSelector(b):"undefined"!=typeof a.webkitMatchesSelector?a.webkitMatchesSelector(b):"undefined"!=typeof a.mozMatchesSelector?a.mozMatchesSelector(b):"undefined"!=typeof a.msMatchesSelector?a.msMatchesSelector(b):void 0},c.remove=function(a){"undefined"!=typeof a.remove?a.remove():a.parentNode&&a.parentNode.removeChild(a)}},{}],4:[function(a,b,c){"use strict";var d=function(a){this.element=a,this.events={}};d.prototype.bind=function(a,b){"undefined"==typeof this.events[a]&&(this.events[a]=[]),this.events[a].push(b),this.element.addEventListener(a,b,!1)},d.prototype.unbind=function(a,b){var c="undefined"!=typeof b;this.events[a]=this.events[a].filter(function(d){return c&&d!==b?!0:(this.element.removeEventListener(a,d,!1),!1)},this)},d.prototype.unbindAll=function(){for(var a in this.events)this.unbind(a)};var e=function(){this.eventElements=[]};e.prototype.eventElement=function(a){var b=this.eventElements.filter(function(b){return b.element===a})[0];return"undefined"==typeof b&&(b=new d(a),this.eventElements.push(b)),b},e.prototype.bind=function(a,b,c){this.eventElement(a).bind(b,c)},e.prototype.unbind=function(a,b,c){this.eventElement(a).unbind(b,c)},e.prototype.unbindAll=function(){for(var a=0;a<this.eventElements.length;a++)this.eventElements[a].unbindAll()},e.prototype.once=function(a,b,c){var d=this.eventElement(a),e=function(a){d.unbind(b,e),c(a)};d.bind(b,e)},b.exports=e},{}],5:[function(a,b,c){"use strict";b.exports=function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}}()},{}],6:[function(a,b,c){"use strict";var d=a("./class"),e=a("./dom");c.toInt=function(a){return parseInt(a,10)||0},c.clone=function(a){if(null===a)return null;if("object"==typeof a){var b={};for(var c in a)b[c]=this.clone(a[c]);return b}return a},c.extend=function(a,b){var c=this.clone(a);for(var d in b)c[d]=this.clone(b[d]);return c},c.isEditable=function(a){return e.matches(a,"input,[contenteditable]")||e.matches(a,"select,[contenteditable]")||e.matches(a,"textarea,[contenteditable]")||e.matches(a,"button,[contenteditable]")},c.removePsClasses=function(a){for(var b=d.list(a),c=0;c<b.length;c++){var e=b[c];0===e.indexOf("ps-")&&d.remove(a,e)}},c.outerWidth=function(a){return this.toInt(e.css(a,"width"))+this.toInt(e.css(a,"paddingLeft"))+this.toInt(e.css(a,"paddingRight"))+this.toInt(e.css(a,"borderLeftWidth"))+this.toInt(e.css(a,"borderRightWidth"))},c.startScrolling=function(a,b){d.add(a,"ps-in-scrolling"),"undefined"!=typeof b?d.add(a,"ps-"+b):(d.add(a,"ps-x"),d.add(a,"ps-y"))},c.stopScrolling=function(a,b){d.remove(a,"ps-in-scrolling"),"undefined"!=typeof b?d.remove(a,"ps-"+b):(d.remove(a,"ps-x"),d.remove(a,"ps-y"))},c.env={isWebKit:"WebkitAppearance"in document.documentElement.style,supportsTouch:"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,supportsIePointer:null!==window.navigator.msMaxTouchPoints}},{"./class":2,"./dom":3}],7:[function(a,b,c){"use strict";var d=a("./plugin/destroy"),e=a("./plugin/initialize"),f=a("./plugin/update");b.exports={initialize:e,update:f,destroy:d}},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":20}],8:[function(a,b,c){"use strict";b.exports={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0}},{}],9:[function(a,b,c){"use strict";var d=a("../lib/dom"),e=a("../lib/helper"),f=a("./instances");b.exports=function(a){var b=f.get(a);if(!b)throw new Error("perfect-scrollbar: instance not found");b.event.unbindAll(),d.remove(b.scrollbarX),d.remove(b.scrollbarY),d.remove(b.scrollbarXRail),d.remove(b.scrollbarYRail),e.removePsClasses(a),f.remove(a)}},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(a,b,c){"use strict";function d(a,b){function c(a){return a.getBoundingClientRect()}var d=window.Event.prototype.stopPropagation.bind;b.event.bind(b.scrollbarY,"click",d),b.event.bind(b.scrollbarYRail,"click",function(d){var f=e.toInt(b.scrollbarYHeight/2),h=b.railYRatio*(d.pageY-window.scrollY-c(b.scrollbarYRail).top-f),i=b.railYRatio*(b.railYHeight-b.scrollbarYHeight),j=h/i;0>j?j=0:j>1&&(j=1),a.scrollTop=(b.contentHeight-b.containerHeight)*j,g(a),d.stopPropagation()}),b.event.bind(b.scrollbarX,"click",d),b.event.bind(b.scrollbarXRail,"click",function(d){var f=e.toInt(b.scrollbarXWidth/2),h=b.railXRatio*(d.pageX-window.scrollX-c(b.scrollbarXRail).left-f),i=b.railXRatio*(b.railXWidth-b.scrollbarXWidth),j=h/i;0>j?j=0:j>1&&(j=1),a.scrollLeft=(b.contentWidth-b.containerWidth)*j-b.negativeScrollAdjustment,g(a),d.stopPropagation()})}var e=a("../../lib/helper"),f=a("../instances"),g=a("../update-geometry");b.exports=function(a){var b=f.get(a);d(a,b)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],11:[function(a,b,c){"use strict";function d(a,b){function c(c){var e=d+c*b.railXRatio,f=b.scrollbarXRail.getBoundingClientRect().left+b.railXRatio*(b.railXWidth-b.scrollbarXWidth);0>e?b.scrollbarXLeft=0:e>f?b.scrollbarXLeft=f:b.scrollbarXLeft=e;var h=g.toInt(b.scrollbarXLeft*(b.contentWidth-b.containerWidth)/(b.containerWidth-b.railXRatio*b.scrollbarXWidth))-b.negativeScrollAdjustment;a.scrollLeft=h}var d=null,e=null,h=function(b){c(b.pageX-e),i(a),b.stopPropagation(),b.preventDefault()},j=function(){g.stopScrolling(a,"x"),b.event.unbind(b.ownerDocument,"mousemove",h)};b.event.bind(b.scrollbarX,"mousedown",function(c){e=c.pageX,d=g.toInt(f.css(b.scrollbarX,"left"))*b.railXRatio,g.startScrolling(a,"x"),b.event.bind(b.ownerDocument,"mousemove",h),b.event.once(b.ownerDocument,"mouseup",j),c.stopPropagation(),c.preventDefault()})}function e(a,b){function c(c){var e=d+c*b.railYRatio,f=b.scrollbarYRail.getBoundingClientRect().top+b.railYRatio*(b.railYHeight-b.scrollbarYHeight);0>e?b.scrollbarYTop=0:e>f?b.scrollbarYTop=f:b.scrollbarYTop=e;var h=g.toInt(b.scrollbarYTop*(b.contentHeight-b.containerHeight)/(b.containerHeight-b.railYRatio*b.scrollbarYHeight));a.scrollTop=h}var d=null,e=null,h=function(b){c(b.pageY-e),i(a),b.stopPropagation(),b.preventDefault()},j=function(){g.stopScrolling(a,"y"),b.event.unbind(b.ownerDocument,"mousemove",h)};b.event.bind(b.scrollbarY,"mousedown",function(c){e=c.pageY,d=g.toInt(f.css(b.scrollbarY,"top"))*b.railYRatio,g.startScrolling(a,"y"),b.event.bind(b.ownerDocument,"mousemove",h),b.event.once(b.ownerDocument,"mouseup",j),c.stopPropagation(),c.preventDefault()})}var f=a("../../lib/dom"),g=a("../../lib/helper"),h=a("../instances"),i=a("../update-geometry");b.exports=function(a){var b=h.get(a);d(a,b),e(a,b)}},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19}],12:[function(a,b,c){"use strict";function d(a,b){function c(c,d){var e=a.scrollTop;if(0===c){if(!b.scrollbarYActive)return!1;if(0===e&&d>0||e>=b.contentHeight-b.containerHeight&&0>d)return!b.settings.wheelPropagation}var f=a.scrollLeft;if(0===d){if(!b.scrollbarXActive)return!1;if(0===f&&0>c||f>=b.contentWidth-b.containerWidth&&c>0)return!b.settings.wheelPropagation}return!0}var d=!1;b.event.bind(a,"mouseenter",function(){d=!0}),b.event.bind(a,"mouseleave",function(){d=!1});var f=!1;b.event.bind(b.ownerDocument,"keydown",function(h){if((!h.isDefaultPrevented||!h.isDefaultPrevented())&&d){var i=document.activeElement?document.activeElement:b.ownerDocument.activeElement;if(i){for(;i.shadowRoot;)i=i.shadowRoot.activeElement;if(e.isEditable(i))return}var j=0,k=0;switch(h.which){case 37:j=-30;break;case 38:k=30;break;case 39:j=30;break;case 40:k=-30;break;case 33:k=90;break;case 32:case 34:k=-90;break;case 35:k=h.ctrlKey?-b.contentHeight:-b.containerHeight;break;case 36:k=h.ctrlKey?a.scrollTop:b.containerHeight;break;default:return}a.scrollTop=a.scrollTop-k,a.scrollLeft=a.scrollLeft+j,g(a),f=c(j,k),f&&h.preventDefault()}})}var e=a("../../lib/helper"),f=a("../instances"),g=a("../update-geometry");b.exports=function(a){var b=f.get(a);d(a,b)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],13:[function(a,b,c){"use strict";function d(a,b){function c(c,d){var e=a.scrollTop;if(0===c){if(!b.scrollbarYActive)return!1;if(0===e&&d>0||e>=b.contentHeight-b.containerHeight&&0>d)return!b.settings.wheelPropagation}var f=a.scrollLeft;if(0===d){if(!b.scrollbarXActive)return!1;if(0===f&&0>c||f>=b.contentWidth-b.containerWidth&&c>0)return!b.settings.wheelPropagation}return!0}function d(a){var b=a.deltaX,c=-1*a.deltaY;return("undefined"==typeof b||"undefined"==typeof c)&&(b=-1*a.wheelDeltaX/6,c=a.wheelDeltaY/6),a.deltaMode&&1===a.deltaMode&&(b*=10,c*=10),b!==b&&c!==c&&(b=0,c=a.wheelDelta),[b,c]}function f(b,c){var d=a.querySelector("textarea:hover");if(d){var e=d.scrollHeight-d.clientHeight;if(e>0&&!(0===d.scrollTop&&c>0||d.scrollTop===e&&0>c))return!0;var f=d.scrollLeft-d.clientWidth;if(f>0&&!(0===d.scrollLeft&&0>b||d.scrollLeft===f&&b>0))return!0}return!1}function h(h){if(e.env.isWebKit||!a.querySelector("select:focus")){var j=d(h),k=j[0],l=j[1];f(k,l)||(i=!1,b.settings.useBothWheelAxes?b.scrollbarYActive&&!b.scrollbarXActive?(l?a.scrollTop=a.scrollTop-l*b.settings.wheelSpeed:a.scrollTop=a.scrollTop+k*b.settings.wheelSpeed,i=!0):b.scrollbarXActive&&!b.scrollbarYActive&&(k?a.scrollLeft=a.scrollLeft+k*b.settings.wheelSpeed:a.scrollLeft=a.scrollLeft-l*b.settings.wheelSpeed,i=!0):(a.scrollTop=a.scrollTop-l*b.settings.wheelSpeed,a.scrollLeft=a.scrollLeft+k*b.settings.wheelSpeed),g(a),i=i||c(k,l),i&&(h.stopPropagation(),h.preventDefault()))}}var i=!1;"undefined"!=typeof window.onwheel?b.event.bind(a,"wheel",h):"undefined"!=typeof window.onmousewheel&&b.event.bind(a,"mousewheel",h)}var e=a("../../lib/helper"),f=a("../instances"),g=a("../update-geometry");b.exports=function(a){var b=f.get(a);d(a,b)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],14:[function(a,b,c){"use strict";function d(a,b){b.event.bind(a,"scroll",function(){f(a)})}var e=a("../instances"),f=a("../update-geometry");b.exports=function(a){var b=e.get(a);d(a,b)}},{"../instances":18,"../update-geometry":19}],15:[function(a,b,c){"use strict";function d(a,b){function c(){var a=window.getSelection?window.getSelection():document.getSelection?document.getSelection():"";return 0===a.toString().length?null:a.getRangeAt(0).commonAncestorContainer}function d(){i||(i=setInterval(function(){return f.get(a)?(a.scrollTop=a.scrollTop+j.top,a.scrollLeft=a.scrollLeft+j.left,void g(a)):void clearInterval(i)},50))}function h(){i&&(clearInterval(i),i=null),e.stopScrolling(a)}var i=null,j={top:0,left:0},k=!1;b.event.bind(b.ownerDocument,"selectionchange",function(){a.contains(c())?k=!0:(k=!1,h())}),b.event.bind(window,"mouseup",function(){k&&(k=!1,h())}),b.event.bind(window,"mousemove",function(b){if(k){var c={x:b.pageX,y:b.pageY},f={left:a.offsetLeft,right:a.offsetLeft+a.offsetWidth,top:a.offsetTop,bottom:a.offsetTop+a.offsetHeight};c.x<f.left+3?(j.left=-5,e.startScrolling(a,"x")):c.x>f.right-3?(j.left=5,e.startScrolling(a,"x")):j.left=0,c.y<f.top+3?(f.top+3-c.y<5?j.top=-5:j.top=-20,e.startScrolling(a,"y")):c.y>f.bottom-3?(c.y-f.bottom+3<5?j.top=5:j.top=20,e.startScrolling(a,"y")):j.top=0,0===j.top&&0===j.left?h():d()}})}var e=a("../../lib/helper"),f=a("../instances"),g=a("../update-geometry");b.exports=function(a){var b=f.get(a);d(a,b)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],16:[function(a,b,c){"use strict";function d(a,b,c,d){function g(c,d){var e=a.scrollTop,f=a.scrollLeft,g=Math.abs(c),h=Math.abs(d);if(h>g){if(0>d&&e===b.contentHeight-b.containerHeight||d>0&&0===e)return!b.settings.swipePropagation}else if(g>h&&(0>c&&f===b.contentWidth-b.containerWidth||c>0&&0===f))return!b.settings.swipePropagation;return!0}function h(b,c){a.scrollTop=a.scrollTop-c,a.scrollLeft=a.scrollLeft-b,f(a)}function i(){t=!0}function j(){t=!1}function k(a){return a.targetTouches?a.targetTouches[0]:a}function l(a){return a.targetTouches&&1===a.targetTouches.length?!0:a.pointerType&&"mouse"!==a.pointerType&&a.pointerType!==a.MSPOINTER_TYPE_MOUSE?!0:!1}function m(a){if(l(a)){u=!0;var b=k(a);p.pageX=b.pageX,p.pageY=b.pageY,q=(new Date).getTime(),null!==s&&clearInterval(s),a.stopPropagation()}}function n(a){if(!t&&u&&l(a)){var b=k(a),c={pageX:b.pageX,pageY:b.pageY},d=c.pageX-p.pageX,e=c.pageY-p.pageY;h(d,e),p=c;var f=(new Date).getTime(),i=f-q;i>0&&(r.x=d/i,r.y=e/i,q=f),g(d,e)&&(a.stopPropagation(),a.preventDefault())}}function o(){!t&&u&&(u=!1,clearInterval(s),s=setInterval(function(){return e.get(a)?Math.abs(r.x)<.01&&Math.abs(r.y)<.01?void clearInterval(s):(h(30*r.x,30*r.y),r.x*=.8,void(r.y*=.8)):void clearInterval(s)},10))}var p={},q=0,r={},s=null,t=!1,u=!1;c&&(b.event.bind(window,"touchstart",i),b.event.bind(window,"touchend",j),b.event.bind(a,"touchstart",m),b.event.bind(a,"touchmove",n),b.event.bind(a,"touchend",o)),d&&(window.PointerEvent?(b.event.bind(window,"pointerdown",i),b.event.bind(window,"pointerup",j),b.event.bind(a,"pointerdown",m),b.event.bind(a,"pointermove",n),b.event.bind(a,"pointerup",o)):window.MSPointerEvent&&(b.event.bind(window,"MSPointerDown",i),b.event.bind(window,"MSPointerUp",j),b.event.bind(a,"MSPointerDown",m),b.event.bind(a,"MSPointerMove",n),b.event.bind(a,"MSPointerUp",o)))}var e=a("../instances"),f=a("../update-geometry");b.exports=function(a,b,c){var f=e.get(a);d(a,f,b,c)}},{"../instances":18,"../update-geometry":19}],17:[function(a,b,c){"use strict";var d=a("../lib/class"),e=a("../lib/helper"),f=a("./instances"),g=a("./update-geometry"),h=a("./handler/click-rail"),i=a("./handler/drag-scrollbar"),j=a("./handler/keyboard"),k=a("./handler/mouse-wheel"),l=a("./handler/native-scroll"),m=a("./handler/selection"),n=a("./handler/touch");b.exports=function(a,b){b="object"==typeof b?b:{},d.add(a,"ps-container");var c=f.add(a);c.settings=e.extend(c.settings,b),h(a),i(a),k(a),l(a),m(a),(e.env.supportsTouch||e.env.supportsIePointer)&&n(a,e.env.supportsTouch,e.env.supportsIePointer),c.settings.useKeyboard&&j(a),g(a)}},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(a,b,c){"use strict";function d(a){var b=this;b.settings=l.clone(i),b.containerWidth=null,b.containerHeight=null,b.contentWidth=null,b.contentHeight=null,b.isRtl="rtl"===h.css(a,"direction"),b.isNegativeScroll=function(){var b=a.scrollLeft,c=null;return a.scrollLeft=-1,c=a.scrollLeft<0,a.scrollLeft=b,c}(),b.negativeScrollAdjustment=b.isNegativeScroll?a.scrollWidth-a.clientWidth:0,b.event=new j,b.ownerDocument=a.ownerDocument||document,b.scrollbarXRail=h.appendTo(h.e("div","ps-scrollbar-x-rail"),a),b.scrollbarX=h.appendTo(h.e("div","ps-scrollbar-x"),b.scrollbarXRail),b.scrollbarXActive=null,b.scrollbarXWidth=null,b.scrollbarXLeft=null,b.scrollbarXBottom=l.toInt(h.css(b.scrollbarXRail,"bottom")),b.isScrollbarXUsingBottom=b.scrollbarXBottom===b.scrollbarXBottom,b.scrollbarXTop=b.isScrollbarXUsingBottom?null:l.toInt(h.css(b.scrollbarXRail,"top")),b.railBorderXWidth=l.toInt(h.css(b.scrollbarXRail,"borderLeftWidth"))+l.toInt(h.css(b.scrollbarXRail,"borderRightWidth")),h.css(b.scrollbarXRail,"display","block"),b.railXMarginWidth=l.toInt(h.css(b.scrollbarXRail,"marginLeft"))+l.toInt(h.css(b.scrollbarXRail,"marginRight")),h.css(b.scrollbarXRail,"display",""),b.railXWidth=null,b.railXRatio=null,b.scrollbarYRail=h.appendTo(h.e("div","ps-scrollbar-y-rail"),a),b.scrollbarY=h.appendTo(h.e("div","ps-scrollbar-y"),b.scrollbarYRail),b.scrollbarYActive=null,b.scrollbarYHeight=null,b.scrollbarYTop=null,b.scrollbarYRight=l.toInt(h.css(b.scrollbarYRail,"right")),b.isScrollbarYUsingRight=b.scrollbarYRight===b.scrollbarYRight,b.scrollbarYLeft=b.isScrollbarYUsingRight?null:l.toInt(h.css(b.scrollbarYRail,"left")),b.scrollbarYOuterWidth=b.isRtl?l.outerWidth(b.scrollbarY):null,b.railBorderYWidth=l.toInt(h.css(b.scrollbarYRail,"borderTopWidth"))+l.toInt(h.css(b.scrollbarYRail,"borderBottomWidth")),h.css(b.scrollbarYRail,"display","block"),b.railYMarginHeight=l.toInt(h.css(b.scrollbarYRail,"marginTop"))+l.toInt(h.css(b.scrollbarYRail,"marginBottom")),h.css(b.scrollbarYRail,"display",""),b.railYHeight=null,b.railYRatio=null}function e(a){return"undefined"==typeof a.dataset?a.getAttribute("data-ps-id"):a.dataset.psId}function f(a,b){"undefined"==typeof a.dataset?a.setAttribute("data-ps-id",b):a.dataset.psId=b}function g(a){"undefined"==typeof a.dataset?a.removeAttribute("data-ps-id"):delete a.dataset.psId}var h=a("../lib/dom"),i=a("./default-setting"),j=a("../lib/event-manager"),k=a("../lib/guid"),l=a("../lib/helper"),m={};c.add=function(a){var b=k();return f(a,b),m[b]=new d(a),m[b]},c.remove=function(a){delete m[e(a)],g(a)},c.get=function(a){return m[e(a)]}},{"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(a,b,c){"use strict";function d(a,b){return a.settings.minScrollbarLength&&(b=Math.max(b,a.settings.minScrollbarLength)),a.settings.maxScrollbarLength&&(b=Math.min(b,a.settings.maxScrollbarLength)),b}function e(a,b){var c={width:b.railXWidth};b.isRtl?c.left=b.negativeScrollAdjustment+a.scrollLeft+b.containerWidth-b.contentWidth:c.left=a.scrollLeft,b.isScrollbarXUsingBottom?c.bottom=b.scrollbarXBottom-a.scrollTop:c.top=b.scrollbarXTop+a.scrollTop,g.css(b.scrollbarXRail,c);var d={top:a.scrollTop,height:b.railYHeight};b.isScrollbarYUsingRight?b.isRtl?d.right=b.contentWidth-(b.negativeScrollAdjustment+a.scrollLeft)-b.scrollbarYRight-b.scrollbarYOuterWidth:d.right=b.scrollbarYRight-a.scrollLeft:b.isRtl?d.left=b.negativeScrollAdjustment+a.scrollLeft+2*b.containerWidth-b.contentWidth-b.scrollbarYLeft-b.scrollbarYOuterWidth:d.left=b.scrollbarYLeft+a.scrollLeft,g.css(b.scrollbarYRail,d),g.css(b.scrollbarX,{left:b.scrollbarXLeft,width:b.scrollbarXWidth-b.railBorderXWidth}),g.css(b.scrollbarY,{top:b.scrollbarYTop,height:b.scrollbarYHeight-b.railBorderYWidth})}var f=a("../lib/class"),g=a("../lib/dom"),h=a("../lib/helper"),i=a("./instances");b.exports=function(a){var b=i.get(a);b.containerWidth=a.clientWidth,b.containerHeight=a.clientHeight,b.contentWidth=a.scrollWidth,b.contentHeight=a.scrollHeight,a.contains(b.scrollbarXRail)||g.appendTo(b.scrollbarXRail,a),a.contains(b.scrollbarYRail)||g.appendTo(b.scrollbarYRail,a),!b.settings.suppressScrollX&&b.containerWidth+b.settings.scrollXMarginOffset<b.contentWidth?(b.scrollbarXActive=!0,b.railXWidth=b.containerWidth-b.railXMarginWidth,b.railXRatio=b.containerWidth/b.railXWidth,b.scrollbarXWidth=d(b,h.toInt(b.railXWidth*b.containerWidth/b.contentWidth)),b.scrollbarXLeft=h.toInt((b.negativeScrollAdjustment+a.scrollLeft)*(b.railXWidth-b.scrollbarXWidth)/(b.contentWidth-b.containerWidth))):(b.scrollbarXActive=!1,b.scrollbarXWidth=0,b.scrollbarXLeft=0,a.scrollLeft=0),!b.settings.suppressScrollY&&b.containerHeight+b.settings.scrollYMarginOffset<b.contentHeight?(b.scrollbarYActive=!0,b.railYHeight=b.containerHeight-b.railYMarginHeight,b.railYRatio=b.containerHeight/b.railYHeight,b.scrollbarYHeight=d(b,h.toInt(b.railYHeight*b.containerHeight/b.contentHeight)),b.scrollbarYTop=h.toInt(a.scrollTop*(b.railYHeight-b.scrollbarYHeight)/(b.contentHeight-b.containerHeight))):(b.scrollbarYActive=!1,b.scrollbarYHeight=0,b.scrollbarYTop=0,a.scrollTop=0),b.scrollbarXLeft>=b.railXWidth-b.scrollbarXWidth&&(b.scrollbarXLeft=b.railXWidth-b.scrollbarXWidth),b.scrollbarYTop>=b.railYHeight-b.scrollbarYHeight&&(b.scrollbarYTop=b.railYHeight-b.scrollbarYHeight),e(a,b),f[b.scrollbarXActive?"add":"remove"](a,"ps-active-x"),f[b.scrollbarYActive?"add":"remove"](a,"ps-active-y")}},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18}],20:[function(a,b,c){"use strict";var d=a("../lib/dom"),e=a("../lib/helper"),f=a("./instances"),g=a("./update-geometry");b.exports=function(a){var b=f.get(a);if(!b)throw new Error("perfect-scrollbar: instance not found");b.negativeScrollAdjustment=b.isNegativeScroll?a.scrollWidth-a.clientWidth:0,d.css(b.scrollbarXRail,"display","block"),d.css(b.scrollbarYRail,"display","block"),b.railXMarginWidth=e.toInt(d.css(b.scrollbarXRail,"marginLeft"))+e.toInt(d.css(b.scrollbarXRail,"marginRight")),b.railYMarginHeight=e.toInt(d.css(b.scrollbarYRail,"marginTop"))+e.toInt(d.css(b.scrollbarYRail,"marginBottom")),d.css(b.scrollbarXRail,"display","none"),d.css(b.scrollbarYRail,"display","none"),g(a),d.css(b.scrollbarXRail,"display",""),d.css(b.scrollbarYRail,"display","")}},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19}]},{},[1]),$(document).ready(function(){$(".scroll").perfectScrollbar(),$("#preview").click(function(a){a.preventDefault();var b=$("#preview-area"),c=$(".editor textarea");if("true"==$(this).attr("previewing"))b.hide(),c.fadeIn(),$(this).attr("previewing","false");else{var d=new showdown.Converter,e=c.val(),f=d.makeHtml(e);c.hide(),b.html(f).fadeIn(),$(this).attr("previewing","true")}return!1}),$("form").submit(function(a){var b=JSON.stringify($(this).serializeForm()),c=$(this).attr("action"),d=$(this).find("input[type=submit]:focus").val();console.log(b),$.ajax({type:"POST",url:c,data:b,beforeSend:function(a){a.setRequestHeader("X-Save-Mode",d)},dataType:"json",encode:!0}).done(function(a){alert("It was saved and/or published")}).fail(function(a){alert("Something went wrong")}),a.preventDefault()}),$("#logout").click(function(a){return a.preventDefault(),jQuery.ajax({type:"GET",url:"/admin",async:!1,username:"logmeout",password:"123456",headers:{Authorization:"Basic xxx"}}).fail(function(){window.location="/"}),!1}),$(".add").click(function(a){return a.preventDefault(),fieldset=$(this).closest("fieldset"),fieldset.append('<input name="'+fieldset.attr("name")+'" id="'+fieldset.attr("name")+'" value=""></input><br>'),!1})}),$.fn.serializeForm=function(){var a={};return this.each(function(){$(this).find(".data > *").each(function(){var b=$(this),c=b.attr("name");b.is("fieldset")&&c?"array"==b.attr("type")?(a[this.name]=[],$.each(b.serializeArray(),function(){a[this.name].push(this.value)})):a[c]=b.serializeForm():$.each(b.serializeArray(),function(){a[this.name]=this.value})})}),a}; |