From 542a4e0eb42f0ad756ddd1da0928ca9684dd38f8 Mon Sep 17 00:00:00 2001 From: James Feng Cao Date: Fri, 12 Nov 2021 15:24:33 +0800 Subject: [PATCH] rebuilding site Fri Nov 12 03:24:33 PM CST 2021 --- index.html | 2 +- links/index.html | 4 +++ searchurl/txt/markdeep.html | 55 ++++++++++++++++++++++++++++--------- searchurl/txt/txtview.html | 51 ++++++++++++++++++++++++++-------- 4 files changed, 86 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index bd89ae6..f6915cb 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - + diff --git a/links/index.html b/links/index.html index 8928e67..1aa0ce0 100644 --- a/links/index.html +++ b/links/index.html @@ -131,6 +131,10 @@ socks代理

重用已有窗口跳转至不同anchor。

  • +

    i:5c[url]
    +更改自动翻页url

    +
  • +
  • i:60[path]:[url]
    如果本地文件存在就打开,否则访问远程url

  • diff --git a/searchurl/txt/markdeep.html b/searchurl/txt/markdeep.html index 529f40f..b43a017 100644 --- a/searchurl/txt/markdeep.html +++ b/searchurl/txt/markdeep.html @@ -20,43 +20,72 @@ //return await resp.text(); } } - - var file = new absFile(location.search.substring(5));//?url=#page= - window.addEventListener('hashchange',loadSlice); - loadSlice(); + function render(u8array){ + document.body.innerHTML = window.markdeep.format(new TextDecoder().decode(u8array),true); + MathJax.typesetPromise(); + } + + var file; + var blocksize = 1024; function loadSlice(){ var url; var page = 1; - var blocksize = 1024; - var extrasize = 1024; //extrasize should <= blocksize + var extrasize = blocksize; //extrasize should <= blocksize let lhash = location.hash; - if(lhash) - page = parseInt(lhash.substring(6),10); + if(lhash){ + if("p"!==lhash.charAt(1)){//#offset=&[len] + let iAmpersand = lhash.indexOf('&',8); + let offset = parseInt(lhash.substring(8,iAmpersand)); + let len = parseInt(lhash.substring(iAmpersand+1)); + {//update urlInc() url + let href = location.href; + let iHash = href.indexOf('#'); + href="i:5c"+href.substring(0,iHash)+"#page="+Math.floor((offset+len)/blocksize); + let d=document; + let a = d.createElement('a'); + a.href = href; + a.click(); + } + file.slice(offset,len).then((buffer)=>{ + let u8 = new Uint8Array(buffer); + render(u8); + }); + return; + } + //#page= + page = parseInt(lhash.substring(6)); + } file.slice(blocksize*(page-1),blocksize+extrasize).then((buffer)=>{ let u8 = new Uint8Array(buffer); + let u8len = u8.length; let iStart = 0; + let limit = Math.min(u8len,extrasize); if(1!=page){ - for(let i=1;i + diff --git a/searchurl/txt/txtview.html b/searchurl/txt/txtview.html index 83a5e16..3bb1217 100644 --- a/searchurl/txt/txtview.html +++ b/searchurl/txt/txtview.html @@ -18,44 +18,71 @@ //return await resp.text(); } } + + function render(u8array){ + document.body.innerHTML = marked(new TextDecoder().decode(u8array)); + } var file; + var blocksize = 1024; function loadSlice(){ var url; var page = 1; - var blocksize = 1024; - var extrasize = 1024; //extrasize should <= blocksize + var extrasize = blocksize; //extrasize should <= blocksize let lhash = location.hash; - if(lhash) - page = parseInt(lhash.substring(6),10); + if(lhash){ + if("p"!==lhash.charAt(1)){//#offset=&[len] + let iAmpersand = lhash.indexOf('&',8); + let offset = parseInt(lhash.substring(8,iAmpersand)); + let len = parseInt(lhash.substring(iAmpersand+1)); + {//update urlInc() url + let href = location.href; + let iHash = href.indexOf('#'); + href="i:5c"+href.substring(0,iHash)+"#page="+Math.floor((offset+len)/blocksize); + let d=document; + let a = d.createElement('a'); + a.href = href; + a.click(); + } + file.slice(offset,len).then((buffer)=>{ + let u8 = new Uint8Array(buffer); + render(u8); + }); + return; + } + //#page= + page = parseInt(lhash.substring(6)); + } file.slice(blocksize*(page-1),blocksize+extrasize).then((buffer)=>{ let u8 = new Uint8Array(buffer); + let u8len = u8.length; let iStart = 0; + let limit = Math.min(u8len,extrasize); if(1!=page){ - for(let i=1;i +