From 18e48404b4ba3df23b3181e9b0ec3f2f33e3bb17 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Wed, 15 Aug 2018 07:59:34 +0000 Subject: [PATCH] custom scrollbar better support for iframes hopefully --- .../titanembeds/static/js/vendor/jquery.mCustomScrollbar.min.js | 1 + webapp/titanembeds/templates/embed.html.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 webapp/titanembeds/static/js/vendor/jquery.mCustomScrollbar.min.js diff --git a/webapp/titanembeds/static/js/vendor/jquery.mCustomScrollbar.min.js b/webapp/titanembeds/static/js/vendor/jquery.mCustomScrollbar.min.js new file mode 100644 index 0000000..9bd89bb --- /dev/null +++ b/webapp/titanembeds/static/js/vendor/jquery.mCustomScrollbar.min.js @@ -0,0 +1 @@ +(function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"undefined"!=typeof module&&module.exports?module.exports=n:n(jQuery,window,document)})(function(n){(function(u){var g="function"==typeof define&&define.amd,_="undefined"!=typeof module&&module.exports,S="https:"==document.location.protocol?"https:":"http:";g||(_?require("jquery-mousewheel")(n):n.event.special.mousewheel||n("head").append(decodeURI("%3Cscript src="+S+"//"+"cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"+"%3E%3C/script%3E"))),u()})(function(){var k,u="mCustomScrollbar",g="mCS",_=".mCustomScrollbar",S={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},v=0,C={},B=window.attachEvent&&!window.addEventListener?1:0,T=!1,O=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],D={init:function(ye){var ye=n.extend(!0,{},S,ye),Be=E.call(this);if(ye.live){var Te=ye.liveSelector||this.selector||_,ke=n(Te);if("off"===ye.live)return void I(Te);C[Te]=setTimeout(function(){ke.mCustomScrollbar(ye),"once"===ye.live&&ke.length&&I(Te)},500)}else I(Te);return ye.setWidth=ye.set_width?ye.set_width:ye.setWidth,ye.setHeight=ye.set_height?ye.set_height:ye.setHeight,ye.axis=ye.horizontalScroll?"x":R(ye.axis),ye.scrollInertia=0ye.scrollInertia?17:ye.scrollInertia,"object"!=typeof ye.mouseWheel&&!0==ye.mouseWheel&&(ye.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),ye.mouseWheel.scrollAmount=ye.mouseWheelPixels?ye.mouseWheelPixels:ye.mouseWheel.scrollAmount,ye.mouseWheel.normalizeDelta=ye.advanced.normalizeMouseWheelDelta?ye.advanced.normalizeMouseWheelDelta:ye.mouseWheel.normalizeDelta,ye.scrollButtons.scrollType=L(ye.scrollButtons.scrollType),W(ye),n(Be).each(function(){var Oe=n(this);if(!Oe.data(g)){Oe.data(g,{idx:++v,opt:ye,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:Oe.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var De=Oe.data(g),Ee=De.opt,We=Oe.data("mcs-axis"),Ie=Oe.data("mcs-scrollbar-position"),Re=Oe.data("mcs-theme");We&&(Ee.axis=We),Ie&&(Ee.scrollbarPosition=Ie),Re&&(Ee.theme=Re,W(Ee)),A.call(this),De&&Ee.callbacks.onCreate&&"function"==typeof Ee.callbacks.onCreate&&Ee.callbacks.onCreate.call(this),n("#mCSB_"+De.idx+"_container img:not(."+O[2]+")").addClass(O[2]),D.update.call(null,Oe)}})},update:function(ye,Be){var Te=ye||E.call(this);return n(Te).each(function(){var ke=n(this);if(ke.data(g)){var Oe=ke.data(g),De=Oe.opt,Ee=n("#mCSB_"+Oe.idx+"_container"),We=n("#mCSB_"+Oe.idx),Ie=[n("#mCSB_"+Oe.idx+"_dragger_vertical"),n("#mCSB_"+Oe.idx+"_dragger_horizontal")];if(!Ee.length)return;Oe.tweenRunning&&pe(ke),Be&&Oe&&De.callbacks.onBeforeUpdate&&"function"==typeof De.callbacks.onBeforeUpdate&&De.callbacks.onBeforeUpdate.call(this),ke.hasClass(O[3])&&ke.removeClass(O[3]),ke.hasClass(O[4])&&ke.removeClass(O[4]),We.css("max-height","none"),We.height()!==ke.height()&&We.css("max-height",ke.height()),P.call(this),"y"===De.axis||De.advanced.autoExpandHorizontalScroll||Ee.css("width",z(Ee)),Oe.overflowed=q.call(this),N.call(this),De.autoDraggerLength&&M.call(this),U.call(this),X.call(this);var Re=[Math.abs(Ee[0].offsetTop),Math.abs(Ee[0].offsetLeft)];"x"!==De.axis&&(Oe.overflowed[0]?Ie[0].height()>Ie[0].parent().height()?Y.call(this):(fe(ke,Re[0].toString(),{dir:"y",dur:0,overwrite:"none"}),Oe.contentReset.y=null):(Y.call(this),"y"===De.axis?j.call(this):"yx"===De.axis&&Oe.overflowed[1]&&fe(ke,Re[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==De.axis&&(Oe.overflowed[1]?Ie[1].width()>Ie[1].parent().width()?Y.call(this):(fe(ke,Re[1].toString(),{dir:"x",dur:0,overwrite:"none"}),Oe.contentReset.x=null):(Y.call(this),"x"===De.axis?j.call(this):"yx"===De.axis&&Oe.overflowed[0]&&fe(ke,Re[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),Be&&Oe&&(2===Be&&De.callbacks.onImageLoad&&"function"==typeof De.callbacks.onImageLoad?De.callbacks.onImageLoad.call(this):3===Be&&De.callbacks.onSelectorChange&&"function"==typeof De.callbacks.onSelectorChange?De.callbacks.onSelectorChange.call(this):De.callbacks.onUpdate&&"function"==typeof De.callbacks.onUpdate&&De.callbacks.onUpdate.call(this)),ue.call(this)}})},scrollTo:function(ye,Be){if("undefined"!=typeof ye&&null!=ye){var Te=E.call(this);return n(Te).each(function(){var ke=n(this);if(ke.data(g)){var Oe=ke.data(g),De=Oe.opt,Ee={trigger:"external",scrollInertia:De.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},We=n.extend(!0,{},Ee,Be),Ie=de.call(this,ye),Re=0We.scrollInertia?17:We.scrollInertia;Ie[0]=ce.call(this,Ie[0],"y"),Ie[1]=ce.call(this,Ie[1],"x"),We.moveDragger&&(Ie[0]*=Oe.scrollRatio.y,Ie[1]*=Oe.scrollRatio.x),We.dur=Ce()?0:Re,setTimeout(function(){null!==Ie[0]&&"undefined"!=typeof Ie[0]&&"x"!==De.axis&&Oe.overflowed[0]&&(We.dir="y",We.overwrite="all",fe(ke,Ie[0].toString(),We)),null!==Ie[1]&&"undefined"!=typeof Ie[1]&&"y"!==De.axis&&Oe.overflowed[1]&&(We.dir="x",We.overwrite="none",fe(ke,Ie[1].toString(),We))},We.timeout)}})}},stop:function(){var ye=E.call(this);return n(ye).each(function(){var Be=n(this);Be.data(g)&&pe(Be)})},disable:function(ye){var Be=E.call(this);return n(Be).each(function(){var Te=n(this);if(Te.data(g)){Te.data(g);ue.call(this,"remove"),j.call(this),ye&&Y.call(this),N.call(this,!0),Te.addClass(O[3])}})},destroy:function(){var ye=E.call(this);return n(ye).each(function(){var Be=n(this);if(Be.data(g)){var Te=Be.data(g),ke=Te.opt,Oe=n("#mCSB_"+Te.idx),De=n("#mCSB_"+Te.idx+"_container"),Ee=n(".mCSB_"+Te.idx+"_scrollbar");ke.live&&I(ke.liveSelector||n(ye).selector),ue.call(this,"remove"),j.call(this),Y.call(this),Be.removeData(g),_e(this,"mcs"),Ee.remove(),De.find("img."+O[2]).removeClass(O[2]),Oe.replaceWith(De.contents()),Be.removeClass(u+" _"+g+"_"+Te.idx+" "+O[6]+" "+O[7]+" "+O[5]+" "+O[3]).addClass(O[4])}})}},E=function(){return"object"!=typeof n(this)||1>n(this).length?_:this},W=function(ye){ye.autoDraggerLength=!(-1
","
"],De="yx"===Te.axis?"mCSB_vertical_horizontal":"x"===Te.axis?"mCSB_horizontal":"mCSB_vertical",Ee="yx"===Te.axis?Oe[0]+Oe[1]:"x"===Te.axis?Oe[1]:Oe[0],We="yx"===Te.axis?"
":"",Ie=Te.autoHideScrollbar?" "+O[6]:"",Re="x"!==Te.axis&&"rtl"===Be.langDir?" "+O[7]:"";Te.setWidth&&ye.css("width",Te.setWidth),Te.setHeight&&ye.css("height",Te.setHeight),Te.setLeft="y"!==Te.axis&&"rtl"===Be.langDir?"989999px":Te.setLeft,ye.addClass(u+" _"+g+"_"+Be.idx+Ie+Re).wrapInner("
");var Le=n("#mCSB_"+Be.idx),Ae=n("#mCSB_"+Be.idx+"_container");"y"===Te.axis||Te.advanced.autoExpandHorizontalScroll||Ae.css("width",z(Ae)),"outside"===Te.scrollbarPosition?("static"===ye.css("position")&&ye.css("position","relative"),ye.css("overflow","visible"),Le.addClass("mCSB_outside").after(Ee)):(Le.addClass("mCSB_inside").append(Ee),Ae.wrap(We)),H.call(this);var ze=[n("#mCSB_"+Be.idx+"_dragger_vertical"),n("#mCSB_"+Be.idx+"_dragger_horizontal")];ze[0].css("min-height",ze[0].height()),ze[1].css("min-width",ze[1].width())},z=function(ye){var Be=[ye[0].scrollWidth,Math.max.apply(Math,ye.children().map(function(){return n(this).outerWidth(!0)}).get())],Te=ye.parent().width();return Be[0]>Te?Be[0]:Be[1]>Te?Be[1]:"100%"},P=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=n("#mCSB_"+Be.idx+"_container");if(Te.advanced.autoExpandHorizontalScroll&&"y"!==Te.axis){ke.css({width:"auto","min-width":0,"overflow-x":"scroll"});var Oe=Math.ceil(ke[0].scrollWidth);3===Te.advanced.autoExpandHorizontalScroll||2!==Te.advanced.autoExpandHorizontalScroll&&Oe>ke.parent().width()?ke.css({width:Oe,"min-width":"100%","overflow-x":"inherit"}):ke.css({"overflow-x":"inherit",position:"absolute"}).wrap("
").css({width:Math.ceil(ke[0].getBoundingClientRect().right+0.4)-Math.floor(ke[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},H=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=n(".mCSB_"+Be.idx+"_scrollbar:first"),Oe=be(Te.scrollButtons.tabindex)?"tabindex='"+Te.scrollButtons.tabindex+"'":"",De=["","","",""],Ee=["x"===Te.axis?De[2]:De[0],"x"===Te.axis?De[3]:De[1],De[2],De[3]];Te.scrollButtons.enable&&ke.prepend(Ee[0]).append(Ee[1]).next(".mCSB_scrollTools").prepend(Ee[2]).append(Ee[3])},M=function(){var ye=n(this),Be=ye.data(g),Te=n("#mCSB_"+Be.idx),ke=n("#mCSB_"+Be.idx+"_container"),Oe=[n("#mCSB_"+Be.idx+"_dragger_vertical"),n("#mCSB_"+Be.idx+"_dragger_horizontal")],De=[Te.height()/ke.outerHeight(!1),Te.width()/ke.outerWidth(!1)],Ee=[parseInt(Oe[0].css("min-height")),Math.round(De[0]*Oe[0].parent().height()),parseInt(Oe[1].css("min-width")),Math.round(De[1]*Oe[1].parent().width())],We=B&&Ee[1]Oe&&(Oe=Ee),We>De&&(De=We),[Oe>Te.height(),De>Te.width()]},Y=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=n("#mCSB_"+Be.idx),Oe=n("#mCSB_"+Be.idx+"_container"),De=[n("#mCSB_"+Be.idx+"_dragger_vertical"),n("#mCSB_"+Be.idx+"_dragger_horizontal")];if(pe(ye),("x"!==Te.axis&&!Be.overflowed[0]||"y"===Te.axis&&Be.overflowed[0])&&(De[0].add(Oe).css("top",0),fe(ye,"_resetY")),"y"!==Te.axis&&!Be.overflowed[1]||"x"===Te.axis&&Be.overflowed[1]){var Ee=dx=0;"rtl"===Be.langDir&&(Ee=ke.width()-Oe.outerWidth(!1),dx=Math.abs(Ee/Be.scrollRatio.x)),Oe.css("left",Ee),De[1].css("left",dx),fe(ye,"_resetX")}},X=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt;if(!Be.bindEvents){if(K.call(this),Te.contentTouchScroll&&G.call(this),J.call(this),Te.mouseWheel.enable){function Oe(){ke=setTimeout(function(){n.event.special.mousewheel?(clearTimeout(ke),Z.call(ye[0])):Oe()},100)}var ke;Oe()}ae.call(this),ne.call(this),Te.advanced.autoScrollOnFocus&&le.call(this),Te.scrollButtons.enable&&ie.call(this),Te.keyboard.enable&&re.call(this),Be.bindEvents=!0}},j=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=g+"_"+Be.idx,Oe=".mCSB_"+Be.idx+"_scrollbar",De=n("#mCSB_"+Be.idx+",#mCSB_"+Be.idx+"_container,#mCSB_"+Be.idx+"_container_wrapper,"+Oe+" ."+O[12]+",#mCSB_"+Be.idx+"_dragger_vertical,#mCSB_"+Be.idx+"_dragger_horizontal,"+Oe+">a"),Ee=n("#mCSB_"+Be.idx+"_container");if(Te.advanced.releaseDraggableSelectors&&De.add(n(Te.advanced.releaseDraggableSelectors)),Te.advanced.extraDraggableSelectors&&De.add(n(Te.advanced.extraDraggableSelectors)),Be.bindEvents){var We=ee()?top.document:document;n(document).add(n(We)).unbind("."+ke),De.each(function(){n(this).unbind("."+ke)}),clearTimeout(ye[0]._focusTimeout),_e(ye[0],"_focusTimeout"),clearTimeout(Be.sequential.step),_e(Be.sequential,"step"),clearTimeout(Ee[0].onCompleteTimeout),_e(Ee[0],"onCompleteTimeout"),Be.bindEvents=!1}},N=function(ye){var Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=n("#mCSB_"+Te.idx+"_container_wrapper"),De=Oe.length?Oe:n("#mCSB_"+Te.idx+"_container"),Ee=[n("#mCSB_"+Te.idx+"_scrollbar_vertical"),n("#mCSB_"+Te.idx+"_scrollbar_horizontal")],We=[Ee[0].find(".mCSB_dragger"),Ee[1].find(".mCSB_dragger")];"x"!==ke.axis&&(Te.overflowed[0]&&!ye?(Ee[0].add(We[0]).add(Ee[0].children("a")).css("display","block"),De.removeClass(O[8]+" "+O[10])):(ke.alwaysShowScrollbar?(2!==ke.alwaysShowScrollbar&&We[0].css("display","none"),De.removeClass(O[10])):(Ee[0].css("display","none"),De.addClass(O[10])),De.addClass(O[8]))),"y"!==ke.axis&&(Te.overflowed[1]&&!ye?(Ee[1].add(We[1]).add(Ee[1].children("a")).css("display","block"),De.removeClass(O[9]+" "+O[11])):(ke.alwaysShowScrollbar?(2!==ke.alwaysShowScrollbar&&We[1].css("display","none"),De.removeClass(O[11])):(Ee[1].css("display","none"),De.addClass(O[11])),De.addClass(O[9]))),Te.overflowed[0]||Te.overflowed[1]?Be.removeClass(O[5]):Be.addClass(O[5])},V=function(ye){var Be=ye.type,Te=ye.target.ownerDocument!==document&&null!==frameElement?[n(frameElement).offset().top,n(frameElement).offset().left]:null,ke=ee()&&ye.target.ownerDocument!==top.document&&null!==frameElement?[n(ye.view.frameElement).offset().top,n(ye.view.frameElement).offset().left]:[0,0];switch(Be){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return Te?[ye.originalEvent.pageY-Te[0]+ke[0],ye.originalEvent.pageX-Te[1]+ke[1],!1]:[ye.originalEvent.pageY,ye.originalEvent.pageX,!1];break;case"touchstart":case"touchmove":case"touchend":var Oe=ye.originalEvent.touches[0]||ye.originalEvent.changedTouches[0],De=ye.originalEvent.touches.length||ye.originalEvent.changedTouches.length;return ye.target.ownerDocument===document?[Oe.pageY,Oe.pageX,1ke.scrollInertia?250:0,Ie.attr("id")===De[1])var qe="x",Ye=(Ie[0].offsetLeft-Me+Fe)*Te.scrollRatio.x;else var qe="y",Ye=(Ie[0].offsetTop-He+Ue)*Te.scrollRatio.y;fe(Be,Ye.toString(),{dir:qe,drag:!0})}var Ie,Re,Le,Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=g+"_"+Te.idx,De=["mCSB_"+Te.idx+"_dragger_vertical","mCSB_"+Te.idx+"_dragger_horizontal"],Ee=n("#mCSB_"+Te.idx+"_container"),We=n("#"+De[0]+",#"+De[1]),Ae=ke.advanced.releaseDraggableSelectors?We.add(n(ke.advanced.releaseDraggableSelectors)):We,ze=ee()?top.document:document,Pe=ke.advanced.extraDraggableSelectors?n(ze).add(n(ke.advanced.extraDraggableSelectors)):n(ze);We.bind("contextmenu."+Oe,function(He){He.preventDefault()}).bind("mousedown."+Oe+" touchstart."+Oe+" pointerdown."+Oe+" MSPointerDown."+Oe,function(He){if(He.stopImmediatePropagation(),He.preventDefault(),!!Se(He)){T=!0,B&&(document.onselectstart=function(){return!1}),te.call(Ee,!1),pe(Be),Ie=n(this);var Me=Ie.offset(),Ue=V(He)[0]-Me.top,Fe=V(He)[1]-Me.left,qe=Ie.height()+Me.top,Ye=Ie.width()+Me.left;Ue-(ct*We.scrollRatio.y)&&(2*Qe[3]-(mt*We.scrollRatio.x)&&(2*Qe[2]Ke,ut=ct?[qe[qe.length-2],Ye[Ye.length-2]]:[0,0];Ve=ct?[rt-ut[0],st-ut[1]]:[rt-Ue,st-Fe];var mt=[Math.abs(Ve[0]),Math.abs(Ve[1])];Ke=ct?[Math.abs(Ve[0]/4),Math.abs(Ve[1]/4)]:[Ke,Ke];var pt=[Math.abs(Ae[0].offsetTop)-Ve[0]*Oe(mt[0]/Ke[0],Ke[0]),Math.abs(Ae[0].offsetLeft)-Ve[1]*Oe(mt[1]/Ke[1],Ke[1])];Ge="yx"===Ie.axis?[pt[0],pt[1]]:"x"===Ie.axis?[null,pt[1]]:[pt[0],null],Ze=[4*mt[0]+Ie.scrollInertia,4*mt[1]+Ie.scrollInertia];var ft=parseInt(Ie.contentTouchScroll)||0;Ge[0]=mt[0]>ft?Ge[0]:0,Ge[1]=mt[1]>ft?Ge[1]:0,We.overflowed[0]&&De(Ge[0],Ze[0],dt,"y",$e,!1),We.overflowed[1]&&De(Ge[1],Ze[1],dt,"x",$e,!1)}}}function Oe(nt,it){var rt=[1.5*it,2*it,it/1.5,it/2];return 90ze?Be("on",38):ze>Ie.height()&&Be("on",40)),"y"!==Oe.axis&&ke.overflowed[1]&&(0>Pe?Be("on",37):Pe>Ie.width()&&Be("on",39)))}}).bind("mouseup."+Ee+" dragend."+Ee,function(){k||(Re&&(Re=0,Be("off",null)),T=!1)})},Z=function(){function ye(Ie,Re){if(pe(Be),!oe(Be,Ie.target)){var Le="auto"===ke.mouseWheel.deltaFactor?B&&100>Ie.deltaFactor?100:Ie.deltaFactor||100:parseInt(ke.mouseWheel.deltaFactor),Ae=ke.scrollInertia;if("x"===ke.axis||"x"===ke.mouseWheel.axis)var ze="x",Pe=[Math.round(Le*Te.scrollRatio.x),parseInt(ke.mouseWheel.scrollAmount)],He="auto"===ke.mouseWheel.scrollAmount?Pe[0]>=De.width()?0.9*De.width():Pe[0]:Pe[1],Me=Math.abs(n("#mCSB_"+Te.idx+"_container")[0].offsetLeft),Ue=Ee[1][0].offsetLeft,Fe=Ee[1].parent().width()-Ee[1].width(),qe="y"===ke.mouseWheel.axis?Ie.deltaY||Re:Ie.deltaX;else var ze="y",Pe=[Math.round(Le*Te.scrollRatio.y),parseInt(ke.mouseWheel.scrollAmount)],He="auto"===ke.mouseWheel.scrollAmount?Pe[0]>=De.height()?0.9*De.height():Pe[0]:Pe[1],Me=Math.abs(n("#mCSB_"+Te.idx+"_container")[0].offsetTop),Ue=Ee[0][0].offsetTop,Fe=Ee[0].parent().height()-Ee[0].height(),qe=Ie.deltaY||Re;("y"!=ze||Te.overflowed[0])&&("x"!=ze||Te.overflowed[1])&&((ke.mouseWheel.invert||Ie.webkitDirectionInvertedFromDevice)&&(qe=-qe),ke.mouseWheel.normalizeDelta&&(qe=0>qe?-1:1),(0qe&&Ue!==Fe||ke.mouseWheel.preventDefault)&&(Ie.stopImmediatePropagation(),Ie.preventDefault()),5>Ie.deltaFactor&&!ke.mouseWheel.normalizeDelta&&(He=Ie.deltaFactor,Ae=17),fe(Be,(Me-qe*He).toString(),{dir:ze,dur:Ae}))}}if(n(this).data(g)){var Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=g+"_"+Te.idx,De=n("#mCSB_"+Te.idx),Ee=[n("#mCSB_"+Te.idx+"_dragger_vertical"),n("#mCSB_"+Te.idx+"_dragger_horizontal")],We=n("#mCSB_"+Te.idx+"_container").find("iframe");We.length&&We.each(function(){n(this).bind("load",function(){ee(this)&&n(this.contentDocument||this.contentWindow.document).bind("mousewheel."+Oe,function(Ie,Re){ye(Ie,Re)})})}),De.bind("mousewheel."+Oe,function(Ie,Re){ye(Ie,Re)})}},Q={},ee=function(ye){var Be=!1,Te=!1,ke=null;if(void 0===ye?Te="#empty":void 0!==n(ye).attr("id")&&(Te=n(ye).attr("id")),!1!=Te&&void 0!==Q[Te])return Q[Te];if(!ye){try{var Oe=top.document;ke=Oe.body.innerHTML}catch(De){}Be=null!==ke}else{try{var Oe=ye.contentDocument||ye.contentWindow.document;ke=Oe.body.innerHTML}catch(De){}Be=null!==ke}return!1!=Te&&(Q[Te]=Be),Be},te=function(ye){var Be=this.find("iframe");if(Be.length){var Te=ye?"auto":"none";Be.css("pointer-events",Te)}},oe=function(ye,Be){var Te=Be.nodeName.toLowerCase(),ke=ye.data(g).opt.mouseWheel.disableOver;return-1Re.offset().left?-1:1,ze=Math.abs(ke[0].offsetLeft)-Ae*(0.9*Oe.width())}else{if(!Be.overflowed[0])return;var Le="y",Ae=We.pageY>Re.offset().top?-1:1,ze=Math.abs(ke[0].offsetTop)-Ae*(0.9*Oe.height())}fe(ye,ze.toString(),{dir:Le,scrollEasing:"mcsEaseInOut"})}})},le=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=g+"_"+Be.idx,Oe=n("#mCSB_"+Be.idx+"_container"),De=Oe.parent();Oe.bind("focusin."+ke,function(){var We=n(document.activeElement),Ie=Oe.find(".mCustomScrollBox").length,Re=0;We.is(Te.advanced.autoScrollOnFocus)&&(pe(ye),clearTimeout(ye[0]._focusTimeout),ye[0]._focusTimer=Ie?(Re+17)*Ie:0,ye[0]._focusTimeout=setTimeout(function(){var Le=[we(We)[0],we(We)[1]],Ae=[Oe[0].offsetTop,Oe[0].offsetLeft],ze=[0<=Ae[0]+Le[0]&&Ae[0]+Le[0]a");Ee.bind("contextmenu."+Oe,function(We){We.preventDefault()}).bind("mousedown."+Oe+" touchstart."+Oe+" pointerdown."+Oe+" MSPointerDown."+Oe+" mouseup."+Oe+" touchend."+Oe+" pointerup."+Oe+" MSPointerUp."+Oe+" mouseout."+Oe+" pointerout."+Oe+" MSPointerOut."+Oe+" click."+Oe,function(We){function Ie(Le,Ae){ke.scrollAmount=Te.scrollButtons.scrollAmount,se(ye,Le,Ae)}if(We.preventDefault(),!!Se(We)){var Re=n(this).attr("class");switch(ke.type=Te.scrollButtons.scrollType,We.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===ke.type)return;T=!0,Be.tweenRunning=!1,Ie("on",Re);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===ke.type)return;T=!1,ke.dir&&Ie("off",Re);break;case"click":if("stepped"!==ke.type||Be.tweenRunning)return;Ie("on",Re);}}})},re=function(){function ye(ze){function Pe(Ye,Xe){Oe.type=ke.keyboard.scrollType,Oe.scrollAmount=ke.keyboard.scrollAmount;"stepped"===Oe.type&&Te.tweenRunning||se(Be,Ye,Xe)}switch(ze.type){case"blur":Te.tweenRunning&&Oe.dir&&Pe("off",null);break;case"keydown":case"keyup":var He=ze.keyCode?ze.keyCode:ze.which,Me="on";if("x"!==ke.axis&&(38===He||40===He)||"y"!==ke.axis&&(37===He||39===He)){if((38===He||40===He)&&!Te.overflowed[0]||(37===He||39===He)&&!Te.overflowed[1])return;"keyup"===ze.type&&(Me="off"),n(document.activeElement).is(Re)||(ze.preventDefault(),ze.stopImmediatePropagation(),Pe(Me,He))}else if(33===He||34===He){if((Te.overflowed[0]||Te.overflowed[1])&&(ze.preventDefault(),ze.stopImmediatePropagation()),"keyup"===ze.type){pe(Be);var Ue=34===He?-1:1;if("x"===ke.axis||"yx"===ke.axis&&Te.overflowed[1]&&!Te.overflowed[0])var Fe="x",qe=Math.abs(We[0].offsetLeft)-Ue*(0.9*Ie.width());else var Fe="y",qe=Math.abs(We[0].offsetTop)-Ue*(0.9*Ie.height());fe(Be,qe.toString(),{dir:Fe,scrollEasing:"mcsEaseInOut"})}}else if((35===He||36===He)&&!n(document.activeElement).is(Re)&&((Te.overflowed[0]||Te.overflowed[1])&&(ze.preventDefault(),ze.stopImmediatePropagation()),"keyup"===ze.type)){if("x"===ke.axis||"yx"===ke.axis&&Te.overflowed[1]&&!Te.overflowed[0])var Fe="x",qe=35===He?Math.abs(Ie.width()-We.outerWidth(!1)):0;else var Fe="y",qe=35===He?Math.abs(Ie.height()-We.outerHeight(!1)):0;fe(Be,qe.toString(),{dir:Fe,scrollEasing:"mcsEaseInOut"})}}}var Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=Te.sequential,De=g+"_"+Te.idx,Ee=n("#mCSB_"+Te.idx),We=n("#mCSB_"+Te.idx+"_container"),Ie=We.parent(),Re="input,textarea,select,datalist,keygen,[contenteditable='true']",Le=We.find("iframe"),Ae=["blur."+De+" keydown."+De+" keyup."+De];Le.length&&Le.each(function(){n(this).bind("load",function(){ee(this)&&n(this.contentDocument||this.contentWindow.document).bind(Ae[0],function(ze){ye(ze)})})}),Ee.attr("tabindex","0").bind(Ae[0],function(ze){ye(ze)})},se=function(ye,Be,Te,ke,Oe){function De(He){Ie.snapAmount&&(Re.scrollAmount=Ie.snapAmount instanceof Array?"x"===Re.dir[0]?Ie.snapAmount[1]:Ie.snapAmount[0]:Ie.snapAmount);var Me="stepped"!==Re.type,Ue=Oe?Oe:He?Me?ze/1.5:Pe:1e3/60,Fe=He?Me?7.5:40:2.5,qe=[Math.abs(Le[0].offsetTop),Math.abs(Le[0].offsetLeft)],Ye=[10Ue&&(Ne="x"===Re.dir[0]?qe[1]:qe[0]),fe(ye,Ne.toString(),{dir:Re.dir[0],scrollEasing:Ve,dur:Ue,onComplete:!!He}),He?void(Re.dir=!1):void(clearTimeout(Re.step),Re.step=setTimeout(function(){De()},Ue))}function Ee(){clearTimeout(Re.step),_e(Re,"step"),pe(ye)}var We=ye.data(g),Ie=We.opt,Re=We.sequential,Le=n("#mCSB_"+We.idx+"_container"),Ae=!("stepped"!==Re.type),ze=26>Ie.scrollInertia?26:Ie.scrollInertia,Pe=1>Ie.scrollInertia?17:Ie.scrollInertia;switch(Be){case"on":if(Re.dir=[Te===O[16]||Te===O[15]||39===Te||37===Te?"x":"y",Te===O[13]||Te===O[15]||38===Te||37===Te?-1:1],pe(ye),be(Te)&&"stepped"===Re.type)return;De(Ae);break;case"off":Ee(),(Ae||We.tweenRunning&&Re.dir)&&De(!0);}},de=function(ye){var Be=n(this).data(g).opt,Te=[];return"function"==typeof ye&&(ye=ye()),ye instanceof Array?Te=1=Ye[0]+je,We.callbacks.alwaysTriggerOffsets||qe<=-Ne]}function De(){var Ge=[Ae[0].offsetTop,Ae[0].offsetLeft],Je=[Ue[0].offsetTop,Ue[0].offsetLeft],Ze=[Ae.outerHeight(!1),Ae.outerWidth(!1)],$e=[Le.height(),Le.width()];ye[0].mcs={content:Ae,top:Ge[0],left:Ge[1],draggerTop:Je[0],draggerLeft:Je[1],topPct:Math.round(100*Math.abs(Ge[0])/(Math.abs(Ze[0])-$e[0])),leftPct:Math.round(100*Math.abs(Ge[1])/(Math.abs(Ze[1])-$e[1])),direction:Te.dir}}var Ee=ye.data(g),We=Ee.opt,Ie={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:We.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},Te=n.extend(Ie,Te),Re=[Te.dur,Te.drag?0:Te.dur],Le=n("#mCSB_"+Ee.idx),Ae=n("#mCSB_"+Ee.idx+"_container"),ze=Ae.parent(),Pe=We.callbacks.onTotalScrollOffset?de.call(ye,We.callbacks.onTotalScrollOffset):[0,0],He=We.callbacks.onTotalScrollBackOffset?de.call(ye,We.callbacks.onTotalScrollBackOffset):[0,0];if(Ee.trigger=Te.trigger,(0!==ze.scrollTop()||0!==ze.scrollLeft())&&(n(".mCSB_"+Ee.idx+"_scrollbar").css("visibility","visible"),ze.scrollTop(0).scrollLeft(0)),"_resetY"!==Be||Ee.contentReset.y||(ke("onOverflowYNone")&&We.callbacks.onOverflowYNone.call(ye[0]),Ee.contentReset.y=1),"_resetX"!==Be||Ee.contentReset.x||(ke("onOverflowXNone")&&We.callbacks.onOverflowXNone.call(ye[0]),Ee.contentReset.x=1),"_resetY"!==Be&&"_resetX"!==Be){if((Ee.contentReset.y||!ye[0].mcs)&&Ee.overflowed[0]&&(ke("onOverflowY")&&We.callbacks.onOverflowY.call(ye[0]),Ee.contentReset.x=null),(Ee.contentReset.x||!ye[0].mcs)&&Ee.overflowed[1]&&(ke("onOverflowX")&&We.callbacks.onOverflowX.call(ye[0]),Ee.contentReset.x=null),We.snapAmount){var Me=We.snapAmount instanceof Array?"x"===Te.dir?We.snapAmount[1]:We.snapAmount[0]:We.snapAmount;Be=me(Be,Me,We.snapOffset)}switch(Te.dir){case"x":var Ue=n("#mCSB_"+Ee.idx+"_dragger_horizontal"),Fe="left",qe=Ae[0].offsetLeft,Ye=[Le.width()-Ae.outerWidth(!1),Ue.parent().width()-Ue.width()],Xe=[Be,0===Be?0:Be/Ee.scrollRatio.x],je=Pe[1],Ne=He[1],Ve=0Xe[1]||0===Xe[0]&&0===Xe[1]?Xe=[0,0]:Xe[1]>=Ye[1]?Xe=[Ye[0],Ye[1]]:Xe[0]=-Xe[0],ye[0].mcs||(De(),ke("onInit")&&We.callbacks.onInit.call(ye[0])),clearTimeout(Ae[0].onCompleteTimeout),he(Ue[0],Fe,Math.round(Xe[1]),Re[1],Te.scrollEasing),!Ee.tweenRunning&&(0===qe&&0<=Xe[0]||qe===Ye[0]&&Xe[0]<=Ye[0])||he(Ae[0],Fe,Math.round(Xe[0]),Re[0],Te.scrollEasing,Te.overwrite,{onStart:function(){Te.callbacks&&Te.onStart&&!Ee.tweenRunning&&(ke("onScrollStart")&&(De(),We.callbacks.onScrollStart.call(ye[0])),Ee.tweenRunning=!0,F(Ue),Ee.cbOffsets=Oe())},onUpdate:function(){Te.callbacks&&Te.onUpdate&&ke("whileScrolling")&&(De(),We.callbacks.whileScrolling.call(ye[0]))},onComplete:function(){if(Te.callbacks&&Te.onComplete){"yx"===We.axis&&clearTimeout(Ae[0].onCompleteTimeout);var Ge=Ae[0].idleTimer||0;Ae[0].onCompleteTimeout=setTimeout(function(){ke("onScroll")&&(De(),We.callbacks.onScroll.call(ye[0])),ke("onTotalScroll")&&Xe[1]>=Ye[1]-Ve&&Ee.cbOffsets[0]&&(De(),We.callbacks.onTotalScroll.call(ye[0])),ke("onTotalScrollBack")&&Xe[1]<=Ke&&Ee.cbOffsets[1]&&(De(),We.callbacks.onTotalScrollBack.call(ye[0])),Ee.tweenRunning=!1,Ae[0].idleTimer=0,F(Ue,"hide")},Ge)}}})}},he=function(ye,Be,Te,ke,Oe,De,Ee){function We(){je.stop||(!Fe&&ze.call(),Fe=ge()-Me,Ie(),Fe>=je.time&&(je.time=Fe>je.time?Fe+Ue-(Fe-je.time):Fe+Ue-1,je.timeVe)?Ge/2*Ve*Ve+Ke:(Ve--,-Ge/2*(Ve*(Ve-2)-1)+Ke);break;case"easeInOutStrong":return(Ve/=Je/2,1>Ve)?Ge/2*Math.pow(2,10*(Ve-1))+Ke:(Ve--,Ge/2*(-Math.pow(2,-10*Ve)+2)+Ke);break;case"easeInOut":case"mcsEaseInOut":return(Ve/=Je/2,1>Ve)?Ge/2*Ve*Ve*Ve+Ke:(Ve-=2,Ge/2*(Ve*Ve*Ve+2)+Ke);break;case"easeOutSmooth":return Ve/=Je,Ve--,-Ge*(Ve*Ve*Ve*Ve-1)+Ke;break;case"easeOutStrong":return Ge*(-Math.pow(2,-10*Ve/Je)+1)+Ke;break;case"easeOut":case"mcsEaseOut":default:var $e=(Ve/=Je)*Ve,Qe=$e*Ve;return Ke+Ge*(0.499999999999997*Qe*$e+-2.5*$e*$e+5.5*Qe+-6.5*$e+4*Ve);}}ye._mTween||(ye._mTween={top:{},left:{}});var Ue,Xe,Ee=Ee||{},ze=Ee.onStart||function(){},Pe=Ee.onUpdate||function(){},He=Ee.onComplete||function(){},Me=ge(),Fe=0,qe=ye.offsetTop,Ye=ye.style,je=ye._mTween[Be];"left"===Be&&(qe=ye.offsetLeft);var Ne=Te-qe;je.stop=0,"none"!==De&&function(){null==je.id||(window.requestAnimationFrame?window.cancelAnimationFrame(je.id):clearTimeout(je.id),je.id=null)}(),function(){Ue=1e3/60,je.time=Fe+Ue,Xe=window.requestAnimationFrame?window.requestAnimationFrame:function(Ve){return Ie(),setTimeout(Ve,0.01)},je.id=Xe(We)}()},ge=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():new Date().getTime()},xe=function(){var ye=this;ye._mTween||(ye._mTween={top:{},left:{}});for(var ke,Be=["top","left"],Te=0;TeWe[0]-Ee[0]*Ie[0][0]&&0<=We[0]+Oe[0]-Ee[0]*Ie[0][1]&&0>We[1]-Ee[1]*Ie[1][0]&&0<=We[1]+Oe[1]-Ee[1]*Ie[1][1]},mcsOverflow:n.expr[":"].mcsOverflow||function(ye){var Be=n(ye).data(g);return Be?Be.overflowed[0]||Be.overflowed[1]:void 0}})})})}); \ No newline at end of file diff --git a/webapp/titanembeds/templates/embed.html.j2 b/webapp/titanembeds/templates/embed.html.j2 index ad5180b..82ab348 100644 --- a/webapp/titanembeds/templates/embed.html.j2 +++ b/webapp/titanembeds/templates/embed.html.j2 @@ -332,12 +332,12 @@ - + {% include 'sentry_js_init.html.j2' %}