diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.js | 14 | ||||
| -rw-r--r-- | src/util.js | 17 |
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, }; }); |
