summaryrefslogtreecommitdiff
path: root/elm/Lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-04-17 11:17:30 +0200
committerYorhel <git@yorhel.nl>2020-04-17 11:17:34 +0200
commitb14d888f17ff189508f6005352b6dafbccefeafa (patch)
tree52277764cfed1bbdef17964b07f03679cd9210ba /elm/Lib
parent86c0a244fa47a301c43e0750cedff494b0d0ef64 (diff)
JS: Obtain urlStatic from the DOM rather than embedding it in the JS file
This way I don't have to rebuild the JS file for each deploy - the generated JS is now the same for dev and prod. (uglifyjs & zoplfi aren't fast)
Diffstat (limited to 'elm/Lib')
-rw-r--r--elm/Lib/Ffi.elm4
-rw-r--r--elm/Lib/Ffi.js5
2 files changed, 9 insertions, 0 deletions
diff --git a/elm/Lib/Ffi.elm b/elm/Lib/Ffi.elm
index 05025948..b5601a9b 100644
--- a/elm/Lib/Ffi.elm
+++ b/elm/Lib/Ffi.elm
@@ -29,3 +29,7 @@ elemCall s = Browser.Dom.focus
-- just as well?)
fmtFloat : Float -> Int -> String
fmtFloat _ _ = ""
+
+-- Base URL for static files (e.g. "https://s.vndb.org")
+urlStatic : String
+urlStatic = ""
diff --git a/elm/Lib/Ffi.js b/elm/Lib/Ffi.js
index c1c9baf8..78d6083a 100644
--- a/elm/Lib/Ffi.js
+++ b/elm/Lib/Ffi.js
@@ -19,3 +19,8 @@ window.elmFfi_fmtFloat = function(wrap,call) {
}
}
};
+
+var urlStatic = document.querySelector('link[rel=stylesheet]').href.replace(/^(https?:\/\/[^/]+)\/.*$/, '$1');
+window.elmFfi_urlStatic = function(wrap,call) {
+ return urlStatic
+};