~grtcdr/startpages

e05e5aed31794cf1c2cad9d407c90a0979e2d119 — grtcdr 1 year, 8 months ago 530fee1
Make the READMEs more consistent
12 files changed, 58 insertions(+), 113 deletions(-)

M startpage_1/README.md
M startpage_1/src/script.js
M startpage_2/README.md
M startpage_2/src/script.js
M startpage_3/README.md
D startpage_3/src/icons/reddit.svg
D startpage_3/src/icons/youtube.svg
M startpage_3/src/script.js
M startpage_4/README.md
M startpage_5/README.md
M startpage_6/README.md
M startpage_7/README.md
M startpage_1/README.md => startpage_1/README.md +3 -6
@@ 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`.

M startpage_1/src/script.js => startpage_1/src/script.js +1 -1
@@ 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());

M startpage_2/README.md => startpage_2/README.md +3 -9
@@ 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

M startpage_2/src/script.js => startpage_2/src/script.js +1 -3
@@ 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
}

M startpage_3/README.md => startpage_3/README.md +2 -5
@@ 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

D startpage_3/src/icons/reddit.svg => startpage_3/src/icons/reddit.svg +0 -1
@@ 1,1 0,0 @@
<?xml version="1.0" ?><svg enable-background="new 0 0 32 32" version="1.1" viewBox="0 0 32 32" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Flat_copy"><path d="M11.517,20.696c-1.434,0-2.601-1.166-2.601-2.6c0-1.433,1.167-2.599,2.601-2.599c1.433,0,2.599,1.166,2.599,2.599   C14.117,19.53,12.951,20.696,11.517,20.696z M30.331,18.884c0.039,0.297,0.059,0.59,0.059,0.875c0,5.406-6.468,9.804-14.417,9.804   S1.556,25.165,1.556,19.759c0-0.295,0.022-0.601,0.065-0.912C0.601,18.095,0,16.917,0,15.649c0-2.198,1.788-3.986,3.986-3.986   c0.858,0,1.691,0.279,2.377,0.79c2.471-1.503,5.623-2.379,8.935-2.483l2.54-7.217l6.086,1.455c0.574-1.086,1.694-1.771,2.939-1.771   c1.835,0,3.327,1.493,3.327,3.327c0,1.835-1.493,3.327-3.327,3.327c-1.725,0-3.151-1.324-3.312-3.009L19.067,5.01l-1.755,4.988   c3.077,0.194,5.996,1.063,8.301,2.472c0.69-0.523,1.532-0.808,2.401-0.808c2.198,0,3.986,1.788,3.986,3.986   C32,16.943,31.381,18.134,30.331,18.884z M1.91,15.649c0,0.399,0.118,0.787,0.332,1.119c0.525-1.113,1.348-2.163,2.417-3.084   c-0.215-0.074-0.441-0.112-0.673-0.112C2.841,13.572,1.91,14.504,1.91,15.649z M28.48,19.759c0-4.353-5.611-7.895-12.507-7.895   S3.466,15.406,3.466,19.759c0,4.353,5.611,7.894,12.507,7.894C22.87,27.653,28.48,24.112,28.48,19.759z M27.303,13.698   c1.076,0.931,1.901,1.992,2.423,3.118c0.235-0.342,0.364-0.747,0.364-1.167c0-1.145-0.931-2.077-2.076-2.077   C27.769,13.572,27.529,13.615,27.303,13.698z M25.445,5.764c0,0.781,0.636,1.417,1.417,1.417c0.782,0,1.417-0.636,1.417-1.417   c0-0.782-0.636-1.417-1.417-1.417C26.081,4.346,25.445,4.982,25.445,5.764z M20.773,22.73c-0.259,0-0.501,0.102-0.675,0.279   c-0.052,0.05-1.3,1.227-4.15,1.227c-2.815,0-3.95-1.176-3.953-1.18c-0.181-0.208-0.444-0.328-0.72-0.328   c-0.227,0-0.447,0.081-0.62,0.229c-0.194,0.166-0.312,0.397-0.332,0.652c-0.02,0.255,0.061,0.502,0.227,0.695   c0.044,0.052,0.461,0.523,1.342,0.973c1.13,0.577,2.495,0.869,4.057,0.869c1.552,0,2.933-0.287,4.107-0.854   c0.909-0.439,1.362-0.897,1.411-0.949c0.359-0.376,0.348-0.978-0.026-1.343C21.26,22.826,21.024,22.73,20.773,22.73z    M20.743,15.497c-1.434,0-2.601,1.166-2.601,2.599c0,1.434,1.167,2.6,2.601,2.6c1.433,0,2.599-1.166,2.599-2.6   C23.343,16.663,22.177,15.497,20.743,15.497z"/></g></svg>
\ No newline at end of file

D startpage_3/src/icons/youtube.svg => startpage_3/src/icons/youtube.svg +0 -1
@@ 1,1 0,0 @@
<?xml version="1.0" ?><!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M260.4,449c-57.1-1.8-111.4-3.2-165.7-5.3c-11.7-0.5-23.6-2.3-35-5c-21.4-5-36.2-17.9-43.8-39c-6.1-17-8.3-34.5-9.9-52.3   C2.5,305.6,2.5,263.8,4.2,222c1-23.6,1.6-47.4,7.9-70.3c3.8-13.7,8.4-27.1,19.5-37c11.7-10.5,25.4-16.8,41-17.5   c42.8-2.1,85.5-4.7,128.3-5.1c57.6-0.6,115.3,0.2,172.9,1.3c24.9,0.5,50,1.8,74.7,5c22.6,3,39.5,15.6,48.5,37.6   c6.9,16.9,9.5,34.6,11,52.6c3.9,45.1,4,90.2,1.8,135.3c-1.1,22.9-2.2,45.9-8.7,68.2c-7.4,25.6-23.1,42.5-49.3,48.3   c-10.2,2.2-20.8,3-31.2,3.4C366.2,445.7,311.9,447.4,260.4,449z M205.1,335.3c45.6-23.6,90.7-47,136.7-70.9   c-45.9-24-91-47.5-136.7-71.4C205.1,240.7,205.1,287.6,205.1,335.3z"/></g></svg>
\ No newline at end of file

M startpage_3/src/script.js => startpage_3/src/script.js +31 -47
@@ 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;
};

M startpage_4/README.md => startpage_4/README.md +2 -5
@@ 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

M startpage_5/README.md => startpage_5/README.md +6 -8
@@ 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

M startpage_6/README.md => startpage_6/README.md +5 -18
@@ 1,14 1,8 @@
<div align="center">
<h1>Snow</h1>
![Startpage 6](preview.webp)

<img src="preview.webp" alt="startpage_7 preview" />

</div>

### 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`.

M startpage_7/README.md => startpage_7/README.md +4 -9
@@ 1,14 1,9 @@
<div align="center">
  <h1>Quisp</h1>
  <img src="preview.webp" alt="startpage_7 preview" />
</div>
![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