width: 100%;
top: 0px;
left: 0px;
+ display: -webkit-flex;
+ -webkit-justify-content: center;
+ -webkit-flex-direction: column;
display: flex;
justify-content: center;
flex-direction: column;
}
#panel {
- -webkit-justify-content:center;
+ /* -webkit-justify-content:center; does not look good */
justify-content:space-between;
text-align:center;
}
}
#participants .score-cell button {
+ min-height:4ex; /* for old webkit */
min-height: auto;
font-size:x-small;
padding:0 1ex;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
visibility: hidden;
+ -webkit-transition: visibility 0s linear 0.25s, opacity 0.25s 0s;
transform: scale(1.1);
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
z-index: 1;
.show-modal {
opacity: 1;
visibility: visible;
+ -webkit-transition: visibility 0s linear 0s, opacity 0.25s 0s;
transform: scale(1.0);
transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
font-size:small;
border-radius:3px;
border:none;
- margin:0 0 0 auto;
+ margin:0;
min-height: 2em;
}
+#panel #btn-settings-wrapper {
+ text-align:right;
+}
+
+
#btn-settings:before {
content: "⚙️ "
}
#help-box {
margin-left:1ex;
margin-top:1ex;
+ display:-webkit-flex;
+ -webkit-flex-direction:column;
+ -webkit-justify-content:center;
+ -webkit-align-items:center;
align-items:center;
display:flex;
flex-direction:column;
}
#help-box-inner {
+ display:-webkit-flex;
+ -webkit-flex-direction:row;
display:flex;
flex-direction:row;
min-height:2em;
border-top:1px solid gray;
border-bottom:1px solid gray;
+ -webkit-align-items:center;
align-items:center;
}
}
#panel-buttons {
+ display:-webkit-flex;
+ -webkit-flex-direction: column;
display:flex;
flex-direction:column;
}
const content = document.createElement("div");
content.appendChild(document.createElement("span"));
content.lastChild.className = "info";
- content.lastChild.textContent = info;
+ content.lastChild.textContent = info || "";
chatMessage("", content);
return content;
}
}
}
+ function getRowIndex(tr) {
+ // tr.rowIndex is -1 on WebKit-based browsers in Debian Jessie, hence this function
+ return [].indexOf.call(tr.parentNode.rows, tr);
+ }
+
function triggerFlashLight(cell) {
if (!cell) {
return;
const letters = "ABCDEFGHIJKLMNO";
const col = cell.cellIndex - 1;
- const row = cell.parentNode.rowIndex - 1;
+ const row = getRowIndex(cell.parentNode) - 1;
sendCmds([{
cmd: "msg",
const tilePlaceholder = getParentWithClass(e.target, "tile-placeholder");
if (tilePlaceholder) {
const cell = tilePlaceholder.parentNode;
- if (cell.cellIndex && cell.parentNode.rowIndex) {
+ if (cell.cellIndex && getRowIndex(cell.parentNode)) {
return cell;
}
}
};
}
- if (!document.documentElement.style.setProperty && document.getElementById("flash-light-color-p")) {
+ // thx https://stackoverflow.com/a/26633844
+ if (!(window.CSS && CSS.supports && CSS.supports("color", "var(--v)")) && document.getElementById("flash-light-color-p")) {
document.getElementById("flash-light-color-p").hidden = true;
return;
}
board.rows[0].appendChild(document.createElement("th"));
board.rows[0].lastChild.textContent = i + 1;
- board.appendChild(document.createElement("tr"));
- board.lastChild.appendChild(document.createElement("th"));
- board.lastChild.lastChild.textContent = letters[i];
+ const row = board.insertRow(-1);
+ row.appendChild(document.createElement("th"));
+ row.lastChild.textContent = letters[i];
for (let j = 0; j < 15; j++) {
cell = document.createElement("td");
boardCells.push(cell);
- board.lastChild.appendChild(cell);
+ row.appendChild(cell);
cell.appendChild(document.createElement("div"));
cell.lastChild.className = "tile-placeholder";
specialCell("doubleWord", board.lastChild.lastChild);
cell = board.lastChild.lastChild.getElementsByClassName("special-cell-label")[0];
cell.textContent = "★";
- board.lastChild.lastChild.id = "center-cell";
+ row.lastChild.id = "center-cell";
} else if (i % 7 === 0 && j % 7 === 0) {
specialCell("tripleWord", board.lastChild.lastChild);
} else if ((i === j || i + j === 14) && (i < 5 || i > 9)) {
}
}
- board.lastChild.appendChild(document.createElement("th"));
- board.lastChild.lastChild.textContent = letters[i];
+ row.appendChild(document.createElement("th"));
+ row.lastChild.textContent = letters[i];
}
board.rows[0].appendChild(board.rows[0].cells[0].cloneNode(false));
- board.appendChild(document.createElement("tr"));
- board.lastChild.appendChild(board.rows[0].cells[0].cloneNode(false));
+ const row = board.insertRow(-1);
+ row.appendChild(board.rows[0].cells[0].cloneNode(false));
for (let i = 0; i < 15; i++) {
- board.lastChild.appendChild(document.createElement("th"));
- board.lastChild.lastChild.textContent = i + 1;
+ row.appendChild(document.createElement("th"));
+ row.lastChild.textContent = i + 1;
}
- board.lastChild.appendChild(board.rows[0].cells[0].cloneNode(false));
+ row.appendChild(board.rows[0].cells[0].cloneNode(false));
if (getSetting("trivabbleGameNumber")) {
document.getElementById("number").textContent = getSetting("trivabbleGameNumber");
const port = parseInt(process.env.TRIVABBLE_PORT || "3000");
const host = process.env.TRIVABBLE_HOST || "localhost";
+const disableCSP = process.env.DISABLE_CSP || false;
const SAVE_TIMEOUT = 5000;
const KEEP_ALIVE = 30000;
}
response.setHeader("Content-Type", mime);
- response.setHeader("Content-Security-Policy", "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'self'; media-src 'self'");
+
+ response.setHeader(
+ "Content-Security-Policy",
+ "default-src 'none'; " +
+ "script-src 'self'; " +
+ "style-src 'self'; " +
+ "img-src 'self'; " +
+ (disableCSP ? "" : "connect-src 'self' " + (
+ // uzbl (like Safari 9 / iPad 2) does not like unsecure websockets on the
+ // same port with connect-src 'self'
+ // See https://github.com/w3c/webappsec-csp/issues/7
+ "ws://" + host + ":" + port + " " +
+ "ws://127.0.0.1:" + port + " " +
+ "ws://localhost:" + port + "; "
+ )) +
+ "media-src 'self'"
+ );
+
response.end(contents);
});
} else {