Kommentare in main.js
Habe die Kommentare und Beschreibungen der Parameter in Main.js hinzugefügt
This commit is contained in:
parent
9d730633ad
commit
6b141395bf
1 changed files with 28 additions and 2 deletions
|
@ -14,9 +14,13 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
|
||||
|
||||
/**
|
||||
* Initiale Methode, die alles startet
|
||||
*/
|
||||
function init() {
|
||||
//forceHttps();
|
||||
actrivateMessage();
|
||||
|
@ -24,16 +28,26 @@ function init() {
|
|||
windowReload();
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode stellt das Protokoll fals nötig auf https:// um
|
||||
*/
|
||||
function forceHttps() {
|
||||
if (location.protocol != 'https:') {
|
||||
location.href = 'https://' + location.hostname + location.pathname;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode lässt die Status-/Fehlermeldung(en) erscheinen
|
||||
*/
|
||||
function actrivateMessage() {
|
||||
document.querySelectorAll('.modal').forEach((modal)=>{modal.style.position = 'fixed'});
|
||||
document.querySelectorAll('.modal').forEach((modal) => { modal.style.position = 'fixed' });
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode extrahiert den Dateinamen aus der Adresse
|
||||
* @returns {string} Der Dateinamen
|
||||
*/
|
||||
function getFileName() {
|
||||
let pathname = location.pathname;
|
||||
let fileNameRegEx = /[a-z]+\.[a-z]+/i;
|
||||
|
@ -41,12 +55,18 @@ function getFileName() {
|
|||
return (fileName === null)?'index.php':fileName[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode lässt die Status-/Fehlermeldung(en) verschwinden
|
||||
*/
|
||||
function hideMessage() {
|
||||
if (getFileName() != 'check.php') {
|
||||
document.querySelectorAll('.modal').forEach((modal) => { modal.style.display = 'none' });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode startet auf der Seite check.php den Countdown
|
||||
*/
|
||||
function windowReload() {
|
||||
if (getFileName() == 'check.php') {
|
||||
let message = document.querySelector('.message p').innerHTML;
|
||||
|
@ -57,6 +77,12 @@ function windowReload() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Funktion ändert die Zeit in der Anzeige des Countdowns und das neuladen der Seite am Ende
|
||||
* @param {int} time Zeit des Countdowns
|
||||
* @param {string} message Statusnachricht
|
||||
* @returns {empty}
|
||||
*/
|
||||
function updateMessage(time, message) {
|
||||
let newTime = time-1;
|
||||
message = message.replace(time, newTime);
|
||||
|
|
Loading…
Reference in a new issue