Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
1) Step number line-height
2) IE7 doesn't like bracket notation for characters. Use charAt.
3) Check for CSS transition support on document ready
  • Loading branch information
Gordon Koo committed Apr 9, 2013
1 parent f346215 commit f2581a6
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 45 deletions.
2 changes: 1 addition & 1 deletion css/hopscotch.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 16 additions & 10 deletions js/hopscotch-0.0.5.js
Expand Up @@ -8,6 +8,7 @@
callbacks,
helpers,
winLoadHandler,
hasCssTransitions,
winHopscotch = context[namespace],
undefinedStr = 'undefined',
waitingToStart = false, // is a tour waiting for the document to finish
Expand All @@ -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.
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -1073,15 +1077,17 @@
/**
* 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
if (document.addEventListener) {
appendToBody = function() {
document.removeEventListener('DOMContentLoaded', appendToBody);
document.body.appendChild(el);
hasCssTransitions = utils.supportsCssTransitions();
};

document.addEventListener('DOMContentLoaded', appendToBody);
Expand All @@ -1093,6 +1099,7 @@
document.detachEvent('onreadystatechange', appendToBody);
document.body.appendChild(el);
}
hasCssTransitions = utils.supportsCssTransitions();
};

document.attachEvent('onreadystatechange', appendToBody);
Expand Down Expand Up @@ -1686,7 +1693,6 @@

showBubble = function() {
bubble.show();
// tour-wide callback
utils.invokeEventCallbacks('show', step.onShow);
};

Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit f2581a6

Please sign in to comment.