-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
70 lines (61 loc) · 2.59 KB
/
script.js
File metadata and controls
70 lines (61 loc) · 2.59 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
// Tab switching functionality
document.addEventListener('DOMContentLoaded', function() {
const tabButtons = document.querySelectorAll('.tab-button');
const tabPanes = document.querySelectorAll('.tab-pane');
// Add click event listeners to all tab buttons
tabButtons.forEach(button => {
button.addEventListener('click', function() {
// Remove active class from all tabs
tabButtons.forEach(btn => btn.classList.remove('active'));
tabPanes.forEach(pane => pane.classList.remove('active'));
// Add active class to clicked tab
button.classList.add('active');
// Show corresponding tab pane
const tabId = button.getAttribute('data-tab');
document.getElementById(tabId).classList.add('active');
// Notify Medium about size change
setTimeout(function() {
if (window.parent) {
const height = Math.max(800, document.body.scrollHeight);
window.parent.postMessage({ type: 'resize', height: height }, '*');
}
}, 100);
});
});
// Ensure Medium receives proper sizing on load
window.addEventListener('load', function() {
setTimeout(function() {
if (window.parent) {
const height = Math.max(800, document.body.scrollHeight);
window.parent.postMessage({ type: 'resize', height: height }, '*');
}
}, 500);
});
// Handle example interactions for the ZKP tab
const exampleCase = document.querySelector('.example-case');
if (exampleCase) {
exampleCase.addEventListener('click', function() {
this.classList.toggle('expanded');
});
}
// Initialize dot animation for payment flow
function animatePaymentFlow() {
const arrows = document.querySelectorAll('.payment-arrow');
arrows.forEach((arrow, index) => {
setTimeout(() => {
arrow.classList.add('active');
setTimeout(() => {
arrow.classList.remove('active');
}, 700);
}, index * 800);
});
}
// Try to run the animation when the monetization tab becomes visible
const monetizationTab = document.querySelector('[data-tab="monetization"]');
if (monetizationTab) {
monetizationTab.addEventListener('click', function() {
setTimeout(animatePaymentFlow, 500);
setInterval(animatePaymentFlow, 5000);
});
}
});