From 0ae478afeff5a60a4d283fda3beff36b58738f65 Mon Sep 17 00:00:00 2001 From: tom-workman Date: Wed, 18 Oct 2017 13:19:44 -0500 Subject: [PATCH] Fix: update grunt-rollup package for builds --- dist/js/hopscotch.js | 121 +++++++++++++++++++++++++++++++++-- dist/js/hopscotch.min.js | 2 +- dist/js/hopscotch_amd.js | 121 +++++++++++++++++++++++++++++++++-- dist/js/hopscotch_amd.min.js | 2 +- package.json | 2 +- 5 files changed, 237 insertions(+), 11 deletions(-) diff --git a/dist/js/hopscotch.js b/dist/js/hopscotch.js index a609bf55..58d23922 100644 --- a/dist/js/hopscotch.js +++ b/dist/js/hopscotch.js @@ -26,6 +26,123 @@ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + + + + var asyncGenerator = function () { + function AwaitValue(value) { + this.value = value; + } + + function AsyncGenerator(gen) { + var front, back; + + function send(key, arg) { + return new Promise(function (resolve, reject) { + var request = { + key: key, + arg: arg, + resolve: resolve, + reject: reject, + next: null + }; + + if (back) { + back = back.next = request; + } else { + front = back = request; + resume(key, arg); + } + }); + } + + function resume(key, arg) { + try { + var result = gen[key](arg); + var value = result.value; + + if (value instanceof AwaitValue) { + Promise.resolve(value.value).then(function (arg) { + resume("next", arg); + }, function (arg) { + resume("throw", arg); + }); + } else { + settle(result.done ? "return" : "normal", result.value); + } + } catch (err) { + settle("throw", err); + } + } + + function settle(type, value) { + switch (type) { + case "return": + front.resolve({ + value: value, + done: true + }); + break; + + case "throw": + front.reject(value); + break; + + default: + front.resolve({ + value: value, + done: false + }); + break; + } + + front = front.next; + + if (front) { + resume(front.key, front.arg); + } else { + back = null; + } + } + + this._invoke = send; + + if (typeof gen.return !== "function") { + this.return = undefined; + } + } + + if (typeof Symbol === "function" && Symbol.asyncIterator) { + AsyncGenerator.prototype[Symbol.asyncIterator] = function () { + return this; + }; + } + + AsyncGenerator.prototype.next = function (arg) { + return this._invoke("next", arg); + }; + + AsyncGenerator.prototype.throw = function (arg) { + return this._invoke("throw", arg); + }; + + AsyncGenerator.prototype.return = function (arg) { + return this._invoke("return", arg); + }; + + return { + wrap: function (fn) { + return function () { + return new AsyncGenerator(fn.apply(this, arguments)); + }; + }, + await: function (value) { + return new AwaitValue(value); + } + }; + }(); + /* global document */ var Hopscotch; @@ -34,7 +151,6 @@ var HopscotchI18N; var customI18N; var customRenderer; - var customEscape; var templateToUse = 'bubble_default'; var Sizzle = window.Sizzle || null; var utils; @@ -2400,9 +2516,6 @@ * @returns {Object} The Hopscotch object (for chaining). */ this.setEscaper = function (esc) { - if (typeof esc === 'function') { - customEscape = esc; - } return this; }; diff --git a/dist/js/hopscotch.min.js b/dist/js/hopscotch.min.js index 97e99a02..2d6fba14 100644 --- a/dist/js/hopscotch.min.js +++ b/dist/js/hopscotch.min.js @@ -14,4 +14,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.hopscotch=b()}(this,function(){"use strict";var a,b,c,d,e,f,g,h,i,j,k,l,m,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},o="bubble_default",p=window.Sizzle||null,q="undefined",r=!1,s=("undefined"==typeof jQuery?"undefined":n(jQuery))!==q,t=!1,u=!1,v=/^[a-zA-Z]+[a-zA-Z0-9_-]*$/,w={left:"right",right:"left"};try{n(window.sessionStorage)!==q&&(t=!0,sessionStorage.setItem("hopscotch.test.storage","ok"),sessionStorage.removeItem("hopscotch.test.storage"),u=!0)}catch(x){}l={smoothScroll:!0,scrollDuration:1e3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0,isRtl:!1,cookieName:"hopscotch.tour.state"},Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),k=function(){r&&m.startTour()},h={addClass:function(a,b){var c,d,e,f;if(a.className){for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c.indexOf(" "+d[e]+" ")<0&&(c+=d[e]+" ");a.className=c.replace(/^\s+|\s+$/g,"")}else a.className=b},removeClass:function(a,b){var c,d,e,f;for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c=c.replace(" "+d[e]+" "," ");a.className=c.replace(/^\s+|\s+$/g,"")},hasClass:function(a,b){var c;return a.className?(c=" "+a.className+" ",-1!==c.indexOf(" "+b+" ")):!1},getPixelValue:function(a){var b="undefined"==typeof a?"undefined":n(a);return"number"===b?a:"string"===b?parseInt(a,10):0},valOrDefault:function(a,b){return("undefined"==typeof a?"undefined":n(a))!==q?a:b},invokeCallbackArrayHelper:function(a){var b;return Array.isArray(a)&&(b=j[a[0]],"function"==typeof b)?b.apply(this,a.slice(1)):void 0},invokeCallbackArray:function(a){var b,c;if(Array.isArray(a)){if("string"==typeof a[0])return h.invokeCallbackArrayHelper(a);for(b=0,c=a.length;c>b;++b)h.invokeCallback(a[b])}},invokeCallback:function(a){return"function"==typeof a?a():"string"==typeof a&&j[a]?j[a]():h.invokeCallbackArray(a)},invokeEventCallbacks:function(a,b){var c,d,e=i[a];if(b)return this.invokeCallback(b);for(c=0,d=e.length;d>c;++c)this.invokeCallback(e[c].cb)},getScrollTop:function(){var a;return a=n(window.pageYOffset)!==q?window.pageYOffset:document.documentElement.scrollTop},getScrollLeft:function(){var a;return a=n(window.pageXOffset)!==q?window.pageXOffset:document.documentElement.scrollLeft},getWindowHeight:function(){return window.innerHeight||document.documentElement.clientHeight},addEvtListener:function(a,b,c){return a?a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c):void 0},removeEvtListener:function(a,b,c){return a?a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c):void 0},documentIsReady:function(){return"complete"===document.readyState},evtPreventDefault:function(a){a.preventDefault?a.preventDefault():event&&(event.returnValue=!1)},extend:function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},getStepTargetHelper:function(a){var b=document.getElementById(a);if(b)return b;if(s)return b=jQuery(a),b.length?b[0]:null;if(p)return b=new p(a),b.length?b[0]:null;if(document.querySelector)try{return document.querySelector(a)}catch(c){}return/^#[a-zA-Z][\w-_:.]*$/.test(a)?document.getElementById(a.substring(1)):null},getStepTarget:function(a){var b;if(!a||!a.target)return null;if("string"==typeof a.target)return h.getStepTargetHelper(a.target);if(Array.isArray(a.target)){var c,d;for(c=0,d=a.target.length;d>c;c++)if("string"==typeof a.target[c]&&(b=h.getStepTargetHelper(a.target[c])))return b;return null}return a.target},getI18NString:function(a){return e[a]||d[a]},setState:function(a,b,c){var d,e="";if(t&&u)try{sessionStorage.setItem(a,b)}catch(f){u=!1,this.setState(a,b,c)}else t&&sessionStorage.removeItem(a),c&&(d=new Date,d.setTime(d.getTime()+24*c*60*60*1e3),e="; expires="+d.toGMTString()),document.cookie=a+"="+b+e+"; path=/"},getState:function(a){var b,c,d,e=a+"=",f=document.cookie.split(";");if(t&&(d=sessionStorage.getItem(a)))return d;for(b=0;b0,showNext:h.valOrDefault(a.showNextButton,this.opt.showNextButton),showCTA:h.valOrDefault(a.showCTAButton&&a.ctaLabel,!1),ctaLabel:a.ctaLabel,showClose:h.valOrDefault(this.opt.showCloseButton,!0)},step:{num:b,isLast:h.valOrDefault(n,!1),title:a.title||"",content:a.content||"",isRtl:a.isRtl,placement:a.placement,padding:h.valOrDefault(a.padding,this.opt.bubblePadding),width:h.getPixelValue(a.width)||this.opt.bubbleWidth,customData:a.customData||{}},tour:{isTour:this.opt.isTourBubble,numSteps:j,unsafe:h.valOrDefault(g,!1),customData:e||{}}},"function"==typeof d)r.innerHTML=d(q);else if("string"==typeof d){if(!m.templates||"function"!=typeof m.templates[d])throw new Error('Bubble rendering failed - template "'+d+'" is not a function.');r.innerHTML=m.templates[d](q)}else if(f)r.innerHTML=f(q);else{if(!m.templates||"function"!=typeof m.templates[o])throw new Error('Bubble rendering failed - template "'+o+'" is not a function.');r.innerHTML=m.templates[o](q)}var s,t=r.children,u=t.length;for(p=0;u>p;p++)s=t[p],h.hasClass(s,"hopscotch-arrow")&&(this.arrowEl=s);return r.style.zIndex="number"==typeof a.zindex?a.zindex:"",this._setArrow(a.placement),this.hide(!1),this.setPosition(a),c&&c(!a.fixedElement),this},_getStepNum:function(a){var b,c,d=0,e=m.getSkippedStepsIndexes(),f=e.length;for(c=0;f>c;c++)b=e[c],a>b&&d++;return a-d},_getStepI18nNum:function(a){var b=h.getI18NString("stepNums");return b&&au||u>=t.steps.length?null:t.steps[u]},G=function(){z.nextStep()},H=function(a){var b,c,d,e,f,g,i=C(),j=i.element,k=h.getPixelValue(j.style.top),l=k+h.getPixelValue(j.offsetHeight),m=h.getStepTarget(F()),o=m.getBoundingClientRect(),p=o.top+h.getScrollTop(),r=o.bottom+h.getScrollTop(),t=p>k?k:p,u=l>r?l:r,v=h.getScrollTop(),w=v+h.getWindowHeight(),x=t-E("scrollTopMargin");t>=v&&(t<=v+E("scrollTopMargin")||w>=u)?a&&a():E("smoothScroll")?("undefined"==typeof YAHOO?"undefined":n(YAHOO))!==q&&n(YAHOO.env)!==q&&n(YAHOO.env.ua)!==q&&n(YAHOO.util)!==q&&n(YAHOO.util.Scroll)!==q?(b=YAHOO.env.ua.webkit?document.body:document.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,c=new YAHOO.util.Scroll(b,{scroll:{to:[0,x]}},E("scrollDuration")/1e3,d),c.onComplete.subscribe(a),c.animate()):s?jQuery("body, html").animate({scrollTop:x},E("scrollDuration"),a):(0>x&&(x=0),e=v>t?-1:1,f=Math.abs(v-x)/(E("scrollDuration")/10),(g=function(){var b=h.getScrollTop(),c=b+e*f;return e>0&&c>=x||0>e&&x>=c?(c=x,a&&a(),void window.scrollTo(0,c)):(window.scrollTo(0,c),h.getScrollTop()===b?void(a&&a()):void setTimeout(g,10))})()):(window.scrollTo(0,x),a&&a())},I=function P(a,b){var c,d,e;u+a>=0&&u+a0?d.multipage:u>0&&t.steps[u-1].multipage,f=function(c){var f;if(-1===c)return this.endTour(!0);if(a&&(f=b>0?h.invokeEventCallbacks("next",d.onNext):h.invokeEventCallbacks("prev",d.onPrev)),c===u){if(e)return void N();f=h.valOrDefault(f,!0),f?this.showStep(c):this.endTour(!1)}},!e&&E("skipIfNoElement"))I(b,function(a){f.call(i,a)});else if(u+b>=0&&u+b2&&(B=d[2].split(",")),x=parseInt(x,10)),this},L=function(a,b,c){var d,e;if(u=a||0,A=b||{},d=F(),e=h.getStepTarget(d))return void c(u);if(!e){if(h.invokeEventCallbacks("error"),A[u]=!0,E("skipIfNoElement"))return void I(1,c);u=-1,c(u)}},M=function(a){function b(){d.show(),h.invokeEventCallbacks("show",c.onShow)}var c=t.steps[a],d=C(),e=h.getStepTarget(c);u!==a&&F().nextOnTargetClick&&h.removeEvtListener(h.getStepTarget(F()),"click",G),u=a,d.hide(!1),d.render(c,a,function(a){a?H(b):b(),c.nextOnTargetClick&&h.addEvtListener(e,"click",G)}),N()},N=function(){var a=t.id+":"+u,b=m.getSkippedStepsIndexes();b&&b.length>0&&(a+=":"+b.join(",")),h.setState(E("cookieName"),a,1)},O=function(a){a&&this.configure(a)};this.getCalloutManager=function(){return("undefined"==typeof k?"undefined":n(k))===q&&(k=new c),k},this.startTour=function(a,b){var c,d,e={},f=this;if(!t){if(!a)throw new Error("Tour data is required for startTour.");if(!a.id||!v.test(a.id))throw new Error("Tour ID is using an invalid format. Use alphanumeric, underscores, and/or hyphens only. First character must be a letter.");t=a,K.call(this,a)}if(("undefined"==typeof b?"undefined":n(b))!==q){if(b>=t.steps.length)throw new Error("Specified step number out of bounds.");d=b}if(!h.documentIsReady())return r=!0,this;if("undefined"==typeof d&&t.id===w&&("undefined"==typeof x?"undefined":n(x))!==q){if(d=x,B.length>0)for(var g=0,i=B.length;i>g;g++)e[B[g]]=!0}else d||(d=0);return L(d,e,function(a){var b=-1!==a&&h.getStepTarget(t.steps[a]);return b?(h.invokeEventCallbacks("start"),c=C(),c.hide(!1),f.isActive=!0,void(h.getStepTarget(F())?f.showStep(a):(h.invokeEventCallbacks("error"),E("skipIfNoElement")&&f.nextStep(!1)))):void f.endTour(!1,!1)}),this},this.showStep=function(a){var b=t.steps[a],c=u;return h.getStepTarget(b)?(b.delay?setTimeout(function(){M(a)},b.delay):M(a),this):(u=a,h.invokeEventCallbacks("error"),void(u=c))},this.prevStep=function(a){return J.call(this,a,-1),this},this.nextStep=function(a){return J.call(this,a,1),this},this.endTour=function(a,b){var c,d=C();return a=h.valOrDefault(a,!0),b=h.valOrDefault(b,!0),t&&(c=F(),c&&c.nextOnTargetClick&&h.removeEvtListener(h.getStepTarget(c),"click",G)),u=0,x=void 0,d.hide(),a&&h.clearState(E("cookieName")),this.isActive&&(this.isActive=!1,t&&b&&h.invokeEventCallbacks("end")),this.removeCallbacks(null,!0),this.resetDefaultOptions(),D(),t=null,this},this.getCurrTour=function(){return t},this.getCurrTarget=function(){return h.getStepTarget(F())},this.getCurrStepNum=function(){return u},this.getSkippedStepsIndexes=function(){var a,b=[];for(a in A)b.push(a);return b},this.refreshBubblePosition=function(){var a=F();return a&&C().setPosition(a),this.getCalloutManager().refreshCalloutPositions(),this},this.listen=function(a,b,c){return a&&i[a].push({cb:b,fromTour:c}),this},this.unlisten=function(a,b){var c,d,e=i[a];for(c=0,d=e.length;d>c;++c)e[c].cb===b&&e.splice(c,1);return this},this.removeCallbacks=function(a,b){var c,d,e,f;for(f in i)if(!a||a===f)if(b)for(c=i[f],d=0,e=c.length;e>d;++d)c[d].fromTour&&(c.splice(d--,1),--e);else i[f]=[];return this},this.registerHelper=function(a,b){"string"==typeof a&&"function"==typeof b&&(j[a]=b)},this.unregisterHelper=function(a){j[a]=null},this.invokeHelper=function(a){var b,c,d=[];for(b=1,c=arguments.length;c>b;++b)d.push(arguments[b]);j[a]&&j[a].call(null,d)},this.setCookieName=function(a){return p.cookieName=a,this},this.resetDefaultOptions=function(){return p={},this},this.resetDefaultI18N=function(){return e={},this},this.getState=function(){return h.getState(E("cookieName"))},y=function(a,b){var c,d,f,g,i=["next","prev","start","end","show","error","close"];for(p||this.resetDefaultOptions(),h.extend(p,a),a&&h.extend(e,a.i18n),f=0,g=i.length;g>f;++f)d="on"+i[f].charAt(0).toUpperCase()+i[f].substring(1),a[d]&&this.listen(i[f],a[d],b);return c=C(!0),this},this.configure=function(a){return y.call(this,a,!1)},this.setRenderer=function(a){var b="undefined"==typeof a?"undefined":n(a);return"string"===b?(o=a,f=void 0):"function"===b&&(f=a),this},this.setEscaper=function(a){return"function"==typeof a&&(g=a),this},O.call(this,a)},m=new a,function(){var a={};a.escape=function(a){return g?g(a):null==a?"":(""+a).replace(new RegExp("[&<>\"']","g"),function(a){return"&"==a?"&":"<"==a?"<":">"==a?">":'"'==a?""":"'"==a?"'":void 0})},this.templates=this.templates||{},this.templates.bubble_default=function(b){function c(b,c){return c?a.escape(b):b}var d,e="";a.escape,Array.prototype.join;e+="\n";var f=b.i18n,g=b.buttons,h=b.step,i=b.tour;return e+='\n
\n ',i.isTour&&(e+=''+(null==(d=f.stepNum)?"":d)+""),e+='\n
\n ',""!==h.title&&(e+='

'+(null==(d=c(h.title,i.unsafe))?"":d)+"

"),e+="\n ",""!==h.content&&(e+='
'+(null==(d=c(h.content,i.unsafe))?"":d)+"
"),e+='\n
\n
\n ',g.showPrev&&(e+='"),e+="\n ",g.showCTA&&(e+='"),e+="\n ",g.showNext&&(e+='"),e+="\n
\n ",g.showClose&&(e+='"),e+='\n
\n
\n
\n
\n
\n'}}.call(m);var y=m;return y}); \ No newline at end of file +!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.hopscotch=b()}(this,function(){"use strict";var a,b,c,d,e,f,g,h,i,j,k,l,m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},n=(function(){function a(a){this.value=a}function b(b){function c(a,b){return new Promise(function(c,e){var h={key:a,arg:b,resolve:c,reject:e,next:null};g?g=g.next=h:(f=g=h,d(a,b))})}function d(c,f){try{var g=b[c](f),h=g.value;h instanceof a?Promise.resolve(h.value).then(function(a){d("next",a)},function(a){d("throw",a)}):e(g.done?"return":"normal",g.value)}catch(i){e("throw",i)}}function e(a,b){switch(a){case"return":f.resolve({value:b,done:!0});break;case"throw":f.reject(b);break;default:f.resolve({value:b,done:!1})}f=f.next,f?d(f.key,f.arg):g=null}var f,g;this._invoke=c,"function"!=typeof b["return"]&&(this["return"]=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(b.prototype[Symbol.asyncIterator]=function(){return this}),b.prototype.next=function(a){return this._invoke("next",a)},b.prototype["throw"]=function(a){return this._invoke("throw",a)},b.prototype["return"]=function(a){return this._invoke("return",a)},{wrap:function(a){return function(){return new b(a.apply(this,arguments))}},await:function(b){return new a(b)}}}(),"bubble_default"),o=window.Sizzle||null,p="undefined",q=!1,r=("undefined"==typeof jQuery?"undefined":m(jQuery))!==p,s=!1,t=!1,u=/^[a-zA-Z]+[a-zA-Z0-9_-]*$/,v={left:"right",right:"left"};try{m(window.sessionStorage)!==p&&(s=!0,sessionStorage.setItem("hopscotch.test.storage","ok"),sessionStorage.removeItem("hopscotch.test.storage"),t=!0)}catch(w){}k={smoothScroll:!0,scrollDuration:1e3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0,isRtl:!1,cookieName:"hopscotch.tour.state"},Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),j=function(){q&&l.startTour()},g={addClass:function(a,b){var c,d,e,f;if(a.className){for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c.indexOf(" "+d[e]+" ")<0&&(c+=d[e]+" ");a.className=c.replace(/^\s+|\s+$/g,"")}else a.className=b},removeClass:function(a,b){var c,d,e,f;for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c=c.replace(" "+d[e]+" "," ");a.className=c.replace(/^\s+|\s+$/g,"")},hasClass:function(a,b){var c;return a.className?(c=" "+a.className+" ",-1!==c.indexOf(" "+b+" ")):!1},getPixelValue:function(a){var b="undefined"==typeof a?"undefined":m(a);return"number"===b?a:"string"===b?parseInt(a,10):0},valOrDefault:function(a,b){return("undefined"==typeof a?"undefined":m(a))!==p?a:b},invokeCallbackArrayHelper:function(a){var b;return Array.isArray(a)&&(b=i[a[0]],"function"==typeof b)?b.apply(this,a.slice(1)):void 0},invokeCallbackArray:function(a){var b,c;if(Array.isArray(a)){if("string"==typeof a[0])return g.invokeCallbackArrayHelper(a);for(b=0,c=a.length;c>b;++b)g.invokeCallback(a[b])}},invokeCallback:function(a){return"function"==typeof a?a():"string"==typeof a&&i[a]?i[a]():g.invokeCallbackArray(a)},invokeEventCallbacks:function(a,b){var c,d,e=h[a];if(b)return this.invokeCallback(b);for(c=0,d=e.length;d>c;++c)this.invokeCallback(e[c].cb)},getScrollTop:function(){var a;return a=m(window.pageYOffset)!==p?window.pageYOffset:document.documentElement.scrollTop},getScrollLeft:function(){var a;return a=m(window.pageXOffset)!==p?window.pageXOffset:document.documentElement.scrollLeft},getWindowHeight:function(){return window.innerHeight||document.documentElement.clientHeight},addEvtListener:function(a,b,c){return a?a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c):void 0},removeEvtListener:function(a,b,c){return a?a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c):void 0},documentIsReady:function(){return"complete"===document.readyState},evtPreventDefault:function(a){a.preventDefault?a.preventDefault():event&&(event.returnValue=!1)},extend:function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},getStepTargetHelper:function(a){var b=document.getElementById(a);if(b)return b;if(r)return b=jQuery(a),b.length?b[0]:null;if(o)return b=new o(a),b.length?b[0]:null;if(document.querySelector)try{return document.querySelector(a)}catch(c){}return/^#[a-zA-Z][\w-_:.]*$/.test(a)?document.getElementById(a.substring(1)):null},getStepTarget:function(a){var b;if(!a||!a.target)return null;if("string"==typeof a.target)return g.getStepTargetHelper(a.target);if(Array.isArray(a.target)){var c,d;for(c=0,d=a.target.length;d>c;c++)if("string"==typeof a.target[c]&&(b=g.getStepTargetHelper(a.target[c])))return b;return null}return a.target},getI18NString:function(a){return e[a]||d[a]},setState:function(a,b,c){var d,e="";if(s&&t)try{sessionStorage.setItem(a,b)}catch(f){t=!1,this.setState(a,b,c)}else s&&sessionStorage.removeItem(a),c&&(d=new Date,d.setTime(d.getTime()+24*c*60*60*1e3),e="; expires="+d.toGMTString()),document.cookie=a+"="+b+e+"; path=/"},getState:function(a){var b,c,d,e=a+"=",f=document.cookie.split(";");if(s&&(d=sessionStorage.getItem(a)))return d;for(b=0;b0,showNext:g.valOrDefault(a.showNextButton,this.opt.showNextButton),showCTA:g.valOrDefault(a.showCTAButton&&a.ctaLabel,!1),ctaLabel:a.ctaLabel,showClose:g.valOrDefault(this.opt.showCloseButton,!0)},step:{num:b,isLast:g.valOrDefault(o,!1),title:a.title||"",content:a.content||"",isRtl:a.isRtl,placement:a.placement,padding:g.valOrDefault(a.padding,this.opt.bubblePadding),width:g.getPixelValue(a.width)||this.opt.bubbleWidth,customData:a.customData||{}},tour:{isTour:this.opt.isTourBubble,numSteps:j,unsafe:g.valOrDefault(h,!1),customData:e||{}}},"function"==typeof d)r.innerHTML=d(q);else if("string"==typeof d){if(!l.templates||"function"!=typeof l.templates[d])throw new Error('Bubble rendering failed - template "'+d+'" is not a function.');r.innerHTML=l.templates[d](q)}else if(f)r.innerHTML=f(q);else{if(!l.templates||"function"!=typeof l.templates[n])throw new Error('Bubble rendering failed - template "'+n+'" is not a function.');r.innerHTML=l.templates[n](q)}var s,t=r.children,u=t.length;for(p=0;u>p;p++)s=t[p],g.hasClass(s,"hopscotch-arrow")&&(this.arrowEl=s);return r.style.zIndex="number"==typeof a.zindex?a.zindex:"",this._setArrow(a.placement),this.hide(!1),this.setPosition(a),c&&c(!a.fixedElement),this},_getStepNum:function(a){var b,c,d=0,e=l.getSkippedStepsIndexes(),f=e.length;for(c=0;f>c;c++)b=e[c],a>b&&d++;return a-d},_getStepI18nNum:function(a){var b=g.getI18NString("stepNums");return b&&at||t>=s.steps.length?null:s.steps[t]},F=function(){y.nextStep()},G=function(a){var b,c,d,e,f,h,i=B(),j=i.element,k=g.getPixelValue(j.style.top),l=k+g.getPixelValue(j.offsetHeight),n=g.getStepTarget(E()),o=n.getBoundingClientRect(),q=o.top+g.getScrollTop(),s=o.bottom+g.getScrollTop(),t=q>k?k:q,u=l>s?l:s,v=g.getScrollTop(),w=v+g.getWindowHeight(),x=t-D("scrollTopMargin");t>=v&&(t<=v+D("scrollTopMargin")||w>=u)?a&&a():D("smoothScroll")?("undefined"==typeof YAHOO?"undefined":m(YAHOO))!==p&&m(YAHOO.env)!==p&&m(YAHOO.env.ua)!==p&&m(YAHOO.util)!==p&&m(YAHOO.util.Scroll)!==p?(b=YAHOO.env.ua.webkit?document.body:document.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,c=new YAHOO.util.Scroll(b,{scroll:{to:[0,x]}},D("scrollDuration")/1e3,d),c.onComplete.subscribe(a),c.animate()):r?jQuery("body, html").animate({scrollTop:x},D("scrollDuration"),a):(0>x&&(x=0),e=v>t?-1:1,f=Math.abs(v-x)/(D("scrollDuration")/10),(h=function(){var b=g.getScrollTop(),c=b+e*f;return e>0&&c>=x||0>e&&x>=c?(c=x,a&&a(),void window.scrollTo(0,c)):(window.scrollTo(0,c),g.getScrollTop()===b?void(a&&a()):void setTimeout(h,10))})()):(window.scrollTo(0,x),a&&a())},H=function O(a,b){var c,d,e;t+a>=0&&t+a0?d.multipage:t>0&&s.steps[t-1].multipage,f=function(c){var f;if(-1===c)return this.endTour(!0);if(a&&(f=b>0?g.invokeEventCallbacks("next",d.onNext):g.invokeEventCallbacks("prev",d.onPrev)),c===t){if(e)return void M();f=g.valOrDefault(f,!0),f?this.showStep(c):this.endTour(!1)}},!e&&D("skipIfNoElement"))H(b,function(a){f.call(i,a)});else if(t+b>=0&&t+b2&&(A=d[2].split(",")),w=parseInt(w,10)),this},K=function(a,b,c){var d,e;if(t=a||0,z=b||{},d=E(),e=g.getStepTarget(d))return void c(t);if(!e){if(g.invokeEventCallbacks("error"),z[t]=!0,D("skipIfNoElement"))return void H(1,c);t=-1,c(t)}},L=function(a){function b(){d.show(),g.invokeEventCallbacks("show",c.onShow)}var c=s.steps[a],d=B(),e=g.getStepTarget(c);t!==a&&E().nextOnTargetClick&&g.removeEvtListener(g.getStepTarget(E()),"click",F),t=a,d.hide(!1),d.render(c,a,function(a){a?G(b):b(),c.nextOnTargetClick&&g.addEvtListener(e,"click",F)}),M()},M=function(){var a=s.id+":"+t,b=l.getSkippedStepsIndexes();b&&b.length>0&&(a+=":"+b.join(",")),g.setState(D("cookieName"),a,1)},N=function(a){a&&this.configure(a)};this.getCalloutManager=function(){return("undefined"==typeof j?"undefined":m(j))===p&&(j=new c),j},this.startTour=function(a,b){var c,d,e={},f=this;if(!s){if(!a)throw new Error("Tour data is required for startTour.");if(!a.id||!u.test(a.id))throw new Error("Tour ID is using an invalid format. Use alphanumeric, underscores, and/or hyphens only. First character must be a letter.");s=a,J.call(this,a)}if(("undefined"==typeof b?"undefined":m(b))!==p){if(b>=s.steps.length)throw new Error("Specified step number out of bounds.");d=b}if(!g.documentIsReady())return q=!0,this;if("undefined"==typeof d&&s.id===v&&("undefined"==typeof w?"undefined":m(w))!==p){if(d=w,A.length>0)for(var h=0,i=A.length;i>h;h++)e[A[h]]=!0}else d||(d=0);return K(d,e,function(a){var b=-1!==a&&g.getStepTarget(s.steps[a]);return b?(g.invokeEventCallbacks("start"),c=B(),c.hide(!1),f.isActive=!0,void(g.getStepTarget(E())?f.showStep(a):(g.invokeEventCallbacks("error"),D("skipIfNoElement")&&f.nextStep(!1)))):void f.endTour(!1,!1)}),this},this.showStep=function(a){var b=s.steps[a],c=t;return g.getStepTarget(b)?(b.delay?setTimeout(function(){L(a)},b.delay):L(a),this):(t=a,g.invokeEventCallbacks("error"),void(t=c))},this.prevStep=function(a){return I.call(this,a,-1),this},this.nextStep=function(a){return I.call(this,a,1),this},this.endTour=function(a,b){var c,d=B();return a=g.valOrDefault(a,!0),b=g.valOrDefault(b,!0),s&&(c=E(),c&&c.nextOnTargetClick&&g.removeEvtListener(g.getStepTarget(c),"click",F)),t=0,w=void 0,d.hide(),a&&g.clearState(D("cookieName")),this.isActive&&(this.isActive=!1,s&&b&&g.invokeEventCallbacks("end")),this.removeCallbacks(null,!0),this.resetDefaultOptions(),C(),s=null,this},this.getCurrTour=function(){return s},this.getCurrTarget=function(){return g.getStepTarget(E())},this.getCurrStepNum=function(){return t},this.getSkippedStepsIndexes=function(){var a,b=[];for(a in z)b.push(a);return b},this.refreshBubblePosition=function(){var a=E();return a&&B().setPosition(a),this.getCalloutManager().refreshCalloutPositions(),this},this.listen=function(a,b,c){return a&&h[a].push({cb:b,fromTour:c}),this},this.unlisten=function(a,b){var c,d,e=h[a];for(c=0,d=e.length;d>c;++c)e[c].cb===b&&e.splice(c,1);return this},this.removeCallbacks=function(a,b){var c,d,e,f;for(f in h)if(!a||a===f)if(b)for(c=h[f],d=0,e=c.length;e>d;++d)c[d].fromTour&&(c.splice(d--,1),--e);else h[f]=[];return this},this.registerHelper=function(a,b){"string"==typeof a&&"function"==typeof b&&(i[a]=b)},this.unregisterHelper=function(a){i[a]=null},this.invokeHelper=function(a){var b,c,d=[];for(b=1,c=arguments.length;c>b;++b)d.push(arguments[b]);i[a]&&i[a].call(null,d)},this.setCookieName=function(a){return o.cookieName=a,this},this.resetDefaultOptions=function(){return o={},this},this.resetDefaultI18N=function(){return e={},this},this.getState=function(){return g.getState(D("cookieName"))},x=function(a,b){var c,d,f,h,i=["next","prev","start","end","show","error","close"];for(o||this.resetDefaultOptions(),g.extend(o,a),a&&g.extend(e,a.i18n),f=0,h=i.length;h>f;++f)d="on"+i[f].charAt(0).toUpperCase()+i[f].substring(1),a[d]&&this.listen(i[f],a[d],b);return c=B(!0),this},this.configure=function(a){return x.call(this,a,!1)},this.setRenderer=function(a){var b="undefined"==typeof a?"undefined":m(a);return"string"===b?(n=a,f=void 0):"function"===b&&(f=a),this},this.setEscaper=function(a){return this},N.call(this,a)},l=new a,function(){var a={};a.escape=function(a){return customEscape?customEscape(a):null==a?"":(""+a).replace(new RegExp("[&<>\"']","g"),function(a){return"&"==a?"&":"<"==a?"<":">"==a?">":'"'==a?""":"'"==a?"'":void 0})},this.templates=this.templates||{},this.templates.bubble_default=function(b){function c(b,c){return c?a.escape(b):b}var d,e="";a.escape,Array.prototype.join;e+="\n";var f=b.i18n,g=b.buttons,h=b.step,i=b.tour;return e+='\n
\n ',i.isTour&&(e+=''+(null==(d=f.stepNum)?"":d)+""),e+='\n
\n ',""!==h.title&&(e+='

'+(null==(d=c(h.title,i.unsafe))?"":d)+"

"),e+="\n ",""!==h.content&&(e+='
'+(null==(d=c(h.content,i.unsafe))?"":d)+"
"),e+='\n
\n
\n ',g.showPrev&&(e+='"),e+="\n ",g.showCTA&&(e+='"),e+="\n ",g.showNext&&(e+='"),e+="\n
\n ",g.showClose&&(e+='"),e+='\n
\n
\n
\n
\n
\n'}}.call(l);var x=l;return x}); \ No newline at end of file diff --git a/dist/js/hopscotch_amd.js b/dist/js/hopscotch_amd.js index 34fb9440..bd1bace3 100644 --- a/dist/js/hopscotch_amd.js +++ b/dist/js/hopscotch_amd.js @@ -22,6 +22,123 @@ define('hopscotch', function () { 'use strict'; return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + + + + var asyncGenerator = function () { + function AwaitValue(value) { + this.value = value; + } + + function AsyncGenerator(gen) { + var front, back; + + function send(key, arg) { + return new Promise(function (resolve, reject) { + var request = { + key: key, + arg: arg, + resolve: resolve, + reject: reject, + next: null + }; + + if (back) { + back = back.next = request; + } else { + front = back = request; + resume(key, arg); + } + }); + } + + function resume(key, arg) { + try { + var result = gen[key](arg); + var value = result.value; + + if (value instanceof AwaitValue) { + Promise.resolve(value.value).then(function (arg) { + resume("next", arg); + }, function (arg) { + resume("throw", arg); + }); + } else { + settle(result.done ? "return" : "normal", result.value); + } + } catch (err) { + settle("throw", err); + } + } + + function settle(type, value) { + switch (type) { + case "return": + front.resolve({ + value: value, + done: true + }); + break; + + case "throw": + front.reject(value); + break; + + default: + front.resolve({ + value: value, + done: false + }); + break; + } + + front = front.next; + + if (front) { + resume(front.key, front.arg); + } else { + back = null; + } + } + + this._invoke = send; + + if (typeof gen.return !== "function") { + this.return = undefined; + } + } + + if (typeof Symbol === "function" && Symbol.asyncIterator) { + AsyncGenerator.prototype[Symbol.asyncIterator] = function () { + return this; + }; + } + + AsyncGenerator.prototype.next = function (arg) { + return this._invoke("next", arg); + }; + + AsyncGenerator.prototype.throw = function (arg) { + return this._invoke("throw", arg); + }; + + AsyncGenerator.prototype.return = function (arg) { + return this._invoke("return", arg); + }; + + return { + wrap: function (fn) { + return function () { + return new AsyncGenerator(fn.apply(this, arguments)); + }; + }, + await: function (value) { + return new AwaitValue(value); + } + }; + }(); + /* global document */ var Hopscotch; @@ -30,7 +147,6 @@ define('hopscotch', function () { 'use strict'; var HopscotchI18N; var customI18N; var customRenderer; - var customEscape; var templateToUse = 'bubble_default'; var Sizzle = window.Sizzle || null; var utils; @@ -2396,9 +2512,6 @@ define('hopscotch', function () { 'use strict'; * @returns {Object} The Hopscotch object (for chaining). */ this.setEscaper = function (esc) { - if (typeof esc === 'function') { - customEscape = esc; - } return this; }; diff --git a/dist/js/hopscotch_amd.min.js b/dist/js/hopscotch_amd.min.js index 9410e408..d21a3518 100644 --- a/dist/js/hopscotch_amd.min.js +++ b/dist/js/hopscotch_amd.min.js @@ -14,4 +14,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -define("hopscotch",function(){"use strict";var a,b,c,d,e,f,g,h,i,j,k,l,m,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},o="bubble_default",p=window.Sizzle||null,q="undefined",r=!1,s=("undefined"==typeof jQuery?"undefined":n(jQuery))!==q,t=!1,u=!1,v=/^[a-zA-Z]+[a-zA-Z0-9_-]*$/,w={left:"right",right:"left"};try{n(window.sessionStorage)!==q&&(t=!0,sessionStorage.setItem("hopscotch.test.storage","ok"),sessionStorage.removeItem("hopscotch.test.storage"),u=!0)}catch(x){}l={smoothScroll:!0,scrollDuration:1e3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0,isRtl:!1,cookieName:"hopscotch.tour.state"},Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),k=function(){r&&m.startTour()},h={addClass:function(a,b){var c,d,e,f;if(a.className){for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c.indexOf(" "+d[e]+" ")<0&&(c+=d[e]+" ");a.className=c.replace(/^\s+|\s+$/g,"")}else a.className=b},removeClass:function(a,b){var c,d,e,f;for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c=c.replace(" "+d[e]+" "," ");a.className=c.replace(/^\s+|\s+$/g,"")},hasClass:function(a,b){var c;return a.className?(c=" "+a.className+" ",-1!==c.indexOf(" "+b+" ")):!1},getPixelValue:function(a){var b="undefined"==typeof a?"undefined":n(a);return"number"===b?a:"string"===b?parseInt(a,10):0},valOrDefault:function(a,b){return("undefined"==typeof a?"undefined":n(a))!==q?a:b},invokeCallbackArrayHelper:function(a){var b;return Array.isArray(a)&&(b=j[a[0]],"function"==typeof b)?b.apply(this,a.slice(1)):void 0},invokeCallbackArray:function(a){var b,c;if(Array.isArray(a)){if("string"==typeof a[0])return h.invokeCallbackArrayHelper(a);for(b=0,c=a.length;c>b;++b)h.invokeCallback(a[b])}},invokeCallback:function(a){return"function"==typeof a?a():"string"==typeof a&&j[a]?j[a]():h.invokeCallbackArray(a)},invokeEventCallbacks:function(a,b){var c,d,e=i[a];if(b)return this.invokeCallback(b);for(c=0,d=e.length;d>c;++c)this.invokeCallback(e[c].cb)},getScrollTop:function(){var a;return a=n(window.pageYOffset)!==q?window.pageYOffset:document.documentElement.scrollTop},getScrollLeft:function(){var a;return a=n(window.pageXOffset)!==q?window.pageXOffset:document.documentElement.scrollLeft},getWindowHeight:function(){return window.innerHeight||document.documentElement.clientHeight},addEvtListener:function(a,b,c){return a?a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c):void 0},removeEvtListener:function(a,b,c){return a?a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c):void 0},documentIsReady:function(){return"complete"===document.readyState},evtPreventDefault:function(a){a.preventDefault?a.preventDefault():event&&(event.returnValue=!1)},extend:function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},getStepTargetHelper:function(a){var b=document.getElementById(a);if(b)return b;if(s)return b=jQuery(a),b.length?b[0]:null;if(p)return b=new p(a),b.length?b[0]:null;if(document.querySelector)try{return document.querySelector(a)}catch(c){}return/^#[a-zA-Z][\w-_:.]*$/.test(a)?document.getElementById(a.substring(1)):null},getStepTarget:function(a){var b;if(!a||!a.target)return null;if("string"==typeof a.target)return h.getStepTargetHelper(a.target);if(Array.isArray(a.target)){var c,d;for(c=0,d=a.target.length;d>c;c++)if("string"==typeof a.target[c]&&(b=h.getStepTargetHelper(a.target[c])))return b;return null}return a.target},getI18NString:function(a){return e[a]||d[a]},setState:function(a,b,c){var d,e="";if(t&&u)try{sessionStorage.setItem(a,b)}catch(f){u=!1,this.setState(a,b,c)}else t&&sessionStorage.removeItem(a),c&&(d=new Date,d.setTime(d.getTime()+24*c*60*60*1e3),e="; expires="+d.toGMTString()),document.cookie=a+"="+b+e+"; path=/"},getState:function(a){var b,c,d,e=a+"=",f=document.cookie.split(";");if(t&&(d=sessionStorage.getItem(a)))return d;for(b=0;b0,showNext:h.valOrDefault(a.showNextButton,this.opt.showNextButton),showCTA:h.valOrDefault(a.showCTAButton&&a.ctaLabel,!1),ctaLabel:a.ctaLabel,showClose:h.valOrDefault(this.opt.showCloseButton,!0)},step:{num:b,isLast:h.valOrDefault(n,!1),title:a.title||"",content:a.content||"",isRtl:a.isRtl,placement:a.placement,padding:h.valOrDefault(a.padding,this.opt.bubblePadding),width:h.getPixelValue(a.width)||this.opt.bubbleWidth,customData:a.customData||{}},tour:{isTour:this.opt.isTourBubble,numSteps:j,unsafe:h.valOrDefault(g,!1),customData:e||{}}},"function"==typeof d)r.innerHTML=d(q);else if("string"==typeof d){if(!m.templates||"function"!=typeof m.templates[d])throw new Error('Bubble rendering failed - template "'+d+'" is not a function.');r.innerHTML=m.templates[d](q)}else if(f)r.innerHTML=f(q);else{if(!m.templates||"function"!=typeof m.templates[o])throw new Error('Bubble rendering failed - template "'+o+'" is not a function.');r.innerHTML=m.templates[o](q)}var s,t=r.children,u=t.length;for(p=0;u>p;p++)s=t[p],h.hasClass(s,"hopscotch-arrow")&&(this.arrowEl=s);return r.style.zIndex="number"==typeof a.zindex?a.zindex:"",this._setArrow(a.placement),this.hide(!1),this.setPosition(a),c&&c(!a.fixedElement),this},_getStepNum:function(a){var b,c,d=0,e=m.getSkippedStepsIndexes(),f=e.length;for(c=0;f>c;c++)b=e[c],a>b&&d++;return a-d},_getStepI18nNum:function(a){var b=h.getI18NString("stepNums");return b&&au||u>=t.steps.length?null:t.steps[u]},G=function(){z.nextStep()},H=function(a){var b,c,d,e,f,g,i=C(),j=i.element,k=h.getPixelValue(j.style.top),l=k+h.getPixelValue(j.offsetHeight),m=h.getStepTarget(F()),o=m.getBoundingClientRect(),p=o.top+h.getScrollTop(),r=o.bottom+h.getScrollTop(),t=p>k?k:p,u=l>r?l:r,v=h.getScrollTop(),w=v+h.getWindowHeight(),x=t-E("scrollTopMargin");t>=v&&(t<=v+E("scrollTopMargin")||w>=u)?a&&a():E("smoothScroll")?("undefined"==typeof YAHOO?"undefined":n(YAHOO))!==q&&n(YAHOO.env)!==q&&n(YAHOO.env.ua)!==q&&n(YAHOO.util)!==q&&n(YAHOO.util.Scroll)!==q?(b=YAHOO.env.ua.webkit?document.body:document.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,c=new YAHOO.util.Scroll(b,{scroll:{to:[0,x]}},E("scrollDuration")/1e3,d),c.onComplete.subscribe(a),c.animate()):s?jQuery("body, html").animate({scrollTop:x},E("scrollDuration"),a):(0>x&&(x=0),e=v>t?-1:1,f=Math.abs(v-x)/(E("scrollDuration")/10),(g=function(){var b=h.getScrollTop(),c=b+e*f;return e>0&&c>=x||0>e&&x>=c?(c=x,a&&a(),void window.scrollTo(0,c)):(window.scrollTo(0,c),h.getScrollTop()===b?void(a&&a()):void setTimeout(g,10))})()):(window.scrollTo(0,x),a&&a())},I=function P(a,b){var c,d,e;u+a>=0&&u+a0?d.multipage:u>0&&t.steps[u-1].multipage,f=function(c){var f;if(-1===c)return this.endTour(!0);if(a&&(f=b>0?h.invokeEventCallbacks("next",d.onNext):h.invokeEventCallbacks("prev",d.onPrev)),c===u){if(e)return void N();f=h.valOrDefault(f,!0),f?this.showStep(c):this.endTour(!1)}},!e&&E("skipIfNoElement"))I(b,function(a){f.call(i,a)});else if(u+b>=0&&u+b2&&(B=d[2].split(",")),x=parseInt(x,10)),this},L=function(a,b,c){var d,e;if(u=a||0,A=b||{},d=F(),e=h.getStepTarget(d))return void c(u);if(!e){if(h.invokeEventCallbacks("error"),A[u]=!0,E("skipIfNoElement"))return void I(1,c);u=-1,c(u)}},M=function(a){function b(){d.show(),h.invokeEventCallbacks("show",c.onShow)}var c=t.steps[a],d=C(),e=h.getStepTarget(c);u!==a&&F().nextOnTargetClick&&h.removeEvtListener(h.getStepTarget(F()),"click",G),u=a,d.hide(!1),d.render(c,a,function(a){a?H(b):b(),c.nextOnTargetClick&&h.addEvtListener(e,"click",G)}),N()},N=function(){var a=t.id+":"+u,b=m.getSkippedStepsIndexes();b&&b.length>0&&(a+=":"+b.join(",")),h.setState(E("cookieName"),a,1)},O=function(a){a&&this.configure(a)};this.getCalloutManager=function(){return("undefined"==typeof k?"undefined":n(k))===q&&(k=new c),k},this.startTour=function(a,b){var c,d,e={},f=this;if(!t){if(!a)throw new Error("Tour data is required for startTour.");if(!a.id||!v.test(a.id))throw new Error("Tour ID is using an invalid format. Use alphanumeric, underscores, and/or hyphens only. First character must be a letter.");t=a,K.call(this,a)}if(("undefined"==typeof b?"undefined":n(b))!==q){if(b>=t.steps.length)throw new Error("Specified step number out of bounds.");d=b}if(!h.documentIsReady())return r=!0,this;if("undefined"==typeof d&&t.id===w&&("undefined"==typeof x?"undefined":n(x))!==q){if(d=x,B.length>0)for(var g=0,i=B.length;i>g;g++)e[B[g]]=!0}else d||(d=0);return L(d,e,function(a){var b=-1!==a&&h.getStepTarget(t.steps[a]);return b?(h.invokeEventCallbacks("start"),c=C(),c.hide(!1),f.isActive=!0,void(h.getStepTarget(F())?f.showStep(a):(h.invokeEventCallbacks("error"),E("skipIfNoElement")&&f.nextStep(!1)))):void f.endTour(!1,!1)}),this},this.showStep=function(a){var b=t.steps[a],c=u;return h.getStepTarget(b)?(b.delay?setTimeout(function(){M(a)},b.delay):M(a),this):(u=a,h.invokeEventCallbacks("error"),void(u=c))},this.prevStep=function(a){return J.call(this,a,-1),this},this.nextStep=function(a){return J.call(this,a,1),this},this.endTour=function(a,b){var c,d=C();return a=h.valOrDefault(a,!0),b=h.valOrDefault(b,!0),t&&(c=F(),c&&c.nextOnTargetClick&&h.removeEvtListener(h.getStepTarget(c),"click",G)),u=0,x=void 0,d.hide(),a&&h.clearState(E("cookieName")),this.isActive&&(this.isActive=!1,t&&b&&h.invokeEventCallbacks("end")),this.removeCallbacks(null,!0),this.resetDefaultOptions(),D(),t=null,this},this.getCurrTour=function(){return t},this.getCurrTarget=function(){return h.getStepTarget(F())},this.getCurrStepNum=function(){return u},this.getSkippedStepsIndexes=function(){var a,b=[];for(a in A)b.push(a);return b},this.refreshBubblePosition=function(){var a=F();return a&&C().setPosition(a),this.getCalloutManager().refreshCalloutPositions(),this},this.listen=function(a,b,c){return a&&i[a].push({cb:b,fromTour:c}),this},this.unlisten=function(a,b){var c,d,e=i[a];for(c=0,d=e.length;d>c;++c)e[c].cb===b&&e.splice(c,1);return this},this.removeCallbacks=function(a,b){var c,d,e,f;for(f in i)if(!a||a===f)if(b)for(c=i[f],d=0,e=c.length;e>d;++d)c[d].fromTour&&(c.splice(d--,1),--e);else i[f]=[];return this},this.registerHelper=function(a,b){"string"==typeof a&&"function"==typeof b&&(j[a]=b)},this.unregisterHelper=function(a){j[a]=null},this.invokeHelper=function(a){var b,c,d=[];for(b=1,c=arguments.length;c>b;++b)d.push(arguments[b]);j[a]&&j[a].call(null,d)},this.setCookieName=function(a){return p.cookieName=a,this},this.resetDefaultOptions=function(){return p={},this},this.resetDefaultI18N=function(){return e={},this},this.getState=function(){return h.getState(E("cookieName"))},y=function(a,b){var c,d,f,g,i=["next","prev","start","end","show","error","close"];for(p||this.resetDefaultOptions(),h.extend(p,a),a&&h.extend(e,a.i18n),f=0,g=i.length;g>f;++f)d="on"+i[f].charAt(0).toUpperCase()+i[f].substring(1),a[d]&&this.listen(i[f],a[d],b);return c=C(!0),this},this.configure=function(a){return y.call(this,a,!1)},this.setRenderer=function(a){var b="undefined"==typeof a?"undefined":n(a);return"string"===b?(o=a,f=void 0):"function"===b&&(f=a),this},this.setEscaper=function(a){return"function"==typeof a&&(g=a),this},O.call(this,a)},m=new a,function(){var a={};a.escape=function(a){return g?g(a):null==a?"":(""+a).replace(new RegExp("[&<>\"']","g"),function(a){return"&"==a?"&":"<"==a?"<":">"==a?">":'"'==a?""":"'"==a?"'":void 0})},this.templates=this.templates||{},this.templates.bubble_default=function(b){function c(b,c){return c?a.escape(b):b}var d,e="";a.escape,Array.prototype.join;e+="\n";var f=b.i18n,g=b.buttons,h=b.step,i=b.tour;return e+='\n
\n ',i.isTour&&(e+=''+(null==(d=f.stepNum)?"":d)+""),e+='\n
\n ',""!==h.title&&(e+='

'+(null==(d=c(h.title,i.unsafe))?"":d)+"

"),e+="\n ",""!==h.content&&(e+='
'+(null==(d=c(h.content,i.unsafe))?"":d)+"
"),e+='\n
\n
\n ',g.showPrev&&(e+='"),e+="\n ",g.showCTA&&(e+='"),e+="\n ",g.showNext&&(e+='"),e+="\n
\n ",g.showClose&&(e+='"),e+='\n
\n
\n
\n
\n
\n'}}.call(m);var y=m;return y}); \ No newline at end of file +define("hopscotch",function(){"use strict";var a,b,c,d,e,f,g,h,i,j,k,l,m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},n=(function(){function a(a){this.value=a}function b(b){function c(a,b){return new Promise(function(c,e){var h={key:a,arg:b,resolve:c,reject:e,next:null};g?g=g.next=h:(f=g=h,d(a,b))})}function d(c,f){try{var g=b[c](f),h=g.value;h instanceof a?Promise.resolve(h.value).then(function(a){d("next",a)},function(a){d("throw",a)}):e(g.done?"return":"normal",g.value)}catch(i){e("throw",i)}}function e(a,b){switch(a){case"return":f.resolve({value:b,done:!0});break;case"throw":f.reject(b);break;default:f.resolve({value:b,done:!1})}f=f.next,f?d(f.key,f.arg):g=null}var f,g;this._invoke=c,"function"!=typeof b["return"]&&(this["return"]=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(b.prototype[Symbol.asyncIterator]=function(){return this}),b.prototype.next=function(a){return this._invoke("next",a)},b.prototype["throw"]=function(a){return this._invoke("throw",a)},b.prototype["return"]=function(a){return this._invoke("return",a)},{wrap:function(a){return function(){return new b(a.apply(this,arguments))}},await:function(b){return new a(b)}}}(),"bubble_default"),o=window.Sizzle||null,p="undefined",q=!1,r=("undefined"==typeof jQuery?"undefined":m(jQuery))!==p,s=!1,t=!1,u=/^[a-zA-Z]+[a-zA-Z0-9_-]*$/,v={left:"right",right:"left"};try{m(window.sessionStorage)!==p&&(s=!0,sessionStorage.setItem("hopscotch.test.storage","ok"),sessionStorage.removeItem("hopscotch.test.storage"),t=!0)}catch(w){}k={smoothScroll:!0,scrollDuration:1e3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0,isRtl:!1,cookieName:"hopscotch.tour.state"},Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),j=function(){q&&l.startTour()},g={addClass:function(a,b){var c,d,e,f;if(a.className){for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c.indexOf(" "+d[e]+" ")<0&&(c+=d[e]+" ");a.className=c.replace(/^\s+|\s+$/g,"")}else a.className=b},removeClass:function(a,b){var c,d,e,f;for(d=b.split(/\s+/),c=" "+a.className+" ",e=0,f=d.length;f>e;++e)c=c.replace(" "+d[e]+" "," ");a.className=c.replace(/^\s+|\s+$/g,"")},hasClass:function(a,b){var c;return a.className?(c=" "+a.className+" ",-1!==c.indexOf(" "+b+" ")):!1},getPixelValue:function(a){var b="undefined"==typeof a?"undefined":m(a);return"number"===b?a:"string"===b?parseInt(a,10):0},valOrDefault:function(a,b){return("undefined"==typeof a?"undefined":m(a))!==p?a:b},invokeCallbackArrayHelper:function(a){var b;return Array.isArray(a)&&(b=i[a[0]],"function"==typeof b)?b.apply(this,a.slice(1)):void 0},invokeCallbackArray:function(a){var b,c;if(Array.isArray(a)){if("string"==typeof a[0])return g.invokeCallbackArrayHelper(a);for(b=0,c=a.length;c>b;++b)g.invokeCallback(a[b])}},invokeCallback:function(a){return"function"==typeof a?a():"string"==typeof a&&i[a]?i[a]():g.invokeCallbackArray(a)},invokeEventCallbacks:function(a,b){var c,d,e=h[a];if(b)return this.invokeCallback(b);for(c=0,d=e.length;d>c;++c)this.invokeCallback(e[c].cb)},getScrollTop:function(){var a;return a=m(window.pageYOffset)!==p?window.pageYOffset:document.documentElement.scrollTop},getScrollLeft:function(){var a;return a=m(window.pageXOffset)!==p?window.pageXOffset:document.documentElement.scrollLeft},getWindowHeight:function(){return window.innerHeight||document.documentElement.clientHeight},addEvtListener:function(a,b,c){return a?a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c):void 0},removeEvtListener:function(a,b,c){return a?a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c):void 0},documentIsReady:function(){return"complete"===document.readyState},evtPreventDefault:function(a){a.preventDefault?a.preventDefault():event&&(event.returnValue=!1)},extend:function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},getStepTargetHelper:function(a){var b=document.getElementById(a);if(b)return b;if(r)return b=jQuery(a),b.length?b[0]:null;if(o)return b=new o(a),b.length?b[0]:null;if(document.querySelector)try{return document.querySelector(a)}catch(c){}return/^#[a-zA-Z][\w-_:.]*$/.test(a)?document.getElementById(a.substring(1)):null},getStepTarget:function(a){var b;if(!a||!a.target)return null;if("string"==typeof a.target)return g.getStepTargetHelper(a.target);if(Array.isArray(a.target)){var c,d;for(c=0,d=a.target.length;d>c;c++)if("string"==typeof a.target[c]&&(b=g.getStepTargetHelper(a.target[c])))return b;return null}return a.target},getI18NString:function(a){return e[a]||d[a]},setState:function(a,b,c){var d,e="";if(s&&t)try{sessionStorage.setItem(a,b)}catch(f){t=!1,this.setState(a,b,c)}else s&&sessionStorage.removeItem(a),c&&(d=new Date,d.setTime(d.getTime()+24*c*60*60*1e3),e="; expires="+d.toGMTString()),document.cookie=a+"="+b+e+"; path=/"},getState:function(a){var b,c,d,e=a+"=",f=document.cookie.split(";");if(s&&(d=sessionStorage.getItem(a)))return d;for(b=0;b0,showNext:g.valOrDefault(a.showNextButton,this.opt.showNextButton),showCTA:g.valOrDefault(a.showCTAButton&&a.ctaLabel,!1),ctaLabel:a.ctaLabel,showClose:g.valOrDefault(this.opt.showCloseButton,!0)},step:{num:b,isLast:g.valOrDefault(o,!1),title:a.title||"",content:a.content||"",isRtl:a.isRtl,placement:a.placement,padding:g.valOrDefault(a.padding,this.opt.bubblePadding),width:g.getPixelValue(a.width)||this.opt.bubbleWidth,customData:a.customData||{}},tour:{isTour:this.opt.isTourBubble,numSteps:j,unsafe:g.valOrDefault(h,!1),customData:e||{}}},"function"==typeof d)r.innerHTML=d(q);else if("string"==typeof d){if(!l.templates||"function"!=typeof l.templates[d])throw new Error('Bubble rendering failed - template "'+d+'" is not a function.');r.innerHTML=l.templates[d](q)}else if(f)r.innerHTML=f(q);else{if(!l.templates||"function"!=typeof l.templates[n])throw new Error('Bubble rendering failed - template "'+n+'" is not a function.');r.innerHTML=l.templates[n](q)}var s,t=r.children,u=t.length;for(p=0;u>p;p++)s=t[p],g.hasClass(s,"hopscotch-arrow")&&(this.arrowEl=s);return r.style.zIndex="number"==typeof a.zindex?a.zindex:"",this._setArrow(a.placement),this.hide(!1),this.setPosition(a),c&&c(!a.fixedElement),this},_getStepNum:function(a){var b,c,d=0,e=l.getSkippedStepsIndexes(),f=e.length;for(c=0;f>c;c++)b=e[c],a>b&&d++;return a-d},_getStepI18nNum:function(a){var b=g.getI18NString("stepNums");return b&&at||t>=s.steps.length?null:s.steps[t]},F=function(){y.nextStep()},G=function(a){var b,c,d,e,f,h,i=B(),j=i.element,k=g.getPixelValue(j.style.top),l=k+g.getPixelValue(j.offsetHeight),n=g.getStepTarget(E()),o=n.getBoundingClientRect(),q=o.top+g.getScrollTop(),s=o.bottom+g.getScrollTop(),t=q>k?k:q,u=l>s?l:s,v=g.getScrollTop(),w=v+g.getWindowHeight(),x=t-D("scrollTopMargin");t>=v&&(t<=v+D("scrollTopMargin")||w>=u)?a&&a():D("smoothScroll")?("undefined"==typeof YAHOO?"undefined":m(YAHOO))!==p&&m(YAHOO.env)!==p&&m(YAHOO.env.ua)!==p&&m(YAHOO.util)!==p&&m(YAHOO.util.Scroll)!==p?(b=YAHOO.env.ua.webkit?document.body:document.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,c=new YAHOO.util.Scroll(b,{scroll:{to:[0,x]}},D("scrollDuration")/1e3,d),c.onComplete.subscribe(a),c.animate()):r?jQuery("body, html").animate({scrollTop:x},D("scrollDuration"),a):(0>x&&(x=0),e=v>t?-1:1,f=Math.abs(v-x)/(D("scrollDuration")/10),(h=function(){var b=g.getScrollTop(),c=b+e*f;return e>0&&c>=x||0>e&&x>=c?(c=x,a&&a(),void window.scrollTo(0,c)):(window.scrollTo(0,c),g.getScrollTop()===b?void(a&&a()):void setTimeout(h,10))})()):(window.scrollTo(0,x),a&&a())},H=function O(a,b){var c,d,e;t+a>=0&&t+a0?d.multipage:t>0&&s.steps[t-1].multipage,f=function(c){var f;if(-1===c)return this.endTour(!0);if(a&&(f=b>0?g.invokeEventCallbacks("next",d.onNext):g.invokeEventCallbacks("prev",d.onPrev)),c===t){if(e)return void M();f=g.valOrDefault(f,!0),f?this.showStep(c):this.endTour(!1)}},!e&&D("skipIfNoElement"))H(b,function(a){f.call(i,a)});else if(t+b>=0&&t+b2&&(A=d[2].split(",")),w=parseInt(w,10)),this},K=function(a,b,c){var d,e;if(t=a||0,z=b||{},d=E(),e=g.getStepTarget(d))return void c(t);if(!e){if(g.invokeEventCallbacks("error"),z[t]=!0,D("skipIfNoElement"))return void H(1,c);t=-1,c(t)}},L=function(a){function b(){d.show(),g.invokeEventCallbacks("show",c.onShow)}var c=s.steps[a],d=B(),e=g.getStepTarget(c);t!==a&&E().nextOnTargetClick&&g.removeEvtListener(g.getStepTarget(E()),"click",F),t=a,d.hide(!1),d.render(c,a,function(a){a?G(b):b(),c.nextOnTargetClick&&g.addEvtListener(e,"click",F)}),M()},M=function(){var a=s.id+":"+t,b=l.getSkippedStepsIndexes();b&&b.length>0&&(a+=":"+b.join(",")),g.setState(D("cookieName"),a,1)},N=function(a){a&&this.configure(a)};this.getCalloutManager=function(){return("undefined"==typeof j?"undefined":m(j))===p&&(j=new c),j},this.startTour=function(a,b){var c,d,e={},f=this;if(!s){if(!a)throw new Error("Tour data is required for startTour.");if(!a.id||!u.test(a.id))throw new Error("Tour ID is using an invalid format. Use alphanumeric, underscores, and/or hyphens only. First character must be a letter.");s=a,J.call(this,a)}if(("undefined"==typeof b?"undefined":m(b))!==p){if(b>=s.steps.length)throw new Error("Specified step number out of bounds.");d=b}if(!g.documentIsReady())return q=!0,this;if("undefined"==typeof d&&s.id===v&&("undefined"==typeof w?"undefined":m(w))!==p){if(d=w,A.length>0)for(var h=0,i=A.length;i>h;h++)e[A[h]]=!0}else d||(d=0);return K(d,e,function(a){var b=-1!==a&&g.getStepTarget(s.steps[a]);return b?(g.invokeEventCallbacks("start"),c=B(),c.hide(!1),f.isActive=!0,void(g.getStepTarget(E())?f.showStep(a):(g.invokeEventCallbacks("error"),D("skipIfNoElement")&&f.nextStep(!1)))):void f.endTour(!1,!1)}),this},this.showStep=function(a){var b=s.steps[a],c=t;return g.getStepTarget(b)?(b.delay?setTimeout(function(){L(a)},b.delay):L(a),this):(t=a,g.invokeEventCallbacks("error"),void(t=c))},this.prevStep=function(a){return I.call(this,a,-1),this},this.nextStep=function(a){return I.call(this,a,1),this},this.endTour=function(a,b){var c,d=B();return a=g.valOrDefault(a,!0),b=g.valOrDefault(b,!0),s&&(c=E(),c&&c.nextOnTargetClick&&g.removeEvtListener(g.getStepTarget(c),"click",F)),t=0,w=void 0,d.hide(),a&&g.clearState(D("cookieName")),this.isActive&&(this.isActive=!1,s&&b&&g.invokeEventCallbacks("end")),this.removeCallbacks(null,!0),this.resetDefaultOptions(),C(),s=null,this},this.getCurrTour=function(){return s},this.getCurrTarget=function(){return g.getStepTarget(E())},this.getCurrStepNum=function(){return t},this.getSkippedStepsIndexes=function(){var a,b=[];for(a in z)b.push(a);return b},this.refreshBubblePosition=function(){var a=E();return a&&B().setPosition(a),this.getCalloutManager().refreshCalloutPositions(),this},this.listen=function(a,b,c){return a&&h[a].push({cb:b,fromTour:c}),this},this.unlisten=function(a,b){var c,d,e=h[a];for(c=0,d=e.length;d>c;++c)e[c].cb===b&&e.splice(c,1);return this},this.removeCallbacks=function(a,b){var c,d,e,f;for(f in h)if(!a||a===f)if(b)for(c=h[f],d=0,e=c.length;e>d;++d)c[d].fromTour&&(c.splice(d--,1),--e);else h[f]=[];return this},this.registerHelper=function(a,b){"string"==typeof a&&"function"==typeof b&&(i[a]=b)},this.unregisterHelper=function(a){i[a]=null},this.invokeHelper=function(a){var b,c,d=[];for(b=1,c=arguments.length;c>b;++b)d.push(arguments[b]);i[a]&&i[a].call(null,d)},this.setCookieName=function(a){return o.cookieName=a,this},this.resetDefaultOptions=function(){return o={},this},this.resetDefaultI18N=function(){return e={},this},this.getState=function(){return g.getState(D("cookieName"))},x=function(a,b){var c,d,f,h,i=["next","prev","start","end","show","error","close"];for(o||this.resetDefaultOptions(),g.extend(o,a),a&&g.extend(e,a.i18n),f=0,h=i.length;h>f;++f)d="on"+i[f].charAt(0).toUpperCase()+i[f].substring(1),a[d]&&this.listen(i[f],a[d],b);return c=B(!0),this},this.configure=function(a){return x.call(this,a,!1)},this.setRenderer=function(a){var b="undefined"==typeof a?"undefined":m(a);return"string"===b?(n=a,f=void 0):"function"===b&&(f=a),this},this.setEscaper=function(a){return this},N.call(this,a)},l=new a,function(){var a={};a.escape=function(a){return customEscape?customEscape(a):null==a?"":(""+a).replace(new RegExp("[&<>\"']","g"),function(a){return"&"==a?"&":"<"==a?"<":">"==a?">":'"'==a?""":"'"==a?"'":void 0})},this.templates=this.templates||{},this.templates.bubble_default=function(b){function c(b,c){return c?a.escape(b):b}var d,e="";a.escape,Array.prototype.join;e+="\n";var f=b.i18n,g=b.buttons,h=b.step,i=b.tour;return e+='\n
\n ',i.isTour&&(e+=''+(null==(d=f.stepNum)?"":d)+""),e+='\n
\n ',""!==h.title&&(e+='

'+(null==(d=c(h.title,i.unsafe))?"":d)+"

"),e+="\n ",""!==h.content&&(e+='
'+(null==(d=c(h.content,i.unsafe))?"":d)+"
"),e+='\n
\n
\n ',g.showPrev&&(e+='"),e+="\n ",g.showCTA&&(e+='"),e+="\n ",g.showNext&&(e+='"),e+="\n
\n ",g.showClose&&(e+='"),e+='\n
\n
\n
\n
\n
\n'}}.call(l);var x=l;return x}); \ No newline at end of file diff --git a/package.json b/package.json index c405695d..1cf76359 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "grunt-contrib-uglify": "~0.2.2", "grunt-contrib-watch": "~0.5.1", "grunt-include-replace": "~1.2.0", - "grunt-rollup": "^1.0.1", + "grunt-rollup": "^6.0.0", "grunt-shell": "~0.3.1", "grunt-template-jasmine-istanbul": "^0.3.0", "grunt-template-jasmine-requirejs": "^0.2.3",