mirror of
https://github.com/frainfreeze/the-monospace-web-pandoc
synced 2025-12-29 18:49:50 -08:00
cleanup
This commit is contained in:
17
index.js
17
index.js
@@ -1,9 +1,3 @@
|
|||||||
function firstEvent(element, name) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
element.addEventListener(name, resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function gridCellDimensions() {
|
function gridCellDimensions() {
|
||||||
const element = document.createElement("div");
|
const element = document.createElement("div");
|
||||||
element.style.position = "fixed";
|
element.style.position = "fixed";
|
||||||
@@ -15,9 +9,8 @@ function gridCellDimensions() {
|
|||||||
return { width: rect.width, height: rect.height };
|
return { width: rect.width, height: rect.height };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add padding to each media to maintain grid.
|
||||||
// Set the ratio variable on each media.
|
function adjustMediaPadding() {
|
||||||
function setRatios() {
|
|
||||||
const cell = gridCellDimensions();
|
const cell = gridCellDimensions();
|
||||||
|
|
||||||
function onMediaLoaded(media) {
|
function onMediaLoaded(media) {
|
||||||
@@ -73,9 +66,9 @@ function setRatios() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setRatios();
|
adjustMediaPadding();
|
||||||
window.addEventListener("load", setRatios);
|
window.addEventListener("load", adjustMediaPadding);
|
||||||
window.addEventListener("resize", setRatios);
|
window.addEventListener("resize", adjustMediaPadding);
|
||||||
|
|
||||||
function checkOffsets() {
|
function checkOffsets() {
|
||||||
const ignoredTagNames = new Set([
|
const ignoredTagNames = new Set([
|
||||||
|
|||||||
Reference in New Issue
Block a user