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

Cleaned some JS code

This commit is contained in:
Krateng 2020-09-25 16:03:51 +02:00
parent f7861c44b4
commit c312608f2d
No known key found for this signature in database
GPG Key ID: 46735607861C6FCE
4 changed files with 20 additions and 19 deletions

View File

@ -91,7 +91,8 @@ css = generate_css()
def clean_html(inp):
return html_minify(inp)
if settings.get_settings("DEV_MODE"): return inp
else: return html_minify(inp)
#os.makedirs("web/css",exist_ok=True)
#with open("web/css/style.css","w") as f:

View File

@ -7,26 +7,26 @@
{% block scripts %}
<script>
function newrule() {
keys = ""
keys = "";
for (var i = 1; i < arguments.length; i++) {
keys += encodeURIComponent(arguments[i]) + "&"
keys += encodeURIComponent(arguments[i]) + "&";
}
console.log(keys)
console.log(keys);
var xhttp = new XMLHttpRequest();
xhttp.open("POST","/api/newrule?", true);
xhttp.send(keys);
e = arguments[0]
line = e.parentNode
line.parentNode.removeChild(line)
e = arguments[0];
line = e.parentNode;
line.parentNode.removeChild(line);
}
function fullrebuild() {
var xhttp = new XMLHttpRequest();
xhttp.open("POST","/api/rebuild", true);
xhttp.send()
xhttp.send();
window.location = "/wait";
}

View File

@ -8,10 +8,10 @@
function replaceurls() {
url = window.location.origin
s = document.getElementsByName("serverurl")
url = window.location.origin;
s = document.getElementsByName("serverurl");
for (var i=0;i<s.length;i++) {
s[i].innerHTML = url
s[i].innerHTML = url;
}
}
@ -21,26 +21,26 @@
}
function activateRuleModule(e,filename) {
keys = "filename=" + encodeURIComponent(filename)
console.log(keys)
keys = "filename=" + encodeURIComponent(filename);
console.log(keys);
var xhttp = new XMLHttpRequest();
xhttp.open("POST","/api/importrules", true);
xhttp.send(keys);
e.innerHTML = e.innerHTML.replace("Add","Remove")
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("activate","deactivate")
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)
keys = "remove&filename=" + encodeURIComponent(filename);
var xhttp = new XMLHttpRequest();
xhttp.open("POST","/api/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");
}
document.addEventListener("DOMContentLoaded",replace);

View File

@ -27,7 +27,7 @@
function goback() {
if ((this.readyState == 4) && (this.status == 205)) {
console.log("Not ready yet!")
console.log("Not ready yet!");
pending = false;
}
if ((this.readyState == 4) && (this.status == 204)) {