aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Szopka <bartek.szopka+github@gmail.com>2012-03-14 20:44:04 +0000
committerBartek Szopka <bartek.szopka+github@gmail.com>2012-03-14 20:44:04 +0000
commit1a21865ea693f5a59ea95a429731c833f525893d (patch)
tree5e05d232d38f28d6e24bd97423d73a89146888de
parentc4d6ab3b8a93182a11dd0099afa3d129a5d21074 (diff)
downloadimpress.js-1a21865ea693f5a59ea95a429731c833f525893d.tar.gz
"`goto` is back, bye bye ugly `stepTo`"
-rw-r--r--README.md3
-rw-r--r--index.html2
-rw-r--r--js/impress.js20
3 files changed, 13 insertions, 12 deletions
diff --git a/README.md b/README.md
index 3147982..5117459 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,8 @@ VERSION HISTORY
- `present` class appears on currently visible step - it's different from `active` class as `present` class
is added when transition finishes (step is entered)
- `past` class is added to already visited steps (when the step is left)
-
+* and good news, `goto()` API method is back! it seems that `goto` **was** a future reserved word but isn't anymore,
+ so we can use this short and pretty name instead of camelCassy `stepTo` - and yes, that means API changed again...
### 0.4.1 ([browse](http://github.com/bartaz/impress.js/tree/0.4.1), [zip](http://github.com/bartaz/impress.js/zipball/0.4.1), [tar](http://github.com/bartaz/impress.js/tarball/0.4.1))
diff --git a/index.html b/index.html
index 0a885a8..72e8e5d 100644
--- a/index.html
+++ b/index.html
@@ -340,7 +340,7 @@ if ("ontouchstart" in document.documentElement) {
`api.init()` - initializes the presentation,
`api.next()` - moves to next step of the presentation,
`api.prev()` - moves to previous step of the presentation
- `api.stepTo( stepElement ) - moves the presentation to given step element (the DOM element of the step).
+ `api.goto( stepElement ) - moves the presentation to given step element (the DOM element of the step).
You can also simply call `impress()` again to get the API, so `impress().next()` is also allowed.
Don't worry, it wont initialize the presentation again.
diff --git a/js/impress.js b/js/impress.js
index 00d9b23..6e8d7c0 100644
--- a/js/impress.js
+++ b/js/impress.js
@@ -184,7 +184,7 @@
if (!impressSupported) {
return {
init: empty,
- stepTo: empty,
+ goto: empty,
prev: empty,
next: empty
};
@@ -356,7 +356,7 @@
triggerEvent(root, "impress-init", { api: roots[ "impress-root-" + rootId ] });
};
- var stepTo = function ( el, force ) {
+ var goto = function ( el, force ) {
if ( !initialized ||
!(el && el.id && stepsData["impress-" + el.id]) || // element is not a step
(el === activeStep && !force) ) {
@@ -446,14 +446,14 @@
var prev = steps.indexOf( activeStep ) - 1;
prev = prev >= 0 ? steps[ prev ] : steps[ steps.length-1 ];
- return stepTo(prev);
+ return goto(prev);
};
var next = function () {
var next = steps.indexOf( activeStep ) + 1;
next = next < steps.length ? steps[ next ] : steps[ 0 ];
- return stepTo(next);
+ return goto(next);
};
root.addEventListener("impress-init", function(){
@@ -489,19 +489,19 @@
}, false);
window.addEventListener("hashchange", function () {
- stepTo( getElementFromUrl() );
+ goto( getElementFromUrl() );
}, false);
// START
// by selecting step defined in url or first step of the presentation
- stepTo(getElementFromUrl() || steps[0]);
+ goto(getElementFromUrl() || steps[0]);
}, false);
body.classList.add("impress-disabled");
return (roots[ "impress-root-" + rootId ] = {
init: init,
- stepTo: stepTo,
+ goto: goto,
next: next,
prev: prev
});
@@ -583,7 +583,7 @@
}
}
- if ( api.stepTo(target) ) {
+ if ( api.goto(target) ) {
event.stopImmediatePropagation();
event.preventDefault();
}
@@ -598,7 +598,7 @@
target = target.parentNode;
}
- if ( api.stepTo(target) ) {
+ if ( api.goto(target) ) {
event.preventDefault();
}
}, false);
@@ -625,7 +625,7 @@
// rescale presentation when window is resized
window.addEventListener("resize", throttle(function () {
// force going to active step again, to trigger rescaling
- api.stepTo( document.querySelector(".active"), true );
+ api.goto( document.querySelector(".active"), true );
}, 250), false);
}, false);