mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Modularized Javascript
This commit is contained in:
@@ -4,8 +4,11 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Maloja - Setup</title>
|
||||
<script src="javascript/cookies.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
function replaceurls() {
|
||||
url = window.location.origin
|
||||
s = document.getElementsByName("serverurl")
|
||||
@@ -20,26 +23,34 @@
|
||||
}
|
||||
|
||||
function activateRuleModule(e,filename) {
|
||||
keys = "filename=" + encodeURIComponent(filename)
|
||||
if (apikeycorrect) {
|
||||
keys = "filename=" + encodeURIComponent(filename)
|
||||
apikey = document.getElementById("apikey").value
|
||||
keys += "&key=" + encodeURIComponent(apikey)
|
||||
console.log(keys)
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.open("POST","/db/importrules", true);
|
||||
xhttp.send(keys);
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.open("POST","/db/importrules", true);
|
||||
xhttp.send(keys);
|
||||
|
||||
e.innerHTML = e.innerHTML.replace("Add","Remove")
|
||||
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("activate","deactivate")
|
||||
/* Nobody ever look at this code please */
|
||||
e.innerHTML = e.innerHTML.replace("Add","Remove")
|
||||
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("activate","deactivate")
|
||||
/* Nobody ever look at this code please */
|
||||
}
|
||||
}
|
||||
|
||||
function deactivateRuleModule(e,filename) {
|
||||
keys = "remove&filename=" + encodeURIComponent(filename)
|
||||
if (apikeycorrect) {
|
||||
keys = "remove&filename=" + encodeURIComponent(filename)
|
||||
apikey = document.getElementById("apikey").value
|
||||
keys += "&key=" + encodeURIComponent(apikey)
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.open("POST","/db/importrules", true);
|
||||
xhttp.send(keys);
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.open("POST","/db/importrules", true);
|
||||
xhttp.send(keys);
|
||||
|
||||
e.innerHTML = e.innerHTML.replace("Remove","Add")
|
||||
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("deactivate","activate")
|
||||
e.innerHTML = e.innerHTML.replace("Remove","Add")
|
||||
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("deactivate","activate")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -53,7 +64,7 @@
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="replace()">
|
||||
<body onload="replace();insertAPIKeyFromCookie()">
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
@@ -99,7 +110,11 @@
|
||||
After you've scrobbled for a bit, you might want to check the <a class="textlink" href="/issues">Issues page</a> to see if you need to set up some rules. You can also manually add rules in your server's "rules" directory - just add your own .tsv file and read the instructions on how to declare a rule.
|
||||
<br/><br/>
|
||||
|
||||
You can also set up some predefined rulesets right away!
|
||||
You can also set up some predefined rulesets right away! Enter your API key and click the buttons.
|
||||
<br/>
|
||||
API Key:
|
||||
<input id='apikey' onchange='checkAPIkey()' style='width:300px;'/>
|
||||
|
||||
<br/><br/>
|
||||
KEY_PREDEFINED_RULESETS
|
||||
|
||||
@@ -117,4 +132,6 @@
|
||||
Done! Visit <a class="textlink" href="/"><span name="serverurl">yourserver.tld</span></a> (or your public / proxy URL) to look at your overview page. Almost everything is clickable!
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user