-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
142 lines (133 loc) · 4.55 KB
/
script.js
File metadata and controls
142 lines (133 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
const inputBox = document.getElementById("input-box");
const listContainer = document.getElementById("list-container");
const campingGear = [
"Tent (with stakes and guylines)",
"Sleeping bag (appropriate for the season)",
"Sleeping pad or air mattress",
"Camping pillow",
"Headlamp or flashlight (with extra batteries)",
"Camping stove or portable grill",
"Cooking utensils (pot, pan, spatula, etc.)",
"Lighter or waterproof matches",
"Food and snacks",
"Cooler and ice packs",
"Reusable water bottle or hydration system",
"Water filter or purification tablets",
"Camping chairs or portable seating",
"Clothing (weather-appropriate, including layers)",
"Rain gear (rain jacket, poncho)",
"First aid kit",
"Personal hygiene items (toothbrush, toothpaste, hand sanitizer)",
"Insect repellent",
"Sunscreen and lip balm with SPF",
"Map and compass or GPS device",
"Multi-tool or knife",
"Trash bags and recycling bags",
"Campfire gear (firestarter, kindling, if allowed)",
"Toiletries (biodegradable soap, trowel for digging a cat hole)",
"Camera or binoculars (for wildlife viewing)",
"Sunglasses and hat",
"Campground reservation confirmation or permit"
];
const hotWeatherGear = ["Hat", "Sun Screen", "Sun Glasses", "Water Bottle"];
const coldWeatherGear = ["Hat", "Coat", "Hand Warmers", "Gloves", "Wool Socks"];
const beachGear = [
"Beach towel or blanket",
"Swimsuit",
"Sunscreen (SPF 30 or higher)",
"Beach hat or cap",
"Sunglasses",
"Beach umbrella or sunshade",
"Beach chairs",
"Cooler with ice packs",
"Snacks and drinks",
"Reusable water bottle",
"Beach bag",
"Beach shoes or sandals",
"Change of clothes",
"Beach toys (frisbee, beach ball, etc.)",
"Books or magazines",
"Portable speaker (optional)",
"Wet wipes or hand sanitizer",
"Trash bags (to clean up after yourself)",
"Ziplock bags (for wet or sandy items)",
"Personal identification and keys",
"Camera or phone for photos",
"Beach-safe sunscreen lip balm",
"Beach mat or portable lounge chair"
];
const campingFunGear = ["Throwable (Frisbee, Football etc...)", "Smores Ingredients", "Yard Game (Spikeball, Cornhole, etc...)", "Playing Cards", "Bicycle", "Hammock"];
const college = [
"Bedding (sheets, pillows, blanket, mattress protector)",
"Towels (bath and hand towels)",
"Clothing (seasonal clothing, underwear, socks)",
"Laundry supplies (detergent, dryer sheets, laundry basket)",
"Toiletries (toothbrush, toothpaste, shampoo, soap, etc.)",
"School supplies (notebooks, pens, pencils, highlighters)",
"Laptop and charger",
"Phone and charger",
"Personal identification (ID, driver's license)",
"First aid kit (band-aids, pain relievers, etc.)",
"Kitchen supplies (reusable water bottle, microwave-safe dishes, utensils)",
"Non-perishable snacks (granola bars, chips, etc.)",
"Cleaning supplies (disinfectant wipes, broom, dustpan)",
"Comfort items (photos, decorations, favorite books)",
"Power strips and extension cords",
"Alarm clock or bedside lamp",
"Backpack or tote bag",
"Reusable shopping bags",
"Umbrella and rain gear",
"Bike or other transportation (if applicable)",
"Basic tools (screwdriver, tape, etc.)"
];
function addTask() {
if (inputBox.value === '') {
alert("You Must Write Something!");
}
else {
createTask(inputBox.value);
}
}
listContainer.addEventListener("click", function(e){
if (e.target.tagName === "LI") {
e.target.classList.toggle("checked")
saveData();
}
else if (e.target.tagName === "SPAN") {
e.target.parentElement.remove();
saveData();
}
}, false);
function saveData() {
localStorage.setItem("data", listContainer.innerHTML);
}
function showTask() {
listContainer.innerHTML = localStorage.getItem("data");
}
function group(list) {
for (let i = 0; i < list.length; i++) {
createTask(list[i]);
}
}
function clearList() {
listContainer.innerHTML = "";
saveData();
}
function createTask(item) {
let x = document.getElementsByTagName('li');
for (i = 0; i < x.length; i++) {
if (x[i].innerHTML.includes(item)) {
inputBox.value = '';
return;
}
}
let li = document.createElement("li");
li.innerHTML = item;
listContainer.appendChild(li);
let span = document.createElement("span");
span.innerHTML = "\u00d7";
li.appendChild(span);
inputBox.value = '';
saveData();
}
showTask();