@@ -49,6 +49,17 @@
|
||||
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
|
||||
// http://remysharp.com/2010/07/21/throttling-function-calls/
|
||||
var throttle = function( fn, delay ) {
|
||||
@@ -85,7 +96,8 @@
|
||||
getElementFromHash: getElementFromHash,
|
||||
throttle: throttle,
|
||||
toNumber: toNumber,
|
||||
triggerEvent: triggerEvent
|
||||
triggerEvent: triggerEvent,
|
||||
getUrlParamValue: getUrlParamValue
|
||||
};
|
||||
roots[ rootId ] = lib;
|
||||
return lib;
|
||||
|
||||
Reference in New Issue
Block a user