-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbookmarks.html
More file actions
142 lines (128 loc) · 3.85 KB
/
bookmarks.html
File metadata and controls
142 lines (128 loc) · 3.85 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Bookmarks</title>
<link rel="stylesheet" href="isaac_styles.css" />
<link rel="stylesheet" href="spencer_styles.css" />
<style>
/* Popup styles */
.popup-message {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
border: 2px solid #333;
padding: 20px 30px;
z-index: 2000;
box-shadow: 0 0 15px rgba(0,0,0,0.3);
text-align: center;
border-radius: 10px;
}
.popup-message p {
margin: 10px 0;
}
.ok-btn {
margin-top: 15px;
padding: 8px 20px;
cursor: pointer;
}
/* Overlay to dim background */
#overlay {
display: none;
position: fixed;
top:0;
left:0;
width:100vw;
height:100vh;
background: rgba(0,0,0,0.4);
z-index: 1500;
}
</style>
</head>
<body>
<iframe src="menu.html?page=bookmarks.html" class="menu-iframe" id="menu-iframe" title="menu" style="display:block;height:62px;border:0;position:fixed;top:0;left:0;width:100%;z-index:1000;"></iframe>
<div class="page">
<div class="content-area">
<div class="section-bar">
<h2 class="available-title">Bookmarks</h2>
</div>
<div class="table-wrap">
<table class="bookmark-table">
<thead>
<tr>
<th>Position</th>
<th>Company</th>
<th>Location</th>
<th>Open Until</th>
<th>Date Posted</th>
<th class="remove-col"></th>
</tr>
</thead>
</table>
<div class="table-scroll">
<table class="bookmark-table">
<tbody id="bookmark-body"></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Overlay -->
<div id="overlay"></div>
<!-- Popup -->
<div id="popup" class="popup-message">
<p id="popup-title"></p>
<p id="popup-subtitle"></p>
<p id="popup-extra"></p>
<button id="popup-ok" class="ok-btn">OK</button>
</div>
</body>
<script>
const popup = document.getElementById("popup");
const overlay = document.getElementById("overlay");
const popupTitle = document.getElementById("popup-title");
const popupSubtitle = document.getElementById("popup-subtitle");
const popupExtra = document.getElementById("popup-extra");
const popupOkBtn = document.getElementById("popup-ok");
function showPopup(title, subtitle = "", extra = "") {
popupTitle.innerHTML = title;
popupSubtitle.innerHTML = subtitle;
popupExtra.innerHTML = extra;
popup.style.display = "block";
overlay.style.display = "block";
}
function hidePopup() {
popup.style.display = "none";
overlay.style.display = "none";
}
// Clicking overlay closes popup (for bookmark)
overlay.onclick = hidePopup;
</script>
<script>
let bookmarks = JSON.parse(localStorage.getItem("bookmarks")) || [];
const tbody = document.getElementById("bookmark-body");
bookmarks.forEach((bookmark, index) => {
console.log(bookmark, index);
const tr = document.createElement("tr");
tr.innerHTML = `
<td><a class="job-link" href="${bookmark.link}" target="_top">${bookmark.title}</a></td>
<td>${bookmark.company}</td>
<td>${bookmark.location}</td>
<td>${bookmark.openUntil}</td>
<td>${bookmark.posted}</td>
<td><button class="remove-btn">Remove</button></td>`;
tbody.appendChild(tr);
tr.querySelector(".remove-btn").addEventListener("click", () => {
bookmarks.splice(index, 1);
localStorage.setItem("bookmarks", JSON.stringify(bookmarks));
tr.remove();
showPopup("Bookmark Removed Successfully");
popupOkBtn.onclick = hidePopup;
});
});
</script>
</html>