Skip to content

Commit 4131d6d

Browse files
committed
TMP: review
1 parent af69f7e commit 4131d6d

File tree

4 files changed

+194
-196
lines changed

4 files changed

+194
-196
lines changed

static/css/devhub/new-landing/sections/connect.less

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ a.Before-Icon::before {
158158
}
159159
}
160160

161-
// TODO: fix this for some reason images are not being mapped by vite correctly
162-
// additionally it looks like the import paths here were wrong already?
163161
a.Before-Icon-twitter::before {
164162
content: url(../../../../img/icons/twitter.svg);
165163
}

static/css/zamboni/zamboni.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ input[type=button].caution.concealed {
489489
white-space: normal;
490490
}
491491

492-
a.button.caution: hover,
492+
a.button.caution:hover,
493493
a.button.caution:focus,
494494
button.caution:hover,
495495
button.caution:focus,
@@ -3290,4 +3290,4 @@ ul.errorlist li.strength {
32903290
text-decoration: none;
32913291
padding: 20px;
32923292
right: 0px;
3293-
}
3293+
}

static/js/lib/jquery.hoverIntent.js

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import $ from 'jquery';
2-
31
/**
42
* hoverIntent is similar to jQuery's built-in "hover" function except that
53
* instead of firing the onMouseOver event immediately, hoverIntent checks
@@ -29,92 +27,94 @@ import $ from 'jquery';
2927
* @param g onMouseOut function || Nothing (use configuration options object)
3028
* @author Brian Cherne brian(at)cherne(dot)net
3129
*/
32-
$.fn.hoverIntent = function (f, g) {
33-
// default configuration options
34-
let cfg = {
35-
sensitivity: 7,
36-
interval: 100,
37-
timeout: 0,
38-
};
39-
// override configuration options with user supplied object
40-
cfg = $.extend(cfg, g ? { over: f, out: g } : f);
30+
(function ($) {
31+
$.fn.hoverIntent = function (f, g) {
32+
// default configuration options
33+
var cfg = {
34+
sensitivity: 7,
35+
interval: 100,
36+
timeout: 0,
37+
};
38+
// override configuration options with user supplied object
39+
cfg = $.extend(cfg, g ? { over: f, out: g } : f);
4140

42-
// instantiate variables
43-
// cX, cY = current X and Y position of mouse, updated by mousemove event
44-
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
45-
let cX, cY, pX, pY;
41+
// instantiate variables
42+
// cX, cY = current X and Y position of mouse, updated by mousemove event
43+
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
44+
var cX, cY, pX, pY;
4645

47-
// A private function for getting mouse position
48-
let track = function (ev) {
49-
cX = ev.pageX;
50-
cY = ev.pageY;
51-
};
52-
53-
// A private function for comparing current and previous mouse position
54-
let compare = function (ev, ob) {
55-
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
56-
// compare mouse positions to see if they've crossed the threshold
57-
if (Math.abs(pX - cX) + Math.abs(pY - cY) < cfg.sensitivity) {
58-
$(ob).off('mousemove', track);
59-
// set hoverIntent state to true (so mouseOut can be called)
60-
ob.hoverIntent_s = 1;
61-
return cfg.over.apply(ob, [ev]);
62-
} else {
63-
// set previous coordinates for next time
64-
pX = cX;
65-
pY = cY;
66-
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
67-
ob.hoverIntent_t = setTimeout(function () {
68-
compare(ev, ob);
69-
}, cfg.interval);
70-
}
71-
};
46+
// A private function for getting mouse position
47+
var track = function (ev) {
48+
cX = ev.pageX;
49+
cY = ev.pageY;
50+
};
7251

73-
// A private function for delaying the mouseOut function
74-
let delay = function (ev, ob) {
75-
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
76-
ob.hoverIntent_s = 0;
77-
return cfg.out.apply(ob, [ev]);
78-
};
79-
80-
// A private function for handling mouse 'hovering'
81-
let handleHover = function (e) {
82-
// copy objects to be passed into t (required for event object to be passed in IE)
83-
let ev = $.extend({}, e);
84-
let ob = this;
85-
86-
// cancel hoverIntent timer if it exists
87-
if (ob.hoverIntent_t) {
52+
// A private function for comparing current and previous mouse position
53+
var compare = function (ev, ob) {
8854
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
89-
}
90-
91-
// if e.type == "mouseenter"
92-
if (e.type == 'mouseenter') {
93-
// set "previous" X and Y position based on initial entry point
94-
pX = ev.pageX;
95-
pY = ev.pageY;
96-
// update "current" X and Y position based on mousemove
97-
$(ob).on('mousemove', track);
98-
// start polling interval (self-calling timeout) to compare mouse coordinates over time
99-
if (ob.hoverIntent_s != 1) {
55+
// compare mouse positions to see if they've crossed the threshold
56+
if (Math.abs(pX - cX) + Math.abs(pY - cY) < cfg.sensitivity) {
57+
$(ob).off('mousemove', track);
58+
// set hoverIntent state to true (so mouseOut can be called)
59+
ob.hoverIntent_s = 1;
60+
return cfg.over.apply(ob, [ev]);
61+
} else {
62+
// set previous coordinates for next time
63+
pX = cX;
64+
pY = cY;
65+
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
10066
ob.hoverIntent_t = setTimeout(function () {
10167
compare(ev, ob);
10268
}, cfg.interval);
10369
}
70+
};
10471

105-
// else e.type == "mouseleave"
106-
} else {
107-
// unbind expensive mousemove event
108-
$(ob).off('mousemove', track);
109-
// if hoverIntent state is true, then call the mouseOut function after the specified delay
110-
if (ob.hoverIntent_s == 1) {
111-
ob.hoverIntent_t = setTimeout(function () {
112-
delay(ev, ob);
113-
}, cfg.timeout);
72+
// A private function for delaying the mouseOut function
73+
var delay = function (ev, ob) {
74+
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
75+
ob.hoverIntent_s = 0;
76+
return cfg.out.apply(ob, [ev]);
77+
};
78+
79+
// A private function for handling mouse 'hovering'
80+
var handleHover = function (e) {
81+
// copy objects to be passed into t (required for event object to be passed in IE)
82+
var ev = jQuery.extend({}, e);
83+
var ob = this;
84+
85+
// cancel hoverIntent timer if it exists
86+
if (ob.hoverIntent_t) {
87+
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
11488
}
115-
}
116-
};
11789

118-
// bind the function to the two event listeners
119-
return this.on('mouseenter', handleHover).on('mouseleave', handleHover);
120-
};
90+
// if e.type == "mouseenter"
91+
if (e.type == 'mouseenter') {
92+
// set "previous" X and Y position based on initial entry point
93+
pX = ev.pageX;
94+
pY = ev.pageY;
95+
// update "current" X and Y position based on mousemove
96+
$(ob).on('mousemove', track);
97+
// start polling interval (self-calling timeout) to compare mouse coordinates over time
98+
if (ob.hoverIntent_s != 1) {
99+
ob.hoverIntent_t = setTimeout(function () {
100+
compare(ev, ob);
101+
}, cfg.interval);
102+
}
103+
104+
// else e.type == "mouseleave"
105+
} else {
106+
// unbind expensive mousemove event
107+
$(ob).off('mousemove', track);
108+
// if hoverIntent state is true, then call the mouseOut function after the specified delay
109+
if (ob.hoverIntent_s == 1) {
110+
ob.hoverIntent_t = setTimeout(function () {
111+
delay(ev, ob);
112+
}, cfg.timeout);
113+
}
114+
}
115+
};
116+
117+
// bind the function to the two event listeners
118+
return this.on('mouseenter', handleHover).on('mouseleave', handleHover);
119+
};
120+
})(jQuery);

0 commit comments

Comments
 (0)