diff --git a/css/hopscotch.css b/css/hopscotch.css index e8353743..fff1e692 100644 --- a/css/hopscotch.css +++ b/css/hopscotch.css @@ -15,7 +15,7 @@ div.hopscotch-bubble .hopscotch-bubble-container{padding:15px;position:relative; div.hopscotch-bubble .hopscotch-bubble-content{margin:0 0 0 40px;} div.hopscotch-bubble.no-number .hopscotch-bubble-content{margin:0;} div.hopscotch-bubble .hopscotch-bubble-close{color:#000;background:transparent url(../img/sprite-green-0.3.png) -192px -92px no-repeat;display:block;padding:8px;position:absolute;text-decoration:none;text-indent:-9999px;width:8px;height:8px;top:0;right:0;}div.hopscotch-bubble .hopscotch-bubble-close.hide,div.hopscotch-bubble .hopscotch-bubble-close.hide-all{display:none;} -div.hopscotch-bubble .hopscotch-bubble-number{background:transparent url(../img/sprite-green-0.3.png) 0 0 no-repeat;color:#fff;display:block;float:left;font-size:17px;font-weight:bold;line-height:32px;padding:0 10px 0 0;text-align:center;width:30px;height:30px;} +div.hopscotch-bubble .hopscotch-bubble-number{background:transparent url(../img/sprite-green-0.3.png) 0 0 no-repeat;color:#fff;display:block;float:left;font-size:17px;font-weight:bold;line-height:31px;padding:0 10px 0 0;text-align:center;width:30px;height:30px;} div.hopscotch-bubble .hopscotch-bubble-arrow-container{position:absolute;width:34px;height:34px;}div.hopscotch-bubble .hopscotch-bubble-arrow-container .hopscotch-bubble-arrow,div.hopscotch-bubble .hopscotch-bubble-arrow-container .hopscotch-bubble-arrow-border{width:0;height:0;} div.hopscotch-bubble .hopscotch-bubble-arrow-container.up{top:-22px;left:10px;}div.hopscotch-bubble .hopscotch-bubble-arrow-container.up .hopscotch-bubble-arrow{border-bottom:17px solid #ffffff;border-left:17px solid transparent;border-right:17px solid transparent;position:relative;top:-10px;} div.hopscotch-bubble .hopscotch-bubble-arrow-container.up .hopscotch-bubble-arrow-border{border-bottom:17px solid #000000;border-bottom:17px solid rgba(0, 0, 0, 0.5);border-left:17px solid transparent;border-right:17px solid transparent;} diff --git a/js/hopscotch-0.0.5.js b/js/hopscotch-0.0.5.js index dd440412..5c5170b4 100644 --- a/js/hopscotch-0.0.5.js +++ b/js/hopscotch-0.0.5.js @@ -8,6 +8,7 @@ callbacks, helpers, winLoadHandler, + hasCssTransitions, winHopscotch = context[namespace], undefinedStr = 'undefined', waitingToStart = false, // is a tour waiting for the document to finish @@ -27,13 +28,7 @@ }, hasJquery = (typeof window.jQuery !== undefinedStr), hasSessionStorage = (typeof window.sessionStorage !== undefinedStr), - document = window.document, - docStyle = document.head.style, - hasCssTransitions = (typeof docStyle.MozTransition !== undefinedStr || - typeof docStyle.MsTransition !== undefinedStr || - typeof docStyle.webkitTransition !== undefinedStr || - typeof docStyle.OTransition !== undefinedStr || - typeof docStyle.transition !== undefinedStr); + document = window.document; if (winHopscotch) { // Hopscotch already exists. @@ -154,6 +149,15 @@ return typeof val !== undefinedStr ? val : valDefault; }, + supportsCssTransitions: function() { + var docStyle = document.body.style; + return (typeof docStyle.MozTransition !== undefinedStr || + typeof docStyle.MsTransition !== undefinedStr || + typeof docStyle.webkitTransition !== undefinedStr || + typeof docStyle.OTransition !== undefinedStr || + typeof docStyle.transition !== undefinedStr); + }, + /** * Invokes a single callback represented by an array. * Example input: ["my_fn", "arg1", 2, "arg3"] @@ -1073,8 +1077,9 @@ /** * Append to body once the DOM is ready. */ - if (document.readyState === 'complete') { + if (document.readyState === 'complete' || document.readyState === 'interactive') { document.body.appendChild(el); + hasCssTransitions = utils.supportsCssTransitions(); } else { // Moz, webkit, Opera @@ -1082,6 +1087,7 @@ appendToBody = function() { document.removeEventListener('DOMContentLoaded', appendToBody); document.body.appendChild(el); + hasCssTransitions = utils.supportsCssTransitions(); }; document.addEventListener('DOMContentLoaded', appendToBody); @@ -1093,6 +1099,7 @@ document.detachEvent('onreadystatechange', appendToBody); document.body.appendChild(el); } + hasCssTransitions = utils.supportsCssTransitions(); }; document.attachEvent('onreadystatechange', appendToBody); @@ -1686,7 +1693,6 @@ showBubble = function() { bubble.show(); - // tour-wide callback utils.invokeEventCallbacks('show', step.onShow); }; @@ -1956,7 +1962,7 @@ for (i = 0, len = events.length; i < len; ++i) { // At this point, options[eventPropName] may have changed from an array // to a function. - eventPropName = 'on' + events[i][0].toUpperCase() + events[i].substring(1); + eventPropName = 'on' + events[i].charAt(0).toUpperCase() + events[i].substring(1); if (options[eventPropName]) { this.listen(events[i], options[eventPropName], diff --git a/js/hopscotch-0.0.5.min.js b/js/hopscotch-0.0.5.min.js index 7053f46c..68316285 100644 --- a/js/hopscotch-0.0.5.min.js +++ b/js/hopscotch-0.0.5.min.js @@ -1,35 +1,35 @@ -(function(x,B){var k,y,C,n,D=window.Sizzle||null,b,s,u,p=x[B],E=!1,t={animate:!1,smoothScroll:!0,scrollDuration:1E3,scrollTopMargin:200,showCloseButton:!0,showPrevButton:!1,showNextButton:!0,bubbleWidth:280,bubblePadding:15,arrowWidth:20,skipIfNoElement:!0},z="undefined"!==typeof window.jQuery,v="undefined"!==typeof window.sessionStorage,g=window.document;k=g.head.style;var G="undefined"!==typeof k.MozTransition||"undefined"!==typeof k.MsTransition||"undefined"!==typeof k.webkitTransition||"undefined"!== -typeof k.OTransition||"undefined"!==typeof k.transition;p||(Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),k=function(){E&&p.startTour()},window.addEventListener?window.addEventListener("load",k,!1):window.attachEvent&&window.attachEvent("onload",k),b={addClass:function(a,e){var b,d,f;if(0===a.className.length)a.className=e;else{b=a.className.split(/\s+/);d=0;for(f=b.length;dh||h>=j.steps.length?null:j.steps[h]},v=function(){e.nextStep(!1)},A=function(a, -f){var d,c;0<=h+a&&h+ae?d:e,h=b.getScrollTop(),e=h+b.getWindowHeight(),q=a-f.scrollTopMargin,i,F,j;a>=h&&(a<=h+f.scrollTopMargin||d<=e)?l&&l():f.smoothScroll?"undefined"!==typeof YAHOO&&"undefined"!==typeof YAHOO.env&&"undefined"!==typeof YAHOO.env.ua&&"undefined"!==typeof YAHOO.util&&"undefined"!==typeof YAHOO.util.Scroll?(a=YAHOO.env.ua.webkit?g.body:g.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut:void 0,a=new YAHOO.util.Scroll(a,{scroll:{to:[0,q]}},f.scrollDuration/1E3,d),a.onComplete.subscribe(l), -a.animate()):z?$("body, html").animate({scrollTop:q},f.scrollDuration,l):(0>q&&(q=0),i=h>a?-1:1,F=Math.abs(h-q)/(f.scrollDuration/10),j=function(){var a=b.getScrollTop(),c=a+i*F;0=q||0>i&&c<=q?(c=q,l&&l(),window.scrollTo(0,c)):(window.scrollTo(0,c),b.getScrollTop()===a?l&&l():setTimeout(j,10))},j()):(window.scrollTo(0,q),l&&l())}else l();c.nextOnTargetClick&&b.addClickListener(k,v)});c.multipage&&(e+=":mp");b.setState(f.cookieName,e,1)},c.delay||0);return this};this.prevStep=function(a){x.call(this, -a,-1);return this};this.nextStep=function(a){var c=r(),d=b.getStepTarget(c);c.nextOnTargetClick&&b.removeClickListener(d,v);x.call(this,a,1);return this};this.endTour=function(a,c){var d=w(),a=b.valOrDefault(a,!0),c=b.valOrDefault(c,!0);h=0;i=void 0;d.hide();a&&b.clearState(f.cookieName);p.isActive=!1;j&&c&&b.invokeEventCallbacks("end");p.removeCallbacks(!0);j=null;return this};this.getCurrTour=function(){return j};this.getCurrStepNum=function(){return h};this.listen=function(a,b,c){a&&s[a].push({cb:b, -fromTour:c});return this};this.unlisten=function(a,b){var c=s[a],d,e;d=0;for(e=c.length;dh||h>=j.steps.length?null:j.steps[h]},t=function(){e.nextStep(!1)},v=function(a,d){var g,c;0<=h+a&&h+ae?d:e,h=b.getScrollTop(),e=h+b.getWindowHeight(),q=a-g.scrollTopMargin,i,F,j;a>=h&&(a<=h+g.scrollTopMargin||d<=e)?l&&l():g.smoothScroll?"undefined"!==typeof YAHOO&&"undefined"!==typeof YAHOO.env&&"undefined"!==typeof YAHOO.env.ua&&"undefined"!==typeof YAHOO.util&&"undefined"!==typeof YAHOO.util.Scroll?(a=YAHOO.env.ua.webkit?f.body:f.documentElement,d=YAHOO.util.Easing?YAHOO.util.Easing.easeOut: +void 0,a=new YAHOO.util.Scroll(a,{scroll:{to:[0,q]}},g.scrollDuration/1E3,d),a.onComplete.subscribe(l),a.animate()):A?$("body, html").animate({scrollTop:q},g.scrollDuration,l):(0>q&&(q=0),i=h>a?-1:1,F=Math.abs(h-q)/(g.scrollDuration/10),j=function(){var a=b.getScrollTop(),c=a+i*F;0=q||0>i&&c<=q?(c=q,l&&l(),window.scrollTo(0,c)):(window.scrollTo(0,c),b.getScrollTop()===a?l&&l():setTimeout(j,10))},j()):(window.scrollTo(0,q),l&&l())}else l();c.nextOnTargetClick&&b.addClickListener(k,t)});c.multipage&& +(e+=":mp");b.setState(g.cookieName,e,1)},c.delay||0);return this};this.prevStep=function(a){y.call(this,a,-1);return this};this.nextStep=function(a){var c=r(),d=b.getStepTarget(c);c.nextOnTargetClick&&b.removeClickListener(d,t);y.call(this,a,1);return this};this.endTour=function(a,c){var d=x(),a=b.valOrDefault(a,!0),c=b.valOrDefault(c,!0);h=0;i=void 0;d.hide();a&&b.clearState(g.cookieName);n.isActive=!1;j&&c&&b.invokeEventCallbacks("end");n.removeCallbacks(!0);j=null;return this};this.getCurrTour= +function(){return j};this.getCurrStepNum=function(){return h};this.listen=function(a,b,c){a&&s[a].push({cb:b,fromTour:c});return this};this.unlisten=function(a,b){var c=s[a],d,e;d=0;for(e=c.length;d