Skip to content

Commit 21983f0

Browse files
committed
Use snake case consistently
1 parent fe99c43 commit 21983f0

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

$Window.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@ function $Window(options) {
4747
$w.addClass("component-window");
4848
}
4949

50-
const $eventTarget = $({});
51-
const makeSimpleListenable = (name) => {
50+
const $event_target = $({});
51+
const make_simple_listenable = (name) => {
5252
return (callback) => {
5353
const fn = () => {
5454
callback();
5555
};
56-
$eventTarget.on(name, fn);
56+
$event_target.on(name, fn);
5757
const dispose = () => {
58-
$eventTarget.off(name, fn);
58+
$event_target.off(name, fn);
5959
};
6060
return dispose;
6161
};
6262
};
63-
$w.onFocus = makeSimpleListenable("focus");
64-
$w.onBlur = makeSimpleListenable("blur");
65-
$w.onClosed = makeSimpleListenable("closed");
63+
$w.onFocus = make_simple_listenable("focus");
64+
$w.onBlur = make_simple_listenable("blur");
65+
$w.onClosed = make_simple_listenable("closed");
6666

6767
let child$Windows = [];
6868
let $focusShowers = $w;
@@ -85,15 +85,15 @@ function $Window(options) {
8585
$w.bringToFront();
8686
$focusShowers.addClass("focused");
8787
window.focusedWindow = $w;
88-
$eventTarget.triggerHandler("focus");
88+
$event_target.triggerHandler("focus");
8989
};
9090
$w.blur = () => {
9191
if (window.focusedWindow !== $w) {
9292
return;
9393
}
9494
$focusShowers.removeClass("focused");
9595
// TODO: document.activeElement && document.activeElement.blur()?
96-
$eventTarget.triggerHandler("blur");
96+
$event_target.triggerHandler("blur");
9797

9898
window.focusedWindow = null;
9999
};
@@ -328,22 +328,22 @@ function $Window(options) {
328328
// If there's no selected ("checked") radio, it should still visit the group,
329329
// but it should skip all unselected radios in that group if there is a selected radio in that group.
330330
const radios = {}; // best radio found so far, per group
331-
const toSkip = [];
331+
const to_skip = [];
332332
for (const el of $controls) {
333333
if (el.nodeName.toLowerCase() === "input" && el.type === "radio") {
334334
if (radios[el.name]) {
335335
if (el.checked) {
336-
toSkip.push(radios[el.name]);
336+
to_skip.push(radios[el.name]);
337337
radios[el.name] = el;
338338
} else {
339-
toSkip.push(el);
339+
to_skip.push(el);
340340
}
341341
} else {
342342
radios[el.name] = el;
343343
}
344344
}
345345
}
346-
$controls = $controls.not(toSkip);
346+
$controls = $controls.not(to_skip);
347347
// debug viz:
348348
// $controls.css({boxShadow: "0 0 2px 2px green"});
349349
// $(toSkip).css({boxShadow: "0 0 2px 2px gray"})
@@ -484,7 +484,7 @@ function $Window(options) {
484484
cursor += "-resize";
485485

486486
const thickness = ($w.outerWidth() - $w.width()) / 2; // Note: innerWidth() would be less "inner" than width(), because it includes padding!
487-
const windowFrameHeight = $w.outerHeight() - $w.$content.outerHeight();
487+
const window_frame_height = $w.outerHeight() - $w.$content.outerHeight(); // includes titlebar and borders
488488
$handle.css({
489489
position: "absolute",
490490
"--resize-thickness": `${thickness}px`,
@@ -578,7 +578,7 @@ function $Window(options) {
578578
new_rect = options.constrainRect(new_rect, x_axis, y_axis);
579579
}
580580
new_rect.width = Math.max(new_rect.width, options.minWidth ?? 100);
581-
new_rect.height = Math.max(new_rect.height, options.minHeight ?? windowFrameHeight);
581+
new_rect.height = Math.max(new_rect.height, options.minHeight ?? window_frame_height);
582582
// prevent free movement via resize past minimum size
583583
if (x_axis === HANDLE_LEFT) {
584584
new_rect.x = Math.min(new_rect.x, rect.x + rect.width - new_rect.width);
@@ -639,10 +639,10 @@ function $Window(options) {
639639
const $eye_leader = $w.$titlebar.clone(true);
640640
$eye_leader.find("button").remove();
641641
$eye_leader.appendTo("body");
642-
const durationMS = 200; // TODO: how long?
643-
const duration = `${durationMS}ms`;
642+
const duration_ms = 200; // TODO: how long?
643+
const duration_str = `${duration_ms}ms`;
644644
$eye_leader.css({
645-
transition: `left ${duration} linear, top ${duration} linear, width ${duration} linear, height ${duration} linear`,
645+
transition: `left ${duration_str} linear, top ${duration_str} linear, width ${duration_str} linear, height ${duration_str} linear`,
646646
position: "fixed",
647647
zIndex: 10000000,
648648
pointerEvents: "none",
@@ -662,7 +662,7 @@ function $Window(options) {
662662
const tid = setTimeout(() => {
663663
$eye_leader.remove();
664664
callback();
665-
}, durationMS * 1.2);
665+
}, duration_ms * 1.2);
666666
$eye_leader.on("transitionend animationcancel", () => {
667667
$eye_leader.remove();
668668
clearTimeout(tid);
@@ -682,7 +682,7 @@ function $Window(options) {
682682
}
683683
$w.remove();
684684
$w.closed = true;
685-
$eventTarget.triggerHandler("closed");
685+
$event_target.triggerHandler("closed");
686686
$w.trigger("closed");
687687
// TODO: change usages of "close" to "closed" where appropriate
688688
// and probably rename the "close" event

0 commit comments

Comments
 (0)