Skip to content

Commit

Permalink
feat(文章封面视频): 静音按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
KotoriK committed Nov 18, 2021
1 parent a0397d6 commit bd54d8e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/sakura-app/global-func.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,48 @@ function cmt_showPopup(ele) {
/*视频feature*/
function coverVideo() {
let video = document.getElementById("coverVideo"),
btn = document.getElementById("coverVideo-btn");
btn_playControl = document.getElementById("cv-pc");

if (video.paused) {
video.play();
try {
btn.innerHTML = '<i class="fa fa-pause" aria-hidden="true"></i>';
btn_playControl.innerHTML = '<i class="fa fa-pause" aria-hidden="true"></i>';
} catch { };
//console.info('play:coverVideo()');
} else {
video.pause();
try {
btn.innerHTML = '<i class="fa fa-play" aria-hidden="true"></i>';
btn_playControl.innerHTML = '<i class="fa fa-play" aria-hidden="true"></i>';
} catch { };
//console.info('pause:coverVideo()');
}
}

function coverVideoMute() {
const video = document.getElementById("coverVideo")
const btn_volumeControl = document.getElementById("cv-vc");
if (video.muted) {
video.muted = false
btn_volumeControl.innerHTML = '<i class="fa fa-volume-up" aria-hidden="true"></i>'
} else {
video.muted = true
btn_volumeControl.innerHTML = '<i class="fa fa-volume-muted" aria-hidden="true"></i>'
}
}
function killCoverVideo() {
var video = document.getElementById("coverVideo");
var btn = document.getElementById("coverVideo-btn");
var btn_playControl = document.getElementById("cv-pc");

if (video.paused) {
//console.info('none:killCoverVideo()');
} else {
video.pause();
try {
btn.innerHTML = '<i class="fa fa-play" aria-hidden="true"></i>';
btn_playControl.innerHTML = '<i class="fa fa-play" aria-hidden="true"></i>';
} catch (e) { };
//console.info('pause:killCoverVideo()');
}
}

function mail_me() {
window.open("mailto:" + mashiro_option.email_name + "@" + mashiro_option.email_domain);
}
Expand All @@ -65,6 +76,7 @@ function headertop_down() {
window.imgError = imgError
window.cmt_showPopup = cmt_showPopup
window.coverVideo = coverVideo
window.coverVideoMute = coverVideoMute
window.killCoverVideo = killCoverVideo
window.mail_me = mail_me
window.headertop_down = headertop_down

0 comments on commit bd54d8e

Please sign in to comment.