@@ -1207,6 +1207,17 @@
|
|||||||
return byId( window.location.hash.replace( /^#\/?/, "" ) );
|
return byId( window.location.hash.replace( /^#\/?/, "" ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// `getUrlParamValue` return a given URL parameter value if it exists
|
||||||
|
// `undefined` if it doesn't exist
|
||||||
|
var getUrlParamValue = function( parameter ) {
|
||||||
|
var chunk = window.location.search.split( parameter + "=" )[ 1 ];
|
||||||
|
var value = chunk && chunk.split( "&" )[ 0 ];
|
||||||
|
|
||||||
|
if ( value !== "" ) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Throttling function calls, by Remy Sharp
|
// Throttling function calls, by Remy Sharp
|
||||||
// http://remysharp.com/2010/07/21/throttling-function-calls/
|
// http://remysharp.com/2010/07/21/throttling-function-calls/
|
||||||
var throttle = function( fn, delay ) {
|
var throttle = function( fn, delay ) {
|
||||||
@@ -1243,7 +1254,8 @@
|
|||||||
getElementFromHash: getElementFromHash,
|
getElementFromHash: getElementFromHash,
|
||||||
throttle: throttle,
|
throttle: throttle,
|
||||||
toNumber: toNumber,
|
toNumber: toNumber,
|
||||||
triggerEvent: triggerEvent
|
triggerEvent: triggerEvent,
|
||||||
|
getUrlParamValue: getUrlParamValue
|
||||||
};
|
};
|
||||||
roots[ rootId ] = lib;
|
roots[ rootId ] = lib;
|
||||||
return lib;
|
return lib;
|
||||||
@@ -1287,9 +1299,10 @@
|
|||||||
// Element attributes starting with "data-", become available under
|
// Element attributes starting with "data-", become available under
|
||||||
// element.dataset. In addition hyphenized words become camelCased.
|
// element.dataset. In addition hyphenized words become camelCased.
|
||||||
var data = root.dataset;
|
var data = root.dataset;
|
||||||
|
var autoplay = util.getUrlParamValue( "impress-autoplay" ) || data.autoplay;
|
||||||
|
|
||||||
if ( data.autoplay ) {
|
if ( autoplay ) {
|
||||||
autoplayDefault = util.toNumber( data.autoplay, 0 );
|
autoplayDefault = util.toNumber( autoplay, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
var toolbar = document.querySelector( "#impress-toolbar" );
|
var toolbar = document.querySelector( "#impress-toolbar" );
|
||||||
|
|||||||
@@ -49,6 +49,17 @@
|
|||||||
return byId( window.location.hash.replace( /^#\/?/, "" ) );
|
return byId( window.location.hash.replace( /^#\/?/, "" ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// `getUrlParamValue` return a given URL parameter value if it exists
|
||||||
|
// `undefined` if it doesn't exist
|
||||||
|
var getUrlParamValue = function( parameter ) {
|
||||||
|
var chunk = window.location.search.split( parameter + "=" )[ 1 ];
|
||||||
|
var value = chunk && chunk.split( "&" )[ 0 ];
|
||||||
|
|
||||||
|
if ( value !== "" ) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Throttling function calls, by Remy Sharp
|
// Throttling function calls, by Remy Sharp
|
||||||
// http://remysharp.com/2010/07/21/throttling-function-calls/
|
// http://remysharp.com/2010/07/21/throttling-function-calls/
|
||||||
var throttle = function( fn, delay ) {
|
var throttle = function( fn, delay ) {
|
||||||
@@ -85,7 +96,8 @@
|
|||||||
getElementFromHash: getElementFromHash,
|
getElementFromHash: getElementFromHash,
|
||||||
throttle: throttle,
|
throttle: throttle,
|
||||||
toNumber: toNumber,
|
toNumber: toNumber,
|
||||||
triggerEvent: triggerEvent
|
triggerEvent: triggerEvent,
|
||||||
|
getUrlParamValue: getUrlParamValue
|
||||||
};
|
};
|
||||||
roots[ rootId ] = lib;
|
roots[ rootId ] = lib;
|
||||||
return lib;
|
return lib;
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ rather require the user to invoke them somehow. For example:
|
|||||||
* The *navigation* plugin waits for the user to press some keys, arrows, page
|
* The *navigation* plugin waits for the user to press some keys, arrows, page
|
||||||
down, page up, space or tab.
|
down, page up, space or tab.
|
||||||
* The *autoplay* plugin looks for the HTML attribute `data-autoplay` to see
|
* The *autoplay* plugin looks for the HTML attribute `data-autoplay` to see
|
||||||
whether it should do its thing.
|
whether it should do its thing. It can also be triggered with a URL GET parameter
|
||||||
|
`?impress-autoplay=5` *5 is the waiting duration*.
|
||||||
* The *toolbar* plugin looks for a `<div>` element to become visible.
|
* The *toolbar* plugin looks for a `<div>` element to become visible.
|
||||||
|
|
||||||
Extra addons
|
Extra addons
|
||||||
|
|||||||
@@ -31,9 +31,10 @@
|
|||||||
// Element attributes starting with "data-", become available under
|
// Element attributes starting with "data-", become available under
|
||||||
// element.dataset. In addition hyphenized words become camelCased.
|
// element.dataset. In addition hyphenized words become camelCased.
|
||||||
var data = root.dataset;
|
var data = root.dataset;
|
||||||
|
var autoplay = util.getUrlParamValue( "impress-autoplay" ) || data.autoplay;
|
||||||
|
|
||||||
if ( data.autoplay ) {
|
if ( autoplay ) {
|
||||||
autoplayDefault = util.toNumber( data.autoplay, 0 );
|
autoplayDefault = util.toNumber( autoplay, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
var toolbar = document.querySelector( "#impress-toolbar" );
|
var toolbar = document.querySelector( "#impress-toolbar" );
|
||||||
|
|||||||
Reference in New Issue
Block a user