Add 'trust' setting to demo (#2107)

Ask if enabling 'trust' from the permalink
This commit is contained in:
ylemkimon
2019-10-03 10:06:53 +09:00
committed by Erik Demaine
parent be0c79b375
commit 634b4e2ae4
2 changed files with 8 additions and 2 deletions

View File

@@ -162,6 +162,10 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td><label for="trust">trust</label></td>
<td><input type="checkbox" id="trust"/></td>
</tr>
</table> </table>
<h4><label for="macros">macros</label></h4> <h4><label for="macros">macros</label></h4>
<textarea id="macros" placeholder="JSON"> <textarea id="macros" placeholder="JSON">

View File

@@ -48,10 +48,12 @@ window.WebFontConfig = {
} }
var katexOptions = ["displayMode", "leqno", "fleqn", "throwOnError", var katexOptions = ["displayMode", "leqno", "fleqn", "throwOnError",
"errorColor", "strict", "macros"].map(function(id) { "errorColor", "strict", "trust", "macros"].map(function(id) {
var el = document.getElementById(id); var el = document.getElementById(id);
if (el.type === "checkbox") { if (el.type === "checkbox") {
if (typeof data[id] === "boolean") { if (typeof data[id] === "boolean" && !(id === "trust" && data[id] &&
// eslint-disable-next-line no-alert, max-len
!confirm("Enable 'trust' setting? Don't enable if you don't trust the source."))) {
el.checked = data[id]; el.checked = data[id];
} }
} else if (data[id]) { } else if (data[id]) {