generated from nhcarrigan/template
Compare commits
5 Commits
cdc0f71a0f
...
v1.2.1
Author | SHA1 | Date | |
---|---|---|---|
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
|
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@ -2,5 +2,11 @@
|
|||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit"
|
"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: {
|
rules: {
|
||||||
"no-console": "off"
|
"no-console": "off",
|
||||||
|
"max-lines": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
11
index.html
11
index.html
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "website-headers",
|
"name": "website-headers",
|
||||||
"version": "1.1.0",
|
"version": "1.2.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"build:watch": "tsc --watch",
|
"build:watch": "tsc --watch",
|
||||||
"lint": "eslint src --max-warnings 0",
|
"lint": "eslint src --max-warnings 0",
|
||||||
"start": "node --watch prod/develop.js",
|
"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"
|
"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": [],
|
"keywords": [],
|
||||||
|
85
src/index.ts
85
src/index.ts
@ -165,7 +165,7 @@ footer {
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
height: 75px;
|
height: 75px;
|
||||||
padding-left: 100px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: unset;
|
color: unset;
|
||||||
@ -185,9 +185,6 @@ a {
|
|||||||
#tree-nation-offset-website {
|
#tree-nation-offset-website {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
footer {
|
|
||||||
padding-right: 100px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -221,6 +218,7 @@ videoOverlay.style.opacity = "0.25";
|
|||||||
videoOverlay.style.width = "100vw";
|
videoOverlay.style.width = "100vw";
|
||||||
videoOverlay.style.height = "100vh";
|
videoOverlay.style.height = "100vh";
|
||||||
videoOverlay.style.objectFit = "cover";
|
videoOverlay.style.objectFit = "cover";
|
||||||
|
videoOverlay.style.zIndex = "10000";
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
@ -249,11 +247,6 @@ const interval = setInterval(() => {
|
|||||||
`;
|
`;
|
||||||
const fontAwesome = document.createElement("script");
|
const fontAwesome = document.createElement("script");
|
||||||
fontAwesome.src = "https://kit.fontawesome.com/f949111719.js";
|
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");
|
const analytics = document.createElement("script");
|
||||||
analytics.defer = true;
|
analytics.defer = true;
|
||||||
analytics.setAttribute("domain", "nhcarrigan.com");
|
analytics.setAttribute("domain", "nhcarrigan.com");
|
||||||
@ -293,7 +286,6 @@ head?.appendChild(styles);
|
|||||||
|
|
||||||
head?.appendChild(treeNation);
|
head?.appendChild(treeNation);
|
||||||
head?.appendChild(fontAwesome);
|
head?.appendChild(fontAwesome);
|
||||||
head?.appendChild(hubspot);
|
|
||||||
head?.appendChild(analytics);
|
head?.appendChild(analytics);
|
||||||
head?.appendChild(analytics2);
|
head?.appendChild(analytics2);
|
||||||
|
|
||||||
@ -318,3 +310,76 @@ playButton?.addEventListener("click", () => {
|
|||||||
playButton.innerHTML = "<i class=\"fa-solid fa-pause\"></i>";
|
playButton.innerHTML = "<i class=\"fa-solid fa-pause\"></i>";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #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