Spaces:
Running
Running
Update index.html
Browse files- index.html +118 -46
index.html
CHANGED
|
@@ -169,55 +169,127 @@
|
|
| 169 |
|
| 170 |
// Paste this code inside the existing document.addEventListener('DOMContentLoaded', () => { ... });
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
}
|
| 193 |
-
};
|
| 194 |
-
|
| 195 |
-
// --- Function to update the display ---
|
| 196 |
-
const updatePointsDisplay = () => {
|
| 197 |
-
const selectedRole = document.querySelector('input[name="filmRole"]:checked').value;
|
| 198 |
-
const data = pointsData[selectedRole];
|
| 199 |
-
|
| 200 |
-
pointsResultDiv.innerHTML = `
|
| 201 |
-
<h4 class="text-2xl font-bold text-blue-600">${data.points}</h4>
|
| 202 |
-
<p class="text-xs text-gray-600 mt-1">${data.description}</p>
|
| 203 |
-
`;
|
| 204 |
-
};
|
| 205 |
-
|
| 206 |
-
// --- Event Listeners ---
|
| 207 |
-
toggleCalculatorBtn.addEventListener('click', () => {
|
| 208 |
-
pointsCalculatorPanel.classList.toggle('hidden');
|
| 209 |
-
pointsCalculatorPanel.classList.toggle('opacity-0');
|
| 210 |
-
pointsCalculatorPanel.classList.toggle('translate-y-4');
|
| 211 |
-
// Update display when panel opens
|
| 212 |
-
updatePointsDisplay();
|
| 213 |
-
});
|
| 214 |
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
-
|
| 220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
});
|
| 222 |
|
| 223 |
</script>
|
|
|
|
| 169 |
|
| 170 |
// Paste this code inside the existing document.addEventListener('DOMContentLoaded', () => { ... });
|
| 171 |
|
| 172 |
+
<script>
|
| 173 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 174 |
+
|
| 175 |
+
// #################################################################
|
| 176 |
+
// ## LOGIC FOR THE "INDICATE YOUR INTEREST" PANEL (FORM)
|
| 177 |
+
// #################################################################
|
| 178 |
+
const interestForm = document.getElementById('interestForm');
|
| 179 |
+
if (interestForm) {
|
| 180 |
+
// --- CONFIGURATION ---
|
| 181 |
+
const WORKER_URL = 'https://contact-form-api.aiagents.workers.dev/';
|
| 182 |
+
// --- STATE ---
|
| 183 |
+
let isSubmitting = false;
|
| 184 |
+
// --- ELEMENTS ---
|
| 185 |
+
const togglePanelBtn = document.getElementById('togglePanel');
|
| 186 |
+
const floatingPanel = document.getElementById('floatingPanel');
|
| 187 |
+
const closePanelBtn = document.getElementById('closePanel');
|
| 188 |
+
const formContainer = document.getElementById('formContainer');
|
| 189 |
+
const successMessage = document.getElementById('successMessage');
|
| 190 |
+
const uniqueIDDisplay = document.getElementById('uniqueIDDisplay');
|
| 191 |
+
const closeSuccessBtn = document.getElementById('closeSuccess');
|
| 192 |
+
const submitButton = document.getElementById('submitButton');
|
| 193 |
+
const buttonText = document.getElementById('buttonText');
|
| 194 |
+
|
| 195 |
+
const showInterestPanel = () => floatingPanel.classList.remove('hidden');
|
| 196 |
+
const hideInterestPanel = () => floatingPanel.classList.add('hidden');
|
| 197 |
+
const generateUniqueId = () => 'CFP-' + Date.now().toString(36) + Math.random().toString(36).substring(2, 8).toUpperCase();
|
| 198 |
+
|
| 199 |
+
togglePanelBtn.addEventListener('click', showInterestPanel);
|
| 200 |
+
closePanelBtn.addEventListener('click', hideInterestPanel);
|
| 201 |
+
closeSuccessBtn.addEventListener('click', () => {
|
| 202 |
+
hideInterestPanel();
|
| 203 |
+
setTimeout(() => {
|
| 204 |
+
formContainer.classList.remove('hidden');
|
| 205 |
+
successMessage.classList.add('hidden');
|
| 206 |
+
interestForm.reset();
|
| 207 |
+
}, 300);
|
| 208 |
+
});
|
| 209 |
+
|
| 210 |
+
interestForm.addEventListener('submit', async (e) => {
|
| 211 |
+
e.preventDefault();
|
| 212 |
+
if (isSubmitting) return;
|
| 213 |
+
|
| 214 |
+
isSubmitting = true;
|
| 215 |
+
submitButton.disabled = true;
|
| 216 |
+
buttonText.textContent = 'Submitting...';
|
| 217 |
+
const uniqueId = generateUniqueId();
|
| 218 |
+
const name = document.getElementById('name').value;
|
| 219 |
+
const email = document.getElementById('email').value;
|
| 220 |
+
|
| 221 |
+
try {
|
| 222 |
+
const response = await fetch(WORKER_URL, {
|
| 223 |
+
method: 'POST',
|
| 224 |
+
headers: { 'Content-Type': 'application/json' },
|
| 225 |
+
body: JSON.stringify({ name, email, uniqueId }),
|
| 226 |
+
});
|
| 227 |
+
if (!response.ok) {
|
| 228 |
+
const errorData = await response.json();
|
| 229 |
+
throw new Error(errorData.error || 'Submission failed');
|
| 230 |
+
}
|
| 231 |
+
uniqueIDDisplay.textContent = uniqueId;
|
| 232 |
+
formContainer.classList.add('hidden');
|
| 233 |
+
successMessage.classList.remove('hidden');
|
| 234 |
+
} catch (error) {
|
| 235 |
+
console.error('Error submitting form:', error);
|
| 236 |
+
alert(`There was an error: ${error.message}`);
|
| 237 |
+
} finally {
|
| 238 |
+
isSubmitting = false;
|
| 239 |
+
submitButton.disabled = false;
|
| 240 |
+
buttonText.textContent = 'Generate Unique ID';
|
| 241 |
+
}
|
| 242 |
+
});
|
| 243 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
+
// #################################################################
|
| 246 |
+
// ## LOGIC FOR THE "POINTS CALCULATOR" PANEL
|
| 247 |
+
// #################################################################
|
| 248 |
+
const pointsCalculatorPanel = document.getElementById('pointsCalculatorPanel');
|
| 249 |
+
if (pointsCalculatorPanel) {
|
| 250 |
+
// --- ELEMENTS ---
|
| 251 |
+
const toggleCalculatorBtn = document.getElementById('toggleCalculator');
|
| 252 |
+
const closeCalculatorBtn = document.getElementById('closeCalculator');
|
| 253 |
+
const pointsResultDiv = document.getElementById('pointsResult');
|
| 254 |
+
const roleInputs = document.querySelectorAll('input[name="filmRole"]');
|
| 255 |
+
|
| 256 |
+
// --- POINTS DATA ---
|
| 257 |
+
const pointsData = {
|
| 258 |
+
Financier: {
|
| 259 |
+
points: "50 Points",
|
| 260 |
+
description: "Financing 100% of the budget typically equals 50% of the net profits, representing the foundational 50/50 split between capital and production."
|
| 261 |
+
},
|
| 262 |
+
Producer: {
|
| 263 |
+
points: "10 Points",
|
| 264 |
+
description: "A lead producer typically receives points from the 'Producer's Pool,' rewarding their effort in developing and managing the entire project."
|
| 265 |
+
},
|
| 266 |
+
Director: {
|
| 267 |
+
points: "5 Points",
|
| 268 |
+
description: "An established director's creative leadership is often rewarded with points from the 'Talent Pool' in addition to their fee."
|
| 269 |
+
}
|
| 270 |
+
};
|
| 271 |
+
|
| 272 |
+
const updatePointsDisplay = () => {
|
| 273 |
+
const selectedRole = document.querySelector('input[name="filmRole"]:checked').value;
|
| 274 |
+
const data = pointsData[selectedRole];
|
| 275 |
+
pointsResultDiv.innerHTML = `<h4 class="text-2xl font-bold text-blue-600">${data.points}</h4><p class="text-xs text-gray-600 mt-1">${data.description}</p>`;
|
| 276 |
+
};
|
| 277 |
+
|
| 278 |
+
toggleCalculatorBtn.addEventListener('click', () => {
|
| 279 |
+
pointsCalculatorPanel.classList.toggle('hidden');
|
| 280 |
+
pointsCalculatorPanel.classList.toggle('opacity-0');
|
| 281 |
+
pointsCalculatorPanel.classList.toggle('translate-y-4');
|
| 282 |
+
updatePointsDisplay();
|
| 283 |
+
});
|
| 284 |
|
| 285 |
+
closeCalculatorBtn.addEventListener('click', () => {
|
| 286 |
+
pointsCalculatorPanel.classList.add('hidden', 'opacity-0', 'translate-y-4');
|
| 287 |
+
});
|
| 288 |
+
|
| 289 |
+
roleInputs.forEach(input => {
|
| 290 |
+
input.addEventListener('change', updatePointsDisplay);
|
| 291 |
+
});
|
| 292 |
+
}
|
| 293 |
});
|
| 294 |
|
| 295 |
</script>
|