From da963213f8f49aa127b3e0bb43ffa50228bfd173 Mon Sep 17 00:00:00 2001 From: LostCrew Date: Wed, 2 Oct 2013 23:07:04 +0200 Subject: [PATCH] fixed #147 --- build/css/bootstrap-tour.css | 9 +++-- build/css/bootstrap-tour.min.css | 2 +- build/js/bootstrap-tour.min.js | 2 +- docs/assets/css/bootstrap-tour.css | 9 +++-- docs/assets/css/bootstrap-tour.min.css | 2 +- docs/assets/js/bootstrap-tour.min.js | 2 +- docs/assets/js/index.js | 1 - docs/index.coffee | 1 - src/less/bootstrap-tour.less | 46 ++++++++++++-------------- 9 files changed, 38 insertions(+), 36 deletions(-) diff --git a/build/css/bootstrap-tour.css b/build/css/bootstrap-tour.css index 72c6e8cb..fc075bb4 100644 --- a/build/css/bootstrap-tour.css +++ b/build/css/bootstrap-tour.css @@ -4,20 +4,23 @@ right: 0; bottom: 0; left: 0; - z-index: 1009; + z-index: 1030; background-color: #000; opacity: 0.8; } .tour-step-backdrop { position: relative; - z-index: 1011; + z-index: 1031; } .tour-step-background { position: absolute; - z-index: 1010; + z-index: 1030; background: #fff; border-radius: 6px; } +.popover[class*="tour-"] { + z-index: 1030; +} .popover[class*="tour-"] .popover-navigation { padding: 9px 14px; } diff --git a/build/css/bootstrap-tour.min.css b/build/css/bootstrap-tour.min.css index 73edaaca..ea97d1e6 100644 --- a/build/css/bootstrap-tour.min.css +++ b/build/css/bootstrap-tour.min.css @@ -1 +1 @@ -.tour-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1009;background-color:#000;opacity:.8}.tour-step-backdrop{position:relative;z-index:1011}.tour-step-background{position:absolute;z-index:1010;background:#fff;border-radius:6px}.popover[class*="tour-"] .popover-navigation{padding:9px 14px}.popover[class*="tour-"] .popover-navigation *[data-role=end]{float:right}.popover[class*="tour-"] .popover-navigation *[data-role=prev],.popover[class*="tour-"] .popover-navigation *[data-role=next],.popover[class*="tour-"] .popover-navigation *[data-role=end]{cursor:pointer}.popover[class*="tour-"] .popover-navigation *[data-role=prev].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=next].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=end].disabled{cursor:default}.popover[class*="tour-"].orphan{position:fixed;margin-top:0}.popover[class*="tour-"].orphan .arrow{display:none} \ No newline at end of file +.tour-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000;opacity:.8}.tour-step-backdrop{position:relative;z-index:1031}.tour-step-background{position:absolute;z-index:1030;background:#fff;border-radius:6px}.popover[class*="tour-"]{z-index:1030}.popover[class*="tour-"] .popover-navigation{padding:9px 14px}.popover[class*="tour-"] .popover-navigation *[data-role=end]{float:right}.popover[class*="tour-"] .popover-navigation *[data-role=prev],.popover[class*="tour-"] .popover-navigation *[data-role=next],.popover[class*="tour-"] .popover-navigation *[data-role=end]{cursor:pointer}.popover[class*="tour-"] .popover-navigation *[data-role=prev].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=next].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=end].disabled{cursor:default}.popover[class*="tour-"].orphan{position:fixed;margin-top:0}.popover[class*="tour-"].orphan .arrow{display:none} \ No newline at end of file diff --git a/build/js/bootstrap-tour.min.js b/build/js/bootstrap-tour.min.js index 9dd67619..bbb4b2cc 100644 --- a/build/js/bootstrap-tour.min.js +++ b/build/js/bootstrap-tour.min.js @@ -16,4 +16,4 @@ # See the License for the specific language governing permissions and # limitations under the License. */ -(function(){!function(a,b){var c,d;return d=b.document,c=function(){function c(c){this._options=a.extend({name:"tour",container:"body",keyboard:!0,storage:b.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,basePath:"",template:"

",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){}},c),this._steps=[],this.setCurrentStep(),this.backdrop={overlay:null,$element:null,$background:null}}return c.prototype.setState=function(a,b){var c;return this._options.storage?(c=""+this._options.name+"_"+a,this._options.storage.setItem(c,b),this._options.afterSetState(c,b)):(null==this._state&&(this._state={}),this._state[a]=b)},c.prototype.removeState=function(a){var b;return this._options.storage?(b=""+this._options.name+"_"+a,this._options.storage.removeItem(b),this._options.afterRemoveState(b)):null!=this._state?delete this._state[a]:void 0},c.prototype.getState=function(a){var b,c;return this._options.storage?(b=""+this._options.name+"_"+a,c=this._options.storage.getItem(b)):null!=this._state&&(c=this._state[a]),(void 0===c||"null"===c)&&(c=null),this._options.afterGetState(a,c),c},c.prototype.addSteps=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addStep(b));return e},c.prototype.addStep=function(a){return this._steps.push(a)},c.prototype.getStep=function(b){return null!=this._steps[b]?a.extend({id:"step-"+b,path:"",placement:"right",title:"",content:"

",next:b===this._steps.length-1?-1:b+1,prev:b-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev},this._steps[b]):void 0},c.prototype.start=function(b){var c,e=this;return null==b&&(b=!1),this.ended()&&!b?this._debug("Tour ended, start prevented."):(a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)",function(a){return a.preventDefault(),e.next()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)",function(a){return a.preventDefault(),e.prev()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]",function(a){return a.preventDefault(),e.end()}),this._onResize(function(){return e.showStep(e._current)}),this._setupKeyboardNavigation(),c=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(c,this.showStep,this._current))},c.prototype.next=function(){var a;return this.ended()?this._debug("Tour ended, next prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep))},c.prototype.prev=function(){var a;return this.ended()?this._debug("Tour ended, prev prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep))},c.prototype.goto=function(a){var b;return this.ended()?this._debug("Tour ended, goto prevented."):(b=this.hideStep(this._current),this._callOnPromiseDone(b,this.showStep,a))},c.prototype.end=function(){var c,e,f=this;return c=function(){return a(d).off("click.tour-"+f._options.name),a(d).off("keyup.tour-"+f._options.name),a(b).off("resize.tour-"+f._options.name),f.setState("end","yes"),null!=f._options.onEnd?f._options.onEnd(f):void 0},e=this.hideStep(this._current),this._callOnPromiseDone(e,c)},c.prototype.ended=function(){return!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.hideStep=function(b){var c,d,e,f=this;return e=this.getStep(b),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=f._isOrphan(e)?a("body"):a(e.element),b.popover("destroy"),e.reflex&&b.css("cursor","").off("click.tour-"+f._options.name),e.backdrop&&f._hideBackdrop(),null!=e.onHidden?e.onHidden(f):void 0},this._callOnPromiseDone(d,c),d},c.prototype.showStep=function(b){var c,e,f,g,h=this;return(g=this.getStep(b))?(f=b").parent().html(),d.popover({placement:b.placement,trigger:"manual",title:b.title,content:b.content,html:!0,animation:b.animation,container:b.container,template:b.template,selector:b.element}).popover("show"),g=d.data("bs.popover")?d.data("bs.popover").tip():d.data("popover").tip(),g.attr("id",b.id),this._scrollIntoView(g),this._reposition(g,b),h?this._center(g):void 0},c.prototype._reposition=function(b,c){var e,f,g,h,i,j,k;if(h=b[0].offsetWidth,f=b[0].offsetHeight,k=b.offset(),i=k.left,j=k.top,e=a(d).outerHeight()-k.top-b.outerHeight(),0>e&&(k.top=k.top+e),g=a("html").outerWidth()-k.left-b.outerWidth(),0>g&&(k.left=k.left+g),k.top<0&&(k.top=0),k.left<0&&(k.left=0),b.offset(k),"bottom"===c.placement||"top"===c.placement){if(i!==k.left)return this._replaceArrow(b,2*(k.left-i),h,"left")}else if(j!==k.top)return this._replaceArrow(b,2*(k.top-j),f,"top")},c.prototype._center=function(c){return c.css("top",a(b).outerHeight()/2-c.outerHeight()/2)},c.prototype._replaceArrow=function(a,b,c,d){return a.find(".arrow").css(d,b?50*(1-b/c)+"%":"")},c.prototype._scrollIntoView=function(c){return a("html, body").stop().animate({scrollTop:Math.ceil(c.offset().top-a(b).height()/2)})},c.prototype._onResize=function(c,d){return a(b).on("resize.tour-"+this._options.name,function(){return clearTimeout(d),d=setTimeout(c,100)})},c.prototype._setupKeyboardNavigation=function(){var b=this;return this._options.keyboard?a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._current0)return b.prev();break;case 27:return a.preventDefault(),b.end()}}):void 0},c.prototype._makePromise=function(b){return b&&a.isFunction(b.then)?b:null},c.prototype._callOnPromiseDone=function(a,b,c){var d=this;return a?a.then(function(){return b.call(d,c)}):b.call(this,c)},c.prototype._showBackdrop=function(a){return null===this.backdrop.overlay?(this._showOverlay(),null!=a?this._showOverlayElement(a):void 0):void 0},c.prototype._hideBackdrop=function(){return null!==this.backdrop.overlay?(this.backdrop.$element&&this._hideOverlayElement(),this._hideOverlay()):void 0},c.prototype._showOverlay=function(){return this.backdrop=a("
",{"class":"tour-backdrop"}),a("body").append(this.backdrop)},c.prototype._hideOverlay=function(){return this.backdrop.remove(),this.backdrop.overlay=null},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),c=a("
"),e=d.offset(),e.top=e.top,e.left=e.left,c.width(d.innerWidth()).height(d.innerHeight()).addClass("tour-step-background").offset(e),d.addClass("tour-step-backdrop"),a("body").append(c),this.backdrop.$element=d,this.backdrop.$background=c},c.prototype._hideOverlayElement=function(){return this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null},c}(),b.Tour=c}(jQuery,window)}).call(this); \ No newline at end of file +!function(){!function(a,b){var c,d;return d=b.document,c=function(){function c(c){this._options=a.extend({name:"tour",container:"body",keyboard:!0,storage:b.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,basePath:"",template:"

",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){}},c),this._steps=[],this.setCurrentStep(),this.backdrop={overlay:null,$element:null,$background:null}}return c.prototype.setState=function(a,b){var c;return this._options.storage?(c=""+this._options.name+"_"+a,this._options.storage.setItem(c,b),this._options.afterSetState(c,b)):(null==this._state&&(this._state={}),this._state[a]=b)},c.prototype.removeState=function(a){var b;return this._options.storage?(b=""+this._options.name+"_"+a,this._options.storage.removeItem(b),this._options.afterRemoveState(b)):null!=this._state?delete this._state[a]:void 0},c.prototype.getState=function(a){var b,c;return this._options.storage?(b=""+this._options.name+"_"+a,c=this._options.storage.getItem(b)):null!=this._state&&(c=this._state[a]),(void 0===c||"null"===c)&&(c=null),this._options.afterGetState(a,c),c},c.prototype.addSteps=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addStep(b));return e},c.prototype.addStep=function(a){return this._steps.push(a)},c.prototype.getStep=function(b){return null!=this._steps[b]?a.extend({id:"step-"+b,path:"",placement:"right",title:"",content:"

",next:b===this._steps.length-1?-1:b+1,prev:b-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev},this._steps[b]):void 0},c.prototype.start=function(b){var c,e=this;return null==b&&(b=!1),this.ended()&&!b?this._debug("Tour ended, start prevented."):(a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)",function(a){return a.preventDefault(),e.next()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)",function(a){return a.preventDefault(),e.prev()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]",function(a){return a.preventDefault(),e.end()}),this._onResize(function(){return e.showStep(e._current)}),this._setupKeyboardNavigation(),c=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(c,this.showStep,this._current))},c.prototype.next=function(){var a;return this.ended()?this._debug("Tour ended, next prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep))},c.prototype.prev=function(){var a;return this.ended()?this._debug("Tour ended, prev prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep))},c.prototype.goto=function(a){var b;return this.ended()?this._debug("Tour ended, goto prevented."):(b=this.hideStep(this._current),this._callOnPromiseDone(b,this.showStep,a))},c.prototype.end=function(){var c,e,f=this;return c=function(){return a(d).off("click.tour-"+f._options.name),a(d).off("keyup.tour-"+f._options.name),a(b).off("resize.tour-"+f._options.name),f.setState("end","yes"),null!=f._options.onEnd?f._options.onEnd(f):void 0},e=this.hideStep(this._current),this._callOnPromiseDone(e,c)},c.prototype.ended=function(){return!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.hideStep=function(b){var c,d,e,f=this;return e=this.getStep(b),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=f._isOrphan(e)?a("body"):a(e.element),b.popover("destroy"),e.reflex&&b.css("cursor","").off("click.tour-"+f._options.name),e.backdrop&&f._hideBackdrop(),null!=e.onHidden?e.onHidden(f):void 0},this._callOnPromiseDone(d,c),d},c.prototype.showStep=function(b){var c,e,f,g,h=this;return(g=this.getStep(b))?(f=b").parent().html(),d.popover({placement:b.placement,trigger:"manual",title:b.title,content:b.content,html:!0,animation:b.animation,container:b.container,template:b.template,selector:b.element}).popover("show"),g=d.data("bs.popover")?d.data("bs.popover").tip():d.data("popover").tip(),g.attr("id",b.id),this._scrollIntoView(g),this._reposition(g,b),h?this._center(g):void 0},c.prototype._reposition=function(b,c){var e,f,g,h,i,j,k;if(h=b[0].offsetWidth,f=b[0].offsetHeight,k=b.offset(),i=k.left,j=k.top,e=a(d).outerHeight()-k.top-b.outerHeight(),0>e&&(k.top=k.top+e),g=a("html").outerWidth()-k.left-b.outerWidth(),0>g&&(k.left=k.left+g),k.top<0&&(k.top=0),k.left<0&&(k.left=0),b.offset(k),"bottom"===c.placement||"top"===c.placement){if(i!==k.left)return this._replaceArrow(b,2*(k.left-i),h,"left")}else if(j!==k.top)return this._replaceArrow(b,2*(k.top-j),f,"top")},c.prototype._center=function(c){return c.css("top",a(b).outerHeight()/2-c.outerHeight()/2)},c.prototype._replaceArrow=function(a,b,c,d){return a.find(".arrow").css(d,b?50*(1-b/c)+"%":"")},c.prototype._scrollIntoView=function(c){return a("html, body").stop().animate({scrollTop:Math.ceil(c.offset().top-a(b).height()/2)})},c.prototype._onResize=function(c,d){return a(b).on("resize.tour-"+this._options.name,function(){return clearTimeout(d),d=setTimeout(c,100)})},c.prototype._setupKeyboardNavigation=function(){var b=this;return this._options.keyboard?a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._current0)return b.prev();break;case 27:return a.preventDefault(),b.end()}}):void 0},c.prototype._makePromise=function(b){return b&&a.isFunction(b.then)?b:null},c.prototype._callOnPromiseDone=function(a,b,c){var d=this;return a?a.then(function(){return b.call(d,c)}):b.call(this,c)},c.prototype._showBackdrop=function(a){return null===this.backdrop.overlay?(this._showOverlay(),null!=a?this._showOverlayElement(a):void 0):void 0},c.prototype._hideBackdrop=function(){return null!==this.backdrop.overlay?(this.backdrop.$element&&this._hideOverlayElement(),this._hideOverlay()):void 0},c.prototype._showOverlay=function(){return this.backdrop=a("
",{"class":"tour-backdrop"}),a("body").append(this.backdrop)},c.prototype._hideOverlay=function(){return this.backdrop.remove(),this.backdrop.overlay=null},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),c=a("
"),e=d.offset(),e.top=e.top,e.left=e.left,c.width(d.innerWidth()).height(d.innerHeight()).addClass("tour-step-background").offset(e),d.addClass("tour-step-backdrop"),a("body").append(c),this.backdrop.$element=d,this.backdrop.$background=c},c.prototype._hideOverlayElement=function(){return this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null},c}(),b.Tour=c}(jQuery,window)}.call(this); \ No newline at end of file diff --git a/docs/assets/css/bootstrap-tour.css b/docs/assets/css/bootstrap-tour.css index 72c6e8cb..fc075bb4 100644 --- a/docs/assets/css/bootstrap-tour.css +++ b/docs/assets/css/bootstrap-tour.css @@ -4,20 +4,23 @@ right: 0; bottom: 0; left: 0; - z-index: 1009; + z-index: 1030; background-color: #000; opacity: 0.8; } .tour-step-backdrop { position: relative; - z-index: 1011; + z-index: 1031; } .tour-step-background { position: absolute; - z-index: 1010; + z-index: 1030; background: #fff; border-radius: 6px; } +.popover[class*="tour-"] { + z-index: 1030; +} .popover[class*="tour-"] .popover-navigation { padding: 9px 14px; } diff --git a/docs/assets/css/bootstrap-tour.min.css b/docs/assets/css/bootstrap-tour.min.css index 73edaaca..ea97d1e6 100644 --- a/docs/assets/css/bootstrap-tour.min.css +++ b/docs/assets/css/bootstrap-tour.min.css @@ -1 +1 @@ -.tour-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1009;background-color:#000;opacity:.8}.tour-step-backdrop{position:relative;z-index:1011}.tour-step-background{position:absolute;z-index:1010;background:#fff;border-radius:6px}.popover[class*="tour-"] .popover-navigation{padding:9px 14px}.popover[class*="tour-"] .popover-navigation *[data-role=end]{float:right}.popover[class*="tour-"] .popover-navigation *[data-role=prev],.popover[class*="tour-"] .popover-navigation *[data-role=next],.popover[class*="tour-"] .popover-navigation *[data-role=end]{cursor:pointer}.popover[class*="tour-"] .popover-navigation *[data-role=prev].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=next].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=end].disabled{cursor:default}.popover[class*="tour-"].orphan{position:fixed;margin-top:0}.popover[class*="tour-"].orphan .arrow{display:none} \ No newline at end of file +.tour-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000;opacity:.8}.tour-step-backdrop{position:relative;z-index:1031}.tour-step-background{position:absolute;z-index:1030;background:#fff;border-radius:6px}.popover[class*="tour-"]{z-index:1030}.popover[class*="tour-"] .popover-navigation{padding:9px 14px}.popover[class*="tour-"] .popover-navigation *[data-role=end]{float:right}.popover[class*="tour-"] .popover-navigation *[data-role=prev],.popover[class*="tour-"] .popover-navigation *[data-role=next],.popover[class*="tour-"] .popover-navigation *[data-role=end]{cursor:pointer}.popover[class*="tour-"] .popover-navigation *[data-role=prev].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=next].disabled,.popover[class*="tour-"] .popover-navigation *[data-role=end].disabled{cursor:default}.popover[class*="tour-"].orphan{position:fixed;margin-top:0}.popover[class*="tour-"].orphan .arrow{display:none} \ No newline at end of file diff --git a/docs/assets/js/bootstrap-tour.min.js b/docs/assets/js/bootstrap-tour.min.js index 9dd67619..bbb4b2cc 100644 --- a/docs/assets/js/bootstrap-tour.min.js +++ b/docs/assets/js/bootstrap-tour.min.js @@ -16,4 +16,4 @@ # See the License for the specific language governing permissions and # limitations under the License. */ -(function(){!function(a,b){var c,d;return d=b.document,c=function(){function c(c){this._options=a.extend({name:"tour",container:"body",keyboard:!0,storage:b.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,basePath:"",template:"

",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){}},c),this._steps=[],this.setCurrentStep(),this.backdrop={overlay:null,$element:null,$background:null}}return c.prototype.setState=function(a,b){var c;return this._options.storage?(c=""+this._options.name+"_"+a,this._options.storage.setItem(c,b),this._options.afterSetState(c,b)):(null==this._state&&(this._state={}),this._state[a]=b)},c.prototype.removeState=function(a){var b;return this._options.storage?(b=""+this._options.name+"_"+a,this._options.storage.removeItem(b),this._options.afterRemoveState(b)):null!=this._state?delete this._state[a]:void 0},c.prototype.getState=function(a){var b,c;return this._options.storage?(b=""+this._options.name+"_"+a,c=this._options.storage.getItem(b)):null!=this._state&&(c=this._state[a]),(void 0===c||"null"===c)&&(c=null),this._options.afterGetState(a,c),c},c.prototype.addSteps=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addStep(b));return e},c.prototype.addStep=function(a){return this._steps.push(a)},c.prototype.getStep=function(b){return null!=this._steps[b]?a.extend({id:"step-"+b,path:"",placement:"right",title:"",content:"

",next:b===this._steps.length-1?-1:b+1,prev:b-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev},this._steps[b]):void 0},c.prototype.start=function(b){var c,e=this;return null==b&&(b=!1),this.ended()&&!b?this._debug("Tour ended, start prevented."):(a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)",function(a){return a.preventDefault(),e.next()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)",function(a){return a.preventDefault(),e.prev()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]",function(a){return a.preventDefault(),e.end()}),this._onResize(function(){return e.showStep(e._current)}),this._setupKeyboardNavigation(),c=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(c,this.showStep,this._current))},c.prototype.next=function(){var a;return this.ended()?this._debug("Tour ended, next prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep))},c.prototype.prev=function(){var a;return this.ended()?this._debug("Tour ended, prev prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep))},c.prototype.goto=function(a){var b;return this.ended()?this._debug("Tour ended, goto prevented."):(b=this.hideStep(this._current),this._callOnPromiseDone(b,this.showStep,a))},c.prototype.end=function(){var c,e,f=this;return c=function(){return a(d).off("click.tour-"+f._options.name),a(d).off("keyup.tour-"+f._options.name),a(b).off("resize.tour-"+f._options.name),f.setState("end","yes"),null!=f._options.onEnd?f._options.onEnd(f):void 0},e=this.hideStep(this._current),this._callOnPromiseDone(e,c)},c.prototype.ended=function(){return!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.hideStep=function(b){var c,d,e,f=this;return e=this.getStep(b),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=f._isOrphan(e)?a("body"):a(e.element),b.popover("destroy"),e.reflex&&b.css("cursor","").off("click.tour-"+f._options.name),e.backdrop&&f._hideBackdrop(),null!=e.onHidden?e.onHidden(f):void 0},this._callOnPromiseDone(d,c),d},c.prototype.showStep=function(b){var c,e,f,g,h=this;return(g=this.getStep(b))?(f=b").parent().html(),d.popover({placement:b.placement,trigger:"manual",title:b.title,content:b.content,html:!0,animation:b.animation,container:b.container,template:b.template,selector:b.element}).popover("show"),g=d.data("bs.popover")?d.data("bs.popover").tip():d.data("popover").tip(),g.attr("id",b.id),this._scrollIntoView(g),this._reposition(g,b),h?this._center(g):void 0},c.prototype._reposition=function(b,c){var e,f,g,h,i,j,k;if(h=b[0].offsetWidth,f=b[0].offsetHeight,k=b.offset(),i=k.left,j=k.top,e=a(d).outerHeight()-k.top-b.outerHeight(),0>e&&(k.top=k.top+e),g=a("html").outerWidth()-k.left-b.outerWidth(),0>g&&(k.left=k.left+g),k.top<0&&(k.top=0),k.left<0&&(k.left=0),b.offset(k),"bottom"===c.placement||"top"===c.placement){if(i!==k.left)return this._replaceArrow(b,2*(k.left-i),h,"left")}else if(j!==k.top)return this._replaceArrow(b,2*(k.top-j),f,"top")},c.prototype._center=function(c){return c.css("top",a(b).outerHeight()/2-c.outerHeight()/2)},c.prototype._replaceArrow=function(a,b,c,d){return a.find(".arrow").css(d,b?50*(1-b/c)+"%":"")},c.prototype._scrollIntoView=function(c){return a("html, body").stop().animate({scrollTop:Math.ceil(c.offset().top-a(b).height()/2)})},c.prototype._onResize=function(c,d){return a(b).on("resize.tour-"+this._options.name,function(){return clearTimeout(d),d=setTimeout(c,100)})},c.prototype._setupKeyboardNavigation=function(){var b=this;return this._options.keyboard?a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._current0)return b.prev();break;case 27:return a.preventDefault(),b.end()}}):void 0},c.prototype._makePromise=function(b){return b&&a.isFunction(b.then)?b:null},c.prototype._callOnPromiseDone=function(a,b,c){var d=this;return a?a.then(function(){return b.call(d,c)}):b.call(this,c)},c.prototype._showBackdrop=function(a){return null===this.backdrop.overlay?(this._showOverlay(),null!=a?this._showOverlayElement(a):void 0):void 0},c.prototype._hideBackdrop=function(){return null!==this.backdrop.overlay?(this.backdrop.$element&&this._hideOverlayElement(),this._hideOverlay()):void 0},c.prototype._showOverlay=function(){return this.backdrop=a("
",{"class":"tour-backdrop"}),a("body").append(this.backdrop)},c.prototype._hideOverlay=function(){return this.backdrop.remove(),this.backdrop.overlay=null},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),c=a("
"),e=d.offset(),e.top=e.top,e.left=e.left,c.width(d.innerWidth()).height(d.innerHeight()).addClass("tour-step-background").offset(e),d.addClass("tour-step-backdrop"),a("body").append(c),this.backdrop.$element=d,this.backdrop.$background=c},c.prototype._hideOverlayElement=function(){return this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null},c}(),b.Tour=c}(jQuery,window)}).call(this); \ No newline at end of file +!function(){!function(a,b){var c,d;return d=b.document,c=function(){function c(c){this._options=a.extend({name:"tour",container:"body",keyboard:!0,storage:b.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,basePath:"",template:"

",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){}},c),this._steps=[],this.setCurrentStep(),this.backdrop={overlay:null,$element:null,$background:null}}return c.prototype.setState=function(a,b){var c;return this._options.storage?(c=""+this._options.name+"_"+a,this._options.storage.setItem(c,b),this._options.afterSetState(c,b)):(null==this._state&&(this._state={}),this._state[a]=b)},c.prototype.removeState=function(a){var b;return this._options.storage?(b=""+this._options.name+"_"+a,this._options.storage.removeItem(b),this._options.afterRemoveState(b)):null!=this._state?delete this._state[a]:void 0},c.prototype.getState=function(a){var b,c;return this._options.storage?(b=""+this._options.name+"_"+a,c=this._options.storage.getItem(b)):null!=this._state&&(c=this._state[a]),(void 0===c||"null"===c)&&(c=null),this._options.afterGetState(a,c),c},c.prototype.addSteps=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addStep(b));return e},c.prototype.addStep=function(a){return this._steps.push(a)},c.prototype.getStep=function(b){return null!=this._steps[b]?a.extend({id:"step-"+b,path:"",placement:"right",title:"",content:"

",next:b===this._steps.length-1?-1:b+1,prev:b-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev},this._steps[b]):void 0},c.prototype.start=function(b){var c,e=this;return null==b&&(b=!1),this.ended()&&!b?this._debug("Tour ended, start prevented."):(a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)",function(a){return a.preventDefault(),e.next()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)",function(a){return a.preventDefault(),e.prev()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]",function(a){return a.preventDefault(),e.end()}),this._onResize(function(){return e.showStep(e._current)}),this._setupKeyboardNavigation(),c=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(c,this.showStep,this._current))},c.prototype.next=function(){var a;return this.ended()?this._debug("Tour ended, next prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep))},c.prototype.prev=function(){var a;return this.ended()?this._debug("Tour ended, prev prevented."):(a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep))},c.prototype.goto=function(a){var b;return this.ended()?this._debug("Tour ended, goto prevented."):(b=this.hideStep(this._current),this._callOnPromiseDone(b,this.showStep,a))},c.prototype.end=function(){var c,e,f=this;return c=function(){return a(d).off("click.tour-"+f._options.name),a(d).off("keyup.tour-"+f._options.name),a(b).off("resize.tour-"+f._options.name),f.setState("end","yes"),null!=f._options.onEnd?f._options.onEnd(f):void 0},e=this.hideStep(this._current),this._callOnPromiseDone(e,c)},c.prototype.ended=function(){return!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.hideStep=function(b){var c,d,e,f=this;return e=this.getStep(b),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=f._isOrphan(e)?a("body"):a(e.element),b.popover("destroy"),e.reflex&&b.css("cursor","").off("click.tour-"+f._options.name),e.backdrop&&f._hideBackdrop(),null!=e.onHidden?e.onHidden(f):void 0},this._callOnPromiseDone(d,c),d},c.prototype.showStep=function(b){var c,e,f,g,h=this;return(g=this.getStep(b))?(f=b").parent().html(),d.popover({placement:b.placement,trigger:"manual",title:b.title,content:b.content,html:!0,animation:b.animation,container:b.container,template:b.template,selector:b.element}).popover("show"),g=d.data("bs.popover")?d.data("bs.popover").tip():d.data("popover").tip(),g.attr("id",b.id),this._scrollIntoView(g),this._reposition(g,b),h?this._center(g):void 0},c.prototype._reposition=function(b,c){var e,f,g,h,i,j,k;if(h=b[0].offsetWidth,f=b[0].offsetHeight,k=b.offset(),i=k.left,j=k.top,e=a(d).outerHeight()-k.top-b.outerHeight(),0>e&&(k.top=k.top+e),g=a("html").outerWidth()-k.left-b.outerWidth(),0>g&&(k.left=k.left+g),k.top<0&&(k.top=0),k.left<0&&(k.left=0),b.offset(k),"bottom"===c.placement||"top"===c.placement){if(i!==k.left)return this._replaceArrow(b,2*(k.left-i),h,"left")}else if(j!==k.top)return this._replaceArrow(b,2*(k.top-j),f,"top")},c.prototype._center=function(c){return c.css("top",a(b).outerHeight()/2-c.outerHeight()/2)},c.prototype._replaceArrow=function(a,b,c,d){return a.find(".arrow").css(d,b?50*(1-b/c)+"%":"")},c.prototype._scrollIntoView=function(c){return a("html, body").stop().animate({scrollTop:Math.ceil(c.offset().top-a(b).height()/2)})},c.prototype._onResize=function(c,d){return a(b).on("resize.tour-"+this._options.name,function(){return clearTimeout(d),d=setTimeout(c,100)})},c.prototype._setupKeyboardNavigation=function(){var b=this;return this._options.keyboard?a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._current0)return b.prev();break;case 27:return a.preventDefault(),b.end()}}):void 0},c.prototype._makePromise=function(b){return b&&a.isFunction(b.then)?b:null},c.prototype._callOnPromiseDone=function(a,b,c){var d=this;return a?a.then(function(){return b.call(d,c)}):b.call(this,c)},c.prototype._showBackdrop=function(a){return null===this.backdrop.overlay?(this._showOverlay(),null!=a?this._showOverlayElement(a):void 0):void 0},c.prototype._hideBackdrop=function(){return null!==this.backdrop.overlay?(this.backdrop.$element&&this._hideOverlayElement(),this._hideOverlay()):void 0},c.prototype._showOverlay=function(){return this.backdrop=a("
",{"class":"tour-backdrop"}),a("body").append(this.backdrop)},c.prototype._hideOverlay=function(){return this.backdrop.remove(),this.backdrop.overlay=null},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),c=a("
"),e=d.offset(),e.top=e.top,e.left=e.left,c.width(d.innerWidth()).height(d.innerHeight()).addClass("tour-step-background").offset(e),d.addClass("tour-step-backdrop"),a("body").append(c),this.backdrop.$element=d,this.backdrop.$background=c},c.prototype._hideOverlayElement=function(){return this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null},c}(),b.Tour=c}(jQuery,window)}.call(this); \ No newline at end of file diff --git a/docs/assets/js/index.js b/docs/assets/js/index.js index 9cd0ff9b..0d8495b6 100644 --- a/docs/assets/js/index.js +++ b/docs/assets/js/index.js @@ -9,7 +9,6 @@ onEnd: function() { return $start.removeClass("disabled", true); }, - backdrop: true, debug: true }); tour.addSteps([ diff --git a/docs/index.coffee b/docs/index.coffee index 991aede3..b501cd0c 100644 --- a/docs/index.coffee +++ b/docs/index.coffee @@ -4,7 +4,6 @@ $ -> tour = new Tour( onStart: -> $start.addClass "disabled", true onEnd: -> $start.removeClass "disabled", true - backdrop: true debug: true ) diff --git a/src/less/bootstrap-tour.less b/src/less/bootstrap-tour.less index ec9a08f0..10a92afa 100644 --- a/src/less/bootstrap-tour.less +++ b/src/less/bootstrap-tour.less @@ -4,52 +4,50 @@ right: 0; bottom: 0; left: 0; - z-index: 1009; + z-index: 1030; background-color: #000; opacity: 0.8; } .tour-step-backdrop { position: relative; - z-index: 1011; + z-index: 1031; } .tour-step-background { position: absolute; - z-index: 1010; + z-index: 1030; background: #fff; border-radius: 6px; } -.popover { +.popover[class*="tour-"] { + z-index: 1030; - &[class*="tour-"] { + .popover-navigation { + padding: 9px 14px; - .popover-navigation { - padding: 9px 14px; - - *[data-role=end]{ - float:right; - } + *[data-role=end]{ + float: right; + } - *[data-role=prev], - *[data-role=next], - *[data-role=end]{ - cursor: pointer; + *[data-role=prev], + *[data-role=next], + *[data-role=end]{ + cursor: pointer; - &.disabled { - cursor: default; - } + &.disabled { + cursor: default; } } + } - &.orphan { - position: fixed; - margin-top: 0; + &.orphan { + position: fixed; + margin-top: 0; - .arrow { - display: none; - } + .arrow { + display: none; } } } \ No newline at end of file