diff --git a/shepherd-amd.js b/shepherd-amd.js
new file mode 100644
index 000000000..87731b039
--- /dev/null
+++ b/shepherd-amd.js
@@ -0,0 +1,495 @@
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(["tether"], factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require('tether'));
+ } else {
+ root.Shepherd = factory(root.Tether);
+ }
+}(this, function(Tether) {
+
+/*! shepherd 0.5.1 */
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, hasClass, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, hasClass = _ref.hasClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ Shepherd = new Evented;
+
+ ATTACHMENT = {
+ 'top': 'bottom center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'top center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ document.body.setAttribute('data-shepherd-step', this.id);
+ this.setupTether();
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ document.body.removeAttribute('data-shepherd-step');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.tour.cancel();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.tour.complete();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, link, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("
");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ header = document.createElement('header');
+ content.appendChild(header);
+ if (this.options.title != null) {
+ header.innerHTML += "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ }
+ if (this.options.showCancelLink) {
+ link = createFromHTML("✕");
+ header.appendChild(link);
+ this.el.className += ' shepherd-has-cancel-link';
+ this.bindCancelLink(link);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindCancelLink = function(link) {
+ var _this = this;
+ return link.addEventListener('click', function(e) {
+ e.preventDefault();
+ return _this.cancel();
+ });
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _fn, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show', 'active', 'inactive'];
+ _fn = function(event) {
+ return _this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ };
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ _fn(event);
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.complete = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('complete');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ Shepherd.activeTour = null;
+ removeClass(document.body, 'shepherd-active');
+ return this.trigger('inactive', {
+ tour: this
+ });
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ } else {
+ addClass(document.body, 'shepherd-active');
+ this.trigger('active', {
+ tour: this
+ });
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
+
+return Shepherd;
+
+}));
diff --git a/shepherd-amd.min.js b/shepherd-amd.min.js
new file mode 100644
index 000000000..ac7bb91d0
--- /dev/null
+++ b/shepherd-amd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.5.1 */
+!function(t,e){"function"==typeof define&&define.amd?define(["tether"],e):"object"==typeof exports?module.exports=e(require("tether")):t.Shepherd=e(t.Tether)}(this,function(t){return function(){var e,n,i,r,s,o,h,l,u,p,c,d,a,f,v,g=function(t,e){return function(){return t.apply(e,arguments)}},y={}.hasOwnProperty,m=function(t,e){function n(){this.constructor=t}for(var i in e)y.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};v=t.Utils,l=v.extend,a=v.removeClass,o=v.addClass,p=v.hasClass,n=v.Evented,u=v.getBounds,f=v.uniqueId,i=new n,e={top:"bottom center",left:"middle right",right:"middle left",bottom:"top center"},h=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},c=function(t,e){var n,i,r,s,o;return n=null!=(i=null!=(r=null!=(s=null!=(o=t.matches)?o:t.matchesSelector)?s:t.webkitMatchesSelector)?r:t.mozMatchesSelector)?i:t.oMatchesSelector,n.call(t,e)},d=function(t,e){var n,i,r,s,o,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),i={},n=o=0,h=e.length;h>o;n=++o)r=e[n],i[r]=s[n];return i},r=function(n){function i(t,e){this.tour=t,this.destroy=g(this.destroy,this),this.scrollTo=g(this.scrollTo,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.isOpen=g(this.isOpen,this),this.hide=g(this.hide,this),this.show=g(this.show,this),this.setOptions(e)}return m(i,n),i.prototype.setOptions=function(t){var e,n,i,r;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+f(),this.options.when){r=this.options.when;for(e in r)n=r[e],this.on(e,n,this)}return null!=(i=this.options).buttons?(i=this.options).buttons:i.buttons=[{text:"Next",action:this.tour.next}]},i.prototype.getTour=function(){return this.tour},i.prototype.bindAdvance=function(){var t,e,n,i,r=this;return i=d(this.options.advanceOn,["selector","event"]),t=i.event,n=i.selector,e=function(t){if(r.isOpen())if(null!=n){if(c(t.target,n))return r.tour.next()}else if(r.el&&t.target===r.el)return r.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},i.prototype.getAttachTo=function(){var t;if(t=d(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},i.prototype.setupTether=function(){var n,i,r;if("undefined"==typeof t||null===t)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return i=this.getAttachTo(),n=e[i.on||"right"],null==i.element&&(i.element="viewport",n="middle center"),r={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:i.element,offset:i.offset||"0 0",attachment:n},this.tether=new t(l(r,this.options.tetherOptions))},i.prototype.show=function(){var t=this;return null==this.el&&this.render(),o(this.el,"shepherd-open"),document.body.setAttribute("data-shepherd-step",this.id),this.setupTether(),this.options.scrollTo&&setTimeout(function(){return t.scrollTo()}),this.trigger("show")},i.prototype.hide=function(){var t;return a(this.el,"shepherd-open"),document.body.removeAttribute("data-shepherd-step"),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("hide")},i.prototype.isOpen=function(){return p(this.el,"shepherd-open")},i.prototype.cancel=function(){return this.tour.cancel(),this.trigger("cancel")},i.prototype.complete=function(){return this.tour.complete(),this.trigger("complete")},i.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},i.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("destroy")},i.prototype.render=function(){var t,e,n,i,r,s,o,l,u,p,c,d,a,f,v,g,y;if(null!=this.el&&this.destroy(),this.el=h(""),i=document.createElement("div"),i.className="shepherd-content",this.el.appendChild(i),s=document.createElement("header"),i.appendChild(s),null!=this.options.title&&(s.innerHTML+=""+this.options.title+"
",this.el.className+=" shepherd-has-title"),this.options.showCancelLink&&(o=h("✕"),s.appendChild(o),this.el.className+=" shepherd-has-cancel-link",this.bindCancelLink(o)),null!=this.options.text){for(p=h(""),u=this.options.text,"string"==typeof u&&(u=[u]),c=0,a=u.length;a>c;c++)l=u[c],p.innerHTML+=""+l+"
";i.appendChild(p)}if(r=document.createElement("footer"),this.options.buttons){for(e=h(""),g=this.options.buttons,d=0,f=g.length;f>d;d++)n=g[d],t=h(""+n.text+""),e.appendChild(t),this.bindButtonEvents(n,t.querySelector("a"));r.appendChild(e)}return i.appendChild(r),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},i.prototype.bindCancelLink=function(t){var e=this;return t.addEventListener("click",function(t){return t.preventDefault(),e.cancel()})},i.prototype.bindButtonEvents=function(t,e){var n,i,r,s,o=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(n in s)i=s[n],"string"==typeof i&&(r=i,i=function(){return o.tour.show(r)}),e.addEventListener(n,i);return this.on("destroy",function(){var r,s;r=t.events,s=[];for(n in r)i=r[n],s.push(e.removeEventListener(n,i));return s})},i}(n),s=function(t){function e(t){var e,n,r,s,o,h,l=this;for(this.options=null!=t?t:{},this.hide=g(this.hide,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.back=g(this.back,this),this.next=g(this.next,this),this.steps=null!=(o=this.options.steps)?o:[],h=["complete","cancel","hide","start","show","active","inactive"],n=function(t){return l.on(t,function(e){return null==e&&(e={}),e.tour=l,i.trigger(t,e)})},r=0,s=h.length;s>r;r++)e=h[r],n(e)}return m(e,t),e.prototype.addStep=function(t,e){var n;return null==e&&(e=t),e instanceof r?e.tour=this:(("string"==(n=typeof t)||"number"===n)&&(e.id=t.toString()),e=l({},this.options.defaults,e),e=new r(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,n,i,r;for(r=this.steps,n=0,i=r.length;i>n;n++)if(e=r[n],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("cancel"),this.done()},e.prototype.complete=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("complete"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return i.activeTour=null,a(document.body,"shepherd-active"),this.trigger("inactive",{tour:this})},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep?this.currentStep.hide():(o(document.body,"shepherd-active"),this.trigger("active",{tour:this})),i.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(n),l(i,{Tour:s,Step:r,Evented:n}),window.Shepherd=i}.call(this),Shepherd});
\ No newline at end of file