Skip to content

Commit aa6bdb4

Browse files
authored
release/0.5 (#1)
* Added quote of the day widget, added vignette, fixed a lot of bugs * Add version to a sidebar
1 parent 548ea48 commit aa6bdb4

File tree

15 files changed

+363
-29
lines changed

15 files changed

+363
-29
lines changed

NewTabExtension.zip

35.7 KB
Binary file not shown.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
![Main page](Screenshots/Main_page.png "Main page")
2-
![Sidebar, Main page with image from Pixabay](Screenshots/Sidebar,_Main_page_with_image_from_Pixabay.png "Sidebar, Main page with image from Pixabay")
3-
![Sticky notes functionality](Screenshots/Sticky_notes_functionality.png "Sticky notes functionality")
4-
![Weather widget](Screenshots/Weather_widget.png "Weather widget")
52
![Greeting, time and date format, sidebar](Screenshots/Greeting%2C_time_and_date_format%2C_sidebar.png "Greeting, time and date format, sidebar")
63

74
# 🌌 New Tab Extension ([Addons.Mozilla.org](https://addons.mozilla.org/en-US/firefox/addon/new_tab_extension/))
@@ -50,6 +47,12 @@ To make the extension your homepage:
5047
- ⚡ Fast and lightweight - no performance impact
5148
- 🔒 Private — no data collection, no analytics
5249

50+
51+
![Sidebar, Main page with image from Pixabay](Screenshots/Sidebar,_Main_page_with_image_from_Pixabay.png "Sidebar, Main page with image from Pixabay")
52+
![Sticky notes functionality](Screenshots/Sticky_notes_functionality.png "Sticky notes functionality")
53+
![Weather widget](Screenshots/Weather_widget.png "Weather widget")
54+
![Quotes widget](Screenshots/Quote_with_customization.png "Quotes widget with customization")
55+
5356
---
5457

5558
## 💡 Developer Notes
898 KB
Loading

index.html

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<link rel="stylesheet" href="styles/sticky-notes.style.css"/>
1515
<link rel="stylesheet" href="styles/weather.style.css"/>
1616
<link rel="stylesheet" href="styles/greeting.style.css"/>
17+
<link rel="stylesheet" href="styles/quotes.style.css"/>
1718

1819
<link href="https://fonts.googleapis.com/css2?family=Roboto&family=Open+Sans&family=Lato&family=Quicksand&family=Fira+Sans&display=swap" rel="stylesheet">
1920
</head>
@@ -22,6 +23,7 @@
2223
<button id="add-sticky-note">➕ Add Sticky Note</button>
2324

2425
<div id="background-layer"></div>
26+
<div id="vignette-layer"></div>
2527

2628
<button id="menu-toggle" class="menu-button"></button>
2729

@@ -215,6 +217,7 @@ <h4>Background Effects</h4>
215217
<label>Blur: <input type="range" id="bg-blur" min="0" max="40" step="1" value="0"></label>
216218
<label>Brightness: <input type="range" id="bg-brightness" min="20" max="150" step="1"
217219
value="100"></label>
220+
<label>Vignette Intensity: <input type="range" id="bg-vignette" min="0" max="100" step="1" value="0"></label>
218221
<label>Image Fit:
219222
<select id="bg-fit">
220223
<option value="cover">Cover</option>
@@ -299,13 +302,72 @@ <h3>Greeting widget</h3>
299302
</div>
300303
</div>
301304
</section>
305+
306+
<!-- 🗣️ Daily Quote Widget -->
307+
<section data-section="quote-widget">
308+
<div class="section-header">
309+
<span class="section-icon">🗣️</span>
310+
<h3>Daily Quote widget</h3>
311+
<button class="toggle-section">+</button>
312+
</div>
313+
<div class="section-content">
314+
<div class="font-control">
315+
<label>Font:</label>
316+
<select id="quote-font">
317+
<option value="Arial">Arial (default)</option>
318+
<option value="Segoe UI">Segoe UI</option>
319+
<option value="Georgia">Georgia</option>
320+
<option value="Courier New">Courier New</option>
321+
<option value="Roboto">Roboto</option>
322+
<option value="Helvetica">Helvetica</option>
323+
<option value="Verdana">Verdana</option>
324+
<option value="Tahoma">Tahoma</option>
325+
<option value="Trebuchet MS">Trebuchet MS</option>
326+
<option value="Lucida Sans">Lucida Sans</option>
327+
<option value="Times New Roman">Times New Roman</option>
328+
<option value="Fira Sans">Fira Sans</option>
329+
<option value="Open Sans">Open Sans</option>
330+
<option value="Lato">Lato</option>
331+
<option value="Quicksand">Quicksand</option>
332+
<option value="Monaco">Monaco</option>
333+
</select>
334+
</div>
335+
<div class="font-control">
336+
<label>Text color:</label>
337+
<input type="color" id="quote-color">
338+
</div>
339+
<div class="font-control">
340+
<label>Quote size:</label>
341+
<input type="number" id="quote-size" min="10" max="48" value="18"> px
342+
</div>
343+
344+
<button id="reset-quote-widget" class="reset-button">Reset Time & Date Settings</button>
345+
346+
<div class="section-toggle-controls">
347+
<label>
348+
<input type="checkbox" id="toggle-quote">
349+
Show Quote
350+
</label>
351+
</div>
352+
</div>
353+
</section>
354+
355+
<div id="version-info">
356+
Version: loading...
357+
</div>
302358
</div>
303359

360+
<div class="greeting" id="greeting"></div>
361+
304362
<div class="time-container">
305363
<div class="time" id="time">00:00</div>
306364
<div class="date" id="date" data-tooltip="01-15-2025">July 20 2025</div>
365+
366+
<div class="quote-container" id="quote-container">
367+
<div class="quote-text" id="quote-text">Loading quote...</div>
368+
<div class="quote-author" id="quote-author"></div>
369+
</div>
307370
</div>
308-
<div class="greeting" id="greeting"></div>
309371

310372
<div class="links" id="links-container"></div>
311373

@@ -320,6 +382,7 @@ <h3>Greeting widget</h3>
320382

321383
<script src="scripts/config.js"></script>
322384
<script src="scripts/main.js"></script>
385+
<script src="scripts/version.js"></script>
323386
<script src="scripts/effects/effects-main.js"></script>
324387
<script src="scripts/effects/star-generator.js"></script>
325388
<script src="scripts/effects/blob-flow.js"></script>
@@ -333,5 +396,6 @@ <h3>Greeting widget</h3>
333396
<script src="scripts/sticky-notes.js"></script>
334397
<script src="scripts/weather.js"></script>
335398
<script src="scripts/greeting.js"></script>
399+
<script src="scripts/quotes.js"></script>
336400
</body>
337401
</html>

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "New Tab Extension",
44
"description": "An extension for about:newtab that brings life to the new tab.",
5-
"version": "0.4",
5+
"version": "0.5.2",
66
"homepage_url": "https://github.com/OldValencia/NewTab",
77

88
"chrome_url_overrides": {

scripts/effects/effects-main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ function disableDynamicBackground() {
55
backgroundLayer.style.backgroundRepeat = "";
66
backgroundLayer.style.backgroundPosition = "";
77
document.body.style.backgroundImage = "";
8+
vignetteLayer.style.background = "";
89
}

scripts/effects/star-generator.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function enableStarfield() {
3232
}
3333

3434
function createShootingStar() {
35-
const { innerWidth: width } = window;
35+
const {innerWidth: width} = window;
3636
const star = document.createElement('div');
3737
starObserver.observe(star);
3838
star.classList.add('shooting-star');
@@ -42,8 +42,8 @@ function createShootingStar() {
4242
setTimeout(() => star.remove(), STARFIELD_CONFIG.shootingStarLifetime);
4343
}
4444

45-
function createStar({ mini = false } = {}) {
46-
const { innerWidth: width, innerHeight: height } = window;
45+
function createStar({mini = false} = {}) {
46+
const {innerWidth: width, innerHeight: height} = window;
4747
const star = document.createElement('div');
4848
starObserver.observe(star);
4949
star.classList.add(mini ? 'mini-star' : 'star');
@@ -80,6 +80,9 @@ function throttle(fn, delay) {
8080
}
8181

8282
window.addEventListener('resize', throttle(() => {
83-
disableStarfield();
84-
enableStarfield();
83+
const settings = loadCustomSettings();
84+
if (settings.bgMode === "stars") {
85+
disableStarfield();
86+
enableStarfield();
87+
}
8588
}, 500));

scripts/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ function applyBackgroundEffects(settings) {
2222
const brightness = settings.bgBrightness || 100;
2323

2424
backgroundLayer.style.filter = `blur(${blur}px) brightness(${brightness}%)`;
25+
const intensity = settings.bgVignette;
26+
const alpha = intensity / 100 * 0.8;
27+
vignetteLayer.style.background = `radial-gradient(ellipse at center, rgba(0,0,0,0) 60%, rgba(0,0,0,${alpha}) 100%)`;
2528
}
2629

2730
function applyBackgroundFit(fit) {

scripts/quotes.js

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
const quoteContainer = document.getElementById("quote-container");
2+
const quoteText = document.getElementById("quote-text");
3+
const quoteAuthor = document.getElementById("quote-author");
4+
const quoteFontElement = document.getElementById("quote-font");
5+
const quoteColorElement = document.getElementById("quote-color");
6+
const quoteSizeElement = document.getElementById("quote-size");
7+
const quoteToggleElement = document.getElementById("toggle-quote");
8+
const quoteDefaultFont = "Arial";
9+
const quoteDefaultColor = "#6c6c6c";
10+
const quoteDefaultTextSize = "10";
11+
const quoteDefaultShowState = false;
12+
13+
function loadQuoteOfTheDay() {
14+
const quoteKey = "quotableQuote";
15+
const fetchDateKey = "quotableQuoteDate";
16+
const today = new Date().toISOString().split("T")[0];
17+
18+
const savedQuote = localStorage.getItem(quoteKey);
19+
const savedDate = localStorage.getItem(fetchDateKey);
20+
21+
if (savedQuote && savedDate === today) {
22+
const quoteData = JSON.parse(savedQuote);
23+
displayQuote(quoteData.content, quoteData.author);
24+
} else {
25+
fetch("https://api.quotable.io/random")
26+
.then(res => res.json())
27+
.then(data => {
28+
const quote = data.content;
29+
const author = data.author;
30+
31+
localStorage.setItem(quoteKey, JSON.stringify({content: quote, author}));
32+
localStorage.setItem(fetchDateKey, today);
33+
34+
displayQuote(quote, author);
35+
})
36+
.catch(() => {
37+
quoteText.textContent = "Could not load quote.";
38+
quoteAuthor.textContent = "";
39+
});
40+
}
41+
}
42+
43+
function displayQuote(quote, author) {
44+
quoteText.textContent = `“${quote}”`;
45+
quoteAuthor.textContent = `— ${author}`;
46+
}
47+
48+
function applyQuoteSettings() {
49+
const settings = loadCustomSettings();
50+
if (!settings.quoteFont) {
51+
settings.quoteFont = quoteDefaultFont;
52+
}
53+
54+
if (!settings.quoteColor) {
55+
settings.quoteColor = quoteDefaultColor;
56+
}
57+
58+
if (!settings.quoteSize) {
59+
settings.quoteSize = quoteDefaultTextSize;
60+
}
61+
62+
if (settings.quoteShowState === undefined || settings.quoteShowState === null) {
63+
settings.quoteShowState = quoteDefaultShowState;
64+
}
65+
saveCustomSettings(settings);
66+
67+
quoteText.style.fontFamily = settings.quoteFont;
68+
quoteAuthor.style.fontFamily = settings.quoteFont;
69+
quoteText.style.color = settings.quoteColor;
70+
quoteAuthor.style.color = settings.quoteColor;
71+
quoteText.style.fontSize = `${settings.quoteSize}px`;
72+
quoteAuthor.style.fontSize = `${Math.max(settings.quoteSize - 2, 10)}px`;
73+
74+
quoteContainer.style.display = settings.quoteShowState ? "block" : "none";
75+
76+
// Sync UI controls
77+
quoteFontElement.value = settings.quoteFont;
78+
quoteColorElement.value = settings.quoteColor;
79+
quoteSizeElement.value = settings.quoteSize;
80+
quoteToggleElement.checked = settings.quoteShowState;
81+
}
82+
83+
function setupQuoteWidgetControls() {
84+
quoteFontElement.addEventListener("change", e => {
85+
const settings = loadCustomSettings();
86+
settings.quoteFont = e.target.value;
87+
saveCustomSettings(settings);
88+
applyQuoteSettings();
89+
});
90+
91+
quoteColorElement.addEventListener("input", e => {
92+
const settings = loadCustomSettings();
93+
settings.quoteColor = e.target.value;
94+
saveCustomSettings(settings);
95+
applyQuoteSettings();
96+
});
97+
98+
quoteSizeElement.addEventListener("input", e => {
99+
const settings = loadCustomSettings();
100+
settings.quoteSize = e.target.value;
101+
saveCustomSettings(settings);
102+
applyQuoteSettings();
103+
});
104+
105+
quoteToggleElement.addEventListener("change", e => {
106+
const settings = loadCustomSettings();
107+
settings.quoteShowState = e.target.checked;
108+
saveCustomSettings(settings);
109+
applyQuoteSettings();
110+
});
111+
112+
document.getElementById("reset-quote-widget").addEventListener("click", () => {
113+
const settings = loadCustomSettings();
114+
delete settings.quoteFont;
115+
delete settings.quoteColor;
116+
delete settings.quoteSize;
117+
delete settings.quoteShowState;
118+
saveCustomSettings(settings);
119+
applyQuoteSettings();
120+
});
121+
}
122+
123+
document.addEventListener("DOMContentLoaded", () => {
124+
loadQuoteOfTheDay();
125+
applyQuoteSettings();
126+
setupQuoteWidgetControls();
127+
});

0 commit comments

Comments
 (0)