$(document).ready(function () { // Enable share links $(".share-links").each(function (idx, link) { link = $(link); link.attr("data-bs-toggle", "tooltip"); if (!link.attr("data-bs-placement")) link.attr("data-bs-placement", "left"); if (!link.attr("title")) link.attr("title", _("Copy the share URL of this page.")); $(link).click(function (event) { event.preventDefault(); copy_to_clipboard($(link).attr("href")); }); }); // Enable tooltip $('[data-bs-toggle="tooltip"]').tooltip(); $(".copyable") .click(function (event) { copy_to_clipboard($(event.target).html().trim()); }) .css("cursor", "copy"); // Enable 3-states switches $("input.form-3s-switch").each(function (idx, input) { input = $(input); input.click(function (event) { event.preventDefault(); let value = input.attr("value"); if (value == "1") value = null; else if (value == "0") value = "1"; else value = "0"; input.val(value); input.prop("checked", value !== null); input.trigger("change"); }); }); }); /** * Copy a value to clipboard * @param {string} value The value to copy to clipboard */ function copy_to_clipboard(value) { var txt = $("