feat: Move function to app scope

- Move randomIntFrom() to app.js
- Add global entry to jshint configuration
This commit is contained in:
sthag 2026-02-13 11:27:44 +01:00
parent 148f4e0a21
commit ddbd406fc8
3 changed files with 20 additions and 18 deletions

View file

@ -27,6 +27,8 @@
"getClosestEdgeToMouse": true,
"centerElementUnderCursor": true,
"setAttributesAccordingToPosition": true,
"randomIntFrom": false,
"replaceLineBreaks": false,
"HippieTaskBar": true
}
}

View file

@ -405,6 +405,24 @@ function setAttributesAccordingToPosition(element, position, attributes) {
});
}
/**
* Gibt eine Zahl zwischen <min> und <max> aus.
* Die Werte <min> und <max> sind dabei mit eingeschlossen.
* Mit <pos> kann der Exponent für eine 10er-Teilung angegeben werden.
*
* @param {number} min
* @param {number} max
* @param {number} pos
* @returns {number}
*/
function randomIntFrom(min, max, pos = 0) {
pos = Math.pow(10, pos);
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor((Math.random() * (max - min + 1) + min) / pos) * pos;
}
// CONCEPTS
// NOTE: Benutzt private Zuweisungen

View file

@ -272,24 +272,6 @@ function loadCore() {
});
}
/**
* Gibt eine Zahl zwischen <min> und <max> aus.
* Die Werte <min> und <max> sind dabei mit eingeschlossen.
* Mit <pos> kann der Exponent für eine 10er-Teilung angegeben werden.
*
* @param {number} min
* @param {number} max
* @param {number} pos
* @returns {number}
*/
function randomIntFrom(min, max, pos = 0) {
pos = Math.pow(10, pos);
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor((Math.random() * (max - min + 1) + min) / pos) * pos;
}
/**
* Erstellt Kontext für hint-Objekt und ermöglicht das Entfernen des Ereignis.
*/