aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-22 09:58:52 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-22 09:58:52 +0800
commit53fb84ea01cc0de4f50806cd252273f435b41442 (patch)
tree5e523557587a4aef344a9d6c9ff3345c7d403d1a
parentb542121fa90041ea457dd605feaca7077a8f6bc4 (diff)
downloadfg21sim-53fb84ea01cc0de4f50806cd252273f435b41442.tar.bz2
webui: Move several generic functions from "configs.js" to "main.js"
-rw-r--r--fg21sim/webui/static/js/configs.js48
-rw-r--r--fg21sim/webui/static/js/main.js46
2 files changed, 47 insertions, 47 deletions
diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js
index f321881..ad8972d 100644
--- a/fg21sim/webui/static/js/configs.js
+++ b/fg21sim/webui/static/js/configs.js
@@ -3,59 +3,13 @@
* MIT license
*
* Web UI of "fg21sim"
- * Configuration form manipulations using the WebSocket communications
+ * Configuration form manipulations
*/
"use strict";
/**
- * Generic utilities
- */
-
-/**
- * Get the basename of a path
- * FIXME: only support "/" as the path separator
- */
-var basename = function (path) {
- return path.replace(/^.*\//, "");
-};
-
-/**
- * Get the dirname of a path
- * FIXME: only support "/" as the path separator
- */
-var dirname = function (path) {
- var dir = path.replace(/\/[^\/]*\/?$/, "");
- if (dir === "") {
- dir = "/";
- }
- return dir;
-};
-
-/**
- * Join the two path
- * FIXME: only support "/" as the path separator
- */
-var joinPath = function (path1, path2) {
- var p = null;
- // Strip the trailing path separator
- path1 = path1.replace(/\/$/, "");
- if (path1 === "") {
- p = path2;
- } else {
- p = path1 + "/" + path2;
- }
- // Both "path1" and "path2" are empty
- if (p === "/") {
- console.error("Both 'path1' and 'path2' are empty");
- p = null;
- }
- return p;
-};
-
-
-/**
* Set custom error messages for the form fields that failed the server-side
* validations.
*
diff --git a/fg21sim/webui/static/js/main.js b/fg21sim/webui/static/js/main.js
index 5b0e7ec..c714f26 100644
--- a/fg21sim/webui/static/js/main.js
+++ b/fg21sim/webui/static/js/main.js
@@ -9,6 +9,52 @@
/**
+ * Generic utilities
+ */
+
+/**
+ * Get the basename of a path
+ * FIXME: only support "/" as the path separator
+ */
+var basename = function (path) {
+ return path.replace(/^.*\//, "");
+};
+
+/**
+ * Get the dirname of a path
+ * FIXME: only support "/" as the path separator
+ */
+var dirname = function (path) {
+ var dir = path.replace(/\/[^\/]*\/?$/, "");
+ if (dir === "") {
+ dir = "/";
+ }
+ return dir;
+};
+
+/**
+ * Join the two path
+ * FIXME: only support "/" as the path separator
+ */
+var joinPath = function (path1, path2) {
+ var p = null;
+ // Strip the trailing path separator
+ path1 = path1.replace(/\/$/, "");
+ if (path1 === "") {
+ p = path2;
+ } else {
+ p = path1 + "/" + path2;
+ }
+ // Both "path1" and "path2" are empty
+ if (p === "/") {
+ console.error("Both 'path1' and 'path2' are empty");
+ p = null;
+ }
+ return p;
+};
+
+
+/**
* jQuery AJAX global callbacks using the global AJAX event handler methods
*
* NOTE: