1
0
Fork 0
forked from campiaperti/infra

improvement to query string parsing

This commit is contained in:
Hakim El Hattab 2013-11-27 13:16:03 -05:00
parent 69bf9b51ec
commit b314cf7b27
3 changed files with 9 additions and 5 deletions

View file

@ -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 file

@ -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;

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long