2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
|
/*! Tourist.js - http://easelinc.github.io/tourist, built 03-13-2015 */
|
||
|
(function(){var a,b,c,d,e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};window.Tourist=window.Tourist||{},Tourist.Model=function(b){function c(){return a=c.__super__.constructor.apply(this,arguments)}return f(c,b),c.prototype._module="Tourist",c}(Backbone.Model),window.Tourist.Tip=window.Tourist.Tip||{},Tourist.Tip.Base=function(){function a(a){this.options=null!=a?a:{},this.onClickNext=g(this.onClickNext,this),this.onClickClose=g(this.onClickClose,this),this.el=$("<div/>"),this.initialize(a),this._bindClickEvents(),Tourist.Tip.Base._cacheTip(this)}return a.prototype._module="Tourist",_.extend(a.prototype,Backbone.Events),a.prototype.skipButtonTemplate='<button class="btn btn-default btn-sm pull-right tour-next">Skip this step →</button>',a.prototype.nextButtonTemplate='<button class="btn btn-primary btn-sm pull-right tour-next">Next step →</button>',a.prototype.finalButtonTemplate='<button class="btn btn-primary btn-sm pull-right tour-next">Finish up</button>',a.prototype.closeButtonTemplate='<a class="btn btn-close tour-close" href="#"><i class="icon icon-remove"></i></a>',a.prototype.okButtonTemplate='<button class="btn btn-sm tour-close btn-primary">Okay</button>',a.prototype.actionLabelTemplate=_.template('<h4 class="action-label"><%= label %></h4>'),a.prototype.actionLabels=["Do this:","Then this:","Next this:"],a.prototype.highlightClass="tour-highlight",a.prototype.template=_.template('<div>\n <div class="tour-container">\n <%= close_button %>\n <%= content %>\n <p class="tour-counter <%= counter_class %>"><%= counter%></p>\n </div>\n <div class="tour-buttons">\n <%= buttons %>\n </div>\n</div>'),a.prototype.destroy=function(){return this.el.remove()},a.prototype.render=function(a){return this.hide(),a&&(this._setTarget(a.target||!1,a),this._setZIndex(""),this._renderContent(a,this._buildContentElement(a)),a.target&&this.show(),a.zIndex&&this._setZIndex(a.zIndex,a)),this},a.prototype.show=function(){},a.prototype.hide=function(){},a.prototype.setTarget=function(a,b){return this._setTarget(a,b)},a.prototype.cleanupCurrentTarget=function(){return this.target&&this.target.removeClass&&this.target.removeClass(this.highlightClass),this.target=null},a.prototype.onClickClose=function(a){return this.trigger("click:close",this,a),!1},a.prototype.onClickNext=function(a){return this.trigger("click:next",this,a),!1},a.prototype._getTipElement=function(){},a.prototype._renderContent=function(){},a.prototype._bindClickEvents=function(){var a;return a=this._getTipElement(),a.delegate(".tour-close","click",this.onClickClose),a.delegate(".tour-next","click",this.onClickNext)},a.prototype._setTarget=function(a,b){return this.cleanupCurrentTarget(),a&&b&&b.highlightTarget&&a.addClass(this.highlightClass),this.target=a},a.prototype._setZIndex=function(a){var b;return b=this._getTipElement(),b.css("z-index",a||"")},a.prototype._buildContentElement=function(a){var b,c;return b=this._buildButtons(a),c=$($.parseHTML(this.template({content:a.content,buttons:b,close_button:this._buildCloseButton(a),counter:a.final?"":"step "+(a.index+1)+" of "+a.total,counter_class:a.final?"final":""}))),b||c.find(".tour-buttons").addClass("no-buttons"),this._renderActionLabels(c),c},a.prototype._buildButtons=function(a){var b;return b="",a.okButton&&(b+=this.okButtonTemplate),a.skipButton&&(b+=this.skipButtonTemplate),a.nextButton&&(b+=a.final?this.finalButtonTemplate:this.nextButtonTemplate),b},a.prototype._buildCloseButton=function(a){return a.closeButton?this.closeButtonTemplate:""},a.prototype._renderActionLabels=function(a){var b,c,d,e,f,g,h;for(d=a.find(".action"),c=0,h=[],f=0,g=d.length;g>f;f++)b=d[f],e=$($.parseHTML(this.actionLabelTemplate({label:this.actionLabels[c]}))),e.insertBefore(b),h.push(c++);return h},a._cacheTip=function(a){return Tourist.Tip.Base._cachedTips||(Tourist.Tip.Base._cachedTips=[]),Tourist.Tip.Base._cachedT
|