summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/luci.js
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-01-28 11:14:15 +0100
committerJo-Philipp Wich <jo@mein.io>2020-01-28 11:14:42 +0100
commitb60b4790d1b1b8d52657c0c9ba91da86d0b8a28d (patch)
treedc247cd284afafbc642a5405dfb4608b4ad0c109 /modules/luci-base/htdocs/luci-static/resources/luci.js
parent8c860a1d9cf4229419d0cc2eed99a1c001cf16c5 (diff)
luci-base: add L.media() URL construction helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/luci.js')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index 3a8c6b4b17..3b861bfc18 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -1751,6 +1751,28 @@
},
/**
+ * Construct an URL path relative to the media resource path of the
+ * LuCI ui (usually `/luci-static/$theme_name`).
+ *
+ * The resulting URL is guaranteed to only contain the characters
+ * `a-z`, `A-Z`, `0-9`, `_`, `.`, `%`, `,`, `;`, and `-` as well
+ * as `/` for the path separator.
+ *
+ * @instance
+ * @memberof LuCI
+ *
+ * @param {string[]} [parts]
+ * An array of parts to join into an URL path. Parts may contain
+ * slashes and any of the other characters mentioned above.
+ *
+ * @return {string}
+ * Returns the resulting URL path.
+ */
+ media: function() {
+ return this.path(this.env.media, arguments);
+ },
+
+ /**
* Return the complete URL path to the current view.
*
* @instance