1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
hubzilla_ynh/sources/addons/tour/jquery-tourbus.min.js

1 line
No EOL
10 KiB
JavaScript

(function e(t,i,s){function o(r,h){if(!i[r]){if(!t[r]){var l="function"==typeof require&&require;if(!h&&l)return l(r,!0);if(n)return n(r,!0);throw Error("Cannot find module '"+r+"'")}var u=i[r]={exports:{}};t[r][0].call(u.exports,function(i){var s=t[r][1][i];return o(s?s:i)},u,u.exports,e,t,i,s)}return i[r].exports}for(var n="function"==typeof require&&require,r=0;s.length>r;r++)o(s[r]);return o})({1:[function(t){(function(){var i,s,e,o,n,r=[].slice;i=jQuery,s=t("./modules/bus"),e=t("./modules/leg"),n=i.tourbus=function(){var t,s;return t=arguments.length>=1?r.call(arguments,0):[],s=t[0],o.hasOwnProperty(s)?t=t.slice(1):s instanceof i?s="build":"string"==typeof s?(s="build",t[0]=i(t[0])):i.error("Unknown method of $.tourbus --",t),o[s].apply(this,t)},i.fn.tourbus=function(){var t;return t=arguments.length>=1?r.call(arguments,0):[],this.each(function(){return t.unshift(i(this)),n.apply(null,["build"].concat(r.call(t))),this})},o={build:function(t,e){var o;return null==e&&(e={}),e=i.extend(!0,{},n.defaults,e),o=[],t instanceof i||(t=i(t)),t.each(function(){return o.push(new s(this,e))}),0===o.length&&i.error(""+t.selector+" was not found!"),1===o.length?o[0]:o},destroyAll:function(){var t,i,e,o;e=s._busses,o=[];for(i in e)t=e[i],o.push(t.destroy());return o},expose:function(t){return t.tourbus={Bus:s,Leg:e}}},n.defaults={debug:!1,autoDepart:!1,container:"body","class":null,startAt:0,onDepart:function(){return null},onStop:function(){return null},onLegStart:function(){return null},onLegEnd:function(){return null},leg:{"class":null,scrollTo:null,scrollSpeed:150,scrollContext:100,orientation:"bottom",align:"left",width:"auto",margin:10,top:null,left:null,zindex:9999,arrow:"50%"}}}).call(this)},{"./modules/bus":2,"./modules/leg":3}],2:[function(t,i){(function(){var s,e,o,n,r=[].slice;s=jQuery,o=t("./leg"),n=t("./utils"),i.exports=e=function(){function t(t,i){this.options=i,this.id=this.constructor.uniqueId(),this.elId="tourbus-"+this.id,this.constructor._busses[this.id]=this,this.$original=s(t),this.rawData=this.$original.data(),this.$container=s(n.dataProp(this.rawData.container,this.options.container)),this.$original.data({tourbus:this}),this.currentLegIndex=null,this.legs=[],this.legEls=this.$original.children("li"),this.totalLegs=this.legEls.length,this._configureElement(),this._setupEvents(),n.dataProp(this.rawData.autoDepart,this.options.autoDepart)&&this.$original.trigger("depart.tourbus"),this._log("built tourbus with el",""+t,"and options",this.options)}return t._busses={},t._tours=0,t.uniqueId=function(){return this._tours++},t.prototype.depart=function(){return this.running=!0,this.options.onDepart(this),this._log("departing",this),this.currentLegIndex=n.dataProp(this.rawData.startAt,this.options.startAt),this.showLeg()},t.prototype.stop=function(){return this.running?(s.each(this.legs,s.proxy(this.hideLeg,this)),this.currentLegIndex=null,this.options.onStop(this),this.running=!1):void 0},t.prototype.on=function(t,i,s){return this.$container.on(t,i,s)},t.prototype.currentLeg=function(){return null===this.currentLegIndex?null:this.legs[this.currentLegIndex]},t.prototype.buildLeg=function(t){var i,e,n;return i=s(this.legEls[t]),e=i.data(),this.legs[t]=n=new o({bus:this,original:i,target:e.el||"body",index:t,rawData:e}),n.render(),this.$el.append(n.$el),n._position(),n.hide(),n},t.prototype.showLeg=function(t){var i,s;return null==t&&(t=this.currentLegIndex),i=this.legs[t]||this.buildLeg(t),this._log("showLeg:",i),s=this.options.onLegStart(i,this),s!==!1&&i.show(),++t<this.totalLegs&&!this.legs[t]?this.buildLeg(t):void 0},t.prototype.hideLeg=function(t){var i,s;return null==t&&(t=this.currentLegIndex),i=this.legs[t],i&&i.visible&&(this._log("hideLeg:",i),s=this.options.onLegEnd(i,this),s!==!1&&i.hide()),--t>0&&!this.legs[t]?this.buildLeg(t):void 0},t.prototype.repositionLegs=function(){return s.each(this.legs,function(){return this.reposition()})},t.prototype.next=function(){return this.hideLeg(),this.currentLegIndex++,this.currentLegIndex>this.totalLegs-1?this.$original.trigger("stop.tourbus"):this.showLeg()},t.prototype.prev=function(){return this.hideLeg(),this.currentLegIndex--,0>this.currentLegIndex?this.$original.trigger("stop.tourbus"):this.showLeg()},t.prototype.destroy=function(){return s.each(this.legs,function(){return this.destroy()}),this.legs=[],delete this.constructor._busses[this.id],this._teardownEvents(),this.$original.removeData("tourbus"),this.$el.remove()},t.prototype._configureElement=function(){return this.$el=s("<div class='tourbus-container'></div>"),this.el=this.$el[0],this.$el.attr({id:this.elId}),this.$el.addClass(n.dataProp(this.rawData["class"],this.options["class"])),this.$container.append(this.$el)},t.prototype._log=function(){return n.dataProp(this.rawData.debug,this.options.debug)?console.log.apply(console,["TOURBUS "+this.id+":"].concat(r.call(arguments))):void 0},t.prototype._setupEvents=function(){return this.$original.on("depart.tourbus",s.proxy(this.depart,this)),this.$original.on("stop.tourbus",s.proxy(this.stop,this)),this.$original.on("next.tourbus",s.proxy(this.next,this)),this.$original.on("prev.tourbus",s.proxy(this.prev,this))},t.prototype._teardownEvents=function(){return this.$original.off(".tourbus")},t}()}).call(this)},{"./leg":3,"./utils":4}],3:[function(t,i){(function(){var s,e,o,n;s=jQuery,o=t("./utils"),i.exports=e=function(){function t(t){if(this.options=t,this.$original=this.options.original,this.bus=this.options.bus,this.rawData=this.options.rawData,this.index=this.options.index,this.$target=s(this.options.target),this.id=""+this.bus.id+"-"+this.options.index,this.elId="tourbus-leg-"+this.id,this.visible=!1,0===this.$target.length)throw""+this.$target.selector+" is not an element!";this.content=this.$original.html(),this._setupOptions(),this._configureElement(),this._configureTarget(),this._configureScroll(),this._setupEvents(),this.bus._log("leg "+this.index+" made with options",this.options)}return t.prototype.render=function(){var t,i;return t="centered"===this.options.orientation?"":"tourbus-arrow",this.$el.addClass(" "+t+" tourbus-arrow-"+this.options.orientation+" "),i="<div class='tourbus-leg-inner'>\n "+this.content+"\n</div>",this.$el.css({width:this.options.width,zIndex:this.options.zindex}).html(i),this},t.prototype.destroy=function(){return this.$el.remove(),this._teardownEvents()},t.prototype.reposition=function(){return this._configureTarget(),this._position()},t.prototype._position=function(){var t,i,s,e;return"centered"!==this.options.orientation&&(s={},i={top:"left",bottom:"left",left:"top",right:"top"},"number"==typeof this.options.arrow&&(this.options.arrow+="px"),s[i[this.options.orientation]]=this.options.arrow,e="#"+this.elId+".tourbus-arrow",this.bus._log("adding rule for "+this.elId,s),n(""+e+":before, "+e+":after",s)),t=this._offsets(),this.bus._log("setting offsets on leg",t),this.$el.css(t)},t.prototype.show=function(){return this.visible=!0,this.$el.css({visibility:"visible",opacity:1,zIndex:this.options.zindex}),this.scrollIntoView()},t.prototype.hide=function(){return this.visible=!1,this.bus.options.debug?this.$el.css({visibility:"visible",opacity:.4,zIndex:0}):this.$el.css({visibility:"hidden"})},t.prototype.scrollIntoView=function(){var t;if(this.willScroll)return t=o.dataProp(this.options.scrollTo,this.$el),this.bus._log("scrolling to",t,this.scrollSettings),s.scrollTo(t,this.scrollSettings)},t.prototype._setupOptions=function(){var t,i,s,e,n,r;for(i=this.bus.options.leg,t=["class","top","left","scrollTo","scrollSpeed","scrollContext","margin","arrow","align","width","zindex","orientation"],r=[],e=0,n=t.length;n>e;e++)s=t[e],r.push(this.options[s]=o.dataProp(this.rawData[s],i[s]));return r},t.prototype._configureElement=function(){return this.$el=s("<div class='tourbus-leg'></div>"),this.el=this.$el[0],this.$el.attr({id:this.elId}),this.$el.addClass(this.options["class"]),this.$el.css({zIndex:this.options.zindex})},t.prototype._setupEvents=function(){return this.$el.on("click",".tourbus-next",s.proxy(this.bus.next,this.bus)),this.$el.on("click",".tourbus-prev",s.proxy(this.bus.prev,this.bus)),this.$el.on("click",".tourbus-stop",s.proxy(this.bus.stop,this.bus))},t.prototype._teardownEvents=function(){return this.$el.off("click")},t.prototype._configureTarget=function(){return this.targetOffset=this.$target.offset(),o.dataProp(this.options.top,!1)&&(this.targetOffset.top=this.options.top),o.dataProp(this.options.left,!1)&&(this.targetOffset.left=this.options.left),this.targetWidth=this.$target.outerWidth(),this.targetHeight=this.$target.outerHeight()},t.prototype._configureScroll=function(){return this.willScroll=s.fn.scrollTo&&this.options.scrollTo!==!1,this.scrollSettings={offset:-this.options.scrollContext,easing:"linear",axis:"y",duration:this.options.scrollSpeed}},t.prototype._offsets=function(){var t,i,e,n,r,h,l,u;switch(e=this.$el.height(),n=this.$el.width(),r={},this.options.orientation){case"centered":l=s(window).height(),r.top=this.options.top,o.dataProp(r.top,!1)||(r.top=l/2-e/2),r.left=this.targetWidth/2-n/2;break;case"left":r.top=this.targetOffset.top,r.left=this.targetOffset.left-n-this.options.margin;break;case"right":r.top=this.targetOffset.top,r.left=this.targetOffset.left+this.targetWidth+this.options.margin;break;case"top":r.top=this.targetOffset.top-e-this.options.margin,r.left=this.targetOffset.left;break;case"bottom":r.top=this.targetOffset.top+this.targetHeight+this.options.margin,r.left=this.targetOffset.left}if(u={top:["left","right"],bottom:["left","right"],left:["top","bottom"],right:["top","bottom"]},o.include(this.options.orientation,u[this.options.align]))switch(this.options.align){case"right":r.left+=this.targetWidth-n;break;case"bottom":r.top+=this.targetHeight-e}else"center"===this.options.align&&(o.include(this.options.orientation,u.left)?(h=this.targetWidth/2,i=n/2,t="left"):(h=this.targetHeight/2,i=e/2,t="top"),h>i?r[t]+=h-i:r[t]-=i-h);return r},t}(),n=function(t){var i;return t.type="text/css",document.getElementsByTagName("head")[0].appendChild(t),i=document.styleSheets[document.styleSheets.length-1],function(t,e){var o,n;n=s.map(function(){var t;t=[];for(o in e)t.push(o);return t}(),function(t){return""+t+":"+e[t]}).join(";");try{i.insertRule?i.insertRule(""+t+" { "+n+" }",(i.cssRules||i.rules).length):i.addRule(t,n)}catch(r){}}}(document.createElement("style"))}).call(this)},{"./utils":4}],4:[function(t,i){(function(){i.exports={dataProp:function(t,i){return null===t||t===void 0?i:t},include:function(t,i){return-1!==$.inArray(t,i||[])}}}).call(this)},{}]},{},[1,2,3,4]);