JavaScript

// INPUT
const login = document.getElementById("loginInput");
const password = document.getElementById("passwordInput");
const button = document.getElementById("sendButton");
const loginButton = document.getElementById("loginButton");


// FETCH
const url = "https://crudcrud.com/api/ebf57bbd269048e3ac7cacf52f6ac53f/todos";


const dataRender = (array) => {
  const getHtml = document.getElementById("userTable");
  if (array === undefined) {
    console.log("Loading results...");
  } else {
    let dataList = array.map((item) => {
      return `
        <div class="users">
          <p>${item.login}</p>
          <button onclick="deleteRequest('${item._id}')">Delete</button>
        </div>
      `;
    });
    getHtml.innerHTML = dataList.join("");
  }
};


const fetchData = async () => {
  try {
    const response = await fetch(url);
    const data = await response.json();
    dataRender(data);
  } catch (error) {
    console.error(error);
  }
};


fetchData();


// POST_REQUEST
const postRequest = async () => {
  const data = {
    login: login.value,
    password: password.value,
    isLogin: false,
  };


  try {
    const response = await fetch(url, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify(data),
    });


    const results = await response.json();
    console.log(results.message);
    fetchData();
  } catch (error) {
    console.error(error);
  }
};


button.addEventListener("click", () => {
  postRequest();
});


// DELETE_REQUEST
const deleteRequest = async (id) => {
  try {
    const response = await fetch(`${url}/${id}`, {
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
      },
    });


    const results = await response.json();
    console.log(results.message);
    fetchData();
  } catch (error) {
    console.error(error);
  }
};


//GETLOGGEDIN
const getLoggedIn = async () => {
  try {
    const response = await fetch (`${url}/getLoggedIn`, {
      method: "GET",
      headers: {
        "Content-Type": "application/json"
      }
    })
    const results = await response.json()
    console.log(results.message); 
  }
  catch (error) {
    console.error(error);
  }
}


//UPDATEISLOGIN
const updateIsLogin = async (value) => {
  const data = {
    isLogin: value
  }
  try {
    const response = await fetch (`${url}/updateIsLogin`, {
      method: "PUT",
      headers: {
        "Content-Type": "application/json"
      },
      body: JSON.stringify(data) 
    })
    const results = await response.json()
    console.log(results.message);
  }
  catch (error) {
    console.error(error);
  }
}


// LOGIN_REQUEST
const loginRequest = async () => {
  const data = {
    login: login.value,
    password: password.value,
  };


  try {
    const response = await fetch(`${url}/login`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify(data),
    });


    const results = await response.json();
    console.log(results.message);


    if (results.success) {
      await updateIsLogin(true);
      getLoggedIn()
    }
  } catch (error) {
    console.error(error);
  }
};


loginButton.addEventListener("click", () => {
  loginRequest();
});
...zur Antwort

JavaScript:

const title = document.createElement("h1");
        title.textContent = "My favourite movies!";
        document.body.appendChild(title);

        const inputOne = document.createElement("input");
        document.body.appendChild(inputOne);
        inputOne.placeholder = "Enter a movie name!";

        const inputTwo = document.createElement("input");
        document.body.appendChild(inputTwo);
        inputTwo.placeholder = "Add a link!";

        const buttonsDiv = document.createElement("div");
        document.body.append(buttonsDiv);

        const addMovieButton = document.createElement("button");
        addMovieButton.textContent = "Add this movie!";
        buttonsDiv.appendChild(addMovieButton);

        const otherButtonsDiv = document.createElement("div");
        document.body.append(otherButtonsDiv);

        const deleteLastMovieButton = document.createElement("button");
        deleteLastMovieButton.textContent = "Remove last!";
        otherButtonsDiv.appendChild(deleteLastMovieButton);

        const deleteAllMoviesButton = document.createElement("button");
        deleteAllMoviesButton.textContent = "Remove all!";
        otherButtonsDiv.appendChild(deleteAllMoviesButton);

        const movieDivs = document.createElement("div");
        document.body.append(movieDivs);

        document.body.style.backgroundImage = "url(https://i.pinimg.com/564x/55/af/85/55af8508354f18b2ffbb325a36a3c2bb.jpg)";
        //TITLE_STYLE
        title.style.textAlign = "center"
        title.style.fontSize = "3rem"
        title.style.fontFamily = "'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif"
        title.style.color = "#fff"


        //INPUT_ONE_STYLE
        inputOne.style.width = "50%"
        inputOne.style.height = "35px"
        inputOne.style.marginLeft = "24%"
        inputOne.style.marginTop = "10%"
        inputOne.style.borderRadius = "7px"
        
        
        //INPUT_TWO_STYLE
        inputTwo.style.width = "50%"
        inputTwo.style.height = "35px"
        inputTwo.style.marginTop = "13px"
        inputTwo.style.marginLeft = "24%"
        inputTwo.style.borderRadius = "7px"
        
        
        //BUTTON_DIV_STYLE
        buttonsDiv.style.marginLeft = "355px"
        buttonsDiv.style.marginTop = "20px"
        
        
        //ADD_MOVIE_BUTTON_STYLE
        addMovieButton.style.width = "13%"
        addMovieButton.style.height = "30px"
        addMovieButton.style.background = "linear-gradient(45deg, rgba(201,37,107,1) 15%, rgba(116,16,124,1) 75%)";
        addMovieButton.style.color = "#fff"
        addMovieButton.style.fontWeight = "600"
        addMovieButton.style.borderRadius = "7px"
        addMovieButton.style.border = "#fff"
        addMovieButton.style.cursor = "pointer"
        
        
        //OTHER_BUTTONS_DIV_STYLE
        otherButtonsDiv.style.marginLeft = "355px"
        otherButtonsDiv.style.marginTop = "25px"


        //REMOVE_LAST_MOVIE_BUTTON
        deleteLastMovieButton.style.width = "11%"
        deleteLastMovieButton.style.height = "30px"
        deleteLastMovieButton.style.background = "linear-gradient(45deg, rgba(201,37,107,1) 15%, rgba(116,16,124,1) 75%)";
        deleteLastMovieButton.style.color = "#fff"
        deleteLastMovieButton.style.fontWeight = "600"
        deleteLastMovieButton.style.borderRadius = "7px"
        deleteLastMovieButton.style.border = "#fff"
        deleteLastMovieButton.style.cursor = "pointer"


        //REMOVE_ALL_MOVIES_BUTTON
        deleteAllMoviesButton.style.width = "11%"
        deleteAllMoviesButton.style.height = "30px"
        deleteAllMoviesButton.style.background = "linear-gradient(45deg, rgba(201,37,107,1) 15%, rgba(116,16,124,1) 75%)";
        deleteAllMoviesButton.style.color = "#fff"
        deleteAllMoviesButton.style.fontWeight = "600"
        deleteAllMoviesButton.style.borderRadius = "7px"
        deleteAllMoviesButton.style.border = "#fff"
        deleteAllMoviesButton.style.cursor = "pointer"
        deleteAllMoviesButton.style.marginLeft = "15px"

        addMovieButton.onclick = async () => {
            const pictureLinkAdd = inputTwo.value;
            const textAdd = inputOne.value;

            

            if (pictureLinkAdd && textAdd) {
                try {
                    const response = await fetch('https://crudcrud.com/api/c74c6269d5c245c3bbe96bec091fc01d/movies', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json',
                        },
                        body: JSON.stringify({ pictureLink: pictureLinkAdd, text: textAdd }),
                    });

                    const data = await response.json();

                    const pictureAdd = document.createElement("img");
                    pictureAdd.src = data.pictureLink;
                    movieDivs.appendChild(pictureAdd);

                    pictureAdd.style.height = "350px"
                    pictureAdd.style.width = "250px"
                    pictureAdd.style.display = "flex"
                    pictureAdd.style.flexDirection = "column"
                    pictureAdd.style.marginTop = "315px"
                    pictureAdd.style.marginLeft = "355px"

                    const textAdding = document.createElement("h3");
                    textAdding.innerHTML = data.text;
                    movieDivs.appendChild(textAdding)

                    textAdding.style.marginLeft = "650px"
                    textAdding.style.marginTop = "-360px"
                    textAdding.style.fontSize = "50px"
                    textAdding.style.color = "#fff"
                    textAdding.style.fontFamily = "'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif"
                } catch (error) {
                    console.error('Error:', error);
                }

                inputTwo.value = ""
                inputOne.value = ""
            }
        };

        deleteAllMoviesButton.onclick = async () => {
          try {
              const response = await fetch('https://crudcrud.com/api/c74c6269d5c245c3bbe96bec091fc01d/movies');
              const data = await response.json();
      
              if (data.length > 0) {
                  movieDivs.innerHTML = "";

                  const movieIds = data.map(movie => movie._id);
      
                  await fetch('https://crudcrud.com/api/c74c6269d5c245c3bbe96bec091fc01d/movies', {
                      method: 'DELETE',
                      headers: {
                          'Content-Type': 'application/json',
                      },
                      body: JSON.stringify({ ids: movieIds }),
                  });
              }
          } catch (error) {
              console.error('Error:', error);
          }
      };
      

        deleteLastMovieButton.onclick = async () => {
            const lastMovie = movieDivs.lastChild;
            const another = movieDivs.lastChild

            if (lastMovie) {
                try {
                    const response = await fetch('https://crudcrud.com/api/c74c6269d5c245c3bbe96bec091fc01d/movies');
                    const data = await response.json();

                    if (data.length > 0) {
                        const lastItemId = data[data.length - 1]._id

                        await fetch(`https://crudcrud.com/api/c74c6269d5c245c3bbe96bec091fc01d/movies/${lastItemId}`, {
                            method: 'DELETE',
                        });

                        movieDivs.removeChild(lastMovie);

                        if(lastMovie) {
                            movieDivs.removeChild(another)
                        }
                        
                    }
                } catch (error) {
                    console.error('Error:', error);
                }
            }
        }


...zur Antwort

Hallo,

mein Vorschlag wäre:

,,Ich habe praktische Erfahrungen in der Anwendung von Python, Matplotlib, NumPy, Jupyter, Spyder, HTML, CSS, Javascript, jQuery, Flexbox, Bootstrap und SASS gesammelt."

Liebe Grüße

MrOsmo

...zur Antwort
Was für Alkoholische Getränke mögt ihr am Liebsten und wieso?

Hallo,

Erst einmal trinke ich überhaupt nicht und habe auch nicht vor, zu trinken! Ich empfehle es auch dir und anderen Menschen nicht! Durch den Konsum solcher "Getränke" gefährdest du einfach dein eigenes Leben! Aber natürlich liegt die Entscheidung bei dir, und jeder entscheidet selbst, was er tun sollte/muss/darf.

Liebe Grüße

MrOsmo

...zur Antwort

Hallo!

Dieses Gefühl habe tatsächlich in manchen Fällen, aber nicht so oft. Vor allem, wenn ich versuche eine Webseite zu programmieren, aber es nicht klappt, da ich im Code irgendeinen Fehler gemacht habe.. In solchen Fällen möchte ich einfach die Arbeit lassen, und mich vergraben gehen.

Liebe Grüße

MrOsmo

...zur Antwort
Finde ich cool

Hallo!

also ich persönlich habe nichts dagegen, denn davor hatten wir nur männliche Hauptfiguren (...zumindest in GTA V). Jetzt kriegen wir jedoch eine Möglichkeit, aus der Perspektive einer Frau zu spielen. Schlimm ist es nicht, und geil auch nicht. Also kurz gesagt, ist es für mich Wursch.

Liebe Grüße

MrOsmo

...zur Antwort

Guten Abend!

Ja, ich weiß, dass meine Idee banal ist. Aber ich finde, dass "Harry Potter" einer der bekanntesten Filme auf der Welt ist und richtig weihnachtliche Stimmung verbreitet! Die magische Welt von Hogwarts, die winterlichen Szenen und die warmen Beziehungen der Charaktere machen ihn perfekt für gemütliche Weihnachtsabende. Die besondere Atmosphäre, gepaart mit den festlichen Elementen in den Filmen, lässt einen in eine zauberhafte Weihnachtswelt eintauchen.

Liebe Grüße

MrOsmo

...zur Antwort

Hallo!

Ja, ich habe TikTok und habe sogar früher verschiedene Edits erstellt, durch die ich 1000 Abonnenten bekommen habe. Ich dachte, dass man mit 1000 Abonnenten Geld verdienen kann, aber das war nicht der Fall. Man kann zwar mit 1000 Abonnenten Live-Streamen, aber es bringt nicht viel Geld ein. Das war also meine größte Zeitverschwendung und ein Fehler, den ich nie wieder erleben werde!

Liebe Grüße

MrOsmo

...zur Antwort