diff --git a/schlangen_und_leitern/js/makeBoard.js b/schlangen_und_leitern/js/makeBoard.js index 29637c8..ba30bd7 100644 --- a/schlangen_und_leitern/js/makeBoard.js +++ b/schlangen_und_leitern/js/makeBoard.js @@ -261,9 +261,9 @@ function checkPosition(player, objectArr){ //win condition if(player.newPosition == 100){ player.won = true; - document.getElementById("continue").style.display = "block" - document.getElementById("replay").style.display = "block" - document.getElementById("würfelBereich").style.display = "none" + changeElement("continue", "block") + changeElement("replay", "block") + changeElement("würfelBereich", "none") } //snake condition @@ -279,26 +279,28 @@ function checkPosition(player, objectArr){ function continueGame (){ - document.getElementById("continue").style.display = "none" - document.getElementById("replay").style.display = "none" - document.getElementById("würfelBereich").style.display = "grid" - + changeElement("continue", "none") + changeElement("replay", "none") + changeElement("würfelBereich", "grid") } function hideStartMenu(){ //playerselect versctecken - document.getElementById("2Player").style.display = "none"; - document.getElementById("3Player").style.display = "none"; - document.getElementById("4Player").style.display = "none"; - document.getElementById("isUp").style.display = "block"; + changeElement("2Player", "none") + changeElement("3Player", "none") + changeElement("4Player", "none") + changeElement("isUp", "block") // Wufelbereich zeigen. - document.getElementById("würfelBereich").style.display = "grid"; + changeElement("würfelBereich", "grid") } - \ No newline at end of file + function changeElement(id, style){ + + document.getElementById(id).style.display = style; + } \ No newline at end of file diff --git a/schlangen_und_leitern/js/playerHandling.js b/schlangen_und_leitern/js/playerHandling.js index f8da9ea..406d6f0 100644 --- a/schlangen_und_leitern/js/playerHandling.js +++ b/schlangen_und_leitern/js/playerHandling.js @@ -194,9 +194,9 @@ function checkPosition(player, objectArr){ //win condition if(player.newPosition == 100){ player.won = true; - document.getElementById("continue").style.display = "block" - document.getElementById("replay").style.display = "block" - document.getElementById("würfelBereich").style.display = "none" + changeElement("continue","block") + changeElement("replay","block") + changeElement("würfelBereich","none") } //snake condition