add queryparse
This commit is contained in:
		
							parent
							
								
									7e864920b8
								
							
						
					
					
						commit
						e9ee69a178
					
				| @ -31,6 +31,39 @@ | |||||||
|     return qs.join('&'); |     return qs.join('&'); | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  |   // Modified from http://stackoverflow.com/a/7826782
 | ||||||
|  |   core.queryparse = function (search) { | ||||||
|  | 		// parse a query or a hash
 | ||||||
|  | 		if (-1 !== ['#', '?'].indexOf(search[0])) { | ||||||
|  | 			search = search.substring(1); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  |     var args = search.split('&'); | ||||||
|  |     var argsParsed = {}; | ||||||
|  |     var i, arg, kvp, key, value; | ||||||
|  | 
 | ||||||
|  |     for (i = 0; i < args.length; i += 1) { | ||||||
|  | 
 | ||||||
|  |         arg = args[i]; | ||||||
|  | 
 | ||||||
|  |         if (-1 === arg.indexOf('=')) { | ||||||
|  | 
 | ||||||
|  |         	argsParsed[decodeURIComponent(arg).trim()] = true; | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  | 
 | ||||||
|  | 					kvp = arg.split('='); | ||||||
|  | 					key = decodeURIComponent(kvp[0]).trim(); | ||||||
|  | 					value = decodeURIComponent(kvp[1]).trim(); | ||||||
|  | 					argsParsed[key] = value; | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return argsParsed; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|   core.authorizationCode = function (/*directive, scope, redirectUri, clientId*/) { |   core.authorizationCode = function (/*directive, scope, redirectUri, clientId*/) { | ||||||
|     //
 |     //
 | ||||||
|     // Example Authorization Code Request
 |     // Example Authorization Code Request
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user