2020-06-30 10:43:00 +02:00
|
|
|
//===
|
|
|
|
// VARIABLES
|
|
|
|
//===
|
|
|
|
var EVENTS;
|
|
|
|
(function (EVENTS) {
|
|
|
|
EVENTS[EVENTS["i-click"] = 0] = "i-click";
|
|
|
|
EVENTS[EVENTS["i-scroll-up"] = 1] = "i-scroll-up";
|
|
|
|
EVENTS[EVENTS["i-scroll-down"] = 2] = "i-scroll-down";
|
|
|
|
EVENTS[EVENTS["i-hover"] = 3] = "i-hover";
|
|
|
|
})(EVENTS || (EVENTS = {}));
|
|
|
|
//===
|
|
|
|
// FUNCTIONS
|
|
|
|
//===
|
|
|
|
function validateSyntax() {
|
2020-06-30 22:26:12 +02:00
|
|
|
// Get every items from EVENTS
|
|
|
|
var eventsKeys = R.filter(function (key) { return !isNaN(Number(EVENTS[key])); }, Object.keys(EVENTS));
|
|
|
|
// Check all event syntax
|
|
|
|
return eventsKeys.map(function (event) {
|
|
|
|
return R.map(function (element) {
|
|
|
|
console.log(element.getAttribute(event));
|
|
|
|
return /^${event}/.test(element.getAttribute(event));
|
|
|
|
}, document.querySelectorAll("[" + event + "]")).every(function (item) { return item; });
|
|
|
|
}).every(function (event) { return event; });
|
2020-06-30 10:43:00 +02:00
|
|
|
}
|
|
|
|
//===
|
|
|
|
// LINTER
|
|
|
|
//===
|
|
|
|
//===
|
|
|
|
// INIT
|
|
|
|
//===
|
|
|
|
validateSyntax();
|