diff options
author | Phie <phie@phie.ovh> | 2019-12-01 22:24:34 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-12-01 22:26:03 +0300 |
commit | 28c1ae9120912a6dcbca94fd95abb553f6e155ae (patch) | |
tree | 6689d85d6845cc1505bf492ef7da3a9e944f98c8 /utils | |
parent | 29d1f9c116eabe1fb08fe57768ea413c3960b31a (diff) |
use basic http server for images
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utils.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/utils.js b/utils/utils.js index 1dd5a68..1ebe252 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -107,4 +107,16 @@ Utils.generateUID = function () { firstPart = ("000" + firstPart.toString(36)).slice(-3); secondPart = ("000" + secondPart.toString(36)).slice(-3); return firstPart + secondPart; +} + +Utils.getParameterByName = function (name, url) { + if (!url) { + url = window.location.href; + } + name = name.replace(/[\[\]]/g, "\\$&"); + var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), + results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, " ").replace(/%2F/g, "/")); }
\ No newline at end of file |