Initial commit: Klammertext source distribution
Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
55
sks/target/js/target.js
Normal file
55
sks/target/js/target.js
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
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"));
|
||||
});
|
||||
*/
|
||||
Reference in New Issue
Block a user