monitoring-jekyll-theme 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +36 -0
- data/_includes/accessibility.html +38 -0
- data/_includes/competitors.html +1 -0
- data/_includes/lighthouse.html +26 -0
- data/_includes/pagespeed.html +22 -0
- data/_includes/seo.html +177 -0
- data/_includes/statistiques.html +173 -0
- data/_includes/styles.html +50 -0
- data/_includes/stylestats.html +33 -0
- data/_includes/yellowlabtools.html +34 -0
- data/_layouts/default.html +19 -0
- data/_plugins/humanize.rb +258 -0
- data/assets/css/styles.css +449 -0
- data/assets/fonts/IBMPlexMono-Bold.ttf +0 -0
- data/assets/fonts/Optiker-K.woff2 +0 -0
- data/assets/fonts/PublicSans-Regular.woff2 +0 -0
- data/assets/js/frappe-charts.min.iife.js +2 -0
- data/assets/js/lighthouse.js +81 -0
- data/assets/js/van11y-accessible-hide-show-aria.es6.js +326 -0
- data/assets/js/van11y-accessible-tab-panel-aria.es6.js +491 -0
- metadata +105 -0
@@ -0,0 +1,81 @@
|
|
1
|
+
function run() {
|
2
|
+
const url = setUpQuery();
|
3
|
+
var myHeaders = new Headers();
|
4
|
+
myHeaders.append("Access-Control-Allow-Origin", "*");
|
5
|
+
myHeaders.append("Access-Control-Allow-Headers", "origin, x-requested-with, contenttype, Authorization");
|
6
|
+
myHeaders.append("Access-Control-Allow-Methods", "PUT, GET, POST, DELETE, OPTIONS");
|
7
|
+
|
8
|
+
var myInit = {
|
9
|
+
method: 'GET',
|
10
|
+
headers: myHeaders,
|
11
|
+
mode: 'cors',
|
12
|
+
cache: 'default'
|
13
|
+
};
|
14
|
+
fetch(url, myInit)
|
15
|
+
.then(response => response.json())
|
16
|
+
.then(json => {
|
17
|
+
// See https://developers.google.com/speed/docs/insights/v5/reference/pagespeedapi/runpagespeed#response
|
18
|
+
// to learn more about each of the properties in the response object.
|
19
|
+
showInitialContent(json.id);
|
20
|
+
const cruxMetrics = {
|
21
|
+
"First Contentful Paint": json.lighthouseResult.audits.metrics.details.items[0].firstContentfulPaint
|
22
|
+
};
|
23
|
+
//ùshowCruxContent(cruxMetrics);
|
24
|
+
const lighthouse = json.lighthouseResult;
|
25
|
+
const lighthouseMetrics = {
|
26
|
+
'First Contentful Paint': lighthouse.audits['first-contentful-paint'].displayValue,
|
27
|
+
'Speed Index': lighthouse.audits['speed-index'].displayValue,
|
28
|
+
'Time To Interactive': lighthouse.audits['interactive'].displayValue,
|
29
|
+
'First Meaningful Paint': lighthouse.audits['first-meaningful-paint'].displayValue,
|
30
|
+
'First CPU Idle': lighthouse.audits['first-cpu-idle'].displayValue,
|
31
|
+
'Estimated Input Latency': lighthouse.audits['estimated-input-latency'].displayValue
|
32
|
+
};
|
33
|
+
showLighthouseContent(lighthouseMetrics);
|
34
|
+
});
|
35
|
+
}
|
36
|
+
|
37
|
+
let container = document.querySelector(".livehouse")
|
38
|
+
|
39
|
+
function setUpQuery() {
|
40
|
+
const api = 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed';
|
41
|
+
const parameters = {
|
42
|
+
url: encodeURIComponent('https://www.leforestier-immobilier.com/fr/')
|
43
|
+
};
|
44
|
+
let query = `${api}?`;
|
45
|
+
for (key in parameters) {
|
46
|
+
query += `${key}=${parameters[key]}`;
|
47
|
+
}
|
48
|
+
return query;
|
49
|
+
}
|
50
|
+
|
51
|
+
function showInitialContent(id) {
|
52
|
+
container.innerHTML = '';
|
53
|
+
const title = document.createElement('h2');
|
54
|
+
title.textContent = 'Live result';
|
55
|
+
container.appendChild(title);
|
56
|
+
const page = document.createElement('p');
|
57
|
+
page.textContent = `URl testée: ${id}`;
|
58
|
+
container.appendChild(page);
|
59
|
+
}
|
60
|
+
|
61
|
+
function showCruxContent(cruxMetrics) {
|
62
|
+
const cruxHeader = document.createElement('h2');
|
63
|
+
cruxHeader.textContent = "Chrome User Experience Report Results";
|
64
|
+
container.appendChild(cruxHeader);
|
65
|
+
for (key in cruxMetrics) {
|
66
|
+
const p = document.createElement('p');
|
67
|
+
p.textContent = `${key}: ${cruxMetrics[key]}`;
|
68
|
+
container.appendChild(p);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
function showLighthouseContent(lighthouseMetrics) {
|
73
|
+
const lighthouseHeader = document.createElement('h2');
|
74
|
+
lighthouseHeader.textContent = "Lighthouse Results";
|
75
|
+
container.appendChild(lighthouseHeader);
|
76
|
+
for (key in lighthouseMetrics) {
|
77
|
+
const p = document.createElement('p');
|
78
|
+
p.textContent = `${key}: ${lighthouseMetrics[key]}`;
|
79
|
+
container.appendChild(p);
|
80
|
+
}
|
81
|
+
}
|
@@ -0,0 +1,326 @@
|
|
1
|
+
/*
|
2
|
+
* ES2015 simple and accessible hide-show system (collapsible regions), using ARIA
|
3
|
+
* Website: https://van11y.net/accessible-hide-show/
|
4
|
+
* License MIT: https://github.com/nico3333fr/van11y-accessible-hide-show-aria/blob/master/LICENSE
|
5
|
+
*/
|
6
|
+
const loadConfig = () => {
|
7
|
+
|
8
|
+
const CACHE = {};
|
9
|
+
|
10
|
+
const set = (id, config) => {
|
11
|
+
|
12
|
+
CACHE[id] = config;
|
13
|
+
|
14
|
+
};
|
15
|
+
const get = (id) => CACHE[id];
|
16
|
+
const remove = (id) => CACHE[id];
|
17
|
+
|
18
|
+
return {
|
19
|
+
set,
|
20
|
+
get,
|
21
|
+
remove
|
22
|
+
}
|
23
|
+
};
|
24
|
+
|
25
|
+
const DATA_HASH_ID = 'data-hash-id';
|
26
|
+
|
27
|
+
const pluginConfig = loadConfig();
|
28
|
+
|
29
|
+
const findById = (id, hash) => document.querySelector(`#${id}[${DATA_HASH_ID}="${hash}"]`);
|
30
|
+
|
31
|
+
const addClass = (el, className) => {
|
32
|
+
if (el.classList) {
|
33
|
+
el.classList.add(className); // IE 10+
|
34
|
+
} else {
|
35
|
+
el.className += ' ' + className; // IE 8+
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
const removeClass = (el, className) => {
|
40
|
+
if (el.classList) {
|
41
|
+
el.classList.remove(className); // IE 10+
|
42
|
+
} else {
|
43
|
+
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); // IE 8+
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
const hasClass = (el, className) => {
|
48
|
+
if (el.classList) {
|
49
|
+
return el.classList.contains(className); // IE 10+
|
50
|
+
} else {
|
51
|
+
return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className); // IE 8+ ?
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
const setAttributes = (node, attrs) => {
|
56
|
+
Object
|
57
|
+
.keys(attrs)
|
58
|
+
.forEach((attribute) => {
|
59
|
+
node.setAttribute(attribute, attrs[attribute]);
|
60
|
+
});
|
61
|
+
};
|
62
|
+
|
63
|
+
const triggerEvent = (el, event_type) => {
|
64
|
+
if (el.fireEvent) {
|
65
|
+
el.fireEvent('on' + event_type);
|
66
|
+
} else {
|
67
|
+
let evObj = document.createEvent('Events');
|
68
|
+
evObj.initEvent(event_type, true, false);
|
69
|
+
el.dispatchEvent(evObj);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
/* gets an element el, search if it is element with class or child of parent class, returns id of the element founded */
|
74
|
+
const searchParentHashId = (el, hashId) => {
|
75
|
+
let found = false;
|
76
|
+
|
77
|
+
let parentElement = el;
|
78
|
+
while (parentElement.nodeType === 1 && parentElement && found === false) {
|
79
|
+
|
80
|
+
if (parentElement.hasAttribute(hashId) === true) {
|
81
|
+
found = true;
|
82
|
+
} else {
|
83
|
+
parentElement = parentElement.parentNode;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
if (found === true) {
|
87
|
+
return parentElement.getAttribute(hashId);
|
88
|
+
} else {
|
89
|
+
return '';
|
90
|
+
}
|
91
|
+
}
|
92
|
+
const searchParent = (el, parentClass, hashId) => {
|
93
|
+
let found = false;
|
94
|
+
|
95
|
+
let parentElement = el;
|
96
|
+
while (parentElement && found === false) {
|
97
|
+
if (hasClass(parentElement, parentClass) === true && parentElement.getAttribute(DATA_HASH_ID) === hashId) {
|
98
|
+
found = true;
|
99
|
+
} else {
|
100
|
+
parentElement = parentElement.parentNode;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
if (found === true) {
|
104
|
+
return parentElement.getAttribute('id');
|
105
|
+
} else {
|
106
|
+
return '';
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
const plugin = (config = {}) => {
|
111
|
+
|
112
|
+
const CONFIG = {
|
113
|
+
HIDESHOW_EXPAND: 'js-expandmore',
|
114
|
+
HIDESHOW_BUTTON_EXPAND: 'js-expandmore-button',
|
115
|
+
HIDESHOW_BUTTON_EXPAND_STYLE: 'expandmore__button',
|
116
|
+
HIDESHOW_BUTTON_LABEL_ID: 'label_expand_',
|
117
|
+
|
118
|
+
DATA_PREFIX_CLASS: 'data-hideshow-prefix-class',
|
119
|
+
|
120
|
+
HIDESHOW_BUTTON_EMPTY_ELEMENT_SYMBOL: 'expandmore__symbol',
|
121
|
+
HIDESHOW_BUTTON_EMPTY_ELEMENT_TAG: 'span',
|
122
|
+
ATTR_HIDESHOW_BUTTON_EMPTY_ELEMENT: 'aria-hidden',
|
123
|
+
|
124
|
+
HIDESHOW_TO_EXPAND_ID: 'expand_',
|
125
|
+
HIDESHOW_TO_EXPAND_STYLE: 'expandmore__to_expand',
|
126
|
+
|
127
|
+
/*
|
128
|
+
recommended settings by a11y expert
|
129
|
+
*/
|
130
|
+
ATTR_CONTROL: 'data-controls',
|
131
|
+
ATTR_EXPANDED: 'aria-expanded',
|
132
|
+
ATTR_LABELLEDBY: 'data-labelledby',
|
133
|
+
ATTR_HIDDEN: 'data-hidden',
|
134
|
+
|
135
|
+
IS_OPENED_CLASS: 'is-opened',
|
136
|
+
|
137
|
+
DISPLAY_FIRST_LOAD: 'js-first_load',
|
138
|
+
DISPLAY_FIRST_LOAD_DELAY: '1500',
|
139
|
+
...config
|
140
|
+
};
|
141
|
+
|
142
|
+
const HASH_ID = Math.random().toString(32).slice(2, 12);
|
143
|
+
|
144
|
+
pluginConfig.set(HASH_ID, CONFIG);
|
145
|
+
|
146
|
+
|
147
|
+
/** Find all expand inside a container
|
148
|
+
* @param {Node} node Default document
|
149
|
+
* @return {Array}
|
150
|
+
*/
|
151
|
+
const $listHideShows = (node = document) => [].slice.call(node.querySelectorAll('.' + CONFIG.HIDESHOW_EXPAND)); //[...node.querySelectorAll('.' + CONFIG.HIDESHOW_EXPAND)]; // that does not work on IE when transpiled :-(
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Build expands for a container
|
155
|
+
* @param {Node} node
|
156
|
+
*/
|
157
|
+
const attach = (node) => {
|
158
|
+
|
159
|
+
$listHideShows(node)
|
160
|
+
.forEach((expand_node) => {
|
161
|
+
|
162
|
+
let iLisible = Math.random().toString(32).slice(2, 12);
|
163
|
+
// let prefixClassName = typeof expand_node.getAttribute(DATA_PREFIX_CLASS) !== 'undefined' ? expand_node.getAttribute(DATA_PREFIX_CLASS) + '-' : '' ; // IE11+
|
164
|
+
let prefixClassName = expand_node.hasAttribute(CONFIG.DATA_PREFIX_CLASS) === true ? expand_node.getAttribute(CONFIG.DATA_PREFIX_CLASS) + '-' : '';
|
165
|
+
let toExpand = expand_node.nextElementSibling;
|
166
|
+
let expandmoreText = expand_node.innerHTML;
|
167
|
+
let expandButton = document.createElement("BUTTON");
|
168
|
+
let expandButtonEmptyElement = document.createElement(CONFIG.HIDESHOW_BUTTON_EMPTY_ELEMENT_TAG);
|
169
|
+
|
170
|
+
expand_node.setAttribute(DATA_HASH_ID, HASH_ID);
|
171
|
+
|
172
|
+
// empty element for symbol
|
173
|
+
addClass(expandButtonEmptyElement, prefixClassName + CONFIG.HIDESHOW_BUTTON_EMPTY_ELEMENT_SYMBOL);
|
174
|
+
setAttributes(expandButtonEmptyElement, {
|
175
|
+
[CONFIG.ATTR_HIDESHOW_BUTTON_EMPTY_ELEMENT]: true,
|
176
|
+
[DATA_HASH_ID]: HASH_ID
|
177
|
+
});
|
178
|
+
|
179
|
+
// clear element before adding button to it
|
180
|
+
expand_node.innerHTML = '';
|
181
|
+
|
182
|
+
// create a button with all attributes
|
183
|
+
addClass(expandButton, prefixClassName + CONFIG.HIDESHOW_BUTTON_EXPAND_STYLE);
|
184
|
+
addClass(expandButton, CONFIG.HIDESHOW_BUTTON_EXPAND);
|
185
|
+
setAttributes(expandButton, {
|
186
|
+
[CONFIG.ATTR_CONTROL]: CONFIG.HIDESHOW_TO_EXPAND_ID + iLisible,
|
187
|
+
[CONFIG.ATTR_EXPANDED]: 'false',
|
188
|
+
'id': CONFIG.HIDESHOW_BUTTON_LABEL_ID + iLisible,
|
189
|
+
'type': 'button',
|
190
|
+
[DATA_HASH_ID]: HASH_ID
|
191
|
+
});
|
192
|
+
expandButton.innerHTML = expandmoreText;
|
193
|
+
|
194
|
+
// Button goes into node
|
195
|
+
expand_node.appendChild(expandButton);
|
196
|
+
expandButton.insertBefore(expandButtonEmptyElement, expandButton.firstChild);
|
197
|
+
|
198
|
+
// to expand attributes
|
199
|
+
setAttributes(toExpand, {
|
200
|
+
[CONFIG.ATTR_LABELLEDBY]: CONFIG.HIDESHOW_BUTTON_LABEL_ID + iLisible,
|
201
|
+
[CONFIG.ATTR_HIDDEN]: 'true',
|
202
|
+
'id': CONFIG.HIDESHOW_TO_EXPAND_ID + iLisible,
|
203
|
+
[DATA_HASH_ID]: HASH_ID
|
204
|
+
});
|
205
|
+
|
206
|
+
// add delay if DISPLAY_FIRST_LOAD
|
207
|
+
addClass(toExpand, prefixClassName + CONFIG.HIDESHOW_TO_EXPAND_STYLE);
|
208
|
+
if (hasClass(toExpand, CONFIG.DISPLAY_FIRST_LOAD) === true) {
|
209
|
+
setTimeout(function() {
|
210
|
+
removeClass(toExpand, CONFIG.DISPLAY_FIRST_LOAD);
|
211
|
+
}, CONFIG.DISPLAY_FIRST_LOAD_DELAY);
|
212
|
+
}
|
213
|
+
|
214
|
+
// quick tip to open
|
215
|
+
if (hasClass(toExpand, CONFIG.IS_OPENED_CLASS) === true) {
|
216
|
+
addClass(expandButton, CONFIG.IS_OPENED_CLASS);
|
217
|
+
expandButton.setAttribute(CONFIG.ATTR_EXPANDED, 'true');
|
218
|
+
|
219
|
+
removeClass(toExpand, CONFIG.IS_OPENED_CLASS);
|
220
|
+
toExpand.removeAttribute(CONFIG.ATTR_HIDDEN);
|
221
|
+
|
222
|
+
}
|
223
|
+
|
224
|
+
});
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
};
|
230
|
+
|
231
|
+
|
232
|
+
/*const destroy = (node) => {
|
233
|
+
$listHideShows(node)
|
234
|
+
.forEach((expand_node) => {
|
235
|
+
|
236
|
+
});
|
237
|
+
};*/
|
238
|
+
|
239
|
+
|
240
|
+
return {
|
241
|
+
attach
|
242
|
+
/*,
|
243
|
+
destroy*/
|
244
|
+
}
|
245
|
+
};
|
246
|
+
|
247
|
+
const main = () => {
|
248
|
+
|
249
|
+
/* listeners for all configs */
|
250
|
+
['click', 'keydown']
|
251
|
+
.forEach(eventName => {
|
252
|
+
|
253
|
+
document.body
|
254
|
+
.addEventListener(eventName, e => {
|
255
|
+
|
256
|
+
let hashId = searchParentHashId(e.target, DATA_HASH_ID); //e.target.dataset.hashId;
|
257
|
+
// search if click on button or on element in a button contains data-hash-id (it is needed to load config and know which class to search)
|
258
|
+
|
259
|
+
if (hashId !== '') {
|
260
|
+
|
261
|
+
// loading config from element
|
262
|
+
let CONFIG = pluginConfig.get(hashId);
|
263
|
+
|
264
|
+
// search if click on button or on element in a button (fix for Chrome)
|
265
|
+
let id_expand_button = searchParent(e.target, CONFIG.HIDESHOW_BUTTON_EXPAND, hashId);
|
266
|
+
|
267
|
+
|
268
|
+
// click on button
|
269
|
+
if (id_expand_button !== '' && eventName === 'click') {
|
270
|
+
let button_tag = findById(id_expand_button, hashId);
|
271
|
+
let destination = findById(button_tag.getAttribute(CONFIG.ATTR_CONTROL), hashId);
|
272
|
+
let etat_button = button_tag.getAttribute(CONFIG.ATTR_EXPANDED);
|
273
|
+
|
274
|
+
// if closed
|
275
|
+
if (etat_button === 'false') {
|
276
|
+
button_tag.setAttribute(CONFIG.ATTR_EXPANDED, true);
|
277
|
+
addClass(button_tag, CONFIG.IS_OPENED_CLASS);
|
278
|
+
destination.removeAttribute(CONFIG.ATTR_HIDDEN);
|
279
|
+
} else {
|
280
|
+
button_tag.setAttribute(CONFIG.ATTR_EXPANDED, false);
|
281
|
+
removeClass(button_tag, CONFIG.IS_OPENED_CLASS);
|
282
|
+
destination.setAttribute(CONFIG.ATTR_HIDDEN, true);
|
283
|
+
}
|
284
|
+
|
285
|
+
}
|
286
|
+
// click on hx (fix for voiceover = click or keydown on hx => click on button.
|
287
|
+
// this makes no sense, but somebody has to do the job to make it fucking work
|
288
|
+
if (hasClass(e.target, CONFIG.HIDESHOW_EXPAND) === true) {
|
289
|
+
let hx_tag = e.target;
|
290
|
+
let button_in = hx_tag.querySelector('.' + CONFIG.HIDESHOW_BUTTON_EXPAND)
|
291
|
+
|
292
|
+
if (hx_tag != button_in) {
|
293
|
+
if (eventName === 'click') {
|
294
|
+
triggerEvent(button_in, 'click');
|
295
|
+
return false;
|
296
|
+
}
|
297
|
+
if (eventName === 'keydown' && (13 === e.keyCode || 32 === e.keyCode)) {
|
298
|
+
triggerEvent(button_in, 'click');
|
299
|
+
return false;
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
|
308
|
+
}, true);
|
309
|
+
|
310
|
+
|
311
|
+
});
|
312
|
+
|
313
|
+
return plugin;
|
314
|
+
|
315
|
+
};
|
316
|
+
|
317
|
+
window.van11yAccessibleHideShowAria = main();
|
318
|
+
|
319
|
+
const onLoad = () => {
|
320
|
+
const expand_default = window.van11yAccessibleHideShowAria();
|
321
|
+
expand_default.attach();
|
322
|
+
|
323
|
+
document.removeEventListener('DOMContentLoaded', onLoad);
|
324
|
+
}
|
325
|
+
|
326
|
+
document.addEventListener('DOMContentLoaded', onLoad);
|