improvement to query string parsing
This commit is contained in:
parent
69bf9b51ec
commit
b314cf7b27
|
@ -69,7 +69,8 @@ module.exports = function(grunt) {
|
||||||
globals: {
|
globals: {
|
||||||
head: false,
|
head: false,
|
||||||
module: false,
|
module: false,
|
||||||
console: false
|
console: false,
|
||||||
|
unescape: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
files: [ 'Gruntfile.js', 'js/reveal.js' ]
|
files: [ 'Gruntfile.js', 'js/reveal.js' ]
|
||||||
|
|
|
@ -3300,17 +3300,20 @@ var Reveal = (function(){
|
||||||
getQueryHash: function() {
|
getQueryHash: function() {
|
||||||
var query = {};
|
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();
|
query[ a.split( '=' ).shift() ] = a.split( '=' ).pop();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Basic deserialization
|
// Basic deserialization
|
||||||
for( var i in query ) {
|
for( var i in query ) {
|
||||||
var value = query[ i ];
|
var value = query[ i ];
|
||||||
|
|
||||||
|
query[ i ] = unescape( value );
|
||||||
|
|
||||||
if( value === 'null' ) query[ i ] = null;
|
if( value === 'null' ) query[ i ] = null;
|
||||||
else if( value === 'true' ) query[ i ] = true;
|
else if( value === 'true' ) query[ i ] = true;
|
||||||
else if( value === 'false' ) query[ i ] = false;
|
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;
|
return query;
|
||||||
|
|
4
js/reveal.min.js
vendored
4
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user