PDF播放器
This commit is contained in:
parent
fa7df6f423
commit
a032a52523
|
|
@ -28,15 +28,6 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
<meta name="google" content="notranslate">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>PDF播放器</title>
|
||||
<style>
|
||||
.tip {
|
||||
position: fixed;
|
||||
top: 45px;
|
||||
right: 25px;
|
||||
z-index: 99999999;
|
||||
color: #2979ff;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="viewer.css">
|
||||
<!-- This snippet is used in production (included from viewer.html) -->
|
||||
<link rel="resource" type="application/l10n" href="locale/locale.properties">
|
||||
|
|
@ -477,7 +468,6 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
|
||||
</div> <!-- outerContainer -->
|
||||
<div id="printContainer"></div>
|
||||
<div class="tip" id="tip"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -488,61 +478,5 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
let params = window.location.search;
|
||||
console.log('🚀 ~ params:', params)
|
||||
params = decodeURIComponent(params).split('.pdf?')[1].split('&')[0].split('=')[1]
|
||||
console.log('params:',params)
|
||||
if (params > 0) {
|
||||
let minute = Math.floor(params / 60);
|
||||
minute = String(minute).padStart(2, '0')
|
||||
let second = params % 60;
|
||||
let time = minute + ':' + second;
|
||||
let interval = setInterval(() => {
|
||||
params -= 1;
|
||||
console.log('params:',params)
|
||||
|
||||
if (params <= 0) {
|
||||
clearInterval(interval);
|
||||
document.getElementById('tip').innerText = '已完成学习';
|
||||
} else {
|
||||
let arr = time.split(':');
|
||||
let minute = parseInt(arr[0]);
|
||||
let second = parseInt(arr[1]);
|
||||
if (second == 0) {
|
||||
minute -= 1;
|
||||
second = 59;
|
||||
if (minute < 10) {
|
||||
minute = String(minute).padStart(2, '0');
|
||||
}
|
||||
} else {
|
||||
second -= 1;
|
||||
if (minute < 10) {
|
||||
minute = String(minute).padStart(2, '0');
|
||||
}
|
||||
if (second < 10) {
|
||||
second = String(second).padStart(2, '0');
|
||||
}
|
||||
}
|
||||
time = minute + ':' + second;
|
||||
document.getElementById('tip').innerText = '剩余学习时间:' + time;
|
||||
}
|
||||
}, 1000);
|
||||
} else if (params == 0) {
|
||||
document.getElementById('tip').innerText = '已完成学习';
|
||||
} else {
|
||||
document.getElementById('tip').innerText = '';
|
||||
}
|
||||
|
||||
var interval = setInterval('loadPdf()', 300);
|
||||
function loadPdf() {
|
||||
if (PDFViewerApplication.pdfDocument == null) {
|
||||
// console.info('Loading...');
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
|
||||
// let _iframe = document.getElementById("iframe")
|
||||
console.info('Load Success...:',PDFViewerApplication.pdfDocument);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue