1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added wonky date selector, unused so far

This commit is contained in:
Krateng
2019-04-02 11:40:02 +02:00
parent bafd2f2d93
commit 563744c2b9
9 changed files with 151 additions and 67 deletions

View File

@@ -26,6 +26,16 @@ a:hover {
}
input[type="date"] {
background-color:inherit;
color:inherit;
outline: none;
border:0px;
font-family: inherit;
font-size: inherit;
}
/**
Header (unused)
**/

View File

@@ -0,0 +1,43 @@
function datechange() {
since = document.getElementById("dateselect_from").value;
to = document.getElementById("dateselect_to").value;
since = since.split("-").join("/")
to = to.split("-").join("/")
//url = window.location.href
//var url = document.createElement("a")
//url.href = window.location.href
//console.log(url.search)
keys = window.location.search.substring(1).split("&")
var keydict = {};
for (var i=0;i<keys.length;i++) {
kv = keys[i].split("=");
key = kv[0]
value = kv[1]
keydict[key] = value
}
delete keydict["in"]
keydict["since"] = since
keydict["to"] = to
console.log(keydict)
keys = []
Object.keys(keydict).forEach(function(key) {
keys.push(key + "=" + keydict[key])
});
console.log(keys)
window.location.href = window.location.protocol
+ "//" + window.location.hostname
+ ":" + window.location.port
+ window.location.pathname
+ "?" + keys.join("&");
}

View File

@@ -4,6 +4,7 @@
<head>
<meta charset="UTF-8" />
<title>Maloja - Top Artists</title>
<script src="javascript/datechange.js"></script>
</head>
<body>

View File

@@ -26,6 +26,9 @@ def instructions(keys):
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_ARTISTLIST":html_charts,"KEY_RANGE":limitstring,"KEY_FILTERSELECTOR":html_filterselector}
replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,
"KEY_ARTISTLIST":html_charts,
"KEY_RANGE":limitstring,
"KEY_FILTERSELECTOR":html_filterselector}
return (replace,pushresources)