Permalink
Browse files

improvement to query string parsing

  • Loading branch information...
1 parent 69bf9b5 commit b314cf7b27c913c03ec5c36fd7c1b765732ef3e2 @hakimel committed Nov 27, 2013
Showing with 9 additions and 5 deletions.
  1. +2 −1 Gruntfile.js
  2. +5 −2 js/reveal.js
  3. +2 −2 js/reveal.min.js
View
@@ -69,7 +69,8 @@ module.exports = function(grunt) {
globals: {
head: false,
module: false,
- console: false
+ console: false,
+ unescape: false
}
},
files: [ 'Gruntfile.js', 'js/reveal.js' ]
View
@@ -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;
Oops, something went wrong.

0 comments on commit b314cf7

Please sign in to comment.