summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-11-29 21:53:13 +0200
committerAlon Levy <alon@pobox.com>2014-11-29 22:30:16 +0200
commit87cb13da2cf203ad504904c9f6983297c531bd3e (patch)
treec354f953b271217366ed3de1e5a2a8fa4ff7dddc
parentb23df21411df756a2549857fd7bd02839b2b4fac (diff)
move getParmeterByName to util
-rw-r--r--src/main.js14
-rw-r--r--src/util.js17
2 files changed, 16 insertions, 15 deletions
diff --git a/src/main.js b/src/main.js
index feefcf57..80837cdb 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,12 +1,5 @@
-define(['textanalysis.ui', 'textanalysis', 'buttons', 'history', 'drag_n_drop', 'robot', 'model/core', 'rz_config', 'rz_core', 'view/selection'],
-function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop, robot, model_core, rz_config, rz_core, selection) {
-
- function getParameterByName(name) {
- name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
- var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
- results = regex.exec(location.search);
- return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
- }
+define(['textanalysis.ui', 'textanalysis', 'buttons', 'history', 'drag_n_drop', 'robot', 'model/core', 'rz_config', 'rz_core', 'view/selection', 'util'],
+function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop, robot, model_core, rz_config, rz_core, selection, util) {
function expand(obj){
if (!obj.savesize) {
@@ -26,8 +19,7 @@ function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop,
textanalysis_ui.main();
- // TODO: jquery BBQ: $.deparam.querystring().json;
- json = getParameterByName('json');
+ json = util.getParameterByName('json');
if (json) {
rz_core.load_from_json(json);
}
diff --git a/src/util.js b/src/util.js
index 3113474b..7d7ebe69 100644
--- a/src/util.js
+++ b/src/util.js
@@ -43,10 +43,19 @@ define(function() {
return set_diff(sa, sb);
}
+ // TODO: jquery BBQ: $.deparam.querystring().json;
+ function getParameterByName(name) {
+ name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
+ var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
+ results = regex.exec(location.search);
+ return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
+ }
+
return {
- set_from_array : set_from_array,
- set_from_object : set_from_object,
- set_diff : set_diff,
- array_diff : array_diff
+ set_from_array: set_from_array,
+ set_from_object: set_from_object,
+ set_diff: set_diff,
+ array_diff: array_diff,
+ getParameterByName: getParameterByName,
};
});