Getting there
All checks were successful
Build and Deploy Hugo Site / build-and-deploy (push) Successful in 9s
All checks were successful
Build and Deploy Hugo Site / build-and-deploy (push) Successful in 9s
This commit is contained in:
@@ -1,22 +1,668 @@
|
||||
body {
|
||||
color: #222;
|
||||
font-family: sans-serif;
|
||||
line-height: 1.5;
|
||||
margin: 1rem;
|
||||
max-width: 768px;
|
||||
/* Google Fonts */
|
||||
@import url('https://fonts.googleapis.com/css2?family=Pacifico&family=Roboto+Mono:wght@700&display=swap');
|
||||
|
||||
/* CSS Variables for theming */
|
||||
:root {
|
||||
--bg-color: #ffffff;
|
||||
--text-color: #333333;
|
||||
--text-secondary: #666666;
|
||||
--border-color: #e0e0e0;
|
||||
--link-color: #0066cc;
|
||||
--link-hover: #004499;
|
||||
--code-bg: #f5f5f5;
|
||||
--code-text: #333333;
|
||||
--header-border: #cccccc;
|
||||
}
|
||||
|
||||
/* Dark mode - system preference */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) {
|
||||
--bg-color: #1a1a1a;
|
||||
--text-color: #e0e0e0;
|
||||
--text-secondary: #a0a0a0;
|
||||
--border-color: #404040;
|
||||
--link-color: #6699ff;
|
||||
--link-hover: #99bbff;
|
||||
--code-bg: #2a2a2a;
|
||||
--code-text: #e0e0e0;
|
||||
--header-border: #404040;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dark mode - manual override */
|
||||
[data-theme="dark"] {
|
||||
--bg-color: #1a1a1a;
|
||||
--text-color: #e0e0e0;
|
||||
--text-secondary: #a0a0a0;
|
||||
--border-color: #404040;
|
||||
--link-color: #6699ff;
|
||||
--link-hover: #99bbff;
|
||||
--code-bg: #2a2a2a;
|
||||
--code-text: #e0e0e0;
|
||||
--header-border: #404040;
|
||||
}
|
||||
|
||||
/* Base styles */
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
line-height: 1.7;
|
||||
margin: 0;
|
||||
padding: 2rem 1rem;
|
||||
font-size: 18px;
|
||||
transition: background-color 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
/* Center content */
|
||||
body > * {
|
||||
max-width: 720px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
/* Header styles */
|
||||
header {
|
||||
border-bottom: 1px solid #222;
|
||||
border-bottom: 2px solid var(--header-border);
|
||||
padding-bottom: 1.5rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.site-title-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.site-header h1 {
|
||||
margin: 0 0 0.25rem 0;
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.site-header .subtitle {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
color: var(--text-secondary);
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
min-height: 1.5em;
|
||||
}
|
||||
|
||||
/* Theme toggle button */
|
||||
.theme-toggle {
|
||||
background: none;
|
||||
border: 2px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
padding: 0.5rem 0.75rem;
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.theme-toggle:hover {
|
||||
background-color: var(--code-bg);
|
||||
border-color: var(--link-color);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.theme-toggle:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
/* Footer styles */
|
||||
footer {
|
||||
border-top: 2px solid var(--header-border);
|
||||
padding-top: 1.5rem;
|
||||
margin-top: 3rem;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.footer-social {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.footer-social a {
|
||||
color: var(--text-secondary);
|
||||
transition: color 0.2s ease, transform 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.footer-social a:hover {
|
||||
color: var(--link-color);
|
||||
transform: translateY(-2px);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer-content p {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Typography */
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.3;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
/* Links */
|
||||
a {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
code {
|
||||
background-color: var(--code-bg);
|
||||
color: var(--code-text);
|
||||
padding: 0.2em 0.4em;
|
||||
border-radius: 3px;
|
||||
font-size: 0.9em;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: var(--code-bg);
|
||||
color: var(--code-text);
|
||||
padding: 1rem;
|
||||
border-radius: 5px;
|
||||
overflow-x: auto;
|
||||
line-height: 1.5;
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* Lists */
|
||||
ul, ol {
|
||||
margin-bottom: 1.5rem;
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
/* Images */
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 5px;
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
|
||||
/* Blockquotes */
|
||||
blockquote {
|
||||
border-left: 4px solid var(--link-color);
|
||||
margin: 1.5rem 0;
|
||||
padding-left: 1rem;
|
||||
color: var(--text-secondary);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Notice boxes and callouts */
|
||||
.notice {
|
||||
margin: 1.5rem 0;
|
||||
padding: 1rem 1.25rem;
|
||||
border-radius: 8px;
|
||||
border-left: 4px solid;
|
||||
}
|
||||
|
||||
.notice-info {
|
||||
background-color: #e3f2fd;
|
||||
border-color: #2196f3;
|
||||
color: #0d47a1;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .notice-info {
|
||||
background-color: #1a2332;
|
||||
border-color: #42a5f5;
|
||||
color: #90caf9;
|
||||
}
|
||||
|
||||
.notice-warning {
|
||||
background-color: #fff3e0;
|
||||
border-color: #ff9800;
|
||||
color: #e65100;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .notice-warning {
|
||||
background-color: #2d2416;
|
||||
border-color: #ffa726;
|
||||
color: #ffcc80;
|
||||
}
|
||||
|
||||
.notice-success {
|
||||
background-color: #e8f5e9;
|
||||
border-color: #4caf50;
|
||||
color: #1b5e20;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .notice-success {
|
||||
background-color: #1a2e1b;
|
||||
border-color: #66bb6a;
|
||||
color: #a5d6a7;
|
||||
}
|
||||
|
||||
/* Pastel highlights and callouts */
|
||||
.highlight-yellow {
|
||||
background-color: #fff9c4;
|
||||
padding: 0.1em 0.3em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .highlight-yellow {
|
||||
background-color: #3d3a1a;
|
||||
color: #fff59d;
|
||||
}
|
||||
|
||||
.highlight-pink {
|
||||
background-color: #fce4ec;
|
||||
padding: 0.1em 0.3em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .highlight-pink {
|
||||
background-color: #3a2529;
|
||||
color: #f8bbd0;
|
||||
}
|
||||
|
||||
.highlight-blue {
|
||||
background-color: #e1f5fe;
|
||||
padding: 0.1em 0.3em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .highlight-blue {
|
||||
background-color: #1a2a33;
|
||||
color: #b3e5fc;
|
||||
}
|
||||
|
||||
/* Navigation menu */
|
||||
nav ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 1rem 0 0 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
nav li {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Site title link */
|
||||
.site-title-link {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.site-title-link:hover {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Stylized logo */
|
||||
.logo-sometimes {
|
||||
font-family: 'Pacifico', cursive;
|
||||
font-weight: 400;
|
||||
margin-right: 0.3rem;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .logo-sometimes {
|
||||
background: linear-gradient(135deg, #a78bfa 0%, #c084fc 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.logo-code {
|
||||
font-family: 'Roboto Mono', 'Courier New', monospace;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.cursor {
|
||||
display: inline-block;
|
||||
font-family: 'Roboto Mono', 'Courier New', monospace;
|
||||
font-weight: 700;
|
||||
color: #00ff41;
|
||||
animation: cursor-blink 1s ease-in-out infinite;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .cursor {
|
||||
color: #00ff41;
|
||||
}
|
||||
|
||||
.cursor::after {
|
||||
content: '_';
|
||||
}
|
||||
|
||||
@keyframes cursor-blink {
|
||||
0%, 49% {
|
||||
opacity: 1;
|
||||
}
|
||||
50%, 100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Post list on homepage */
|
||||
.posts-list {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.post-summary {
|
||||
margin-bottom: 3rem;
|
||||
padding-bottom: 2rem;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.post-summary:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.post-summary h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
|
||||
.post-summary h2 a {
|
||||
color: var(--text-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.post-summary h2 a:hover {
|
||||
color: var(--link-color);
|
||||
}
|
||||
|
||||
/* Post metadata */
|
||||
.post-meta {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 1rem;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.post-categories {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.category {
|
||||
background-color: var(--code-bg);
|
||||
padding: 0.2rem 0.6rem;
|
||||
border-radius: 3px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* Post excerpt */
|
||||
.post-excerpt {
|
||||
color: var(--text-color);
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.read-more {
|
||||
display: inline-block;
|
||||
margin-top: 0.5rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Single post page */
|
||||
.post-header {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.post-header h1 {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.post-header .post-meta {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.post-content {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
/* Post tags */
|
||||
.post-footer {
|
||||
margin-top: 3rem;
|
||||
padding-top: 2rem;
|
||||
border-top: 2px solid var(--border-color);
|
||||
}
|
||||
|
||||
.post-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.post-tags strong {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.tag {
|
||||
background-color: var(--code-bg);
|
||||
color: var(--link-color);
|
||||
padding: 0.3rem 0.8rem;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9rem;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.tag:hover {
|
||||
background-color: var(--link-color);
|
||||
color: var(--bg-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Edit page link */
|
||||
.edit-page {
|
||||
margin-top: 2rem;
|
||||
padding-top: 1.5rem;
|
||||
border-top: 1px solid var(--border-color);
|
||||
text-align: center;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.edit-page a {
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.edit-page a:hover {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.edit-page svg {
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.edit-page a:hover svg {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
/* Post navigation */
|
||||
.post-nav {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 3rem;
|
||||
padding-top: 2rem;
|
||||
border-top: 2px solid var(--border-color);
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.post-nav-prev,
|
||||
.post-nav-next {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.post-nav-next {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.post-nav a {
|
||||
display: inline-block;
|
||||
padding: 0.75rem 1.25rem;
|
||||
background-color: var(--code-bg);
|
||||
border-radius: 5px;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.post-nav a:hover {
|
||||
background-color: var(--link-color);
|
||||
color: var(--bg-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Featured post on homepage */
|
||||
.featured-post {
|
||||
margin-bottom: 3rem;
|
||||
padding-bottom: 3rem;
|
||||
border-bottom: 2px solid var(--border-color);
|
||||
}
|
||||
|
||||
.featured-post h1 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: 1px solid #222;
|
||||
margin-top: 1rem;
|
||||
.featured-content {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00e;
|
||||
text-decoration: none;
|
||||
.section-divider {
|
||||
margin: 3rem 0 2rem 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.section-divider h2 {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding: 0 2rem;
|
||||
margin: 0;
|
||||
background-color: var(--bg-color);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.section-divider::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
height: 2px;
|
||||
background-color: var(--border-color);
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media (max-width: 640px) {
|
||||
body {
|
||||
font-size: 16px;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.site-header h1 {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.35rem;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.theme-toggle {
|
||||
min-width: 44px;
|
||||
height: 44px;
|
||||
padding: 0.4rem;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.post-nav {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.post-nav-next {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,117 @@
|
||||
console.log('This site was generated by Hugo.');
|
||||
|
||||
// Theme toggle functionality
|
||||
(function() {
|
||||
const STORAGE_KEY = 'theme-preference';
|
||||
|
||||
const getColorPreference = () => {
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
if (stored) {
|
||||
return stored;
|
||||
}
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
};
|
||||
|
||||
const setPreference = (theme) => {
|
||||
localStorage.setItem(STORAGE_KEY, theme);
|
||||
reflectPreference(theme);
|
||||
};
|
||||
|
||||
const reflectPreference = (theme) => {
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
const button = document.querySelector('#theme-toggle');
|
||||
if (button) {
|
||||
button.setAttribute('aria-label', theme === 'dark' ? 'Switch to light theme' : 'Switch to dark theme');
|
||||
button.textContent = theme === 'dark' ? '☀️' : '🌙';
|
||||
}
|
||||
};
|
||||
|
||||
// Set initial theme
|
||||
const theme = getColorPreference();
|
||||
reflectPreference(theme);
|
||||
|
||||
// Set up toggle button when DOM is ready
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const button = document.querySelector('#theme-toggle');
|
||||
if (button) {
|
||||
button.addEventListener('click', () => {
|
||||
const currentTheme = document.documentElement.getAttribute('data-theme');
|
||||
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
|
||||
setPreference(newTheme);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for system theme changes
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches: isDark }) => {
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
if (!stored) {
|
||||
setPreference(isDark ? 'dark' : 'light');
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
// Typing animation for subtitle with mistakes
|
||||
(function() {
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const subtitleElement = document.querySelector('.site-header .subtitle');
|
||||
if (!subtitleElement) return;
|
||||
|
||||
const fullText = subtitleElement.textContent;
|
||||
subtitleElement.textContent = '';
|
||||
|
||||
// Define the typing sequence with mistakes happening naturally
|
||||
const sequence = [
|
||||
{ action: 'type', text: "echo 'Coding, family, life'; // by Chris Sm" },
|
||||
{ action: 'type', text: 't' },
|
||||
{ action: 'type', text: 'i' },
|
||||
{ action: 'type', text: 'h' },
|
||||
{ action: 'pause', duration: 400 },
|
||||
{ action: 'backspace', count: 3 },
|
||||
{ action: 'pause', duration: 200 },
|
||||
{ action: 'type', text: 'ith' }
|
||||
];
|
||||
|
||||
let currentText = '';
|
||||
let sequenceIndex = 0;
|
||||
let charIndex = 0;
|
||||
|
||||
function executeSequence() {
|
||||
if (sequenceIndex >= sequence.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const step = sequence[sequenceIndex];
|
||||
|
||||
if (step.action === 'type') {
|
||||
if (charIndex < step.text.length) {
|
||||
currentText += step.text[charIndex];
|
||||
subtitleElement.textContent = currentText;
|
||||
charIndex++;
|
||||
setTimeout(executeSequence, 80 + Math.random() * 40);
|
||||
} else {
|
||||
charIndex = 0;
|
||||
sequenceIndex++;
|
||||
setTimeout(executeSequence, 100);
|
||||
}
|
||||
} else if (step.action === 'backspace') {
|
||||
if (charIndex < step.count) {
|
||||
currentText = currentText.slice(0, -1);
|
||||
subtitleElement.textContent = currentText;
|
||||
charIndex++;
|
||||
setTimeout(executeSequence, 60);
|
||||
} else {
|
||||
charIndex = 0;
|
||||
sequenceIndex++;
|
||||
setTimeout(executeSequence, 100);
|
||||
}
|
||||
} else if (step.action === 'pause') {
|
||||
sequenceIndex++;
|
||||
setTimeout(executeSequence, step.duration);
|
||||
}
|
||||
}
|
||||
|
||||
// Start typing after a short delay
|
||||
setTimeout(executeSequence, 500);
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user