Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXED #943 #1492

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion assets/css/audiobook.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,21 @@
height: 70px;

}
#nyan-btn2{
width: 70px;
height: 70px;

}
#nyan-btn3{
width: 70px;
height: 70px;

}
#nyan-btn4{
width: 70px;
height: 70px;

}




47 changes: 46 additions & 1 deletion assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,52 @@ background-image: linear-gradient(190deg,rgb(95,79,57),rgb(127,106,77), rgb(191,
box-shadow: 0 0 30px #fff;
cursor: pointer;
transform: scale(1.1);

}
#nyan-btn2{
border-radius: 200px;
background-color: #fff;
border: 1px solid #ffffff;
}
#nyan-btn2:hover{
border-radius: 200px;
background-color: #fff;
border: 1px solid #fff;
box-shadow: 0 0 30px #fff;
cursor: pointer;
transform: scale(1.1);

}
#nyan-btn3{
border-radius: 200px;
background-color: #fff;
border: 1px solid #ffffff;
}
#nyan-btn3:hover{
border-radius: 200px;
background-color: #fff;
border: 1px solid #fff;
box-shadow: 0 0 30px #fff;
cursor: pointer;
transform: scale(1.1);

}
#nyan-btn4{
border-radius: 200px;
background-color: #fff;
border: 1px solid #ffffff;
}
#nyan-btn4:hover{
border-radius: 200px;
background-color: #fff;
border: 1px solid #fff;
box-shadow: 0 0 30px #fff;
cursor: pointer;
transform: scale(1.1);

}


.books-audios{
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -3076,4 +3121,4 @@ select {
background: #a56902;
border-color: #ffc96b;
text-decoration: none;
}
}
141 changes: 140 additions & 1 deletion assets/js/audiobook.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,143 @@ if(nyanBtn){
playPause(nyan);
progress(nyanBtn, nyan);
});
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//for book2
var nyan2 = document.getElementById("nyan2");
var nyanBtn2 = document.getElementById("nyan-btn2");

nyanBtn2.onclick = function(){
if (nyan2.paused && nyan2.currentTime >= 0 && !nyan2.ended) {
nyan2.play();
nyanBtn2.src = "media/pause.webp";
}else {
nyan2.pause();
nyanBtn2.src ="media/play.webp"
}
}

function reset(btn, song) {
if (btn.classList.contains('playing')) {
btn.classList.toggle('playing');
}
song.pause();
song.currentTime = 0;
}

function progress(btn, song) {
setTimeout(function () {
var end = song.duration;
var current = song.currentTime;
var percent = current / (end / 100);
//check if song is at the end
if (current == end) {
reset(btn, song);
}
//set inset box shadow
btn.style.boxShadow = "inset " + btn.offsetWidth * (percent / 100) + "px 0px 0px 0px rgba(0,0,0,0.125)"
//call function again
progress(btn, song);
}, 133.7);
}

if(nyanBtn2){
nyanBtn2.addEventListener('click', function () {
nyanBtn2.classList.toggle('playing');
playPause(nyan2);
progress(nyanBtn2, nyan2);
});
}
//////////////////////////////////////////////////////////////////////////////////////
//for book 3
var nyan3 = document.getElementById("nyan3");
var nyanBtn3 = document.getElementById("nyan-btn3");

nyanBtn3.onclick = function(){
if (nyan3.paused && nyan3.currentTime >= 0 && !nyan3.ended) {
nyan3.play();
nyanBtn3.src = "media/pause.webp";
}else {
nyan3.pause();
nyanBtn3.src ="media/play.webp"
}
}

function reset(btn, song) {
if (btn.classList.contains('playing')) {
btn.classList.toggle('playing');
}
song.pause();
song.currentTime = 0;
}

function progress(btn, song) {
setTimeout(function () {
var end = song.duration;
var current = song.currentTime;
var percent = current / (end / 100);
//check if song is at the end
if (current == end) {
reset(btn, song);
}
//set inset box shadow
btn.style.boxShadow = "inset " + btn.offsetWidth * (percent / 100) + "px 0px 0px 0px rgba(0,0,0,0.125)"
//call function again
progress(btn, song);
}, 133.7);
}

if(nyanBtn3){
nyanBtn3.addEventListener('click', function () {
nyanBtn3.classList.toggle('playing');
playPause(nyan3);
progress(nyanBtn3, nyan3);
});
}
//////////////////////////////////////////////////////////////
//for book4
var nyan4 = document.getElementById("nyan4");
var nyanBtn4 = document.getElementById("nyan-btn4");

nyanBtn4.onclick = function(){
if (nyan4.paused && nyan4.currentTime >= 0 && !nyan4.ended) {
nyan4.play();
nyanBtn4.src = "media/pause.webp";
}else {
nyan4.pause();
nyanBtn4.src ="media/play.webp"
}
}

function reset(btn, song) {
if (btn.classList.contains('playing')) {
btn.classList.toggle('playing');
}
song.pause();
song.currentTime = 0;
}

function progress(btn, song) {
setTimeout(function () {
var end = song.duration;
var current = song.currentTime;
var percent = current / (end / 100);
//check if song is at the end
if (current == end) {
reset(btn, song);
}
//set inset box shadow
btn.style.boxShadow = "inset " + btn.offsetWidth * (percent / 100) + "px 0px 0px 0px rgba(0,0,0,0.125)"
//call function again
progress(btn, song);
}, 133.7);
}

if(nyanBtn4){
nyanBtn4.addEventListener('click', function () {
nyanBtn4.classList.toggle('playing');
playPause(nyan4);
progress(nyanBtn4, nyan4);
});
}

12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,9 @@ <h1 class="bheads audiobooks-heading">Listen to Audiobooks</h1>
<img src="https://m.media-amazon.com/images/I/51vpG4hU6FL._SL500_.jpg">
</a>
<div class="sound">
<img src="media/play.webp" id="nyan-btn">
<img src="media/play.webp" id="nyan-btn2">
</div>
<audio id="nyan" src="assets/AudioBook/Python_1.mp3" preload="metadata" type="audio/mpeg">
<audio id="nyan2" src="assets/AudioBook/Comp_Networking.mp3" preload="metadata" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
Expand All @@ -562,9 +562,9 @@ <h1 class="bheads audiobooks-heading">Listen to Audiobooks</h1>
<img src="https://m.media-amazon.com/images/I/51hVSO2ONDL._SL500_.jpg" target="_blank">
</a>
<div class="sound">
<img src="media/play.webp" id="nyan-btn">
<img src="media/play.webp" id="nyan-btn3">
</div>
<audio id="nyan" src="assets/AudioBook/Python_1.mp3" preload="metadata" type="audio/mpeg">
<audio id="nyan3" src="assets/AudioBook/Comp_Prog_-_the_bible.mp3" preload="metadata" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
Expand All @@ -578,9 +578,9 @@ <h1 class="bheads audiobooks-heading">Listen to Audiobooks</h1>
<img src="https://m.media-amazon.com/images/I/511KH-QzPeL._SL500_.jpg">
</a>
<div class="sound">
<img src="media/play.webp" id="nyan-btn">
<img src="media/play.webp" id="nyan-btn4">
</div>
<audio id="nyan" src="assets/AudioBook/Python_1.mp3" preload="metadata" type="audio/mpeg">
<audio id="nyan4" src="assets/AudioBook/Comp_Prog_and_Cyber_Sec.mp3" preload="metadata" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
Expand Down