mirror of https://github.com/dirtbags/moth.git
Fixes from SECOR spark
* Puzzle list word-wraps * Puzzle pull mutation handler can cope with non-HTML nodes
This commit is contained in:
parent
65daa41ca1
commit
e390c4443e
|
@ -35,6 +35,7 @@ function render(obj) {
|
||||||
var id = puzzle[1];
|
var id = puzzle[1];
|
||||||
|
|
||||||
var i = document.createElement('li');
|
var i = document.createElement('li');
|
||||||
|
i.textContent = " ";
|
||||||
l.appendChild(i);
|
l.appendChild(i);
|
||||||
|
|
||||||
if (points === 0) {
|
if (points === 0) {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<link rel="icon" href="res/icon.svg" type="image/svg+xml">
|
<link rel="icon" href="res/icon.svg" type="image/svg+xml">
|
||||||
<link rel="icon" href="res/icon.png" type="image/png">
|
<link rel="icon" href="res/icon.png" type="image/png">
|
||||||
|
<script src="res/concat.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function init() {
|
function init() {
|
||||||
let params = new URLSearchParams(window.location.search);
|
let params = new URLSearchParams(window.location.search);
|
||||||
|
@ -20,7 +21,6 @@ function init() {
|
||||||
.then(function(resp) {
|
.then(function(resp) {
|
||||||
return resp.json();
|
return resp.json();
|
||||||
}).then(function(obj) {
|
}).then(function(obj) {
|
||||||
document.getElementById("puzzle").innerHTML = obj.body;
|
|
||||||
document.getElementById("authors").textContent = obj.authors.join(", ");
|
document.getElementById("authors").textContent = obj.authors.join(", ");
|
||||||
for (let fn of obj.files) {
|
for (let fn of obj.files) {
|
||||||
let li = document.createElement("li");
|
let li = document.createElement("li");
|
||||||
|
@ -30,6 +30,7 @@ function init() {
|
||||||
li.appendChild(a);
|
li.appendChild(a);
|
||||||
document.getElementById("files").appendChild(li);
|
document.getElementById("files").appendChild(li);
|
||||||
}
|
}
|
||||||
|
document.getElementById("puzzle").innerHTML = obj.body;
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log("Error", err);
|
console.log("Error", err);
|
||||||
});
|
});
|
||||||
|
@ -42,14 +43,15 @@ function init() {
|
||||||
for (let mutation of mutationsList) {
|
for (let mutation of mutationsList) {
|
||||||
if (mutation.type == 'childList') {
|
if (mutation.type == 'childList') {
|
||||||
for (let e of mutation.addedNodes) {
|
for (let e of mutation.addedNodes) {
|
||||||
console.log(e);
|
//console.log(e);
|
||||||
|
if (! e.querySelectorAll) { continue; }
|
||||||
for (let se of e.querySelectorAll("[src],[href]")) {
|
for (let se of e.querySelectorAll("[src],[href]")) {
|
||||||
se.outerHTML = se.outerHTML.replace(/(src|href)="([^/]+)"/i, "$1=\"" + base + "$2\"")
|
se.outerHTML = se.outerHTML.replace(/(src|href)="([^/]+)"/i, "$1=\"" + base + "$2\"")
|
||||||
console.log(se.outerHTML);
|
//console.log(se.outerHTML);
|
||||||
}
|
}
|
||||||
console.log(e.querySelectorAll("[src]"));
|
//console.log(e.querySelectorAll("[src]"));
|
||||||
}
|
}
|
||||||
console.log(mutation.addedNodes);
|
//console.log(mutation.addedNodes);
|
||||||
} else {
|
} else {
|
||||||
console.log(mutation);
|
console.log(mutation);
|
||||||
}
|
}
|
||||||
|
@ -86,6 +88,7 @@ document.addEventListener("DOMContentLoaded", init);
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="puzzle-list.html">Puzzles</a></li>
|
<li><a href="puzzle-list.html">Puzzles</a></li>
|
||||||
<li><a href="scoreboard.html">Scoreboard</a></li>
|
<li><a href="scoreboard.html">Scoreboard</a></li>
|
||||||
|
<li><a href="scoring.html">Scoring</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue