mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
rebuilding site Thu Sep 23 05:28:42 PM CST 2021
This commit is contained in:
parent
90e1d439bb
commit
1778ab4ca6
3 changed files with 80 additions and 1 deletions
|
@ -27,7 +27,7 @@
|
|||
<a target="_self" href="i:0h/sdcard/uweb/app/dplayer.html:https://cdn.jsdelivr.net/gh/torappinfo/uwebzh/searchurl/txt/dplayer.html">点击安装dplayer视频播放器</a><br>
|
||||
<a target="_self" href="i:0h/sdcard/uweb/app/pdfviewer.html:https://cdn.jsdelivr.net/gh/torappinfo/uwebzh/searchurl/txt/pdfviewer.html">点击安装pdf阅读器</a><br>
|
||||
<a target="_self" href="i:0h/sdcard/uweb/app/epub.html:https://cdn.jsdelivr.net/gh/torappinfo/uwebzh/searchurl/txt/epub.html">点击安装epub阅读器</a><br>
|
||||
<a target="_self" href="i:0h/sdcard/uweb/app/djvu.html:https://cdn.jsdelivr.net/gh/torappinfo/uwebjs/djvujs/djvu.html">点击安装djvu阅读器</a><br>
|
||||
<a target="_self" href="i:0h/sdcard/uweb/app/djvu.html:https://cdn.jsdelivr.net/gh/torappinfo/uwebzh/searchurl/txt/djvu.html">点击安装djvu阅读器</a><br>
|
||||
相应的菜单安装可见<a href="../searchurl/urls.html">浏览器特色服务</a></p>
|
||||
<p>超微配置目录下的子目录名如果以"app"开始(譬如"/sdcard/uweb/appPDF"),则这些"app"开头目录树下放置的html5应用将可获得功能增强。</p>
|
||||
<p><a href="../filecap">配置default.filecap</a>并打开选项“文件预处理”,清后台重启浏览器后超微可直接阅读应用对应格式文件。<br>
|
||||
|
|
77
searchurl/txt/djvu.html
Normal file
77
searchurl/txt/djvu.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<header>
|
||||
<meta charset="utf-8">
|
||||
<script src="https://djvu.js.org/assets/dist/djvu.js"></script>
|
||||
<script src="https://djvu.js.org/assets/dist/djvu_viewer.js"></script>
|
||||
|
||||
<style>
|
||||
#for_viewer {
|
||||
height: 80vh;
|
||||
width: 90vw;
|
||||
margin: 5vh auto;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<div id="for_viewer"></div>
|
||||
<script>
|
||||
function makeRequest (method, url) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open(method, url);
|
||||
//xhr.overrideMimeType("application/octet-stream");
|
||||
xhr.responseType="arraybuffer";
|
||||
xhr.onload = function () {
|
||||
if (this.status == 0 || (this.status >= 200 && this.status < 300)) {
|
||||
resolve(xhr.response);
|
||||
} else {
|
||||
reject({
|
||||
status: this.status,
|
||||
statusText: xhr.statusText
|
||||
});
|
||||
}
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
reject({
|
||||
status: this.status,
|
||||
statusText: xhr.statusText
|
||||
});
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
// save as a global value
|
||||
window.viewer = new DjVu.Viewer();
|
||||
viewer.render(document.querySelector("#for_viewer"));
|
||||
{
|
||||
//?url=#page=
|
||||
let url = location.search.substring(5);
|
||||
if(url.startsWith("file:///"))
|
||||
url = "https://local/"+url.substring(8);
|
||||
let page = 1;
|
||||
let lhash = location.hash;
|
||||
if(lhash)
|
||||
page = parseInt(lhash.substring(6),10);
|
||||
//viewer.loadDocumentByUrl(url,{"pageNumber": page,});
|
||||
|
||||
/*fetch(new Request(url))
|
||||
.then(function(response) {
|
||||
return response.arrayBuffer();
|
||||
})
|
||||
*/
|
||||
makeRequest('GET', url)
|
||||
.then(function(buffer) {
|
||||
viewer.loadDocument(buffer," ",{"pageNumber":page,});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -3,6 +3,8 @@
|
|||
<div id="area"></div>
|
||||
<script>
|
||||
let url = location.search.substring(3);
|
||||
if(url.startsWith("file:///"))
|
||||
url = "https://local/"+url.substring(8);
|
||||
var book = ePub(url);
|
||||
var rendition = book.renderTo("area");
|
||||
var displayed = rendition.display();
|
||||
|
|
Loading…
Reference in a new issue