Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

split_get_parameters function added

  • Loading branch information...
commit bbd57c0539f3cea3dc2f7c705b1385cdb35b1ef4 1 parent e957b60
Jonas Fiala authored
Showing with 27 additions and 1 deletion.
  1. +27 −1 ella/newman/media/js/kobayashi.js
View
28 ella/newman/media/js/kobayashi.js
@@ -16,7 +16,7 @@
* Kobayashi object.
*
*/
-KOBAYASHI_VERSION = '2010-06-09';
+KOBAYASHI_VERSION = '2010-07-27';
// Kobayashi logging
log_kobayashi = new LoggingLib('KOBAYASHI:', false);
@@ -607,6 +607,32 @@ Kobayashi.LOADED_MEDIA = {};
return {target_id:target_id, address:address};
}
Kobayashi.get_simple_load_arguments = get_simple_load_arguments;
+
+ // Returns object containing HTTP GET parameters
+ function split_get_arguments(url) {
+ var out = new Object();
+ var qmark_position = url.indexOf('?');
+ if (url.length == 0 || qmark_position < 0 || (qmark_position + 1) >= url.length) {
+ return out;
+ }
+ var get_parameters = url.substr(qmark_position + 1);
+ if (get_parameters.length == 0) {
+ get_parameters = url;
+ }
+ var assignments = get_parameters.split(/&/);
+
+ for (var i = 0; i < assignments.length; i++) {
+ var ass = assignments[i];
+ var param = (ass.indexOf('=') < 0) ? ass : ass.substr(0, ass.indexOf('='));
+ if (param.length == 0) {
+ continue;
+ }
+ var value = ass.substr(ass.indexOf('=') + 1);
+ out[param] = value;
+ }
+ return out;
+ }
+ Kobayashi.split_get_arguments = split_get_arguments;
// Set up event handlers
$('.js-simpleload,.js-simpleload-container a').live('click', function(evt) {
Please sign in to comment.
Something went wrong with that request. Please try again.