Skip to content

Commit b314cf7

Browse files
committed
improvement to query string parsing
1 parent 69bf9b5 commit b314cf7

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Gruntfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ module.exports = function(grunt) {
6969
globals: {
7070
head: false,
7171
module: false,
72-
console: false
72+
console: false,
73+
unescape: false
7374
}
7475
},
7576
files: [ 'Gruntfile.js', 'js/reveal.js' ]

js/reveal.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,17 +3300,20 @@ var Reveal = (function(){
33003300
getQueryHash: function() {
33013301
var query = {};
33023302

3303-
location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) {
3303+
location.search.replace( /[A-Z0-9]+?=([\w\.%-]*)/gi, function(a) {
33043304
query[ a.split( '=' ).shift() ] = a.split( '=' ).pop();
33053305
} );
33063306

33073307
// Basic deserialization
33083308
for( var i in query ) {
33093309
var value = query[ i ];
3310+
3311+
query[ i ] = unescape( value );
3312+
33103313
if( value === 'null' ) query[ i ] = null;
33113314
else if( value === 'true' ) query[ i ] = true;
33123315
else if( value === 'false' ) query[ i ] = false;
3313-
else if( !isNaN( parseFloat( value ) ) ) query[ i ] = parseFloat( value );
3316+
else if( value.match( /^\d+$/ ) ) query[ i ] = parseFloat( value );
33143317
}
33153318

33163319
return query;

0 commit comments

Comments
 (0)