summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js22
-rw-r--r--modules/luci-base/luasrc/view/header.htm1
2 files changed, 23 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
diff --git a/modules/luci-base/luasrc/view/header.htm b/modules/luci-base/luasrc/view/header.htm
index 6f7f0e48e7..fbede8ff57 100644
--- a/modules/luci-base/luasrc/view/header.htm
+++ b/modules/luci-base/luasrc/view/header.htm
@@ -18,6 +18,7 @@
<script type="text/javascript">
L = new LuCI(<%= luci.http.write_json({
token = token,
+ media = media,
resource = resource,
scriptname = luci.http.getenv("SCRIPT_NAME"),
pathinfo = luci.http.getenv("PATH_INFO"),