generated from nhcarrigan/template
Compare commits
13 Commits
cdc0f71a0f
...
v1.5.0
Author | SHA1 | Date | |
---|---|---|---|
93a2339c92
|
|||
3e3213c554
|
|||
2e7d5d26e4
|
|||
52a7b5b812
|
|||
6be8026024
|
|||
c10089c351
|
|||
5b8b597d7d
|
|||
dd7d4042ea
|
|||
bf87dc345f
|
|||
017261c80b
|
|||
8f76c3b9f1
|
|||
b5701520fa | |||
4e05e999b5 |
38
.gitea/workflows/ci.yml
Normal file
38
.gitea/workflows/ci.yml
Normal file
@ -0,0 +1,38 @@
|
||||
name: Node.js CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint and Test
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Files
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js v22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint Source Files
|
||||
run: pnpm run lint
|
||||
|
||||
- name: Verify Build
|
||||
run: pnpm run build
|
||||
|
||||
- name: Run Tests
|
||||
run: pnpm run test
|
34
.gitea/workflows/sonar.yml
Normal file
34
.gitea/workflows/sonar.yml
Normal file
@ -0,0 +1,34 @@
|
||||
name: Code Analysis
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
sonar:
|
||||
name: SonarQube
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Files
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: SonarCube Scan
|
||||
uses: SonarSource/sonarqube-scan-action@v4
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONAR_HOST_URL: "https://quality.nhcarrigan.com"
|
||||
with:
|
||||
args: >
|
||||
-Dsonar.sources=.
|
||||
-Dsonar.projectKey=website-headers
|
||||
|
||||
- name: SonarQube Quality Gate check
|
||||
uses: sonarsource/sonarqube-quality-gate-action@v1
|
||||
with:
|
||||
pollingTimeoutSec: 600
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONAR_HOST_URL: "https://quality.nhcarrigan.com"
|
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@ -2,5 +2,11 @@
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit"
|
||||
},
|
||||
"eslint.validate": ["typescript"]
|
||||
"eslint.validate": [
|
||||
"typescript"
|
||||
],
|
||||
"sonarlint.connectedMode.project": {
|
||||
"connectionId": "nhcarrigan",
|
||||
"projectKey": "nhcarrigan_website-headers"
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ export default [
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
"no-console": "off"
|
||||
"no-console": "off",
|
||||
"max-lines": "off"
|
||||
}
|
||||
}
|
||||
];
|
||||
|
30
index.html
30
index.html
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "website-headers",
|
||||
"version": "1.1.0",
|
||||
"version": "1.5.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
@ -11,7 +11,7 @@
|
||||
"build:watch": "tsc --watch",
|
||||
"lint": "eslint src --max-warnings 0",
|
||||
"start": "node --watch prod/develop.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"test": "echo \"Error: no test specified\" && exit 0",
|
||||
"scan": "SONAR_TOKEN='op://Environment Variables - Development/SonarCloud/website-headers' op run -- sonar-scanner -Dsonar.organization=nhcarrigan -Dsonar.projectKey=nhcarrigan_website-headers -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io"
|
||||
},
|
||||
"keywords": [],
|
||||
|
202
src/index.ts
202
src/index.ts
@ -112,8 +112,8 @@ styles.innerHTML = `
|
||||
}
|
||||
|
||||
:root {
|
||||
--foreground: #04624f;
|
||||
--background: #abfcecdd;
|
||||
--foreground: #db7093;
|
||||
--background: #ffefefbb;
|
||||
}
|
||||
|
||||
* {
|
||||
@ -152,20 +152,35 @@ main {
|
||||
width: 95%;
|
||||
max-width: 1080px;
|
||||
margin: auto;
|
||||
margin-bottom: 100px;
|
||||
margin-bottom: 105px;
|
||||
padding: 10px;
|
||||
}
|
||||
footer {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: var(--foreground);
|
||||
background-color: var(--background);
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
height: 95px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
#footer-inner-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 75px;
|
||||
padding-left: 100px;
|
||||
}
|
||||
#footer-badge-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, 1fr);
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
#audio-theme-button, #theme-select-button {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: url('https://cdn.nhcarrigan.com/cursors/pointer.cur'), pointer;
|
||||
color: var(--foreground);
|
||||
}
|
||||
a {
|
||||
color: unset;
|
||||
@ -175,18 +190,46 @@ a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
#audio-theme-button {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: url('https://cdn.nhcarrigan.com/cursors/pointer.cur'), pointer;
|
||||
color: var(--foreground);
|
||||
.is-dark {
|
||||
--foreground: #ffefef;
|
||||
--background: #db7093bb;
|
||||
}
|
||||
@media screen and (max-width: 600px) {
|
||||
@media screen and (prefers-reduced-motion) {
|
||||
#footer-badge-container {
|
||||
display: none;
|
||||
}
|
||||
footer, #footer-inner-container {
|
||||
height: 75px;
|
||||
justify-content: space-around;
|
||||
}
|
||||
main {
|
||||
margin-bottom: 85px;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1225px) {
|
||||
#footer-badge-container {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
footer {
|
||||
height: 120px;
|
||||
}
|
||||
main {
|
||||
margin-bottom: 130px;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 625px) {
|
||||
#tree-nation-offset-website {
|
||||
display: none;
|
||||
}
|
||||
footer {
|
||||
padding-right: 100px;
|
||||
#footer-badge-container {
|
||||
display: none;
|
||||
}
|
||||
footer, #footer-inner-container {
|
||||
height: 50px;
|
||||
justify-content: space-around;
|
||||
}
|
||||
main {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -197,14 +240,29 @@ a {
|
||||
|
||||
const footer = document.createElement("footer");
|
||||
footer.innerHTML = `
|
||||
<div id="footer-badge-container">
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/bigots.gif" alt="no bigots allowed"/>
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/blm.gif" alt="black lives matter"/>
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/miku.gif" alt="miku fan!!!"/>
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/neuro.gif" alt="neurodivergent pride"/>
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/palestine.gif" alt="free palestine"/>
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/technomancer.gif" alt="technomancer"/>
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/trans.gif" alt="trans rights!!!"/>
|
||||
<img src="https://cdn.nhcarrigan.com/blinkies/ukraine.gif" alt="glory to ukraine"/>
|
||||
</div>
|
||||
<div id="footer-inner-container">
|
||||
<p>© Naomi Carrigan</p>
|
||||
<a href="https://chat.nhcarrigan.com" target="_blank" rel="noreferrer">
|
||||
<i class="fa-solid fa-comments"></i>
|
||||
</a>
|
||||
<button id="theme-select-button" type="button">
|
||||
<i id="theme-select-icon" class="fa-solid fa-moon"></i>
|
||||
</button>
|
||||
<button id="audio-theme-button" type="button">
|
||||
<i class="fa-solid fa-play"></i>
|
||||
</button>
|
||||
<div id="tree-nation-offset-website"></div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
const videoOverlay = document.createElement("video");
|
||||
@ -221,6 +279,7 @@ videoOverlay.style.opacity = "0.25";
|
||||
videoOverlay.style.width = "100vw";
|
||||
videoOverlay.style.height = "100vh";
|
||||
videoOverlay.style.objectFit = "cover";
|
||||
videoOverlay.style.zIndex = "10000";
|
||||
|
||||
// #endregion
|
||||
|
||||
@ -249,11 +308,6 @@ const interval = setInterval(() => {
|
||||
`;
|
||||
const fontAwesome = document.createElement("script");
|
||||
fontAwesome.src = "https://kit.fontawesome.com/f949111719.js";
|
||||
const hubspot = document.createElement("script");
|
||||
hubspot.src = "https://js.hs-scripts.com/47086586.js";
|
||||
hubspot.async = true;
|
||||
hubspot.defer = true;
|
||||
hubspot.id = "hs-script-loader";
|
||||
const analytics = document.createElement("script");
|
||||
analytics.defer = true;
|
||||
analytics.setAttribute("domain", "nhcarrigan.com");
|
||||
@ -293,7 +347,6 @@ head?.appendChild(styles);
|
||||
|
||||
head?.appendChild(treeNation);
|
||||
head?.appendChild(fontAwesome);
|
||||
head?.appendChild(hubspot);
|
||||
head?.appendChild(analytics);
|
||||
head?.appendChild(analytics2);
|
||||
|
||||
@ -318,3 +371,110 @@ playButton?.addEventListener("click", () => {
|
||||
playButton.innerHTML = "<i class=\"fa-solid fa-pause\"></i>";
|
||||
}
|
||||
});
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Theme
|
||||
|
||||
const themeButton = document.querySelector("#theme-select-button");
|
||||
const themeIcon = document.querySelector("#theme-select-icon");
|
||||
if (localStorage.getItem("theme") === "dark") {
|
||||
themeIcon?.classList.remove("fa-moon");
|
||||
themeIcon?.classList.add("fa-sun");
|
||||
document.querySelector("html")?.classList.add("is-dark");
|
||||
}
|
||||
const toggleTheme = (): void => {
|
||||
const currentTheme = localStorage.getItem("theme");
|
||||
if (currentTheme === "dark") {
|
||||
localStorage.setItem("theme", "light");
|
||||
themeIcon?.classList.remove("fa-sun");
|
||||
themeIcon?.classList.add("fa-moon");
|
||||
document.querySelector("html")?.classList.remove("is-dark");
|
||||
return;
|
||||
}
|
||||
localStorage.setItem("theme", "dark");
|
||||
themeIcon?.classList.remove("fa-moon");
|
||||
themeIcon?.classList.add("fa-sun");
|
||||
document.querySelector("html")?.classList.add("is-dark");
|
||||
};
|
||||
themeButton?.addEventListener("click", toggleTheme);
|
||||
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
if (prefersDark.matches && localStorage.getItem("theme") !== null) {
|
||||
localStorage.setItem("theme", "dark");
|
||||
themeIcon?.classList.remove("fa-moon");
|
||||
themeIcon?.classList.add("fa-sun");
|
||||
document.querySelector("html")?.classList.add("is-dark");
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region CTA
|
||||
|
||||
const cta = document.createElement("dialog");
|
||||
cta.style.position = "fixed";
|
||||
cta.style.top = "50%";
|
||||
cta.style.left = "50%";
|
||||
cta.style.transform = "translate(-50%, -50%)";
|
||||
cta.style.padding = "10px";
|
||||
cta.style.borderRadius = "10px";
|
||||
cta.style.backgroundColor = "var(--background)";
|
||||
cta.style.color = "var(--foreground)";
|
||||
cta.style.textAlign = "center";
|
||||
cta.style.width = "95%";
|
||||
cta.style.maxWidth = "400px";
|
||||
cta.id = "community-cta";
|
||||
cta.innerHTML = `
|
||||
<h1 autofocus>Hello~!</h1>
|
||||
<div style="display: flex; justify-content: space-around; margin-bottom: 10px;">
|
||||
<img src="https://cdn.nhcarrigan.com/profile.png" alt="Naomi Carrigan" style="width: 100px; height: 100px; border-radius: 50%;">
|
||||
<p>
|
||||
Consider joining our community so you can keep up to date on all of our latest activities!
|
||||
</p>
|
||||
</div>
|
||||
<a href="https://chat.nhcarrigan.com" target="_blank" rel="noreferrer" style="padding: 10px; background: var(--foreground); color: var(--background); outline: none">Okay, take me there~!</a>
|
||||
`;
|
||||
|
||||
const modalBg = document.createElement("div");
|
||||
modalBg.style.zIndex = "4999";
|
||||
modalBg.style.position = "fixed";
|
||||
modalBg.style.top = "0";
|
||||
modalBg.style.left = "0";
|
||||
modalBg.style.width = "100vw";
|
||||
modalBg.style.height = "100vh";
|
||||
modalBg.style.backgroundColor = "rgba(0, 0, 0, 0.5)";
|
||||
modalBg.style.display = "none";
|
||||
modalBg.id = "modal-bg";
|
||||
const closeModal = (): void => {
|
||||
cta.close();
|
||||
modalBg.style.display = "none";
|
||||
};
|
||||
const handleModalClick = (event: MouseEvent): void => {
|
||||
event.stopPropagation();
|
||||
if (event.target === cta) {
|
||||
closeModal();
|
||||
}
|
||||
};
|
||||
const showModal = (): void => {
|
||||
const lastShown = Number.parseInt(
|
||||
localStorage.getItem("naomi-community-cta") ?? "0",
|
||||
10,
|
||||
);
|
||||
const lastShownDate = new Date(lastShown);
|
||||
const diff = Date.now() - lastShownDate.getTime();
|
||||
console.table({ diff, lastShown, lastShownDate });
|
||||
// We only want to show this once a week.
|
||||
if (diff < 1000 * 60 * 60 * 24 * 7) {
|
||||
return;
|
||||
}
|
||||
cta.showModal();
|
||||
modalBg.style.display = "block";
|
||||
modalBg.addEventListener("click", closeModal);
|
||||
const closeButton = cta.querySelector("button");
|
||||
closeButton?.addEventListener("click", closeModal);
|
||||
cta.addEventListener("click", handleModalClick);
|
||||
localStorage.setItem("naomi-community-cta", Date.now().toString());
|
||||
};
|
||||
|
||||
body?.appendChild(cta);
|
||||
body?.appendChild(modalBg);
|
||||
showModal();
|
||||
|
Reference in New Issue
Block a user