async function update_file_data() {
const file_data = await wrapped_fetch(PATH_FILE_JSON).then((response) => response.json());
- document.getElementById("sync_checkbox").checked = ! file_data.flags.includes("do not sync");
Array.from(document.getElementsByClassName("listed_tags")).forEach((row) => row.remove());
file_data.tags_showable.forEach((tag) => {
const tr = new_child_to("tr", document.getElementById("tags_table"));
tr.classList.add("listed_tags");
+ {% if allow_edit %}
td_checkbox = new_child_to("td", tr);
td_checkbox.classList.add("tag_checkboxes");
const input = new_child_to("input", td_checkbox);
input.type = "checkbox";
input.checked = true;
- {% if not allow_edit %}input.disabled = true;{% endif %}
input.onclick = send_update;
+ {% endif %}
const a = new_child_to("a", new_child_to("td", new_child_to("td", tr)));
a.href = `${PATH_FILES}?needed_tag=${encodeURIComponent(tag)}`;
a.textContent = tag;
});
+ {% if allow_edit %}
+ document.getElementById("sync_checkbox").checked = ! file_data.flags.includes("do not sync");
document.getElementById("added_tag").value = "";
const datalist = document.getElementById("unused_tags");
datalist.innerHTML = "";
file_data.unused_tags.forEach((tag) => { new_child_to("option", datalist, tag); });
+ {% endif %}
td_present = document.getElementById("presence");
td_present.innerHTML = "";
if (file_data.present) {
td.top_field { width: 100%; }
td.tag_checkboxes { width: 1em; }
td.dangerous { text-align: right}
-td.dangerous > form > input[type=submit], td.dangerous > button { color: red; }
+td.dangerous > form > input[type=submit], td.dangerous > button { background-color: black; color: red; }
{% endblock %}
</td>
</tr>
+{% if allow_edit %}
<tr>
<th>options</th>
<td>
<table>
<tr>
<td>
-<input id="sync_checkbox" type="checkbox" {% if not allow_edit %}disabled{% endif %} onclick="send_update()" /> do sync<br />
+<input id="sync_checkbox" type="checkbox" onclick="send_update()" /> do sync<br />
</td>
-{% if allow_edit %}
<td class="dangerous">
<button id="unlink_button" onclick="send_update(this)" />delete locally</button>
<form action="/{{page_names.file_kill}}/{{file.digest.b64}}" method="POST" />
<input type="submit" value="KILL" />
</form>
</td>
-{% endif %}
</tr>
</table>
</td>
</tr>
+{% endif %}
</table>
{% endblock %}