Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
  <link href="https://fonts.googleapis.com/css2?family=Bungee+Inline&family=Concert+One&family=Galada&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
  <link href="https://fonts.googleapis.com/css2?family=Fjalla+One&display=swap" rel="stylesheet">
</head>
<h1 id='h1'>To Do List</h1>
<div id='div1'>
  <input type="text" id="input" placeholder="What needs to be done" />
</div>

<div id="div">
  <div id="div2" style="overflow:scroll; height:410px;">
    <ul id='ul'></ul>
  </div>
  <div>

    <div id='popup'>
      <div id='popup2'>
        <div id='close'>+</div>
        <h1 id='h1'>Add Reminder</h1>
        <div id='clock'></div>
        <div id='date1'></div>
        <input type="text" id='hour1' placeholder="hour">
        &nbsp :
        <input type="text" id='min1' placeholder="minute">
        &nbsp :
        <input type="text" id='sec1' placeholder="second">
        <br>
        <input type="text" placeholder="Week Day" id="weekDay1">
        ,
        <input type="text" placeholder="Day" id="day1">
        <input type="text" placeholder="Month" id="month1">
        <input type="text" placeholder="Year" id="year1">
        <br>
        <input type="text" placeholder="Confirm 'To Do List'" id='confirm'>
        <button id="button3">Add</button>
      </div>
    </div>
              
            
!

CSS

              
                body {
  background-image: url(https://www.notatnik-kreatywny.pl/wp-content/uploads/2019/01/TAPETA-KAKTUSY-PULPIT-ROZOWA.png);
  background-size: 100% 900px;
  background-repeat: no-repeat;
  background-position: top;
}
#input {
  width: 400px;
  height: 50px;
  border-radius: 20px;
  border: solid #f8ad9d;
  padding-left: 20px;
  font-size: 24px;
  outline: none;
  font-family: "Concert One", cursive;
}
#div2 {
  border: solid transparent 1px;
  width: 500px;
  height: 600px;
  margin: 0 auto;
}
#div1 {
  width: 500px;
  height: 70px;
  margin: 0 auto;
  margin-top: 0px;
  position: relative;
}
ul {
  list-style-type: none;
  margin: 0px;
  padding: 0px;
}
::-webkit-input-placeholder {
  /* Chrome/Opera/Safari */
  color: #f8ad9d;
}
::-moz-placeholder {
  /* Firefox 19+ */
  color: #f8ad9d;
}
:-ms-input-placeholder {
  /* IE 10+ */
  color: #f8ad9d;
}
:-moz-placeholder {
  /* Firefox 18- */
  color: #f8ad9d;
}
#h1 {
  text-align: center;
  font-size: 60px;
  color: #e56b6f;
  font-family: "Bungee Inline", cursive;
}
.label {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
  font-family: "Concert One", cursive;
  font-size: 30px;
  display: flex;
}
.button {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
}
.checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 3px solid #f8ad9d;
  padding-left: 1px;
  padding-top: 1px;
  alighn-items: center;
  justify-content: center;
  margin-top: 10px;
  outline: none;
}
.checkbox:after {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  content: "\f00c";
  color: #e56b6f;
  display: none;
  outline: none;
}
.checkbox:checked:after {
  display: block;
}
/* .checked:checked:after + .label {
  color: red;
} */

#popup {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 0;
  left: 0;
  display: none;
}
#popup2 {
  width: 700px;
  height: 500px;
  background-color: white;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  position: absolute;
}
#clock {
  border: 1px solid transparent;
  width: 700px;
  height: 60px;
  font-size: 50px;
  text-align: center;
  font-family: "Fjalla One", sans-serif;
}
#close {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
  border: 1px solid transparent;
  width: 20px;
  height: 20px;
  margin-left: 660px;
  font-size: 40px;
  padding-bottom: 20px;
  transform: rotate(45deg);
}
#hour1,
#min1,
#sec1 {
  margin-top: 30px;
  margin-left: 3px;
  width: 210px;
  height: 30px;
  outline: none;
  border: 2px solid #f8ad9d;
  font-family: "Concert One", cursive;
  font-size: 30px;
  text-align: center;
}
#date1 {
  text-align: center;
  font-family: "Fjalla One", sans-serif;
  font-size: 25px;
}
#weekDay1,
#day1,
#month1,
#year1 {
  border: 2px solid #f8ad9d;
  height: 30px;
  width: 160px;
  margin-top: 10px;
  margin-left: 3px;
  font-family: "Concert One", cursive;
  font-size: 20px;
  text-align: center;
  outline: none;
}
#button3 {
  margin-top: 5px;
  margin-left: 620px;
  width: 70px;
  height: 30px;
  border: 2px solid #fe938c;
  background-color: white;
  font-size: 15px;
}
#confirm {
  margin-top: 20px;
  margin-left: 250px;
  border: 2px solid #f8ad9d;
  height: 30px;
  width: 210px;
  font-family: "Concert One", cursive;
  font-size: 20px;
  text-align: center;
  outline: none;
}

.checked {
  color: black;
}

#div {
  margin: 0 auto;
  border: 1px trasparent solid;
  width: 500px;
  height: 670px;
}
.button2 {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
}
.button4 {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
}
#button3 {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
}

              
            
!

JS

              
                let ul = document.getElementById("ul");
let div2 = document.getElementById("div2");
let button = document.createElement("img");
button.src = "https://image.flaticon.com/icons/svg/972/972526.svg";
let div1 = document.getElementById("div1");
div1.style.display = "flex";
div1.appendChild(button);
button.style.height = "50px";
button.style.width = "50px";
button.style.marginLeft = "10px";
button.classList.add("button");
let input = document.getElementById("input");
let arrayList = [];
let arrayList2 = [];
let backgrounds = [
  "https://www.notatnik-kreatywny.pl/wp-content/uploads/2019/01/TAPETA-KAKTUSY-PULPIT-ROZOWA.png",
  "https://res.cloudinary.com/duyyuvedc/image/upload/v1590437007/TAPETA-KAKTUSY-PULPIT-ROZOWA-12_rk4x5u.jpg",
  "https://res.cloudinary.com/duyyuvedc/image/upload/v1590437020/TAPETA-KAKTUSY-PULPIT-ROZOWA-11_coghpn.jpg",
  "https://res.cloudinary.com/duyyuvedc/image/upload/v1590437028/TAPETA-KAKTUSY-PULPIT-ROZOWA-10_c9kukb.jpg",
  "https://res.cloudinary.com/duyyuvedc/image/upload/v1590437039/TAPETA-KAKTUSY-PULPIT-ROZOWA-9_kk9irx.jpg"
];

function beckground() {
  let all = arrayList2.length;
  let done = 0;
  for (let i = 0; i < all; i++) {
    if (arrayList2[i] === true) {
      done++;
    }
  }
  let percent = 0;
  if (all !== 0) {
    percent = done / all;
  }
  let index = Math.floor(percent * (backgrounds.length - 1));
  document.body.style.backgroundImage = "url(" + backgrounds[index] + ")";
}

button.onclick = function () {
  let toDoText = input.value;

  if (toDoText.trim().length === 0) {
    return;
  }

  input.value = "";
  createLi(toDoText, false);

  arrayList.push(toDoText);
  arrayList2.push(false);
  saveArray();
  createLi();
};

readArray();
for (let i = 0; i < arrayList.length; i++) {
  createLi(arrayList[i], arrayList2[i]);
}
beckground();

function saveArray() {
  localStorage.setItem("toDoList", JSON.stringify(arrayList));
  localStorage.setItem("toDoList2", JSON.stringify(arrayList2));
  beckground();
}

function readArray() {
  arrayList = JSON.parse(localStorage.getItem("toDoList")) || [];
  arrayList2 = JSON.parse(localStorage.getItem("toDoList2")) || [];
}

input.addEventListener("keyup", function (event) {
  if (event.keyCode === 13) {
    event.preventDefault();
    button.click();
  }
});

function createLi(text, check) {
  let alertSound = new Audio();
  alertSound.src =
    "https://prodigits.co.uk/content2/mp3-ringtones/tone/2015/original/iphonenoti_cRjTITC7.mp3";
  //clock inputs
  let hour1 = document.getElementById("hour1");
  let min1 = document.getElementById("min1");
  let sec1 = document.getElementById("sec1");
  let weekDay1 = document.getElementById("weekDay1");
  let day1 = document.getElementById("day1");
  let month1 = document.getElementById("month1");
  let year1 = document.getElementById("year1");
  let confirm = document.getElementById("confirm");
  //li
  let li = document.createElement("LI");
  li.style.display = "flex";
  ul.appendChild(li);

  let textNode = document.createTextNode(text);

  if (textNode.textContent === "undefined") {
    ul.removeChild(li);
  }

  let checkbox = document.createElement("input");
  checkbox.setAttribute("type", "checkbox");
  checkbox.setAttribute("onclick", "check(this)");
  checkbox.classList.add("checkbox");
  checkbox.checked = check;

  let label = document.createElement("label");
  li.appendChild(label);
  label.appendChild(checkbox);
  label.appendChild(textNode);
  label.classList.add("label");

  if (check === true) {
    label.classList.add("checked");
  } else {
    label.classList.remove("checked");
  }

  input.value = "";
  //trash button
  let button2 = document.createElement("img");
  button2.src = "https://image.flaticon.com/icons/svg/1884/1884483.svg";
  button2.style.height = "30px";
  button2.style.width = "30px";
  button2.style.marginLeft = "10px";
  li.appendChild(button2);
  button2.classList.add("button2");
  // button2.onclick = function () {
  //   ul.removeChild(li);
  // };
  button2.setAttribute("onclick", "remove(this)");

  //clock button
  let button4 = document.createElement("img");
  button4.src = "https://image.flaticon.com/icons/svg/2624/2624383.svg";
  li.appendChild(button4);
  button4.style.height = "30px";
  button4.style.width = "30px";
  button4.style.marginLeft = "10px";
  button4.classList.add("button4");
  let popup = document.getElementById("popup");
  button4.onclick = function () {
    popup.style.display = "flex";
  };
  //close button
  let close = document.getElementById("close");
  close.onclick = function () {
    popup.style.display = "none";
    hour1.value = "";
    min1.value = "";
    sec1.value = "";
    weekDay1.value = "";
    day1.value = "";
    month1.value = "";
    year1.value = "";
    confirm.value = "";
  };
  //popup
  let button3 = document.getElementById("button3");
  button3.onclick = function () {
    popup.style.display = "none";
  };
  //clock
  function time() {
    let date1 = document.getElementById("date1");
    let clock = document.getElementById("clock");
    let date = new Date();
    let hour = date.getHours();
    let min = date.getMinutes();
    let sec = date.getSeconds();
    hour = updateTime(hour);
    min = updateTime(min);
    sec = updateTime(sec);
    clock.innerText = hour + " : " + min + " : " + sec;
    let months = [
      "January",
      "February",
      "March",
      "April",
      "May",
      "June",
      "July",
      "August",
      "September",
      "October",
      "November",
      "December"
    ];
    let days = [
      "Sunday",
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday",
      "Saturday"
    ];
    let WeekDay = days[date.getDay()];
    let Day = date.getDate();
    let Month = months[date.getMonth()];
    let Year = date.getFullYear();
    date = WeekDay + ", " + Day + " " + Month + " " + Year;
    date1.innerHTML = date;
    let t = setTimeout(function () {
      time();
    }, 1000);
    function updateTime(k) {
      if (k < 10) {
        return "0" + k;
      } else {
        return k;
      }
    }
    if (
      hour == hour1.value &&
      min == min1.value &&
      sec == sec1.value &&
      WeekDay == weekDay1.value &&
      Day == day1.value &&
      Month == month1.value &&
      Year == year1.value
    ) {
      let confirm = document.getElementById("confirm");
      alertSound.play();
      alert("Time to" + " " + confirm.value);
      popup.style.display = "none";
      hour1.value = "";
      min1.value = "";
      sec1.value = "";
      weekDay1.value = "";
      day1.value = "";
      month1.value = "";
      year1.value = "";
      confirm.value = "";
    }
  }
  time();
}

function check(Checkbox) {
  let Label = Checkbox.parentElement;
  let Li = Label.parentElement;
  let Index = liIndexInUl(Li);

  if (Checkbox.checked === true) {
    Label.classList.add("checked");
    arrayList2[Index] = true;
  } else {
    Label.classList.remove("checked");
    arrayList2[Index] = false;
  }
  saveArray();
}

function remove(Delete) {
  let Li = Delete.parentElement;
  let Index = liIndexInUl(Li);
  arrayList.splice(Index, 1);
  arrayList2.splice(Index, 1);
  saveArray();
  Li.remove();
}

function liIndexInUl(li) {
  let index = Array.prototype.indexOf.call(li.parentElement.children, li);
  return index;
}

              
            
!
999px

Console