summaryrefslogtreecommitdiff
path: root/contrib/site/js/parseLocationHref.js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-03-03 01:30:17 +0100
committerChristian Pointner <equinox@spreadspace.org>2020-03-03 01:30:17 +0100
commit0b60654e2ae1046bfe85d09e8f98cd8819fc0ac3 (patch)
treedb9a64c19984293e36443e1268f8cd23836f4b25 /contrib/site/js/parseLocationHref.js
parentfix mysql init container (diff)
updated stream-site to 2019
Diffstat (limited to 'contrib/site/js/parseLocationHref.js')
-rw-r--r--contrib/site/js/parseLocationHref.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/contrib/site/js/parseLocationHref.js b/contrib/site/js/parseLocationHref.js
deleted file mode 100644
index ba2cd5b..0000000
--- a/contrib/site/js/parseLocationHref.js
+++ /dev/null
@@ -1,53 +0,0 @@
-function parseLocationHref() {
- var matches = window.location.href.match(/(https?):\/\/(.*)/);
- if(matches === null) {
- return null;
- }
-
- var uri = {};
- uri.scheme = matches[1];
- uri.servername = '';
- uri.path = [];
- uri.query = [];
- uri.fragment = '';
-
- if(matches[2].indexOf('/') < 0) {
- uri.servername = parts[2];
- return uri;
- }
-
- var parts = matches[2].split('/');
- uri.servername = parts[0];
- uri.path = parts.slice(1);
-
- var tmp = uri.path[uri.path.length-1];
- if(tmp.length > 0) {
- var qidx = tmp.indexOf('?');
- var fidx = tmp.indexOf('#');
-
- var query = '';
- if(qidx >= 0 && fidx >= 0) {
- uri.path[uri.path.length-1] = tmp.substring(0, qidx);
- if(qidx < fidx) {
- query = tmp.substring(qidx+1, fidx);
- }
- uri.fragment = tmp.substring(fidx+1);
- } else if (qidx >= 0 && fidx < 0) {
- uri.path[uri.path.length-1] = tmp.substring(0, qidx);
- query = tmp.substring(qidx+1);
- } else if (qidx < 0 && fidx >= 0) {
- uri.path[uri.path.length-1] = tmp.substring(0, fidx);
- uri.fragment = tmp.substring(fidx+1);
- }
- if(query.length > 0) {
- uri.query = query.split('&');
- }
- uri.parameters = {};
- for (var i = 0; i < uri.query.length; i++) {
- var parameter = uri.query[i].split('=');
- uri.parameters[parameter[0]] = parameter[1];
- }
- }
-
- return uri
-}