Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
vincerubinetti committed Feb 2, 2021
1 parent 2e27107 commit a1a5da9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
16 changes: 4 additions & 12 deletions build/plugins/lightbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<script type="module">
// list of possible zoom/scale factors
const zoomSteps =
const zooms =
"0.1, 0.25, 0.333333, 0.5, 0.666666, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8";
// whether to fit image to view ('fit'), display at 100% and shrink if
// necessary ('shrink'), or always display at 100% ('100')
Expand Down Expand Up @@ -135,17 +135,9 @@
img.style.maxHeight = "";
img.id = "lightbox_img";

// build sorted list of unique zoomSteps, always including a 100%
let zoomSteps = [];
const optionsZooms = zoomSteps.split(/[^0-9.]/);
for (const optionZoom of optionsZooms) {
const newZoom = parseFloat(optionZoom);
if (newZoom && !zoomSteps.includes(newZoom)) zoomSteps.push(newZoom);
}
if (!zoomSteps.includes(1)) zoomSteps.push(1);
zoomSteps = zoomSteps.sort(function sortNumber(a, b) {
return a - b;
});
// build sorted list of zoomSteps
const zoomSteps = zooms.split(/[^0-9.]/).map((step) => parseFloat(step));
zoomSteps.sort((a, b) => a - b);

// <img> object property variables
let zoom = 1;
Expand Down
13 changes: 5 additions & 8 deletions build/plugins/tooltips.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}.bind(this);

// run open function after delay
this.openTooltipTimer = window.setTimeout(delayOpenTooltip, options.delay);
this.openTooltipTimer = window.setTimeout(delayOpenTooltip, delay);
}

// when mouse leaves link
Expand All @@ -47,7 +47,7 @@
window.clearTimeout(this.openTooltipTimer);

// don't close on unhover if option specifies
if (options.clickClose === "true") return;
if (clickClose === "true") return;

// function to close tooltip
const delayCloseTooltip = function () {
Expand All @@ -57,10 +57,7 @@
};

// run close function after delay
this.closeTooltipTimer = window.setTimeout(
delayCloseTooltip,
options.delay
);
this.closeTooltipTimer = window.setTimeout(delayCloseTooltip, delay);
}

// when link is focused (tabbed to)
Expand Down Expand Up @@ -253,7 +250,7 @@

// when tooltip is unhovered
function onTooltipUnhover(event) {
if (options.clickClose === "true") return;
if (clickClose === "true") return;

// make sure new mouse/touch/focus no longer over tooltip or any
// element within it
Expand Down Expand Up @@ -354,7 +351,7 @@
// scroll to and focus element
function goToElement(element, offset) {
// expand accordion section if collapsed
expandElement(element);
expandHeading(element);
const y =
getRectInView(element).top -
getRectInView(document.documentElement).top -
Expand Down

0 comments on commit a1a5da9

Please sign in to comment.