From e38b3fc8c476a5bbd74fcb414a7e12ba94ed915f Mon Sep 17 00:00:00 2001 From: Ulrich Sossou Date: Sun, 26 Jan 2014 08:35:29 +0100 Subject: [PATCH 1/3] Make the docs multipage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move the API documentation off the homepage - Remove the “Contributing” section and add the information to the readme - Add Jekyll for building the docs - Add Google Analytics --- .editorconfig | 21 + .gitignore | 1 + Gruntfile.coffee | 27 +- README.md | 40 +- _config.yml | 5 + build/js/bootstrap-tour.min.js | 2 +- docs/_includes/footer.html | 6 + docs/_includes/header.html | 28 + docs/_includes/nav.html | 23 + docs/_layouts/default.html | 12 + docs/api.html | 609 ++++++++++++ .../coffee/docs.coffee} | 47 +- docs/assets/css/{index.css => docs.css} | 6 +- docs/assets/js/bootstrap-tour.min.js | 2 +- docs/assets/js/{index.js => docs.js} | 42 +- docs/assets/vendor/prism.css | 107 --- docs/assets/vendor/prism.js | 8 - docs/assets/vendor/pygments-manni.css | 66 ++ docs/index.html | 895 ++---------------- docs/index.less | 205 ---- package.json | 1 + 21 files changed, 942 insertions(+), 1211 deletions(-) create mode 100644 .editorconfig create mode 100644 _config.yml create mode 100644 docs/_includes/footer.html create mode 100644 docs/_includes/header.html create mode 100644 docs/_includes/nav.html create mode 100644 docs/_layouts/default.html create mode 100644 docs/api.html rename docs/{index.coffee => assets/coffee/docs.coffee} (85%) rename docs/assets/css/{index.css => docs.css} (99%) rename docs/assets/js/{index.js => docs.js} (85%) delete mode 100644 docs/assets/vendor/prism.css delete mode 100644 docs/assets/vendor/prism.js create mode 100644 docs/assets/vendor/pygments-manni.css delete mode 100644 docs/index.less diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..fdbdf0db --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] + +# Change these settings to your own preference +indent_style = space +indent_size = 2 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index e54fc47b..31def024 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .grunt +docs-build node_modules components bootstrap-tour.sublime-project diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 35b57923..124eaf05 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -40,8 +40,8 @@ module.exports = (grunt) -> level: "error" max_line_length: level: "ignore" - default: ["Gruntfile.coffee", "src/**/*.coffee"] - doc: ["Gruntfile.coffee", "docs/*.coffee"] + default: ["Gruntfile.coffee", "src/{,*/}*.coffee"] + doc: ["Gruntfile.coffee", "docs/assets/coffee/*.coffee"] clean: default: "build" @@ -65,8 +65,8 @@ module.exports = (grunt) -> dest: "test" ext: ".spec.js" doc: - src: "docs/index.coffee" - dest: "docs/assets/js/index.js" + src: "docs/assets/coffee/docs.coffee" + dest: "docs/assets/js/docs.js" concat: options: @@ -115,7 +115,12 @@ module.exports = (grunt) -> dest: "build/js" ext: ".min.js" + jekyll: + build: {} + watch: + options: + livereload: true default: files: ["src/coffee/*.coffee"] tasks: ["build"] @@ -123,10 +128,11 @@ module.exports = (grunt) -> files: ["src/spec/*.coffee"] tasks: ["test"] doc: - files: ["docs/*.coffee"] + files: ["docs/assets/coffee/*.coffee"] tasks: ["coffeelint:doc", "coffee:doc"] - options: - livereload: true + jekyll: + files: ["docs/{,*/}*.html"] + tasks: ["jekyll"] jasmine: options: @@ -155,8 +161,9 @@ module.exports = (grunt) -> connect: default: options: + livereload: true port: 3000 - base: "docs" + base: "docs-build" open: default: @@ -196,8 +203,8 @@ module.exports = (grunt) -> ] grunt.registerTask "default", ["run"] - grunt.registerTask "run", ["build", "connect", "open", "watch:doc"] - grunt.registerTask "build", ["clean", "coffeelint", "coffee", "less", "concat", "uglify", "copy"] + grunt.registerTask "run", ["build", "connect", "open", "watch"] + grunt.registerTask "build", ["clean", "coffeelint", "coffee", "less", "concat", "uglify", "copy", "jekyll"] grunt.registerTask "test", ["build", "jasmine"] grunt.registerTask "release", "Release a new version, push it and publish it", (target) -> target = "patch" unless target diff --git a/README.md b/README.md index 9cc81600..548a11d8 100644 --- a/README.md +++ b/README.md @@ -2,34 +2,35 @@ Quick and easy way to build your product tours with Twitter Bootstrap Popovers. -*Compatible with Bootstrap <= 3.0.0* +*Compatible with Bootstrap >= 2.3.0* -## Demo and Documentation ## +## Demo and Documentation [http://bootstraptour.com](http://bootstraptour.com) -## TODO ## +## TODO - Add the smooth scrolling when the popover is outside the viewport - Define an appropriate tag + milestone system -## Contributing ## ->In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). +## Contributing +In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). Feel free to contribute with pull requests, bug reports or enhancement suggestions. We use [Grunt](http://gruntjs.com/) and [Jasmine](http://pivotal.github.io/jasmine/). Both make your lives easier ;) -### How to run/develop +### How to build/develop -Install the dependencies +Files to be developed are located under `./src/` +Compiled sources are then automatically put under `./build/` (and `./test/`) + +#### Installing the dependencies ```bash npm install +gem install jekyll ``` -Files to be developed are located under `./src/` -Compiled sources are then automatically put under `./build/` (and `./test/`) - -Run main tasks (check `Gruntfile.coffee` for more infos) +#### Running Grunt tasks ```javascript // Start a server and run the demo page @@ -39,22 +40,15 @@ grunt run grunt build // Compile all sources and run the tests grunt test -// Automatically release a new version (see below for more details) -grunt release -``` - -[More information here](http://bootstraptour.com/#grunt-usage) - -## Releasing ## -Releasing a new version is completely automated using the Grunt task `grunt release`. - -```javascript +// Automatically release a new version grunt release // patch release grunt release:minor // minor release grunt release:major // major release ``` -## License ## +Check `Gruntfile.coffee` for more infos. + +## License + Code licensed under the [Apache License v2.0](http://www.apache.org/licenses/LICENSE-2.0). Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/). -Well, the same licenses as Bootstrap. We are lazy! ;) diff --git a/_config.yml b/_config.yml new file mode 100644 index 00000000..a4680eb3 --- /dev/null +++ b/_config.yml @@ -0,0 +1,5 @@ +markdown: rdiscount +permalink: pretty +source: ./docs +destination: ./docs-build +encoding: UTF-8 diff --git a/build/js/bootstrap-tour.min.js b/build/js/bootstrap-tour.min.js index c395adc3..739e4bba 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(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,duration:!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(){},onPause:function(){},onResume:function(){}},c),this._force=!1,this._inited=!1,this._steps=[],this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return c.prototype.setState=function(a,b){var c,d;if(this._options.storage){d=""+this._options.name+"_"+a;try{this._options.storage.setItem(d,b)}catch(e){c=e,c.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. setState failed.")}return this._options.afterSetState(d,b)}return 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,duration:this._options.duration,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,onPause:this._options.onPause,onResume:this._options.onResume},this._steps[b]):void 0},c.prototype.init=function(a){var b=this;return this._force=a,this.ended()?this._debug("Tour ended, init prevented."):(this.setCurrentStep(),this._setupMouseNavigation(),this._setupKeyboardNavigation(),this._onResize(function(){return b.showStep(b._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},c.prototype.start=function(a){var b;return null==a&&(a=!1),this._inited||this.init(a),null===this._current?(b=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(b,this.showStep,0)):void 0},c.prototype.next=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep)},c.prototype.prev=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep)},c.prototype.goTo=function(a){var b;return 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"),f._inited=!1,f._force=!1,f._clearTimer(),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._force&&!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.pause=function(){var a;return a=this.getStep(this._current),a&&a.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,b.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=a.onPause?a.onPause(this,this._duration):void 0):void 0},c.prototype.resume=function(){var a,c=this;return a=this.getStep(this._current),a&&a.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||a.duration,this._timer=b.setTimeout(function(){return c._isLast()?c.next():c.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=a.onResume&&this._duration!==a.duration?a.onResume(this,this._duration):void 0):void 0},c.prototype.hideStep=function(b){var c,d,e,f=this;return(e=this.getStep(b))?(this._clearTimer(),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=a(e.element),b.data("bs.popover")||b.data("popover")||(b=a("body")),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):void 0},c.prototype.showStep=function(b){var c,e,f,g,h=this;return this.ended()?this._debug("Tour ended, showStep prevented."):(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._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,d){var e,f,g,h,i,j,k=this;return e=a(c),e.length?(f=a(b),h=e.offset().top,j=f.height(),i=Math.max(0,h-j/2),this._debug("Scroll into view. ScrollTop: "+i+". Element offset: "+h+". Window height: "+j+"."),g=0,a("body,html").stop(!0,!0).animate({scrollTop:Math.ceil(i)},function(){return 2===++g?(d(),k._debug("Scroll into view. Animation end element offset: "+e.offset().top+". Window height: "+f.height()+".")):void 0})):d()},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._setupMouseNavigation=function(){var b=this;return b=this,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(),b.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(),b.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(),b.end()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]",function(c){var d;return c.preventDefault(),d=a(this),d.text(d.data(b._paused?"pause-text":"resume-text")),b._paused?b.resume():b.pause()})},c.prototype._setupKeyboardNavigation=function(){var b=this;if(this._options.keyboard)return a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._isLast()?b.next():b.end();case 37:if(a.preventDefault(),b._current>0)return b.prev();break;case 27:return a.preventDefault(),b.end()}})},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(){return this.backdrop.backgroundShown?void 0:(this.backdrop=a("
",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,a("body").append(this.backdrop))},c.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},c.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),d&&0!==d.length&&!this.backdrop.overlayElementShown?(this.backdrop.overlayElementShown=!0,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):void 0},c.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},c.prototype._clearTimer=function(){return b.clearTimeout(this._timer),this._timer=null,this._duration=null},c}(),b.Tour=c}(jQuery,window); \ No newline at end of file +!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,duration:!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(){},onPause:function(){},onResume:function(){}},c),this._force=!1,this._inited=!1,this._steps=[],this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return c.prototype.setState=function(a,b){var c,d;if(this._options.storage){d=""+this._options.name+"_"+a;try{this._options.storage.setItem(d,b)}catch(e){c=e,c.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. setState failed.")}return this._options.afterSetState(d,b)}return 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,duration:this._options.duration,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,onPause:this._options.onPause,onResume:this._options.onResume},this._steps[b]):void 0},c.prototype.init=function(a){var b=this;return this._force=a,this.ended()?this._debug("Tour ended, init prevented."):(this.setCurrentStep(),this._setupMouseNavigation(),this._setupKeyboardNavigation(),this._onResize(function(){return b.showStep(b._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},c.prototype.start=function(a){var b;return null==a&&(a=!1),this._inited||this.init(a),null===this._current?(b=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(b,this.showStep,0)):void 0},c.prototype.next=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep)},c.prototype.prev=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep)},c.prototype.goTo=function(a){var b;return 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"),f._inited=!1,f._force=!1,f._clearTimer(),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._force&&!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.pause=function(){var a;return a=this.getStep(this._current),a&&a.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,b.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=a.onPause?a.onPause(this,this._duration):void 0):void 0},c.prototype.resume=function(){var a,c=this;return a=this.getStep(this._current),a&&a.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||a.duration,this._timer=b.setTimeout(function(){return c._isLast()?c.next():c.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=a.onResume&&this._duration!==a.duration?a.onResume(this,this._duration):void 0):void 0},c.prototype.hideStep=function(b){var c,d,e,f=this;return(e=this.getStep(b))?(this._clearTimer(),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=a(e.element),b.data("bs.popover")||b.data("popover")||(b=a("body")),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):void 0},c.prototype.showStep=function(b){var c,e,f,g,h=this;return this.ended()?this._debug("Tour ended, showStep prevented."):(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._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,d){var e,f,g,h,i,j,k=this;return e=a(c),e.length?(f=a(b),h=e.offset().top,j=f.height(),i=Math.max(0,h-j/2),this._debug("Scroll into view. ScrollTop: "+i+". Element offset: "+h+". Window height: "+j+"."),g=0,a("body,html").stop(!0,!0).animate({scrollTop:Math.ceil(i)},function(){return 2===++g?(d(),k._debug("Scroll into view. Animation end element offset: "+e.offset().top+". Window height: "+f.height()+".")):void 0})):d()},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._setupMouseNavigation=function(){var b=this;return b=this,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(),b.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(),b.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(),b.end()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]",function(c){var d;return c.preventDefault(),d=a(this),d.text(b._paused?d.data("pause-text"):d.data("resume-text")),b._paused?b.resume():b.pause()})},c.prototype._setupKeyboardNavigation=function(){var b=this;if(this._options.keyboard)return a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._isLast()?b.next():b.end();case 37:if(a.preventDefault(),b._current>0)return b.prev();break;case 27:return a.preventDefault(),b.end()}})},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(){return this.backdrop.backgroundShown?void 0:(this.backdrop=a("
",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,a("body").append(this.backdrop))},c.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},c.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),d&&0!==d.length&&!this.backdrop.overlayElementShown?(this.backdrop.overlayElementShown=!0,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):void 0},c.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},c.prototype._clearTimer=function(){return b.clearTimeout(this._timer),this._timer=null,this._duration=null},c}(),b.Tour=c}(jQuery,window); \ No newline at end of file diff --git a/docs/_includes/footer.html b/docs/_includes/footer.html new file mode 100644 index 00000000..c1a23b8f --- /dev/null +++ b/docs/_includes/footer.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/docs/_includes/header.html b/docs/_includes/header.html new file mode 100644 index 00000000..28370c37 --- /dev/null +++ b/docs/_includes/header.html @@ -0,0 +1,28 @@ + + + + + + + {% if page.title == "Bootstrap Tour" %} + {{ page.title }} + {% else %} + {{ page.title }} · Bootstrap Tour + {% endif %} + + + + + + + + + diff --git a/docs/_includes/nav.html b/docs/_includes/nav.html new file mode 100644 index 00000000..bff2a09f --- /dev/null +++ b/docs/_includes/nav.html @@ -0,0 +1,23 @@ + diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html new file mode 100644 index 00000000..195669e4 --- /dev/null +++ b/docs/_layouts/default.html @@ -0,0 +1,12 @@ + + + + {% include header.html %} + + + Fork me on GitHub + {% include nav.html %} + {{ content }} + {% include footer.html %} + + diff --git a/docs/api.html b/docs/api.html new file mode 100644 index 00000000..df0cd91a --- /dev/null +++ b/docs/api.html @@ -0,0 +1,609 @@ +--- +layout: default +title: API Documentation +slug: api +--- + +
+
+ +

Global options

+{% highlight javascript %} +var tour = new Tour({ + name: "tour", + container: "body", + keyboard: true, + storage: window.localStorage, + debug: false, + backdrop: false, + redirect: true, + orphan: false, + duration: false, + basePath: "", + template: "
+
+

+
+
+ + | + +
+ + +
", + afterGetState: function (key, value) {}, + afterSetState: function (key, value) {}, + afterRemoveState: function (key, value) {}, + onStart: function (tour) {}, + onEnd: function (tour) {}, + onShow: function (tour) {}, + onShown: function (tour) {} + onHide: function (tour) {}, + onHidden: function (tour) {}, + onNext: function (tour) {}, + onPrev: function (tour) {}, + onPause: function (tour, duration) {}, + onResume: function (tour, duration) {} +}); +{% endhighlight %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
nameStringThis option is used to build the name of the + storage item where the tour state is stored. You can + initialize several tours with different names in the same page and + application.'tour'
containerStringAppends the step popover to a specific element.
+ See Usage section of + Popover. + +
'body'
keyboardBooleanThis option set the left and right arrow navigation.true
storageObjectThe storage system you want to use. could be the objects window.localStorage, + window.sessionStorage or your own object.
+ You can set this option as + false to disable storage + persistence (the tour starts from beginning everytime the page is + loaded).
+ Read more about DOM Storage interfaces. +
window.localStorage
debugBooleanSet this option to true to have some useful informations printed in the + console.false
backdropBooleanShow a dark backdrop behind the popover and its element, + highlighting the current step.false
redirectBoolean|FunctionSet a custom function to execute as redirect function. + The default redirect relies on the traditional + document.location.hreftrue
orphanBooleanAllow to show the step regardless whether its element is not set, is + not present in the page or is hidden. The step is fixed + positioned in the middle of the page.false
duration NEWBoolean|StringSet a expiration time for the steps. When the current step expires, + the next step is automatically shown. See it as a sort of guided, automatized tour + functionality. The value is specified in millisecondsfalse
basePathStringSpecify a default base path prepended to the + path option of every single + step. Very useful if you need to reuse the same tour on different + environments or sub-projects.''
templateString|FunctionString or function that returns a string of the HTML template for + the popovers. If you pass a Function, two parameters are available: + i is the position of step in the tour and + step is the an object that contains all the other step + options.
+ From version 0.5, the navigation template is included inside the + template so you can easily rewrite it. However, Bootstrap Tour maps the + previous, next and end logics to the elements + which have the related data-role + attribute. Therefore, you can also have multiple elements with the same + data-role attribute. +
+{% highlight javascript %} +"
+
+

+
+
+ + | + + +
+
" +{% endhighlight %} +
afterGetState, afterSetState, afterRemoveStateFunctionYou may want to do something right after Bootstrap Tour read, write or remove + the state. Just pass functions to these.
+ Your functions can have two parameters: +
    +
  • + key + Contains the name of the state being saved. It can be + current_step (for the state where the + latest step the visitor viewed is saved) or + end (for the state which is saved when + the user complete the tour). Note that Bootstrap Tour prepends the key with + tour_ when saving the state. +
  • +
  • + value + The value of the state been saved. Can be the index of the + current step if the key is current_step, or + yes if the key is end. +
  • +
+

A simple example if to send a post request to your server each + time there is a change:

+{% highlight javascript %} +var tour = new Tour({ + afterSetState: function (key, value) { + $.post("/some/path", value); + } +}); +{% endhighlight %} +
function (key, value) { }
onStartFunctionFunction to execute when the tour starts.function (tour) { }
onEndFunctionFunction to execute when the tour ends.function (tour) { }
onShowFunctionFunction to execute right before each step is shown.function (tour) { }
onShownFunctionFunction to execute right after each step is shown.function (tour) { }
onHideFunctionFunction to execute right before each step is hidden.function (tour) { }
onHiddenFunctionFunction to execute right after each step is hidden.function (tour) { }
onNextFunctionFunction to execute when next step is called.function (tour) { }
onPrevFunctionFunction to execute when prev step is called.function (tour) { }
onPause NEWFunctionFunction to execute when pause is called. The second argument refers to the + remaining duration.function (tour, duration) { }
onResume NEWFunctionFunction to execute when resume is called. The second argument refers to the + remaining duration.function (tour, duration) { }
+ +

Step Options

+{% highlight javascript %} +tour.addStep({ + path: "", + element: "", + placement: "right", + title: "", + content: "", + next: 0, + prev: 0, + animation: true, + container: "body", + backdrop: false, + redirect: true, + reflex: false, + orphan: false, + template: "", + onShow: function (tour) {}, + onShown: function (tour) {}, + onHide: function (tour) {}, + onHidden: function (tour) {}, + onNext: function (tour) {}, + onPrev: function (tour) {}, + onPause: function (tour) {}, + onResume: function (tour) {} +}); +{% endhighlight %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
pathStringPath to the page on which the step should be shown. This + allows you to build tours that span several pages!''
elementString (jQuery selector)HTML element on which the step popover should be shown.
+ If orphan is false, this option is required.
''
placementString|FunctionHow to position the popover. Possible choices: + 'top', + 'bottom', + 'left', + 'right'. + 'right'
titleString|FunctionStep title''
contentString|FunctionStep content''
nextIntegerIndex of the step to show after this one, starting from + 0 for the first step of the + tour. -1 to not show the link + to next step. By default, the next step (in the order you added + them) will be shown.
+ This option should be used in conjunction with + prev.
0
prevIntegerIndex of the step to show before this one, starting from + 0 for the first step of the + tour. -1 to not show the link + to previous step. By default, the previous step (in the order you added + them) will be shown.
+ This option should be used in conjunction with + next.
0
animationBooleanApply a css fade transition to the tooltip.true
containerString (jQuery selector)Attachment of popover. Pass an element to append the popover + to. By default the popover is appended after the 'element' above. + This option is particularly helpful for Internet Explorer.'body'
backdropBooleanShow a dark backdrop behind the popover and its element, + highlighting the current step.false
redirectBoolean|FunctionSet a custom function to execute as redirect function. + The default redirect relies on the traditional + document.location.hreftrue
reflexBooleanEnable the reflex mode: you can click on the element for + continue the tour.false
orphanBooleanAllow to show the step regardless whether its element is not set, is + not present in the page or is hidden. The step is fixed + positioned in the middle of the page.false
duration NEWBoolean|StringSet a expiration time for the stes. When the step expires, + the next step is automatically shown. See it as a sort of guided, automatized tour + functionality. The value is specified in millisecondsfalse
templateString|FunctionString or function that returns a string of the HTML template for + the popovers. If you pass a Function, two parameters are available: + i is the position of step in the tour and + step is the an object that contains all the other step + options.
+ From version 0.5, the navigation template is included inside the + template so you can easily rewrite it. However, Bootstrap Tour maps the + previous, next and end logics to the elements + which have the related data-role + attribute. Therefore, you can also have multiple elements with the same + data-role attribute. +
+{% highlight javascript %} +"
+
+

+
+
+ + | + + +
+
" +{% endhighlight %} +
onShowFunctionFunction to execute right before the step is shown. It overrides the + global onShow option.function (tour) { }
onShownFunctionFunction to execute right after the step is shown. It overrides the + global onShown option.function (tour) { }
onHideFunctionFunction to execute right before the step is hidden. It overrides + the global onHide option.function (tour) { }
onHiddenFunctionFunction to execute right after the step is hidden. It overrides the + global onHidden option.function (tour) { }
onNextFunctionFunction to execute when next step is called. It overrides the + global onNext option.function (tour) { }
onPrevFunctionFunction to execute when prev step is called. It overrides the global + onPrev option.function (tour) { }
onPause NEWFunctionFunction to execute when pause is called. The second argument refers to the + remaining duration. It overrides the global the + onPause optionfunction (tour, duration) { }
onResume NEWFunctionFunction to execute when resume is called. The second argument refers to the + remaining duration. It overrides the global + onResume optionfunction (tour, duration) { }
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
addSteps([])Add multiple steps to the tour. Pass an array of objects.
addStep({})Add single step to the tour. Pass an object.
init()Initialize the tour. You must do it before calling start.
start(true)Start the tour. Pass true to force the start.
restart()Restart the tour after it ended.
end()End the tour prematurely.
next()Skip to the next step.
prev()Go back to the previous step.
goTo(i) + UPDATEDSkip to a specific step. Pass i as the + index of the step in the tour (0-based).
+ From version 0.7.0, the method has been renamed since some Javascript compilers + are confused by the property name goto, which is a reserved word) + . +
pause()Pause the duration timer. It works only if tour or current stap has duration.
resume()Resume the duration timer. It works only if tour or current stap has duration.
ended()Verify if the tour ended. Returns boolean.
getStep(i)Get the step object. Pass i as the index + of the step in the tour (0-based).
getCurrentStep()Get the index of the current step.
setCurrentStep(i)Override the current step. Pass i + as the index of the step in the tour (0-based).
+
+
diff --git a/docs/index.coffee b/docs/assets/coffee/docs.coffee similarity index 85% rename from docs/index.coffee rename to docs/assets/coffee/docs.coffee index a1005607..401ac810 100644 --- a/docs/index.coffee +++ b/docs/assets/coffee/docs.coffee @@ -10,6 +10,7 @@ $ -> remaining = duration tour.addSteps [ + path: "/" element: "#demo" placement: "bottom" title: "Welcome to Bootstrap Tour!" @@ -19,12 +20,20 @@ $ -> Bootstrap from Twitter. """ , + path: "/" element: "#usage" placement: "top" title: "A super simple setup" content: "Easy is better, right? Easy like Bootstrap. The tour is up and running with just a few options and steps." , + path: "/" + element: "#license" + placement: "top" + title: "Best of all, it's free!" + content: "Yeah! Free as in beer... or speech. Use and abuse, but don't forget to contribute!" + , + path: "/api" element: "#options" placement: "top" title: "Flexibilty and expressiveness" @@ -34,6 +43,7 @@ $ -> """ reflex: true , + path: "/api" element: "#duration" placement: "top" title: "Automagically expiring step", @@ -43,6 +53,7 @@ $ -> """ duration: 5000 , + path: "/api" element: "#methods" placement: "top" title: "A new shiny Backdrop option" @@ -52,37 +63,23 @@ $ -> """ backdrop: true , + path: "/api" + element: "#reflex" + placement: "bottom" + title: "Reflex mode" + content: "Reflex mode is enabled, click on the text in the cell to continue!" + reflex: true + , + path: "/api" title: "And support for orphan steps" content: """ If you activate the orphan property, the step(s) are shown centered in the page, and you can forget to specify element and placement! """ orphan: true - , - path: "/" - element: "#reflex" - placement: "bottom" - title: "Reflex mode" - content: "Reflex mode is enabled, click on the page heading to continue!" - reflex: true - , - path: "/page.html" - element: "h1" - placement: "bottom" - title: "See, you are not restricted to only one page" - content: "Well, nothing to see here. Click next to go back to the index page." - , - path: "/" - element: "#license" - placement: "top" - title: "Best of all, it's free!" - content: "Yeah! Free as in beer... or speech. Use and abuse, but don't forget to contribute!" - , - element: ".navbar-nav > li:last" - placement: "bottom" - title: "Fixed position" - content: "Works well for fixed positioned elements! :)" - ] + onHidden: -> + window.location.assign "/" + ] tour.init() tour.start() diff --git a/docs/assets/css/index.css b/docs/assets/css/docs.css similarity index 99% rename from docs/assets/css/index.css rename to docs/assets/css/docs.css index dee240e1..94d2085b 100644 --- a/docs/assets/css/index.css +++ b/docs/assets/css/docs.css @@ -1121,4 +1121,8 @@ pre { code, pre { font-size: 13px; -} \ No newline at end of file +} + +pre code { + white-space: pre; +} diff --git a/docs/assets/js/bootstrap-tour.min.js b/docs/assets/js/bootstrap-tour.min.js index c395adc3..739e4bba 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(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,duration:!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(){},onPause:function(){},onResume:function(){}},c),this._force=!1,this._inited=!1,this._steps=[],this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return c.prototype.setState=function(a,b){var c,d;if(this._options.storage){d=""+this._options.name+"_"+a;try{this._options.storage.setItem(d,b)}catch(e){c=e,c.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. setState failed.")}return this._options.afterSetState(d,b)}return 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,duration:this._options.duration,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,onPause:this._options.onPause,onResume:this._options.onResume},this._steps[b]):void 0},c.prototype.init=function(a){var b=this;return this._force=a,this.ended()?this._debug("Tour ended, init prevented."):(this.setCurrentStep(),this._setupMouseNavigation(),this._setupKeyboardNavigation(),this._onResize(function(){return b.showStep(b._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},c.prototype.start=function(a){var b;return null==a&&(a=!1),this._inited||this.init(a),null===this._current?(b=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(b,this.showStep,0)):void 0},c.prototype.next=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep)},c.prototype.prev=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep)},c.prototype.goTo=function(a){var b;return 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"),f._inited=!1,f._force=!1,f._clearTimer(),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._force&&!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.pause=function(){var a;return a=this.getStep(this._current),a&&a.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,b.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=a.onPause?a.onPause(this,this._duration):void 0):void 0},c.prototype.resume=function(){var a,c=this;return a=this.getStep(this._current),a&&a.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||a.duration,this._timer=b.setTimeout(function(){return c._isLast()?c.next():c.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=a.onResume&&this._duration!==a.duration?a.onResume(this,this._duration):void 0):void 0},c.prototype.hideStep=function(b){var c,d,e,f=this;return(e=this.getStep(b))?(this._clearTimer(),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=a(e.element),b.data("bs.popover")||b.data("popover")||(b=a("body")),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):void 0},c.prototype.showStep=function(b){var c,e,f,g,h=this;return this.ended()?this._debug("Tour ended, showStep prevented."):(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._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,d){var e,f,g,h,i,j,k=this;return e=a(c),e.length?(f=a(b),h=e.offset().top,j=f.height(),i=Math.max(0,h-j/2),this._debug("Scroll into view. ScrollTop: "+i+". Element offset: "+h+". Window height: "+j+"."),g=0,a("body,html").stop(!0,!0).animate({scrollTop:Math.ceil(i)},function(){return 2===++g?(d(),k._debug("Scroll into view. Animation end element offset: "+e.offset().top+". Window height: "+f.height()+".")):void 0})):d()},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._setupMouseNavigation=function(){var b=this;return b=this,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(),b.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(),b.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(),b.end()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]",function(c){var d;return c.preventDefault(),d=a(this),d.text(d.data(b._paused?"pause-text":"resume-text")),b._paused?b.resume():b.pause()})},c.prototype._setupKeyboardNavigation=function(){var b=this;if(this._options.keyboard)return a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._isLast()?b.next():b.end();case 37:if(a.preventDefault(),b._current>0)return b.prev();break;case 27:return a.preventDefault(),b.end()}})},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(){return this.backdrop.backgroundShown?void 0:(this.backdrop=a("
",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,a("body").append(this.backdrop))},c.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},c.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),d&&0!==d.length&&!this.backdrop.overlayElementShown?(this.backdrop.overlayElementShown=!0,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):void 0},c.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},c.prototype._clearTimer=function(){return b.clearTimeout(this._timer),this._timer=null,this._duration=null},c}(),b.Tour=c}(jQuery,window); \ No newline at end of file +!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,duration:!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(){},onPause:function(){},onResume:function(){}},c),this._force=!1,this._inited=!1,this._steps=[],this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return c.prototype.setState=function(a,b){var c,d;if(this._options.storage){d=""+this._options.name+"_"+a;try{this._options.storage.setItem(d,b)}catch(e){c=e,c.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. setState failed.")}return this._options.afterSetState(d,b)}return 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,duration:this._options.duration,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,onPause:this._options.onPause,onResume:this._options.onResume},this._steps[b]):void 0},c.prototype.init=function(a){var b=this;return this._force=a,this.ended()?this._debug("Tour ended, init prevented."):(this.setCurrentStep(),this._setupMouseNavigation(),this._setupKeyboardNavigation(),this._onResize(function(){return b.showStep(b._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},c.prototype.start=function(a){var b;return null==a&&(a=!1),this._inited||this.init(a),null===this._current?(b=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(b,this.showStep,0)):void 0},c.prototype.next=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep)},c.prototype.prev=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep)},c.prototype.goTo=function(a){var b;return 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"),f._inited=!1,f._force=!1,f._clearTimer(),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._force&&!!this.getState("end")},c.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.pause=function(){var a;return a=this.getStep(this._current),a&&a.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,b.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=a.onPause?a.onPause(this,this._duration):void 0):void 0},c.prototype.resume=function(){var a,c=this;return a=this.getStep(this._current),a&&a.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||a.duration,this._timer=b.setTimeout(function(){return c._isLast()?c.next():c.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=a.onResume&&this._duration!==a.duration?a.onResume(this,this._duration):void 0):void 0},c.prototype.hideStep=function(b){var c,d,e,f=this;return(e=this.getStep(b))?(this._clearTimer(),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=a(e.element),b.data("bs.popover")||b.data("popover")||(b=a("body")),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):void 0},c.prototype.showStep=function(b){var c,e,f,g,h=this;return this.ended()?this._debug("Tour ended, showStep prevented."):(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._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,d){var e,f,g,h,i,j,k=this;return e=a(c),e.length?(f=a(b),h=e.offset().top,j=f.height(),i=Math.max(0,h-j/2),this._debug("Scroll into view. ScrollTop: "+i+". Element offset: "+h+". Window height: "+j+"."),g=0,a("body,html").stop(!0,!0).animate({scrollTop:Math.ceil(i)},function(){return 2===++g?(d(),k._debug("Scroll into view. Animation end element offset: "+e.offset().top+". Window height: "+f.height()+".")):void 0})):d()},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._setupMouseNavigation=function(){var b=this;return b=this,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(),b.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(),b.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(),b.end()}),a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]",function(c){var d;return c.preventDefault(),d=a(this),d.text(b._paused?d.data("pause-text"):d.data("resume-text")),b._paused?b.resume():b.pause()})},c.prototype._setupKeyboardNavigation=function(){var b=this;if(this._options.keyboard)return a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._isLast()?b.next():b.end();case 37:if(a.preventDefault(),b._current>0)return b.prev();break;case 27:return a.preventDefault(),b.end()}})},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(){return this.backdrop.backgroundShown?void 0:(this.backdrop=a("
",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,a("body").append(this.backdrop))},c.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},c.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),d&&0!==d.length&&!this.backdrop.overlayElementShown?(this.backdrop.overlayElementShown=!0,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):void 0},c.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},c.prototype._clearTimer=function(){return b.clearTimeout(this._timer),this._timer=null,this._duration=null},c}(),b.Tour=c}(jQuery,window); \ No newline at end of file diff --git a/docs/assets/js/index.js b/docs/assets/js/docs.js similarity index 85% rename from docs/assets/js/index.js rename to docs/assets/js/docs.js index c57cb89f..064c2e56 100644 --- a/docs/assets/js/index.js +++ b/docs/assets/js/docs.js @@ -14,61 +14,59 @@ $(function() { remaining = duration; tour.addSteps([ { + path: "/", element: "#demo", placement: "bottom", title: "Welcome to Bootstrap Tour!", content: "Introduce new users to your product by walking them through it step by step.\nBuilt on the awesome\nBootstrap from Twitter." }, { + path: "/", element: "#usage", placement: "top", title: "A super simple setup", content: "Easy is better, right? Easy like Bootstrap. The tour is up and running with just a few options and steps." }, { + path: "/", + element: "#license", + placement: "top", + title: "Best of all, it's free!", + content: "Yeah! Free as in beer... or speech. Use and abuse, but don't forget to contribute!" + }, { + path: "/api", element: "#options", placement: "top", title: "Flexibilty and expressiveness", content: "There are more options for those who want to get on the dark side.
\nPower to the people!", reflex: true }, { + path: "/api", element: "#duration", placement: "top", title: "Automagically expiring step", content: "A new addition: make your tour (or step) completely automatic. You set the duration, Bootstrap\nTour does the rest. For instance, this step will disappear in 5 seconds.", duration: 5000 }, { + path: "/api", element: "#methods", placement: "top", title: "A new shiny Backdrop option", content: "If you need to highlight the current step's element, activate the backdrop and you won't lose\nthe focus anymore!", backdrop: true }, { - title: "And support for orphan steps", - content: "If you activate the orphan property, the step(s) are shown centered in the page, and you can\nforget to specify element and placement!", - orphan: true - }, { - path: "/", + path: "/api", element: "#reflex", placement: "bottom", title: "Reflex mode", - content: "Reflex mode is enabled, click on the page heading to continue!", + content: "Reflex mode is enabled, click on the text in the cell to continue!", reflex: true }, { - path: "/page.html", - element: "h1", - placement: "bottom", - title: "See, you are not restricted to only one page", - content: "Well, nothing to see here. Click next to go back to the index page." - }, { - path: "/", - element: "#license", - placement: "top", - title: "Best of all, it's free!", - content: "Yeah! Free as in beer... or speech. Use and abuse, but don't forget to contribute!" - }, { - element: ".navbar-nav > li:last", - placement: "bottom", - title: "Fixed position", - content: "Works well for fixed positioned elements! :)" + path: "/api", + title: "And support for orphan steps", + content: "If you activate the orphan property, the step(s) are shown centered in the page, and you can\nforget to specify element and placement!", + orphan: true, + onHidden: function() { + return window.location.assign("/"); + } } ]); tour.init(); diff --git a/docs/assets/vendor/prism.css b/docs/assets/vendor/prism.css deleted file mode 100644 index 7e97fbb4..00000000 --- a/docs/assets/vendor/prism.css +++ /dev/null @@ -1,107 +0,0 @@ -/** - * prism.js default theme for JavaScript, CSS and HTML - * Based on dabblet (http://dabblet.com) - * @author Lea Verou - */ - -code[class*="language-"], -pre[class*="language-"] { - color: black; - text-shadow: 0 1px white; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -@media print { - code[class*="language-"], - pre[class*="language-"] { - text-shadow: none; - } -} - -/* Code blocks */ -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -:not(pre) > code[class*="language-"], -pre[class*="language-"] { - background: #f5f2f0; -} - -/* Inline code */ -:not(pre) > code[class*="language-"] { - padding: .1em; - border-radius: .3em; -} - -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: slategray; -} - -.token.punctuation { - color: #999; -} - -.namespace { - opacity: .7; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number { - color: #905; -} - -.token.selector, -.token.attr-name, -.token.string { - color: #690; -} - -.token.operator, -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string { - color: #a67f59; - background: hsla(0,0%,100%,.5); -} - -.token.atrule, -.token.attr-value, -.token.keyword { - color: #07a; -} - - -.token.regex, -.token.important { - color: #e90; -} - -.token.important { - font-weight: bold; -} - -.token.entity { - cursor: help; -} diff --git a/docs/assets/vendor/prism.js b/docs/assets/vendor/prism.js deleted file mode 100644 index 26c9e8be..00000000 --- a/docs/assets/vendor/prism.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me - */(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+""};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();; -Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});; -Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}}, number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};; -Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});; diff --git a/docs/assets/vendor/pygments-manni.css b/docs/assets/vendor/pygments-manni.css new file mode 100644 index 00000000..1264b87f --- /dev/null +++ b/docs/assets/vendor/pygments-manni.css @@ -0,0 +1,66 @@ +.hll { background-color: #ffffcc } + /*{ background: #f0f3f3; }*/ +.c { color: #999; } /* Comment */ +.err { color: #AA0000; background-color: #FFAAAA } /* Error */ +.k { color: #006699; } /* Keyword */ +.o { color: #555555 } /* Operator */ +.cm { color: #0099FF; font-style: italic } /* Comment.Multiline */ +.cp { color: #009999 } /* Comment.Preproc */ +.c1 { color: #999; } /* Comment.Single */ +.cs { color: #999; } /* Comment.Special */ +.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #003300; } /* Generic.Heading */ +.gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */ +.go { color: #AAAAAA } /* Generic.Output */ +.gp { color: #000099; } /* Generic.Prompt */ +.gs { } /* Generic.Strong */ +.gu { color: #003300; } /* Generic.Subheading */ +.gt { color: #99CC66 } /* Generic.Traceback */ +.kc { color: #006699; } /* Keyword.Constant */ +.kd { color: #006699; } /* Keyword.Declaration */ +.kn { color: #006699; } /* Keyword.Namespace */ +.kp { color: #006699 } /* Keyword.Pseudo */ +.kr { color: #006699; } /* Keyword.Reserved */ +.kt { color: #007788; } /* Keyword.Type */ +.m { color: #FF6600 } /* Literal.Number */ +.s { color: #d44950 } /* Literal.String */ +.na { color: #4f9fcf } /* Name.Attribute */ +.nb { color: #336666 } /* Name.Builtin */ +.nc { color: #00AA88; } /* Name.Class */ +.no { color: #336600 } /* Name.Constant */ +.nd { color: #9999FF } /* Name.Decorator */ +.ni { color: #999999; } /* Name.Entity */ +.ne { color: #CC0000; } /* Name.Exception */ +.nf { color: #CC00FF } /* Name.Function */ +.nl { color: #9999FF } /* Name.Label */ +.nn { color: #00CCFF; } /* Name.Namespace */ +.nt { color: #2f6f9f; } /* Name.Tag */ +.nv { color: #003333 } /* Name.Variable */ +.ow { color: #000000; } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #FF6600 } /* Literal.Number.Float */ +.mh { color: #FF6600 } /* Literal.Number.Hex */ +.mi { color: #FF6600 } /* Literal.Number.Integer */ +.mo { color: #FF6600 } /* Literal.Number.Oct */ +.sb { color: #CC3300 } /* Literal.String.Backtick */ +.sc { color: #CC3300 } /* Literal.String.Char */ +.sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */ +.s2 { color: #CC3300 } /* Literal.String.Double */ +.se { color: #CC3300; } /* Literal.String.Escape */ +.sh { color: #CC3300 } /* Literal.String.Heredoc */ +.si { color: #AA0000 } /* Literal.String.Interpol */ +.sx { color: #CC3300 } /* Literal.String.Other */ +.sr { color: #33AAAA } /* Literal.String.Regex */ +.s1 { color: #CC3300 } /* Literal.String.Single */ +.ss { color: #FFCC33 } /* Literal.String.Symbol */ +.bp { color: #336666 } /* Name.Builtin.Pseudo */ +.vc { color: #003333 } /* Name.Variable.Class */ +.vg { color: #003333 } /* Name.Variable.Global */ +.vi { color: #003333 } /* Name.Variable.Instance */ +.il { color: #FF6600 } /* Literal.Number.Integer.Long */ + +.css .o, +.css .o + .nt, +.css .nt + .nt { color: #999; } diff --git a/docs/index.html b/docs/index.html index c16fa61b..2fbbc5d1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,102 +1,59 @@ - - - - - Bootstrap Tour, easy product tours with Bootstrap from Twitter - - - - - - - - - - Fork me on GitHub - + +
+
+ +

Code licensed under the Apache License v2.0.
+ Documentation licensed under CC BY 3.0.

+
+
diff --git a/docs/index.less b/docs/index.less deleted file mode 100644 index 15057a22..00000000 --- a/docs/index.less +++ /dev/null @@ -1,205 +0,0 @@ -body { - position: relative; - padding-top: 50px; - padding-bottom: 50px; -} - -a { - -webkit-transition: all .2s ease-in-out; - -moz-transition: all .2s ease-in-out; - transition: all .2s ease-in-out; -} - -section { - padding-top: 20px; -} - -/* Base class -------------------------- */ -.banner { - position: relative; - padding: 60px 0 80px; - font-size: 16px; - color: #fff; - text-align: center; - text-shadow: 0 1px 3px rgba(0,0,0,.4), 0 0 30px rgba(0,0,0,.075); - background: #020031; /* Old browsers */ - background: -moz-linear-gradient(45deg, #020031 0%, #6d3353 100%); - background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#020031), color-stop(100%,#6d3353)); - background: -webkit-linear-gradient(45deg, #020031 0%,#6d3353 100%); - background: -o-linear-gradient(45deg, #020031 0%,#6d3353 100%); - background: -ms-linear-gradient(45deg, #020031 0%,#6d3353 100%); - background: linear-gradient(45deg, #020031 0%,#6d3353 100%); - -webkit-box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); - -moz-box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); - box-shadow: inset 0 3px 7px rgba(0,0,0,.2), inset 0 -3px 7px rgba(0,0,0,.2); - - .container { - position: relative; - z-index: 2; - } - - h1 { - font-size: 82px; - letter-spacing: -2px; - line-height: 1; - } - - p { - font-size: 26px; - font-weight: 200; - margin-bottom: 30px; - } - - a { - color: #fff; - color: rgba(255,255,255,.5); - - &:hover { - color: #fff; - text-shadow: 0 0 10px rgba(255,255,255,.25); - } - } - - .btn { - padding: 19px 24px; - font-size: 24px; - font-weight: 200; - color: #fff; /* redeclare to override the `.banner a` */ - border: 0; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25); - box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25); - -webkit-transition: none; - -moz-transition: none; - transition: none; - - &:hover { - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25); - box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 5px rgba(0,0,0,.25); - } - - &:active { - -webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.1); - -moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.1); - box-shadow: inset 0 2px 4px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.1); - } - } - - .links { - margin: 0; - list-style: none; - - li { - display: inline; - padding: 0 10px; - color: rgba(255,255,255,.25); - } - } -} - -#github { - display: block; - position: fixed; - width: 150px; - height: 150px; - top: 0; - right: 0; - z-index: 1050; -} - -code, -pre { - font-size: 13px; -} - -@media (min-width: 1200px) { - .banner { - - h1 { - font-size: 90px; - } - - p { - font-size: 30px; - } - } -} - -@media (min-width: 768px) and (max-width: 979px) { - .banner { - padding: 10px 0 30px; - - h1 { - font-size: 76px; - } - - p, - .btn { - font-size: 20px; - } - } -} - -@media (max-width: 767px) { - body { - padding-top: 0; - } - - .banner { - padding: 70px 20px 20px 20px; - margin-top: -20px; /* Offset bottom margin on .navbar */ - margin-right: -20px; - margin-left: -20px; - - h1 { - font-size: 60px; - } - - p, - .btn { - font-size: 20px; - } - } - - #github { - display: none !important; - } -} - -@media (max-width: 480px) { - body { - padding-top: 0; - } - - h2 small { - display: block; - } - - .banner { - - h1 { - font-size: 45px; - } - - p, - .btn { - font-size: 18px; - } - - .btn { - display: block; - margin: 0 auto; - } - } - - table code { - white-space: normal; - word-wrap: break-word; - word-break: break-all; - } -} \ No newline at end of file diff --git a/package.json b/package.json index b28acedc..e7117ab3 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "grunt-contrib-less": "~0.8.2", "grunt-contrib-uglify": "~0.2.7", "grunt-contrib-watch": "~0.5.3", + "grunt-jekyll": "~0.4.1", "grunt-notify": "~0.2.16", "grunt-open": "~0.2.2", "grunt-replace": "~0.5.1" From 24a7e820b7a5facad7bee92216e788f2775f1704 Mon Sep 17 00:00:00 2001 From: Ulrich Sossou Date: Sun, 26 Jan 2014 08:52:25 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Don=E2=80=99t=20build=20the=20docs=20when?= =?UTF-8?q?=20running=20`grunt=20test`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gruntfile.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 124eaf05..5772bbcb 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -204,8 +204,10 @@ module.exports = (grunt) -> grunt.registerTask "default", ["run"] grunt.registerTask "run", ["build", "connect", "open", "watch"] - grunt.registerTask "build", ["clean", "coffeelint", "coffee", "less", "concat", "uglify", "copy", "jekyll"] - grunt.registerTask "test", ["build", "jasmine"] + grunt.registerTask "build-code", ["clean", "coffeelint", "coffee", "less", "concat", "uglify", "copy"] + grunt.registerTask "build-docs", ["jekyll"] + grunt.registerTask "build", ["build-code", "build-docs"] + grunt.registerTask "test", ["build-code", "jasmine"] grunt.registerTask "release", "Release a new version, push it and publish it", (target) -> target = "patch" unless target grunt.task.run "bump-only:#{target}", "test", "replace", "bump-commit" From 09de112744f4594f3a73238338661b91dd5027e8 Mon Sep 17 00:00:00 2001 From: Ulrich Sossou Date: Mon, 27 Jan 2014 01:13:27 +0100 Subject: [PATCH 3/3] Watch assets to run jekyll task --- Gruntfile.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 5772bbcb..173c969f 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -131,7 +131,10 @@ module.exports = (grunt) -> files: ["docs/assets/coffee/*.coffee"] tasks: ["coffeelint:doc", "coffee:doc"] jekyll: - files: ["docs/{,*/}*.html"] + files: [ + "docs/{,*/}*.html", + "docs/assets/{,*/}*" + ] tasks: ["jekyll"] jasmine: