/*
function resize_grid_images() {
    K.getv("[data-cell-width]").forEach(function (container) {
        let cell_width = parseFloat(container.getAttribute("data-cell-width"));
        let img = container.getElementsByTagName("img")[0];
        console.log("resize_grid_image:")
        console.log(img);
        let text_width = K.width("#text");
        //console.log( Math.trunc(.9 * text_width * cell_width));
        K.width(img, Math.trunc(.9 * text_width * cell_width));

    });
}


function resize_captions() {
    console.log("resize_captions");
    let caption_margins = 30; // See target.css .caption_text 
    K.getv(".caption_bottom").forEach(function (caption_container) {
        //console.log("container_node:");
        console.log(caption_container);
        //if (!caption_container.parentNode.classList.contains("image_grid")) {
            //console.log("resize_caption: " + caption_container);
            let image = caption_container.children[0];
            let caption = caption_container.children[1];
            //console.log({caption_container, image});
            //console.log("width: " + K.width(image));
            K.width(caption, K.width(image) - caption_margins);
        //}
    });
    K.getv(".caption_top").forEach(function (caption_container) {
        console.log(caption_container);
        let image = caption_container.children[1];
        let caption = caption_container.children[0];
        //console.log({caption_container, image});
        //console.log("width: " + K.width(image));
        K.width(caption, K.width(image) - caption_margins);
    });
}


window.addEventListener("load", function (event) {
    window.addEventListener(
        "resize",
        function (event) {
            resize_captions();
            //resize_grid_images();
        });
//    resize_grid_images();
});

window.addEventListener("load", function (event) {
    window.dispatchEvent(new Event("resize"));
});
*/
