-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0f6992
commit 6795887
Showing
4 changed files
with
113 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,50 @@ | ||
document.getElementById('help-btn').addEventListener('click', function () { | ||
var tutorialPopup = document.getElementById('tutorial-popup'); | ||
tutorialPopup.style.display = 'block'; // Use block if flex doesn't work as expected | ||
|
||
tutorialPopup.style.zIndex = '1000'; // Ensure it's above other content | ||
|
||
showStep(1); | ||
}); | ||
|
||
document.querySelectorAll('.next-btn').forEach(btn => { | ||
btn.addEventListener('click', function () { | ||
const currentStep = this.parentElement.getAttribute('data-step'); | ||
showStep(parseInt(currentStep) + 1); | ||
}); | ||
}); | ||
document.getElementById('help-btn').addEventListener('click', function () { | ||
var tutorialPopup = document.getElementById('tutorial-popup'); | ||
tutorialPopup.style.display = 'block'; // Use block if flex doesn't work as expected | ||
|
||
tutorialPopup.style.zIndex = '1000'; // Ensure it's above other content | ||
|
||
document.querySelectorAll('.copy-btn').forEach(btn => { | ||
btn.addEventListener('click', function () { | ||
const text = this.getAttribute('data-text'); | ||
navigator.clipboard.writeText(text).then(() => { | ||
alert('Copied to clipboard'); | ||
}); | ||
}); | ||
}); | ||
showStep(1); | ||
}); | ||
|
||
function showStep(step) { | ||
document.querySelectorAll('.tutorial-step').forEach(stepEl => { | ||
stepEl.style.display = 'none'; | ||
}); | ||
document.querySelector(`.tutorial-step[data-step="${step}"]`).style.display = 'block'; | ||
} | ||
|
||
// after the last step, hide the popup - even if clicking on the overlay or copying the text | ||
document.getElementById('tutorial-popup').addEventListener('click', function (e) { | ||
if (e.target === this) { | ||
this.style.display = 'none'; | ||
} | ||
}); | ||
document.querySelectorAll('.next-btn').forEach(btn => { | ||
btn.addEventListener('click', function () { | ||
const currentStep = this.parentElement.getAttribute('data-step'); | ||
showStep(parseInt(currentStep) + 1); | ||
}); | ||
}); | ||
|
||
// if copied text from one of the examples, hide the popup and mark the #input-board as focused | ||
document.querySelectorAll('.copy-btn').forEach(btn => { | ||
btn.addEventListener('click', function () { | ||
document.getElementById('tutorial-popup').style.display = 'none'; | ||
document.getElementById('input-board').setAttribute('placeholder', 'Paste the copied board here...'); | ||
|
||
}); | ||
}); | ||
document.querySelectorAll('.copy-btn').forEach(btn => { | ||
btn.addEventListener('click', function () { | ||
const text = this.getAttribute('data-text'); | ||
navigator.clipboard.writeText(text).then(() => { | ||
alert('Copied to clipboard'); | ||
}); | ||
}); | ||
}); | ||
|
||
function showStep(step) { | ||
document.querySelectorAll('.tutorial-step').forEach(stepEl => { | ||
stepEl.style.display = 'none'; | ||
}); | ||
document.querySelector(`.tutorial-step[data-step="${step}"]`).style.display = 'block'; | ||
} | ||
|
||
// after the last step, hide the popup - even if clicking on the overlay or copying the text | ||
document.getElementById('tutorial-popup').addEventListener('click', function (e) { | ||
if (e.target === this) { | ||
this.style.display = 'none'; | ||
} | ||
}); | ||
|
||
// if copied text from one of the examples, hide the popup and mark the #input-board as focused | ||
document.querySelectorAll('.copy-btn').forEach(btn => { | ||
btn.addEventListener('click', function () { | ||
document.getElementById('tutorial-popup').style.display = 'none'; | ||
document.getElementById('input-board').setAttribute('placeholder', 'Paste the copied board here...'); | ||
|
||
}); | ||
}); |