-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
178 lines (154 loc) · 5.86 KB
/
script.js
File metadata and controls
178 lines (154 loc) · 5.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
$(document).ready(function() {
// Define content for different pages
const pageContent = {
home: {
welcomeText: `def create_and_scale(vision, tools, execution):`,
introText: `Build, Scale, and Lead with Confidence—From Startup to Sustainable Growth.
Parameters:
- vision (dict): Define your goals, refine your strategy, and establish a clear roadmap.
- tools (list): Select and integrate the right digital solutions to automate, optimize, and scale efficiently.
- execution (list): Implement structured methodologies to drive growth, streamline operations, and sustain success.
Returns:
- dict: A fully realized business model designed for clarity, efficiency, and long-term scalability—whether launching a startup or leading an established business.
[Establish Connection]`
},
services: {
// We'll only type "def frameworks(" and "):" once.
// The middle keyword (formerly 'digital_transformation') will cycle through the list below.
introText: `Parameters:
- strategy (dict): Custom roadmaps for your business growth
- technology (list): Cutting-edge tools and platforms
- execution (list): Proven methodologies for success
Returns:
- dict: Transformative solutions that drive real business results`
}
};
// Keywords to rotate through in Services page heading, and to list below
const keywords = [
"Business Strategy & Organization",
"Business Coaching & Leadership",
"Integrated Online Presence & Strategy",
"Fractional Executive Services",
"Customer Growth & Sales Strategy",
"Digital Engagement & Marketing",
"AI-Powered Automation",
"Scalable Business Operations",
"CRM & Sales Optimization",
"Content Marketing & SEO",
"User Experience & Brand Identity",
"Project & Product Management",
"Full-Stack Business Development",
"Process Improvement & SOPs",
"Entrepreneurial Growth Roadmaps",
"Building Systems for Scale",
"Good Ideas"
];
// Detect which page we are on
const isHomePage = window.location.pathname.endsWith('index.html') || window.location.pathname === '/';
const currentPage = isHomePage ? 'home' : 'services';
const content = pageContent[currentPage];
// Grab references to DOM elements
const welcomeHeading = document.getElementById('welcome-heading');
const introTextElement = document.getElementById('intro-text');
const dynamicKeywordElement = document.getElementById('dynamic-keyword'); // Optional if needed
const keywordsListElement = document.getElementById('keywords-list');
/**
* Simple typewriter for multi-line text
* (Used on the Home page and for the Services "introText".)
*/
function typeWriter(text, element, delay = 50, i = 0) {
if (!element) return; // safeguard if element doesn't exist
if (i < text.length) {
element.innerHTML += text.charAt(i);
setTimeout(() => typeWriter(text, element, delay, i + 1), delay);
}
}
/**
* Create a static list of all keywords (Services page).
*/
function listAllKeywords() {
if (!keywordsListElement) return;
keywordsListElement.innerHTML = "";
keywords.forEach(keyword => {
const li = document.createElement('li');
li.textContent = keyword;
keywordsListElement.appendChild(li);
});
}
/**
* Cycle through keywords in the Services page heading:
* "def frameworks(keyword_here):"
*/
function cycleKeywordsInHeading() {
if (!welcomeHeading) return;
const prefix = "def frameworks(";
const suffix = "):";
let currentKeywordIndex = 0;
let letterIndex = 0;
let isErasing = false;
const typingDelay = 100; // speed of typing
const erasingDelay = 100; // speed of erasing
const waitBeforeErase = 2000; // pause after finishing a word before erasing
function typeLoop() {
const currentKeyword = keywords[currentKeywordIndex];
if (!isErasing) {
// Typing forward
welcomeHeading.textContent = prefix + currentKeyword.substring(0, letterIndex) + suffix;
letterIndex++;
if (letterIndex <= currentKeyword.length) {
setTimeout(typeLoop, typingDelay);
} else {
// Finished typing full keyword, wait a bit then start erasing
setTimeout(() => {
isErasing = true;
setTimeout(typeLoop, erasingDelay);
}, waitBeforeErase);
}
} else {
// Erasing
welcomeHeading.textContent = prefix + currentKeyword.substring(0, letterIndex) + suffix;
letterIndex--;
if (letterIndex >= 0) {
setTimeout(typeLoop, erasingDelay);
} else {
// Finished erasing, move to next keyword
isErasing = false;
currentKeywordIndex = (currentKeywordIndex + 1) % keywords.length;
setTimeout(typeLoop, typingDelay);
}
}
}
// Start the cycle
// First, type out the "def frameworks(" and skip to the dynamic portion
welcomeHeading.textContent = prefix;
typeLoop();
}
// =============== PAGE-SPECIFIC LOGIC ===============
if (currentPage === 'home') {
// Home page: type entire welcomeText and introText
if (welcomeHeading) {
typeWriter(content.welcomeText, welcomeHeading);
}
if (introTextElement) {
typeWriter(content.introText, introTextElement, 30);
}
} else {
// Services page:
// 1. Replace digital_transformation with typed keywords
// "def frameworks(keyword):"
// 2. Type out intro text below
// 3. List all keywords
// Clear heading first
if (welcomeHeading) {
welcomeHeading.textContent = "";
}
// Start cycling the keyword portion in the heading
cycleKeywordsInHeading();
// Type out the intro text if there's an element
if (introTextElement) {
typeWriter(content.introText, introTextElement, 30);
}
// Show a static list of all keywords
listAllKeywords();
}
});