diff options
author | Hakim El Hattab | 2013-11-27 13:16:03 -0500 |
---|---|---|
committer | Hakim El Hattab | 2013-11-27 13:16:03 -0500 |
commit | b314cf7b27c913c03ec5c36fd7c1b765732ef3e2 (patch) | |
tree | 25dc42a435329431054cc6781038556fbd5d2001 /js/reveal.js | |
parent | 69bf9b51ec441fa4f7924d53f3e620a203bff83d (diff) |
improvement to query string parsing
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/js/reveal.js b/js/reveal.js index d1d8ea6..26ebc48 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3300,17 +3300,20 @@ var Reveal = (function(){ getQueryHash: function() { var query = {}; - location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) { + location.search.replace( /[A-Z0-9]+?=([\w\.%-]*)/gi, function(a) { query[ a.split( '=' ).shift() ] = a.split( '=' ).pop(); } ); // Basic deserialization for( var i in query ) { var value = query[ i ]; + + query[ i ] = unescape( value ); + if( value === 'null' ) query[ i ] = null; else if( value === 'true' ) query[ i ] = true; else if( value === 'false' ) query[ i ] = false; - else if( !isNaN( parseFloat( value ) ) ) query[ i ] = parseFloat( value ); + else if( value.match( /^\d+$/ ) ) query[ i ] = parseFloat( value ); } return query; |