
function show_link_boxes(show) {
    K.map("a", function(elt) {
        if (show) {
            K.remove_class(elt, "undisplayed_link");
            K.add_class(elt, "displayed_link");
            localStorage.setItem("klammertext_links", "true");
        } else {
            K.remove_class(elt, "displayed_link");
            K.add_class(elt, "undisplayed_link");
            localStorage.setItem("klammertext_links", "false");
        }
    });
    K.map(".pagelink", function(elt) {
        if (show) {
            K.remove_class(elt, "undisplayed_link");
            K.add_class(elt, "displayed_link");
        } else {
            K.remove_class(elt, "displayed_link");
            K.add_class(elt, "undisplayed_link");
        }
    });
}

window.addEventListener("load", function (event) {
    K.get("#linkshow_check").addEventListener("click", function (event) {
        let box = K.get("#linkshow_check");
        if (K.attr(box, "active") === "false") {
            K.attr(box, "active", "true");
            show_link_boxes(true);
        } else {
            K.attr(box, "active", "false");            
            show_link_boxes(false);
        }

    });
    /*
    K.get("#linkshow_check_label").addEventListener("click", function (event) {
        K.get("#linkshow_check").click();
    });
    */

    define_keypress("L", "#linkshow_check");
});
