From e05e5aed31794cf1c2cad9d407c90a0979e2d119 Mon Sep 17 00:00:00 2001 From: grtcdr Date: Fri, 7 Apr 2023 17:08:02 +0100 Subject: [PATCH] Make the READMEs more consistent --- startpage_1/README.md | 9 ++-- startpage_1/src/script.js | 2 +- startpage_2/README.md | 12 ++--- startpage_2/src/script.js | 4 +- startpage_3/README.md | 7 +-- startpage_3/src/icons/reddit.svg | 1 - startpage_3/src/icons/youtube.svg | 1 - startpage_3/src/script.js | 78 ++++++++++++------------------- startpage_4/README.md | 7 +-- startpage_5/README.md | 14 +++--- startpage_6/README.md | 23 ++------- startpage_7/README.md | 13 ++---- 12 files changed, 58 insertions(+), 113 deletions(-) delete mode 100644 startpage_3/src/icons/reddit.svg delete mode 100644 startpage_3/src/icons/youtube.svg diff --git a/startpage_1/README.md b/startpage_1/README.md index 0cbc410..9d4399a 100644 --- a/startpage_1/README.md +++ b/startpage_1/README.md @@ -1,10 +1,7 @@ -# Screenshot of this startpage +![Startpage 1](preview.webp) -![Screenshot](preview.webp) - -__Main features:__ -- Search engine selection +- Built-in search integration - Quick access to your favorite websites - Time-based greeting -_Big thanks to u/Teiem1 from reddit for refactoring the script.js of this startpage!_ +Thanks to u/Teiem1 from Reddit for refactoring `script.js`. diff --git a/startpage_1/src/script.js b/startpage_1/src/script.js index cb16119..167b44f 100644 --- a/startpage_1/src/script.js +++ b/startpage_1/src/script.js @@ -19,7 +19,7 @@ function check_if_search_empty(event) { } // The same as "onload" -window.addEventListener('load', (event) => { +window.addEventListener('load', () => { let today = new Date(); let time = today.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); determineGreet(new Date().getHours()); diff --git a/startpage_2/README.md b/startpage_2/README.md index d80b47a..d1368f3 100644 --- a/startpage_2/README.md +++ b/startpage_2/README.md @@ -1,11 +1,5 @@ -# Screenshot of this startpage +![Startpage 2](preview.webp) -![Screenshot](preview.webp) - -__Main features:__ -- Quick access to your favorite websites -- Light/Dark Mode +- Quickly access your favorite websites +- Persistent light/dark mode - Time-based greeting - -### Todo: -- [x] Startpage remembers the last mode you were in and sets it on load diff --git a/startpage_2/src/script.js b/startpage_2/src/script.js index 026fbf1..d0f60c1 100644 --- a/startpage_2/src/script.js +++ b/startpage_2/src/script.js @@ -6,7 +6,6 @@ else mode = localStorage.getItem('data'); const determineGreet = hours => document.getElementById("greeting").innerText = `Good ${hours < 12 ? "Morning," : hours < 18 ? "Afternoon," : "Evening,"} ${username}.`; -// The same as "onload" window.addEventListener('load', (event) => { let today = new Date(); let time = today.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); @@ -49,7 +48,6 @@ function dark_colors() { mode_id.style.filter = "invert(100%) sepia(0%) saturate(1620%) hue-rotate(8deg) brightness(94%) contrast(88%)"; for (i = 0; i < link.length; i++) link[i].style.color = "#bbb"; - } function light_colors() { @@ -66,4 +64,4 @@ function light_colors() { function change_colors(mode) { if (mode == "dark") light_colors(); else dark_colors(); -} \ No newline at end of file +} diff --git a/startpage_3/README.md b/startpage_3/README.md index 0374841..e9cf6d3 100644 --- a/startpage_3/README.md +++ b/startpage_3/README.md @@ -1,8 +1,5 @@ -# Screenshot of this startpage +![Startpage 3](preview.webp) -![Screenshot](preview.webp) - -__Main features:__ -- Search engine selection +- Built-in search bar - Quick access to your favorite websites - Card-like list navigation diff --git a/startpage_3/src/icons/reddit.svg b/startpage_3/src/icons/reddit.svg deleted file mode 100644 index f5824da..0000000 --- a/startpage_3/src/icons/reddit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/startpage_3/src/icons/youtube.svg b/startpage_3/src/icons/youtube.svg deleted file mode 100644 index 2619b08..0000000 --- a/startpage_3/src/icons/youtube.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/startpage_3/src/script.js b/startpage_3/src/script.js index e0a2e1b..a3fec2d 100644 --- a/startpage_3/src/script.js +++ b/startpage_3/src/script.js @@ -1,65 +1,49 @@ -let se = 3; +let se = 1; -//document.addEventListener("touchstart", function() {}, true); - -// The same as "onload" -window.addEventListener('load', (event) => { - let today = new Date(); - let time = today.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); - displayTime(time); +window.addEventListener('load', () => { + let today = new Date(); + let time = today.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); + displayTime(time); }); setInterval(function () { - var today = new Date(); - var time = today.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); - document.getElementById("time").innerHTML = time; + var today = new Date(); + var time = today.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); + document.getElementById("time").innerHTML = time; }, 1000); function displayTime(time) { - document.getElementById("time").innerHTML = time; + document.getElementById("time").innerHTML = time; } -//-----------------------------------------------------------------------------------// -// This part of the code takes care of the search engine, cycling and searching etc. // -//-----------------------------------------------------------------------------------// +function preventEmptySearch(event) { + if (document.forms["search_eng_form"]["q"].value == "") { + event.preventDefault(); + } +} -// Listens for click event in se_button, once clicked, se increments by one and cycleSearchEngines() is called to update the icon, placeholder, and form action document.getElementById("se_button").addEventListener("click", function() { - se++; - cycleSearchEngines(se); + se++; + cycleSearchEngines(se); }); -//Do not allow searching if the user clicks "GO" when the search box is empty -function check_if_search_empty(event) { -if (document.forms["search_eng_form"]["q"].value == "") { - event.preventDefault(); -}} - -document.getElementById("go_btn").addEventListener("click", function(){ - check_if_search_empty(event); +document.getElementById("go_btn").addEventListener("click", function(event) { + preventEmptySearch(event); }); const search_engines = [{ - src: "ddg.svg", - placeholder: "DuckDuckGo", - action: "https://www.duckduckgo.com/" - }, { - src: "goog.svg", - placeholder: "Google", - action: "https://www.google.com/search?q=" - }, { - src: "reddit.svg", - placeholder: "Reddit", - action: "https://www.reddit.com/search?q=" - }, { - src: "youtube.svg", - placeholder: "YouTube", - action: "https://www.youtube.com/results?q=" + src: "ddg.svg", + placeholder: "DuckDuckGo", + action: "https://www.duckduckgo.com/" +}, { + src: "goog.svg", + placeholder: "Google", + action: "https://www.google.com/search?q=" }]; - + const cycleSearchEngines = se => { - const curData = search_engines[(se+1) % search_engines.length]; - document.getElementById("se_icon").src = "icons/" + curData.src; - document.getElementById("search").placeholder = "Searching with " + curData.placeholder; - document.getElementById("search_eng_form").action = curData.action; -}; \ No newline at end of file + const curData = search_engines[(se+1) % search_engines.length]; + document.getElementById("se_icon").src = "icons/" + curData.src; + document.getElementById("search").placeholder = "Searching with " + curData.placeholder; + document.getElementById("search_eng_form").action = curData.action; +}; diff --git a/startpage_4/README.md b/startpage_4/README.md index 5f0f150..b24b5c3 100644 --- a/startpage_4/README.md +++ b/startpage_4/README.md @@ -1,7 +1,4 @@ -# Screenshot of this startpage +![Startpage 4](preview.webp) -![Screenshot](preview.webp) - -__Main features:__ - Mobile-friendly design -- Quick access to your favorite websites +- Quickly access your favorite websites diff --git a/startpage_5/README.md b/startpage_5/README.md index d6dc72f..263cc18 100644 --- a/startpage_5/README.md +++ b/startpage_5/README.md @@ -1,9 +1,7 @@ -# Screenshot of this startpage +![Startpage 5](preview.webp) -![Screenshot](preview.webp) - -__Main features:__ -- Terminal-like input/output -- Quick access to your favorite websites -- Search through the web using _d_ (DuckDuckGo) or _g_ (Google) and type your search query -- Supported commands are listed in the help menu \ No newline at end of file +- Terminal-like input/output paradigm +- Quickly access your favorite websites +- Search the web using by typing `d` (DuckDuckGo) or `g` (Google) and + then your search query +- Supported commands are listed in the help menu diff --git a/startpage_6/README.md b/startpage_6/README.md index 8adb086..faea80d 100644 --- a/startpage_6/README.md +++ b/startpage_6/README.md @@ -1,14 +1,8 @@ -
-

Snow

+![Startpage 6](preview.webp) -startpage_7 preview - -
- -### Main Features -- Quick access to your favorite websites -- Supports __web-ext__, you can build this startpage into an extension. -- Built-in search bar: +- Quickly access your favorite websites +- Supports `web-ext`, you can build this startpage into an extension +- Built-in search integration [^1]: - __When focused on the search bar__: - Press `Escape` to unfocus - Press `Enter` to search @@ -17,11 +11,4 @@ - Press `j` to switch to the next search engine - Press `k` to switch to the previous search engine -- The search bar features 5 ways to search the web: - - Using Google - - Using DuckDuckGo - - Using Github - - Using StackOverflow - - Using Reddit - -If you'd like to add some other search engines, see `js/search.js` +[^1]: If you'd like to add some other search engines, make the necessary changes to `js/search.js`. diff --git a/startpage_7/README.md b/startpage_7/README.md index 3c55da5..3390898 100644 --- a/startpage_7/README.md +++ b/startpage_7/README.md @@ -1,14 +1,9 @@ -
-

Quisp

- startpage_7 preview -
+![Startpage 7](preview.webp) Quisp is a startpage built with Qutebrowser [1] and Lisp [2] in mind. -1. Links are easy to traverse with the help of the "Follow Hint" feature. +1. Links are easy to traverse with the help of the "Follow hint" feature. 2. Links are displayed in the form of a data structure. -### Main Features - -- Quick access to your favorite websites -- Supports __web-ext__, you can build this startpage into an extension. +- Quickly access your favorite websites +- Supports `web-ext` meaning you can build this startpage into an extension -- 2.45.2