中国美业 | 长发 | 娱乐 | 健康 | 美妆 | 婚嫁 | 着装 | 手工 |
当前位置:中国美业 > 健康 > 保健 >
亿缕阳光丨医者本能
更新时间:2022-08-21

本文转自:人民视频00:0000:00详请收起00:0000:00// 音频播放var audioPlayer = document.querySelector('.audio-box');// var playPause = audioPlayer.querySelector('#playPause');var playpauseBtn = audioPlayer.querySelector('.audio-bottom-control-play');var playpauseBtnSmall = audioPlayer.querySelector('.audio-left');// var loading = audioPlayer.querySelector('.loading');var progress = audioPlayer.querySelector('.progress');var progressSmall = audioPlayer.querySelector('.progresssmall');var sliders = audioPlayer.querySelectorAll('.slider');var volumeBtn = audioPlayer.querySelector('.volume-btn');var volumeControls = audioPlayer.querySelector('.volume-controls');var volumeProgress = volumeControls.querySelector('.slider .progress');var player = audioPlayer.querySelector('#audio-resource');var currentTime = audioPlayer.querySelector('.audio-bottom-time-now');var currentTimeSmall = audioPlayer.querySelector('.audio-time-now');var totalTime = audioPlayer.querySelector('.audio-bottom-time-all');var totalTimeSmall = audioPlayer.querySelector('.audio-time-all');var refreshbtn = audioPlayer.querySelector('.audio-bottom-control-refresh');// var speaker = audioPlayer.querySelector('#speaker');var draggableClasses = ['pin'];var currentlyDragged = null;window.addEventListener('mousedown', function (event) {if (!isDraggable(event.target)) return false;currentlyDragged = event.target;var handleMethod = currentlyDragged.dataset.method;this.addEventListener('mousemove', window[handleMethod], false);window.addEventListener('mouseup', function () {currentlyDragged = false;window.removeEventListener('mousemove', window[handleMethod], false);}, false);});playpauseBtn.addEventListener('click', togglePlay);playpauseBtnSmall.addEventListener('click', togglePlay);player.addEventListener('timeupdate', updateProgress);refreshbtn.addEventListener('click', refreshAll);player.addEventListener('volumechange', updateVolume);player.addEventListener('loadedmetadata', function () {totalTime.textContent = formatTime(player.duration);totalTimeSmall.textContent = formatTime(player.duration);});player.addEventListener('canplay', makePlay);player.addEventListener('ended', function () {// playPause.attributes.d.value = "";// player.currentTime = 0;$('.audio-left,.audio-yuan').addClass('pause');$('.audio-left,.audio-yuan').removeClass('play');$('.audio-pointer').addClass('stopplaydeg');$('.audio-pointer').removeClass('playdeg');$('.audio-bottom-control-play').removeClass('audio-bottom-control-ing');$('.audio-bottom-control-play').addClass('audio-bottom-control-stop');});volumeBtn.addEventListener('click', function () {volumeBtn.classList.toggle('open');volumeControls.classList.toggle('hidden');});// window.addEventListener('resize', directionAware);sliders.forEach(function (slider) {var pin = slider.querySelector('.pin');slider.addEventListener('click', window[pin.dataset.method]);});// directionAware();function isDraggable(el) {var canDrag = false;var classes = Array.from(el.classList);draggableClasses.forEach(function (draggable) {if (classes.indexOf(draggable) !== -1) canDrag = true;});return canDrag;}function inRange(event) {var rangeBox = getRangeBox(event);var rect = rangeBox.getBoundingClientRect();var direction = rangeBox.dataset.direction;if (direction == 'horizontal') {var min = rangeBox.offsetLeft;var max = min + rangeBox.offsetWidth;if (event.clientX < min || event.clientX > max) return false;} else {var min = rect.top;var max = min + rangeBox.offsetHeight;if (event.clientY < min || event.clientY > max) return false;}return true;}function updateProgress() {var current = player.currentTime;var percent = current / player.duration * 100;progress.style.width = percent + '%';progressSmall.style.width = percent + '%';currentTime.textContent = formatTime(current);currentTimeSmall.textContent = formatTime(current);}function updateVolume() {volumeProgress.style.height = player.volume * 100 + '%';if (player.volume >= 0.5) {// speaker.attributes.d.value = '';} else if (player.volume < 0.5 && player.volume > 0.05) {// speaker.attributes.d.value = '';} else if (player.volume <= 0.05) {// speaker.attributes.d.value = '';}}function getRangeBox(event) {var rangeBox = event.target;var el = currentlyDragged;if (event.type == 'click' && isDraggable(event.target)) {rangeBox = event.target.parentElement.parentElement;}if (event.type == 'mousemove') {rangeBox = el.parentElement.parentElement;}return rangeBox;}function getCoefficient(event) {var slider = getRangeBox(event);var rect = slider.getBoundingClientRect();var K = 0;if (slider.dataset.direction == 'horizontal') {var offsetX = event.clientX - slider.offsetLeft;var width = slider.clientWidth;K = offsetX / width;} else if (slider.dataset.direction == 'vertical') {var height = slider.clientHeight;var offsetY = event.clientY - rect.top;K = 1 - offsetY / height;}return K;}function rewind(event) {if (inRange(event)) {player.currentTime = player.duration * getCoefficient(event);}}function changeVolume(event) {if (inRange(event)) {player.volume = getCoefficient(event);}}function formatTime(time) {var min = Math.floor(time / 60);var sec = Math.floor(time % 60);return (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec);}function togglePlay() {if (player.paused) {// playPause.attributes.d.value = "";$('.audio-left,.audio-yuan').addClass('play');$('.audio-left,.audio-yuan').removeClass('pause');$('.audio-pointer').addClass('playdeg');$('.audio-pointer').removeClass('stopplaydeg');$('.audio-bottom-control-play').removeClass('audio-bottom-control-stop');$('.audio-bottom-control-play').addClass('audio-bottom-control-ing');player.play();} else {// playPause.attributes.d.value = "";$('.audio-left,.audio-yuan').addClass('pause');$('.audio-left,.audio-yuan').removeClass('play');$('.audio-pointer').addClass('stopplaydeg');$('.audio-pointer').removeClass('playdeg');$('.audio-bottom-control-play').removeClass('audio-bottom-control-ing');$('.audio-bottom-control-play').addClass('audio-bottom-control-stop');player.pause();}}function makePlay() {// playpauseBtn.style.display = 'block';// playpauseBtnSmall.style.display = 'block';// loading.style.display = 'none';}// function directionAware() {//if (window.innerHeight < 250) {// volumeControls.style.bottom = '-54px';// volumeControls.style.left = '54px';//} else if (audioPlayer.offsetTop < 154) {// volumeControls.style.bottom = '-164px';// volumeControls.style.left = '-3px';//} else {// volumeControls.style.bottom = '52px';// volumeControls.style.left = '-3px';//}// }function refreshAll() {player.currentTime = 0;progress.style.width = 0;progressSmall.style.width = 0;currentTime.textContent = '00:00';currentTimeSmall.textContent = '00:00';}

不着白衣,亦是“天使”。

编辑:吴方舟

  • 上一篇:宁武:金莲花要茶产业助农增收
  • 下一篇:没有了
  • 关键词:亿缕,阳光,丨,医者,本能,本文,转自,人民,视频,
    >>>
    >>>
    频道热点
    生活
    预防
    保健
    科普
  • 8000家咖啡馆创造“全球第一”,上海的咖啡文化为什么吸引人?
  • “咖啡之城”的味道,以及M恋
  • 打工人“救命水”实锤!JCI:长期喝咖啡,能改善大脑代谢,提高记忆力和学习
  • 滞留三亚旅客安置受关注,游客7天风险排查后方可离岛
  • 种颗牙,上万元?国家医保局出手了
  • 四种疾病根本无法根治,医生提醒:莫轻信江湖郎中,这是一场骗局
  • 换季大作战--宝宝的秋日皮肤护理
  • 做了避孕措施还是有了?其实这几个常听到的避孕方式其实并不靠谱
  • 网站地图 | 长发地图 | 用户登录 | 忘记密码 | 投稿邮箱:2012648158@qq.com
    管理员QQ:2012648158 赣ICP备18014991号