Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <link rel="stylesheet" href="Stylecodes/design4.css">
- <link rel="stylesheet" href="Stylecodes/Main.css">
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Lektion 4</title>
- <script src="jquery-1.10.2.min.js"></script>
- </head>
- <body>
- <div id="float2">
- <div class="kasten2">Falsch beantwortete Vokabeln:<p id="wrong"></p> Wiederhole diese öfter!</div></div>
- <div id="float">
- <ul class="navigation">
- <li> <a href="Startseite.html" target="_blank">Startseite</a></li>
- <li> <a href="Hauptmenü.html"> Hauptmenü </a></li>
- <li><a href="Vokabelliste4.html" target="_blank">Vokabelliste4</a></li>
- <li><a href="Lektion5.html" > Lektion 5</a></li>
- </ul>
- <div class="kasten"> Richtig beantwortete Vokabeln:<p id ="demo"></p> Restliche Vokabeln: <span id="rechnen"></span> </div>
- </div>
- <div id="website">
- <h1 style="text-align: center; color:indianred; text-decoration: underline;">Lektion 4: Zeit</h1>
- <span class="flex"><img src="bilder/germany200.jpg" alt="Deutschlandflagge" > </span>
- <span ide="bild2"><img src="bilder/croatia.jpg" alt="Kroatienflagge" width="200px" style="margin-top: 110px; height:120px;"> </span>
- <div class="center">
- <span id="abstand"> <input type="text" id="vokabel"></span>
- <input type="text" placeholder="Lösung" id="loesung" autofocus> <select id="sonderzeichen">
- <option></option>
- <option>đ</option>
- <option>ć</option>
- <option>ž</option>
- <option>č</option>
- <option>š</option>
- </select>
- <div class="frame"> <button class="custom-btn btn-2" id="pruefen" onclick=Pruefen();>Überprüfen</button> </div>
- </div>
- <div id="main">
- <div id="image">
- <img src="hands.jpg"/>
- </div>
- <div id="player">
- <div id="songTitle">Control</div>
- <div id="buttons">
- <button id="pre" onclick="pre()"><img src="Pre.png" height="90%" width="90%"/></button>
- <button id="play" onclick="playOrPauseSong() "><img src="Play.png"/></button>
- <button id="next" onclick="next()"><img src="Next.png" height="90%" width="90%"/></button>
- </div>
- <div id="seek-bar">
- <div id="fill"></div>
- <div id="handle"></div>
- </div>
- <div id="currentTime">00:00 / 00:00</div>
- </div>
- </div>
- <script>
- var richtigeVokabeln, text;
- var index;
- var rechnung;
- var erg;
- var erg2;
- var vokablen = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", "Frühling", "Sommer", "Herbst", "Winter", "Heute", "Morgen", "Gestern", "Jeden Tag", "Jetzt", "Frohe Weihnachten", "Frohe Ostern", "Frohes neues Jahr", "Mittag", "Nachmittag", "Mitternacht", "Stunde", "Minute", "Sekunde", "Uhr", "2 Uhr", "7 Uhr", "10:30 Uhr", "15 Uhr", "Vorgestern", "Übermorgen"];
- var vokablen2 = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", "Frühling", "Sommer", "Herbst", "Winter", "Heute", "Morgen", "Gestern", "Jeden Tag", "Jetzt", "Frohe Weihnachten", "Frohe Ostern", "Frohes neues Jahr", "Mittag", "Nachmittag", "Mitternacht", "Stunde", "Minute", "Sekunde", "Uhr", "2 Uhr", "7 Uhr", "10:30 Uhr", "15 Uhr", "Vorgestern", "Übermorgen"];
- var uebersetzung = ["ponedjeljak", "utorak", "srijeda", "četrvrtak", "petak", "subota", "nedjelja", "siječanj", "veljača", "ožujak", "travanj", "svibanj", "lipanj", "srpanj", "kolovoz", "rujan", "listopad", "studeni", "prosianc", "proljeće", "ljeto", "jesen", "zima", "danas", "sutra", "jučer", "svaki dan", "sada", "sretan božić", "sretan uskrs", "sretna nova godina", "podne", "poslijepodne", "ponoć", "sat", "minuta", "sekunda", "sat", "dva sat", "sedam sati ujutro", "deset sati i trideset minuta", "tri sata popodne/petnaest sati", "prekjučer", "prekosutra"];
- richtigeVokabeln = [ ];
- var falscheVokabeln = [ ];
- var richtigeAntwort = 0;
- var wiederholung;
- var status ='neu' //das dann au
- const input2 = document.getElementById("loesung");
- const select = document.getElementById("sonderzeichen");
- select.addEventListener("change", function (event) {
- const zeichen = this.value;
- input2.value += zeichen;
- this.selectedIndex = 0;
- document.getElementById("loesung").focus();
- });
- var input = document.getElementById("loesung");
- input.addEventListener("keyup", function(event) {
- if (event.keyCode === 13) {
- event.preventDefault();
- document.getElementById("pruefen").click();
- }
- });
- var input = document.getElementById("loesung");
- document.getElementById('pruefen').addEventListener("click", pruefen);
- // In dieser Form machte die Schleife keinen Sinn: Die Endebedingung (richtigeAntwort == 3)
- // ist nie erfuellt, da die Variable richtigeAntwort den Wert 0 hat
- // Daher wird die Schleife genau einmal durchlaufen
- // do {
- // Diese Funktion prueft ob die Uebersetzung richtig eingegeben wurde
- // und legt ggf. eine neue Vokabel vor
- function pruefen() {
- if(status == 'wiederholung'){
- // Status Wiederholung: Der Benutzer hat die falsche
- // Vokabel erneut eingegeben und Enter gedrueckt
- // Neue Vokabel vorlegen
- neueVokabel();
- status = 'neu';
- input.style.color ='black';
- } else {
- // Pruefen ob die Uebersetzung richtig ist
- if (document.getElementById("loesung").value == uebersetzung[index]) {
- // Anzahl der richtigen Antworten erhoehen
- richtigeAntwort++;
- // Rueckmeldung an den Benutzer
- alert("Richtig! Du hast " + richtigeAntwort + " Vokabeln richtig beantwortet!");
- erg=richtigeVokabeln.includes(uebersetzung[index]);
- if(erg == false){
- richtigeVokabeln.push(uebersetzung[index]);}
- vokablen.splice(index, 1);
- uebersetzung.splice(index, 1);
- // Ist die geforderte Anzahl von richtigen Antworten erreicht
- // geben wir nur eine Rueckmeldung und legen keine neue Vokabel vor
- if (richtigeAntwort == 10) {
- alert("Super! Du hast 10 Vokabeln richtig geschrieben! Mach eine Pause");
- text = "<ul>";
- richtigeVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("demo").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- rechnung= vokablen2.length - richtigeVokabeln.length;
- document.getElementById("rechnen").innerHTML = rechnung;
- text = "<ul>";
- falscheVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("wrong").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- neueVokabel();
- } else {
- // Neue Vokabel vorlegen
- neueVokabel();
- }
- if (richtigeAntwort == 20) {
- alert("Super! Du hast 20 Vokabeln richtig geschrieben! Mach eine Pause");
- text = "<ul>";
- richtigeVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("demo").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- rechnung= vokablen2.length - richtigeVokabeln.length;
- document.getElementById("rechnen").innerHTML = rechnung;
- text = "<ul>";
- falscheVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("wrong").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- neueVokabel();
- } else {
- // Neue Vokabel vorlegen
- neueVokabel();
- }
- if (richtigeAntwort == 40) {
- alert("Super! Du hast 40 Vokabeln richtig geschrieben! Mach eine Pause");
- text = "<ul>";
- richtigeVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("demo").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- rechnung= vokablen2.length - richtigeVokabeln.length;
- document.getElementById("rechnen").innerHTML = rechnung;
- text = "<ul>";
- falscheVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("wrong").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- neueVokabel();
- } else {
- // Neue Vokabel vorlegen
- neueVokabel();
- }
- if (richtigeAntwort == 60) {
- alert("Super! Du hast 60 Vokabeln richtig geschrieben! Mach eine Pause");
- text = "<ul>";
- richtigeVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("demo").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- rechnung= vokablen2.length - richtigeVokabeln.length;
- document.getElementById("rechnen").innerHTML = rechnung;
- text = "<ul>";
- falscheVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("wrong").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- neueVokabel();
- } else {
- // Neue Vokabel vorlegen
- neueVokabel();
- }
- if (richtigeAntwort == 80) {
- alert("Super! Du hast 80 Vokabeln richtig geschrieben! Mach eine Pause");
- text = "<ul>";
- richtigeVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("demo").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- rechnung= vokablen2.length - richtigeVokabeln.length;
- document.getElementById("rechnen").innerHTML = rechnung;
- text = "<ul>";
- falscheVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("wrong").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- neueVokabel();
- }
- if (richtigeAntwort == 100) {
- alert("Super! Du hast 100 Vokabeln richtig geschrieben! Mach eine Pause");
- text = "<ul>";
- richtigeVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("demo").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- rechnung= vokablen2.length - richtigeVokabeln.length;
- document.getElementById("rechnen").innerHTML = rechnung;
- text = "<ul>";
- falscheVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("wrong").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- neueVokabel();
- }
- if (richtigeAntwort == 120) {
- alert("Super! Du hast 120 Vokabeln richtig geschrieben! Mach eine Pause");
- text = "<ul>";
- richtigeVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("demo").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- rechnung= vokablen2.length - richtigeVokabeln.length;
- document.getElementById("rechnen").innerHTML = rechnung;
- text = "<ul>";
- falscheVokabeln.forEach(myFunction);
- text += "</ul>";
- document.getElementById("wrong").innerHTML = text;
- function myFunction(value) {
- text += "<li>" + value + "</li>"; }
- neueVokabel();
- }
- else {
- // Neue Vokabel vorlegen
- neueVokabel();
- }
- if (richtigeVokabeln.length == vokablen2.length){
- alert("Sehr gut! Du hast alle Vokabeln richtig beantwortet. Du kehrst jetzt zurück zum Hauptmenü. Komm einfach wieder, um weiter zu lernen");
- window.location.href = "Hauptmenü.html";
- }
- } else {
- // Falsche Uebersetzung: Rueckmeldung an Benutzer
- alert("Falsch :( Die Lösung ist: " + uebersetzung[index]);
- alert("Gebe " + uebersetzung[index] + " nochmal ein, um die Vokabel zu verinnerlichen"); //war ursprünglich ein prompt
- vokablen.push(vokablen[index]);
- status = 'wiederholung'; // das auch weglassen
- input.focus(); //das auch
- input.style.color='firebrick';
- uebersetzung.push(uebersetzung[index]);
- erg2=falscheVokabeln.includes(uebersetzung[index]);
- if(erg2 == false){
- falscheVokabeln.push(uebersetzung[index]);}
- // Neue Vokabel vorlegen
- // neueVokabel(); das wurde geändert kommentar wegmachen
- }
- }}
- // } while (richtigeAntwort == 3)
- // Diese Funktion legt dem Benutzer eine neue Vokabel vor
- // Der Code wird mehrfach benoetigt, daher in einer Funktion
- function neueVokabel() {
- index = Math.floor(Math.random() * vokablen.length);
- document.getElementById("vokabel").value = vokablen[index];
- document.getElementById("loesung").focus();
- // Alte Uebersetzung kann jetzt geloescht werden
- input.value = '';
- }
- // Die erste Vokabel vorlegen
- neueVokabel();
- </script>
- <script type="text/javascript">
- var songs = ["Control.mp3","Sunshine.wav","Ruleta.wav", "Bebe.wav", "Better Days.wav", "Instagram.wav", "Intentsion.mp3","Rojo.mp3", "SICKO.mp3", "Superstar.mp3", "Troubeld Water.mp3", "painkiller.mp3", "all my friends are fake.mp3", "at least i look cool.mp3", "good old days.mp3", "wrong direction.mp3", "the archer.mp3", "lalalife.mp3", "bulletproof.mp3", "death bed.mp3", "everything i wanted.mp3", "fine line.mp3", "little lion man.mp3", "quit.mp3", "selfish love.mp3", "spanish.mp3", "vermissen.mp3", "worry about me.mp3", "think before i talk.mp3", "Oneofus.mp3", "loveme.mp3", "lovin.mp3", "toyou.mp3", "jam.mp3", "Night Air.mp3"];
- var nameSongs =["Control", "Sunshine", "Ruleta", "Bebe", "Better Days", "Instagram", "Intentions", "Rojo", "SICKO", "Superstar", "Troubled Water", "Painkiller", "All my friends are fake", "At least I look cool", "Good Old Days", "Wrong Direction", "The Archer", "LaLaLife", "Bulletproof", "death bed", "everything I wanted", "Fine Line", "Little Lion Man", "Quit", "Selfish Love", "No Te Enamores", "Vermissen", "Worry about me", "Think before I talk", "ONE OF US", "Love me like you", "Lovin kind", "Someone to you", "Summer Jam", "Night Air"];
- var poster = ["hands.jpg","sun.jpg","roulette.jpg","Bebepic.jpg","Tree.jpg", "instagram.jpg","think2.jpg", "red.jpg", "lost.jpg", "star.jpg", "water.jpg", "pills.jpg", "mask.jpg", "sign.jpg", "ping.jpg", "direction.jpg", "archer.jpg", "life.jpg", "bullet.jpg", "sanduhr.jpg", "snow.jpg", "bridge.jpg", "forgive.jpg", "flash.jpg", "rose.jpg", "sad love.jpg", "lake.jpg", "worry.jpg", "thinktalk.jpg", "Poster3.jpg", "love2.jpg", "hugfriend.jpg", "fullmoon.jpg", "concert.jpg", "night.jpg"];
- var songTitle = document.getElementById("songTitle");
- var fillBar = document.getElementById("fill");
- var currentTime = document.getElementById("currentTime");
- var song = new Audio();
- var currentSong = 0; // it point to the current song
- // it will call the function playSong when window is load
- function playSong(){
- song.src = songs[currentSong]; //set the source of 0th song
- songTitle.textContent = nameSongs[currentSong]; // set the title of song
- song.play(); // play the song
- }
- function playOrPauseSong(){
- if(song.paused){
- song.play();
- $("#play img").attr("src","Pause.png");
- }
- else{
- song.pause();
- $("#play img").attr("src","Play.png");
- }
- }
- song.addEventListener('timeupdate',function(){
- var position = song.currentTime / song.duration;
- fillBar.style.width = position * 100 +'%';
- convertTime(Math.round(song.currentTime));
- if(song.ended){
- next();
- }
- });
- function convertTime(seconds){
- var min = Math.floor(seconds / 60);
- var sec = seconds % 60;
- min = (min < 10) ? "0" + min : min;
- sec= (sec < 10) ? "0" + sec : sec;
- currentTime.textContent = min + ":" + sec;
- totalTime(Math.round(song.duration));
- }
- function totalTime(seconds){
- var min = Math.floor(seconds / 60);
- var sec = seconds % 60;
- min = (min < 10) ? "0" + min : min;
- sec= (sec < 10) ? "0" + sec : sec;
- currentTime.textContent += "/" + min + ":" + sec;
- }
- function next(){
- currentSong++;
- if(currentSong >= songs.length){
- currentSong = 0;
- }
- playSong();
- $("#play img").attr("src","Pause.png");
- $("#image img").attr("src",poster[currentSong]);
- $("#bg img").attr("src",poster[currentSong]);
- }
- function pre(){
- currentSong--;
- if(currentSong < 0){
- currentSong = 34; //anpassen wenn ich mehr Songs habe (Anzahl an Songs nehmen)
- }
- playSong();
- $("#play img").attr("src","Pause.png");
- $("#image img").attr("src",poster[currentSong]);
- $("#bg img").attr("src",poster[currentSong]);
- }
- function getSong(idx) {
- song.src = songs[idx];
- $("#songTitle").text() = songs[idx];
- $("#image img").attr("src",poster[idx]);
- $("#bg img").attr("src",poster[idx]);
- }
- var seekBar = document.getElementById("seek-bar");
- function scrub(e){
- const scrubTime =(e.offsetX / seekBar.offsetWidth) * song.duration;
- song.currentTime = scrubTime
- console.log(e);
- }
- seekBar.addEventListener('click',scrub);
- getSong(0);
- </script>
- <br><br><br><br><br> <br>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement