rebuilding site Sun Sep 26 09:00:25 PM CST 2021

This commit is contained in:
James Feng Cao 2021-09-26 21:00:26 +08:00
parent 1778ab4ca6
commit 368b9359a6
7 changed files with 493 additions and 48 deletions

View file

@ -10,6 +10,10 @@ onload=function(){
switch(ext){
case "js":
ext = "javascript";
break;
case "py":
ext = "python";
break;
}
editor = ace.edit(e);
editor.session.setValue(text);

View file

@ -1,11 +1,365 @@
<script src="https://cdn.jsdelivr.net/npm/epubjs/dist/epub.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip/dist/jszip.min.js"></script>
<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();
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<title>EPUB</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jszip/3.1.5/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/epubjs@0.3.88/dist/epub.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const html = document.querySelector('html')
let fontSize = window.innerWidth / 10
fontSize = fontSize > 50 ? 50 : fontSize
html.style.fontSize = fontSize + 'px'
})
</script>
<style>
* {
padding: 0;
margin: 0;
}
.mask {
position: absolute;
display: flex;
left: 0;
width: 100%;
height: 100%;
flex-direction: column;
}
.meun {
display: flex;
height: 1em;
align-items: center;
}
#toc {
flex: 1;
z-index: 100;
font-size: 0.6em;
padding-left: 0.7em;
color: #333;
}
#toc-content {
position: absolute;
bottom: 0;
right: 0;
z-index: 102;
width: auto;
height: 100%;
background: white;
}
#toc-mask {
position: absolute;
top: 0;
left: 0;
z-index: 101;
width: 100%;
height: 100%;
background: rgba(51, 51, 51, .8);
}
#content {
width: 100%;
height: 100%;
overflow: auto;
}
.item {
padding: 0.4em 0.4em;
border-bottom: 0.1em solid #f4f4f4;
font-size: 0.4em;
color: #333;
}
#open {
flex: 1;
z-index: 100;
font-size: 0.4em;
text-align: right;
padding-right: 1em;
color: #333;
}
.read {
display: flex;
flex: 1 1 auto;
}
#prev {
flex: 0 0 2em;
z-index: 100;
}
#viewer {
flex: 1;
}
#next {
flex: 0 0 2em;
z-index: 100;
}
</style>
</head>
<body>
<div id="ebook">
<div class="mask">
<div class="read">
<div id="prev" onclick="rendition.prev()"></div>
<div id="viewer"></div>
<div id="next" onclick="rendition.next()"></div>
</div>
<div class="meun">
<div id="toc" onclick="showhide()"></div>
<div id="open">
<span onclick="document.getElementById('input').click()"></span>
<input type="file" id="input" style="display: none;">
</div>
</div>
<div id="toc-mask" style="display: none;" onclick="showhide()"></div>
<div id="toc-content" style="display: none;">
<div id="content"></div>
</div>
</div>
</div>
<script>
let url = location.search.substring(3);
if (url !== "") {
var book = ePub(url);
} else {
var book = ePub();
var inputElement = document.getElementById("input");
inputElement.addEventListener('change', function (e) {
var file = e.target.files[0];
if (window.FileReader) {
var reader = new FileReader();
reader.onload = openBook;
reader.readAsArrayBuffer(file);
}
});
function openBook(e) {
var bookData = e.target.result;
book.open(bookData, "binary");
}
}
//渲染
var rendition = book.renderTo("ebook", {
with: window.innerWidth,
height: window.innerHeight - 20
});
rendition.display();
var displayed = rendition.display();
function showhide() {
var $toc = document.getElementById("toc-content")
var $mask = document.getElementById("toc-mask")
if ($toc.style.display == "none") {
$toc.style.display = ""
$mask.style.display = ""
} else {
$toc.style.display = "none"
$mask.style.display = "none"
}
}
// 目录
book.loaded.navigation.then(function (toc) {
var $content = document.getElementById("content")
toc.forEach(function (chapter) {
var div = document.createElement("div");
div.className = "item";
div.textContent = chapter.label;
div.addEventListener("click", function () {
rendition.display(chapter.href);
showhide()
});
$content.appendChild(div)
})
})
</script>
</body>
</html>

View file

@ -1,3 +1,4 @@
pdf:uweb:echo file:///sdcard/uweb/app/pdfviewer.html?file=%u
djvu:uweb:echo file:///sdcard/uweb/app/djvu.html?url=%u
epub:uweb:echo file:///sdcard/uweb/app/epub.html?u=%u
py:termux/*:python %f;exit -1

View file

@ -0,0 +1,4 @@
mp3:text/html:echo '<audio controls width=100% height=100%><source src="%u"></audio>'
m4b:text/html:echo '<audio controls width=100% height=100%><source src="%u"></audio>'
mp4:text/html:echo '<video controls width=100% height=100%><source src="%u"></video>'
mkv:text/html:echo '<video controls width=100% height=100%><source src="%u"></video>'

View file

@ -1,4 +1,4 @@
cookie延期::0000
地址栏内容至输入框:i:54%s
地址栏内容至输入框:i:56%s
地址栏_删除非英文: location.href="i:15"+"%s".replace(/[^\u0000-\u007f]/g,"")
地址栏_保留中英文: location.href="i:15"+"%s".replace(/[^\u4e00-\u9fa5\u0000-\u007f]/g,"")
地址栏_保留中英文: location.href="i:15"+"%s".replace(/[^\u4e00-\u9fa5\u0000-\u007f]/g,"")

80
searchurl/txt/mdict.html Normal file
View file

@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<base href="https://cdn.jsdelivr.net/gh/fengdh/mdict-js/">
<title>mdict</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="selectize.default.css" media="screen">
<style>
#btnLookup {
border: none;
height: 36px;
font-size: 12pt;
font-weight: bold;
vertical-align: top;
border-radius: 3px;
}
#btnLookup:not([disabled]) {
background: #1A4FDD;
color: white;
}
#dict-title {
position: fixed;
bottom: 0;
right: 0;
max-width: 300px;
font-size: 10px;
opacity: 0.9;
background: #DDD;
box-shadow: -2px -2px 4px 4px rgba(0, 0, 0, 0.3);
}
#dict-title * {
font-size: 10px!important;
}
#mdict-online-viewer {
font-size: 14px;
font-family: "Georgia", "Times New Roman";
height: 600px;
width: 100%;
}
#mdict-online-viewer #definition {
font-size: 14px;
height: 500px;
overflow: auto;
}
#word + .selectize-control {
display: inline-block;
min-width: 18em;
}
</style>
</head>
<body>
<section class="main-content">
<div id="mdict-online-viewer">
Choose a dictionary file (*.mdx + optional *.mdd): <input id="dictfile" type="file" multiple>
<p>
<input id="word" type="text" value="">
<input id="btnLookup" type="button" value="look up" disabled="false">
<div id="dict-title"></div>
<div id="definition">
</div>
<script type="text/javascript" src="conf.js"></script>
<script src="require.js" data-main="mdict"></script>
</div>
</section>
</body>
</html>

View file

@ -1,38 +1,50 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html dir="ltr" mozdisallowselectionprint>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>PDF.js viewer</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pdfjs-dist-viewer-min/build/minified/web/viewer.css">
<!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="https://cdn.jsdelivr.net/npm/pdfjs-dist-viewer-min/build/minified/web/locale/locale.properties">
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist-viewer-min/build/minified/build/pdf.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist-viewer-min/build/minified/web/pdf.viewer.js"></script>
<link rel="resource" type="application/l10n" href="https://cdn.jsdelivr.net/npm/pdfjs-dist-viewer-min/build/minified/web/locale/locale.properties">
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist-viewer-min/build/minified/build/pdf.worker.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist-viewer-min/build/minified/web/pdf.viewer.js"></script>
</head>
<body tabindex="1" class="loadingInProgress">
<body tabindex="1">
<div id="outerContainer">
<div id="sidebarContainer">
<div id="toolbarSidebar">
<div class="splitToolbarButton toggled">
<button id="viewThumbnail" class="toolbarButton toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="thumbs">
<span data-l10n-id="thumbs_label">Thumbnails</span>
</button>
<button id="viewOutline" class="toolbarButton" title="Show Document Outline (double-click to expand/collapse all items)" tabindex="3" data-l10n-id="document_outline">
<span data-l10n-id="document_outline_label">Document Outline</span>
</button>
<button id="viewAttachments" class="toolbarButton" title="Show Attachments" tabindex="4" data-l10n-id="attachments">
<span data-l10n-id="attachments_label">Attachments</span>
</button>
<div id="toolbarSidebarLeft">
<div class="splitToolbarButton toggled">
<button id="viewThumbnail" class="toolbarButton toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="thumbs">
<span data-l10n-id="thumbs_label">Thumbnails</span>
</button>
<button id="viewOutline" class="toolbarButton" title="Show Document Outline (double-click to expand/collapse all items)" tabindex="3" data-l10n-id="document_outline">
<span data-l10n-id="document_outline_label">Document Outline</span>
</button>
<button id="viewAttachments" class="toolbarButton" title="Show Attachments" tabindex="4" data-l10n-id="attachments">
<span data-l10n-id="attachments_label">Attachments</span>
</button>
<button id="viewLayers" class="toolbarButton" title="Show Layers (double-click to reset all layers to the default state)" tabindex="5" data-l10n-id="layers">
<span data-l10n-id="layers_label">Layers</span>
</button>
</div>
</div>
<div id="toolbarSidebarRight">
<div id="outlineOptionsContainer" class="hidden">
<div class="verticalToolbarSeparator"></div>
<button id="currentOutlineItem" class="toolbarButton" disabled="disabled" title="Find Current Outline Item" tabindex="6" data-l10n-id="current_outline_item">
<span data-l10n-id="current_outline_item_label">Current Outline Item</span>
</button>
</div>
</div>
</div>
<div id="sidebarContent">
@ -42,8 +54,10 @@
</div>
<div id="attachmentsView" class="hidden">
</div>
<div id="layersView" class="hidden">
</div>
</div>
<div id="sidebarResizer" class="hidden"></div>
<div id="sidebarResizer"></div>
</div> <!-- sidebarContainer -->
<div id="mainContainer">
@ -163,11 +177,11 @@
<div id="toolbarContainer">
<div id="toolbarViewer">
<div id="toolbarViewerLeft">
<button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" tabindex="11" data-l10n-id="toggle_sidebar">
<button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" tabindex="11" data-l10n-id="toggle_sidebar" aria-expanded="false" aria-controls="sidebarContainer">
<span data-l10n-id="toggle_sidebar_label">Toggle Sidebar</span>
</button>
<div class="toolbarButtonSpacer"></div>
<button id="viewFind" class="toolbarButton" title="Find in Document" tabindex="12" data-l10n-id="findbar">
<button id="viewFind" class="toolbarButton" title="Find in Document" tabindex="12" data-l10n-id="findbar" aria-expanded="false" aria-controls="findbar">
<span data-l10n-id="findbar_label">Find</span>
</button>
<div class="splitToolbarButton hiddenSmallView">
@ -179,7 +193,7 @@
<span data-l10n-id="next_label">Next</span>
</button>
</div>
<input type="number" id="pageNumber" class="toolbarField pageNumber" title="Page" value="1" size="4" min="1" tabindex="15" data-l10n-id="page">
<input type="number" id="pageNumber" class="toolbarField pageNumber" title="Page" value="1" size="4" min="1" tabindex="15" data-l10n-id="page" autocomplete="off">
<span id="numPages" class="toolbarLabel"></span>
</div>
<div id="toolbarViewerRight">
@ -204,7 +218,7 @@
<div class="verticalToolbarSeparator hiddenSmallView"></div>
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="36" data-l10n-id="tools">
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="36" data-l10n-id="tools" aria-expanded="false" aria-controls="secondaryToolbar">
<span data-l10n-id="tools_label">Tools</span>
</button>
</div>
@ -246,17 +260,6 @@
</div>
</div>
<menu type="context" id="viewerContextMenu">
<menuitem id="contextFirstPage" label="First Page"
data-l10n-id="first_page"></menuitem>
<menuitem id="contextLastPage" label="Last Page"
data-l10n-id="last_page"></menuitem>
<menuitem id="contextPageRotateCw" label="Rotate Clockwise"
data-l10n-id="page_rotate_cw"></menuitem>
<menuitem id="contextPageRotateCcw" label="Rotate Counter-Clockwise"
data-l10n-id="page_rotate_ccw"></menuitem>
</menu>
<div id="viewerContainer" tabindex="0">
<div id="viewer" class="pdfViewer"></div>
</div>
@ -368,4 +371,3 @@
<div id="printContainer"></div>
</body>
</html>