feat: Move function to app scope
- Move randomIntFrom() to app.js - Add global entry to jshint configuration
This commit is contained in:
parent
148f4e0a21
commit
ddbd406fc8
3 changed files with 20 additions and 18 deletions
|
|
@ -27,6 +27,8 @@
|
||||||
"getClosestEdgeToMouse": true,
|
"getClosestEdgeToMouse": true,
|
||||||
"centerElementUnderCursor": true,
|
"centerElementUnderCursor": true,
|
||||||
"setAttributesAccordingToPosition": true,
|
"setAttributesAccordingToPosition": true,
|
||||||
|
"randomIntFrom": false,
|
||||||
|
"replaceLineBreaks": false,
|
||||||
"HippieTaskBar": true
|
"HippieTaskBar": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
// CONCEPTS
|
||||||
|
|
||||||
// NOTE: Benutzt private Zuweisungen
|
// NOTE: Benutzt private Zuweisungen
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* Erstellt Kontext für hint-Objekt und ermöglicht das Entfernen des Ereignis.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue