improvement to query string parsing
This commit is contained in:
parent
69bf9b51ec
commit
b314cf7b27
3 changed files with 9 additions and 5 deletions
|
@ -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' ]
|
||||
|
|
|
@ -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
4
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue