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 i = document.createElement('li');
|
||||
i.textContent = " ";
|
||||
l.appendChild(i);
|
||||
|
||||
if (points === 0) {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" href="res/icon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="res/icon.png" type="image/png">
|
||||
<script src="res/concat.js"></script>
|
||||
<script>
|
||||
function init() {
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
|
@ -20,7 +21,6 @@ function init() {
|
|||
.then(function(resp) {
|
||||
return resp.json();
|
||||
}).then(function(obj) {
|
||||
document.getElementById("puzzle").innerHTML = obj.body;
|
||||
document.getElementById("authors").textContent = obj.authors.join(", ");
|
||||
for (let fn of obj.files) {
|
||||
let li = document.createElement("li");
|
||||
|
@ -30,6 +30,7 @@ function init() {
|
|||
li.appendChild(a);
|
||||
document.getElementById("files").appendChild(li);
|
||||
}
|
||||
document.getElementById("puzzle").innerHTML = obj.body;
|
||||
}).catch(function(err) {
|
||||
console.log("Error", err);
|
||||
});
|
||||
|
@ -42,14 +43,15 @@ function init() {
|
|||
for (let mutation of mutationsList) {
|
||||
if (mutation.type == 'childList') {
|
||||
for (let e of mutation.addedNodes) {
|
||||
console.log(e);
|
||||
//console.log(e);
|
||||
if (! e.querySelectorAll) { continue; }
|
||||
for (let se of e.querySelectorAll("[src],[href]")) {
|
||||
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 {
|
||||
console.log(mutation);
|
||||
}
|
||||
|
@ -86,6 +88,7 @@ document.addEventListener("DOMContentLoaded", init);
|
|||
<ul>
|
||||
<li><a href="puzzle-list.html">Puzzles</a></li>
|
||||
<li><a href="scoreboard.html">Scoreboard</a></li>
|
||||
<li><a href="scoring.html">Scoring</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue