Skip to content

Commit fea582b

Browse files
committed
Ran npm run prettier:fix
1 parent d804907 commit fea582b

29 files changed

+1842
-1651
lines changed

assets/js/admin/editor.src.js

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
11
(function ($) {
2-
if ('object' !== typeof acf) {
3-
return;
4-
}
5-
// Allow svgs in icon select fields. ACF < 2.6.8
6-
acf.add_filter('select2_args', function (args, $select, settings, field, instance) {
7-
// Taken from `acf-input.js`, just removed escaping from `$selection.html(acf.strEscape(selection.text));`.
8-
args.templateSelection = function (selection) {
9-
var $selection = $('<span class="acf-selection"></span>');
10-
$selection.html(selection.text);
11-
$selection.data('element', selection.element);
12-
return $selection;
13-
};
2+
if ('object' !== typeof acf) {
3+
return;
4+
}
5+
// Allow svgs in icon select fields. ACF < 2.6.8
6+
acf.add_filter(
7+
'select2_args',
8+
function (args, $select, settings, field, instance) {
9+
// Taken from `acf-input.js`, just removed escaping from `$selection.html(acf.strEscape(selection.text));`.
10+
args.templateSelection = function (selection) {
11+
var $selection = $('<span class="acf-selection"></span>');
12+
$selection.html(selection.text);
13+
$selection.data('element', selection.element);
14+
return $selection;
15+
};
1416

15-
return args;
16-
});
17+
return args;
18+
}
19+
);
1720

18-
// Allow svgs in icon select fields. ACF >= 2.6.8.
19-
acf.add_filter('select2_escape_markup', function (escaped_value, original_value, $select, settings, field, instance) {
20-
return original_value;
21-
});
21+
// Allow svgs in icon select fields. ACF >= 2.6.8.
22+
acf.add_filter(
23+
'select2_escape_markup',
24+
function (
25+
escaped_value,
26+
original_value,
27+
$select,
28+
settings,
29+
field,
30+
instance
31+
) {
32+
return original_value;
33+
}
34+
);
2235
})(jQuery);

assets/js/imports/rh-helpers.src.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
* @return {object} The event values
55
*/
66
export function getAnalyticsEventValuesFromElement(el) {
7-
var output = {
8-
category: null,
9-
action: null,
10-
label: null,
11-
value: null
12-
}
7+
var output = {
8+
category: null,
9+
action: null,
10+
label: null,
11+
value: null,
12+
};
1313

14-
if (!el.hasAttribute || !el.hasAttribute('data-ga-category')) {
15-
return output;
16-
}
14+
if (!el.hasAttribute || !el.hasAttribute('data-ga-category')) {
15+
return output;
16+
}
1717

18-
output.category = el.getAttribute('data-ga-category');
19-
output.action = el.getAttribute('data-ga-action') || el.href;
20-
output.label = el.getAttribute('data-ga-label');
21-
output.value = parseInt(el.getAttribute('data-ga-value')) || null;
18+
output.category = el.getAttribute('data-ga-category');
19+
output.action = el.getAttribute('data-ga-action') || el.href;
20+
output.label = el.getAttribute('data-ga-label');
21+
output.value = parseInt(el.getAttribute('data-ga-value')) || null;
2222

23-
return output;
23+
return output;
2424
}
2525

2626
/**
@@ -32,16 +32,20 @@ export function getAnalyticsEventValuesFromElement(el) {
3232
* @param {int} maxIterations - The number of maximum iterations to try and find the variable
3333
*/
3434
export function waitFor(variable, callback, delay = 240, maxIterations = 10) {
35-
var iteration = 0;
36-
var interval = setInterval(function () {
37-
if (window[variable]) {
38-
clearInterval(interval);
39-
callback();
40-
}
35+
var iteration = 0;
36+
var interval = setInterval(
37+
function () {
38+
if (window[variable]) {
39+
clearInterval(interval);
40+
callback();
41+
}
4142

42-
iteration++;
43-
if (iteration > maxIterations) {
44-
clearInterval(interval);
45-
}
46-
}, delay, iteration);
43+
iteration++;
44+
if (iteration > maxIterations) {
45+
clearInterval(interval);
46+
}
47+
},
48+
delay,
49+
iteration
50+
);
4751
}

assets/js/instant.page.src.js

Lines changed: 154 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,155 @@
11
/*! instant.page v5.1.0 - (C) 2019-2020 Alexandre Dieulot - https://instant.page/license */
2-
let t,e;const n=new Set,o=document.createElement("link"),i=o.relList&&o.relList.supports&&o.relList.supports("prefetch")&&window.IntersectionObserver&&"isIntersecting"in IntersectionObserverEntry.prototype,s="instantAllowQueryString"in document.body.dataset,a="instantAllowExternalLinks"in document.body.dataset,r="instantWhitelist"in document.body.dataset,c="instantMousedownShortcut"in document.body.dataset,d=1111;let l=65,u=!1,f=!1,m=!1;if("instantIntensity"in document.body.dataset){const t=document.body.dataset.instantIntensity;if("mousedown"==t.substr(0,"mousedown".length))u=!0,"mousedown-only"==t&&(f=!0);else if("viewport"==t.substr(0,"viewport".length))navigator.connection&&(navigator.connection.saveData||navigator.connection.effectiveType&&navigator.connection.effectiveType.includes("2g"))||("viewport"==t?document.documentElement.clientWidth*document.documentElement.clientHeight<45e4&&(m=!0):"viewport-all"==t&&(m=!0));else{const e=parseInt(t);isNaN(e)||(l=e)}}if(i){const n={capture:!0,passive:!0};if(f||document.addEventListener("touchstart",function(t){e=performance.now();const n=t.target.closest("a");if(!h(n))return;v(n.href)},n),u?c||document.addEventListener("mousedown",function(t){const e=t.target.closest("a");if(!h(e))return;v(e.href)},n):document.addEventListener("mouseover",function(n){if(performance.now()-e<d)return;const o=n.target.closest("a");if(!h(o))return;o.addEventListener("mouseout",p,{passive:!0}),t=setTimeout(()=>{v(o.href),t=void 0},l)},n),c&&document.addEventListener("mousedown",function(t){if(performance.now()-e<d)return;const n=t.target.closest("a");if(t.which>1||t.metaKey||t.ctrlKey)return;if(!n)return;n.addEventListener("click",function(t){1337!=t.detail&&t.preventDefault()},{capture:!0,passive:!1,once:!0});const o=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,detail:1337});n.dispatchEvent(o)},n),m){let t;(t=window.requestIdleCallback?t=>{requestIdleCallback(t,{timeout:1500})}:t=>{t()})(()=>{const t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){const n=e.target;t.unobserve(n),v(n.href)}})});document.querySelectorAll("a").forEach(e=>{h(e)&&t.observe(e)})})}}function p(e){e.relatedTarget&&e.target.closest("a")==e.relatedTarget.closest("a")||t&&(clearTimeout(t),t=void 0)}function h(t){if(t&&t.href&&(!r||"instant"in t.dataset)&&(a||t.origin==location.origin||"instant"in t.dataset)&&["http:","https:"].includes(t.protocol)&&("http:"!=t.protocol||"https:"!=location.protocol)&&(s||!t.search||"instant"in t.dataset)&&!(t.hash&&t.pathname+t.search==location.pathname+location.search||"noInstant"in t.dataset))return!0}function v(t){if(n.has(t))return;const e=document.createElement("link");e.rel="prefetch",e.href=t,document.head.appendChild(e),n.add(t)}
2+
let t, e;
3+
const n = new Set(),
4+
o = document.createElement('link'),
5+
i =
6+
o.relList &&
7+
o.relList.supports &&
8+
o.relList.supports('prefetch') &&
9+
window.IntersectionObserver &&
10+
'isIntersecting' in IntersectionObserverEntry.prototype,
11+
s = 'instantAllowQueryString' in document.body.dataset,
12+
a = 'instantAllowExternalLinks' in document.body.dataset,
13+
r = 'instantWhitelist' in document.body.dataset,
14+
c = 'instantMousedownShortcut' in document.body.dataset,
15+
d = 1111;
16+
let l = 65,
17+
u = !1,
18+
f = !1,
19+
m = !1;
20+
if ('instantIntensity' in document.body.dataset) {
21+
const t = document.body.dataset.instantIntensity;
22+
if ('mousedown' == t.substr(0, 'mousedown'.length))
23+
((u = !0), 'mousedown-only' == t && (f = !0));
24+
else if ('viewport' == t.substr(0, 'viewport'.length))
25+
(navigator.connection &&
26+
(navigator.connection.saveData ||
27+
(navigator.connection.effectiveType &&
28+
navigator.connection.effectiveType.includes('2g')))) ||
29+
('viewport' == t
30+
? document.documentElement.clientWidth *
31+
document.documentElement.clientHeight <
32+
45e4 && (m = !0)
33+
: 'viewport-all' == t && (m = !0));
34+
else {
35+
const e = parseInt(t);
36+
isNaN(e) || (l = e);
37+
}
38+
}
39+
if (i) {
40+
const n = { capture: !0, passive: !0 };
41+
if (
42+
(f ||
43+
document.addEventListener(
44+
'touchstart',
45+
function (t) {
46+
e = performance.now();
47+
const n = t.target.closest('a');
48+
if (!h(n)) return;
49+
v(n.href);
50+
},
51+
n
52+
),
53+
u
54+
? c ||
55+
document.addEventListener(
56+
'mousedown',
57+
function (t) {
58+
const e = t.target.closest('a');
59+
if (!h(e)) return;
60+
v(e.href);
61+
},
62+
n
63+
)
64+
: document.addEventListener(
65+
'mouseover',
66+
function (n) {
67+
if (performance.now() - e < d) return;
68+
const o = n.target.closest('a');
69+
if (!h(o)) return;
70+
(o.addEventListener('mouseout', p, { passive: !0 }),
71+
(t = setTimeout(() => {
72+
(v(o.href), (t = void 0));
73+
}, l)));
74+
},
75+
n
76+
),
77+
c &&
78+
document.addEventListener(
79+
'mousedown',
80+
function (t) {
81+
if (performance.now() - e < d) return;
82+
const n = t.target.closest('a');
83+
if (t.which > 1 || t.metaKey || t.ctrlKey) return;
84+
if (!n) return;
85+
n.addEventListener(
86+
'click',
87+
function (t) {
88+
1337 != t.detail && t.preventDefault();
89+
},
90+
{ capture: !0, passive: !1, once: !0 }
91+
);
92+
const o = new MouseEvent('click', {
93+
view: window,
94+
bubbles: !0,
95+
cancelable: !1,
96+
detail: 1337,
97+
});
98+
n.dispatchEvent(o);
99+
},
100+
n
101+
),
102+
m)
103+
) {
104+
let t;
105+
(t = window.requestIdleCallback
106+
? (t) => {
107+
requestIdleCallback(t, { timeout: 1500 });
108+
}
109+
: (t) => {
110+
t();
111+
})(() => {
112+
const t = new IntersectionObserver((e) => {
113+
e.forEach((e) => {
114+
if (e.isIntersecting) {
115+
const n = e.target;
116+
(t.unobserve(n), v(n.href));
117+
}
118+
});
119+
});
120+
document.querySelectorAll('a').forEach((e) => {
121+
h(e) && t.observe(e);
122+
});
123+
});
124+
}
125+
}
126+
function p(e) {
127+
(e.relatedTarget &&
128+
e.target.closest('a') == e.relatedTarget.closest('a')) ||
129+
(t && (clearTimeout(t), (t = void 0)));
130+
}
131+
function h(t) {
132+
if (
133+
t &&
134+
t.href &&
135+
(!r || 'instant' in t.dataset) &&
136+
(a || t.origin == location.origin || 'instant' in t.dataset) &&
137+
['http:', 'https:'].includes(t.protocol) &&
138+
('http:' != t.protocol || 'https:' != location.protocol) &&
139+
(s || !t.search || 'instant' in t.dataset) &&
140+
!(
141+
(t.hash &&
142+
t.pathname + t.search == location.pathname + location.search) ||
143+
'noInstant' in t.dataset
144+
)
145+
)
146+
return !0;
147+
}
148+
function v(t) {
149+
if (n.has(t)) return;
150+
const e = document.createElement('link');
151+
((e.rel = 'prefetch'),
152+
(e.href = t),
153+
document.head.appendChild(e),
154+
n.add(t));
155+
}

0 commit comments

Comments
 (0)