From 8fde5df4462ecf3574df9aa4e4ac39d53ebe9d1d Mon Sep 17 00:00:00 2001 From: James Feng Cao Date: Mon, 20 Feb 2023 22:03:43 +0800 Subject: [PATCH] use relative path --- en/acmd/index.html | 7 +- en/adblock/index.html | 2 +- en/html5/index.html | 2 +- en/index.xml | 2 +- en/pccopy/index.html | 2 +- en/redirect/index.html | 2 +- en/rjs/index.html | 3 +- en/topposts/index.xml | 2 +- zh/adblock/index.html | 2 +- zh/html5/index.html | 2 +- zh/index.xml | 4 +- zh/links/index.html | 4 +- zh/pccopy/index.html | 2 +- zh/redirect/index.html | 2 +- zh/rjs/index.html | 14 ++- zh/searchurl/bml/content/exportsvg.js | 121 ++++++++++++++++++++++++++ zh/tcron/index.html | 2 +- zh/topposts/index.xml | 4 +- 18 files changed, 147 insertions(+), 32 deletions(-) create mode 100644 zh/searchurl/bml/content/exportsvg.js diff --git a/en/acmd/index.html b/en/acmd/index.html index a44bb26..b8111da 100644 --- a/en/acmd/index.html +++ b/en/acmd/index.html @@ -49,6 +49,9 @@ The command line could be a ".js", ".sh" or other executable

For regular (non-js) executables, the standard output of the command line could be treated as lines of urls (or html, plain text).

Install the example file ".js" (supporting search engine bundle)
Install the example file "s.sh"

+

Click the following links to make commands appear in address bar, then press "enter" to execute:
+Make uweb configuration folder accessible by file managers with termux installed
+(File manager list at end of the page)

Address bar command modes

Commands are the best for repeated execution of an instruction. Address bar command modes provide ways to run different commands in the same category easily.

The configure file "default.acmd" has the exactly same format as default.cmds. Click the following links to install new modes (cold start the app to take effect, then long click the "refresh" button to switch modes):

@@ -58,10 +61,6 @@ The command line could be a ".js", ".sh" or other executable output;plot %25s'%0A">GNUPlot plot (2D function), needs uweb adapted termux & gnuplot

GNUPlot plot (3D function), needs uweb adapted termux & gnuplot

-

Shell command mode

-

Click the following links to make commands appear in address bar, then press "enter" to execute:
-Make uweb configuration folder accessible by file managers with termux installed
-(File manager list at end of the page)

diff --git a/en/adblock/index.html b/en/adblock/index.html index ef2c6f5..384748c 100644 --- a/en/adblock/index.html +++ b/en/adblock/index.html @@ -68,7 +68,7 @@
  • -

    Long press the setting button, check the option "Block external scripts". UI website has option to also block dubious 3rd party resources. js.allow whitelists js libraries.

    +

    Long press the setting button, check the option "Block external scripts". UI website has option to also block dubious 3rd party resources. js.allow whitelists js libraries.

  • Long press the button [☰], "Disable floating ADs", "Disable banners", "clear all timers", "stop events" and "Sleep ..." are also available.

    diff --git a/en/html5/index.html b/en/html5/index.html index b29b533..cf298b3 100644 --- a/en/html5/index.html +++ b/en/html5/index.html @@ -78,7 +78,7 @@ Click to install the following html5 apps:

    With the first approach, the html5 application is installed locally and can read any file allowed by the OS; while in the second approach, the html5 application can be either local or remote, and only files under the subfolder "app" can be accessed; The third approach allows easy access of other external resources (ex. local media).

    Open local files with html5 apps

    Click to configure default.filecap to open local files, and to open remote files with the option "custom file handling":
    -use pdf.js,djvu.js,epub.js, huge markdown viewer for local files

    +use pdf.js,djvu.js,epub.js, huge markdown viewer for local files

    url examples are as follows:

    -

    checked.js: Evaluate checked.js and return value as standard input for the command line. For any file url ending with "/", optionally append "?[prefix][[postfix]]". For example, "file:///sdcard/?.png" lists all .png files under the folder "/sdcard". Select files and process them with checked.js(such as "copy to PC" as the later example).

    +

    checked.js: Evaluate checked.js and return value as standard input for the command line. For any file url ending with "/", optionally append "?[prefix][[postfix]]". For example, "file:///sdcard/?.png" lists all .png files under the folder "/sdcard". Select files and process them with checked.js(such as "copy to PC" as the later example).

    default.select sample file:
    copy2addressbar:/uweb:printf i:15;cat
    copy2PCClipboard::ssh [user:password]@192.168.2.102 "DISPLAY=:0 xsel -i"
    diff --git a/en/redirect/index.html b/en/redirect/index.html index 3d4a78d..53fa52f 100644 --- a/en/redirect/index.html +++ b/en/redirect/index.html @@ -52,7 +52,7 @@

    Click the following links to append mirrors to the file "default.redirect":
    github mirror:fastgit
    github mirror 2

    -

    google recaptcha mirror

    +

    google recaptcha mirror

    Each line of the file "default.redirect" has the following format:
    [domain name]:[regular expression]:[replacement expression]

    in which "[regular expression]" is as defined by java language, and cannot have ":" inside; if empty, it defaults to be same as "[domain name]".

    diff --git a/en/rjs/index.html b/en/rjs/index.html index 740415b..c17c359 100644 --- a/en/rjs/index.html +++ b/en/rjs/index.html @@ -49,7 +49,7 @@

    javascript for domains
    Global javascript files locates in the subfolder "js" of app private folder. Long press button [☰] to configure. Click the following links to install:
    -<a target=_self" href="i:0hjs/savePassword.js:https://fastly.jsdelivr.net/gh/torappinfo/uweb/zh/searchurl/txt/passwdsave.js">Save password
    +<a target=_self" href="i:0hjs/savePassword.js:../../zh/searchurl/txt/passwdsave.js">Save password
    Instant page

    large size javascript code can be installed to the folder "bookmarklet" (long pressing button "js" to popup menu):
    Eruda
    @@ -59,6 +59,7 @@

    Selection to line:;let g='line';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

    Selection to paragraph:;let g='paragraph';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

    markdown:['https://cdn.jsdelivr.net/npm/showdown/dist/showdown.min.js'];var d=document;var md=d.querySelector('pre').innerText;var c=new showdown.Converter({emoji:true,underline:true,});c.setFlavor('github');d.body.innerHTML=c.makeHtml(md);d.title=d.title||d.body.firstElementChild.innerText.trim();

    +

    mermaid:;loadModuleJS(import mermaid from 'https://unpkg.com/mermaid/dist/mermaid.esm.min.mjs';mermaid.initialize({startOnLoad:true});)

    mathjax:['https://fastly.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js']

    New tab to open links:;let d=document;b=d.createElement('base');b.setAttribute('target','_blank');d.head.appendChild(b)

    Site search:;open('i:15site:' + location.hostname)

    diff --git a/en/topposts/index.xml b/en/topposts/index.xml index 5d33f66..3af6a50 100644 --- a/en/topposts/index.xml +++ b/en/topposts/index.xml @@ -131,7 +131,7 @@ Clear logcat::logcat -c /en/rjs/ javascript for domains Global javascript files locates in the subfolder &quot;js&quot; of app private folder. Long press button [☰] to configure. Click the following links to install: -&lt;a target=_self&quot; href=&quot;i:0hjs/savePassword.js:https://fastly.jsdelivr.net/gh/torappinfo/uweb/zh/searchurl/txt/passwdsave.js&quot;&gt;Save password +&lt;a target=_self&quot; href=&quot;i:0hjs/savePassword.js:../../zh/searchurl/txt/passwdsave.js&quot;&gt;Save password Instant page large size javascript code can be installed to the folder &quot;bookmarklet&quot; (long pressing button &quot;js&quot; to popup menu): Eruda diff --git a/zh/adblock/index.html b/zh/adblock/index.html index a5d4989..ef288fc 100644 --- a/zh/adblock/index.html +++ b/zh/adblock/index.html @@ -75,7 +75,7 @@
  • -

    长按设置,选取"拦截外链脚本"。可在界面配置及杂项网页额外拦截第三方可疑资源。可配置白名单js.allow

    +

    长按设置,选取"拦截外链脚本"。可在界面配置及杂项网页额外拦截第三方可疑资源。可配置白名单js.allow

  • 长按[☰]按钮可隐藏浮动信息,移除横幅,清空定时器(防止定时触发不良信息),中断可疑事件(防止用户操作触发),等待(防止延迟触发)。

    diff --git a/zh/html5/index.html b/zh/html5/index.html index c081d2c..2f9a11e 100644 --- a/zh/html5/index.html +++ b/zh/html5/index.html @@ -64,7 +64,7 @@ 相应的菜单安装可见浏览器特色服务

    超微配置目录下的子目录名如果以"app"开始(譬如"appPDF"),则这些"app"开头目录树下放置的html5应用将可获得功能增强。

    配置default.filecap并打开选项“文件预处理”,清后台重启浏览器后超微可直接阅读应用对应格式文件。
    -点击配置pdf.js,djvu.js,epub.js,超大文件阅读器

    +点击配置pdf.js,djvu.js,epub.js,超大文件阅读器

    超大文件阅读器txtview.html url如下:
    file:///data/user/0/info.torapp.uweb/files/app/txtview.html?url=[url]#page=[xxx]
    file:///data/user/0/info.torapp.uweb/files/app/txtview.html?url=[url]#offset=[xxxx]&[length]
    diff --git a/zh/index.xml b/zh/index.xml index 168b4df..6906c22 100644 --- a/zh/index.xml +++ b/zh/index.xml @@ -406,16 +406,14 @@ c[cssFlag]: For example, &quot;c12&quot; will apply the third and fourth 特定网址用户脚本 全局脚本位于js子目录, 长按[☰]按钮配置。点击以下链 接安装: -&lt;a target=_self&quot; href=&quot;i:0hjs/记住密码.js:https://fastly.jsdelivr.net/gh/torappinfo/uweb/searchurl/txt/passwdsave.js&quot;&gt;记住密码 +&lt;a target=_self&quot; href=&quot;i:0hjs/记住密码.js:../searchurl/txt/passwdsave.js&quot;&gt;记住密码 极速网页 大型脚本可安装到&quot;bookmarklet&quot;目录下(长按js按钮): google翻译 Eruda -彩云小译 Performance 移除覆盖物 远程脚本配置文件default.rjs样列如下,点击以下链接自动安装 (清空后台重启浏览器,长按搜索按钮,则弹出远程脚本菜单): -彩云小译:['https://caiyunapp.com/dest/trs.js'] Selection to sentence:;let g='sentence';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g); Selection to line:;let g='line';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g); Selection to paragraph:;let g='paragraph';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g); diff --git a/zh/links/index.html b/zh/links/index.html index 45c11ed..8ff896c 100644 --- a/zh/links/index.html +++ b/zh/links/index.html @@ -55,8 +55,8 @@

    更多 webdav ...

    迅雷盘离线

    网页全屏

    -

    点击安装Cookie延期,地址栏内删除特殊字符,站内搜索,seedr离线下载等
    -点击安装离线下载(pcloud,furk,微云等)

    +

    点击安装Cookie延期,地址栏内删除特殊字符,站内搜索,seedr离线下载等
    +点击安装离线下载(pcloud,furk,微云等)

    酷安扫描

    uweb浏览器中长按书签按钮可弹出常用链接菜单,这些链接定义在文件"default.link"中,改动过的文件清后台重启动后生效。每行格式如下:
    [菜单名]:[url][空格][javascript脚本]
    diff --git a/zh/pccopy/index.html b/zh/pccopy/index.html index c3786d2..5121b09 100644 --- a/zh/pccopy/index.html +++ b/zh/pccopy/index.html @@ -66,7 +66,7 @@ 搜狗翻译

    彩云小译
    deepL

    -

    点击安装"保存文本"等

    +

    点击安装"保存文本"等

    重启浏览器,长按“链接”按钮,将弹出菜单。若用户当前窗口并无选中文本,则选取整个页面作相应操作,否则以选中文本为准。

    配置文件"default.select"定义了超微浏览器对选中(富)文本/元素进行的操作。没有任何选中元素则以整个网页为操作对象。每行格式如下:
    [菜单名]:[mimetype]:[命令行]

    diff --git a/zh/redirect/index.html b/zh/redirect/index.html index 95f344c..ec20238 100644 --- a/zh/redirect/index.html +++ b/zh/redirect/index.html @@ -54,7 +54,7 @@

    github mirror:fastgit
    github mirror 2
    github mirror 3

    -

    点击添加google recaptcha国内镜像

    +

    点击添加google recaptcha国内镜像

    使用服务器在国外的搜索引擎体验往往不如国内的引擎。由于网站屏蔽的原因,两者之间索引权重差别很大。国外受欢迎的技术类网站因此难以在百度上搜到;国外引擎能搜到但由于其中不少结果无法访问而体验糟糕。

    其实,很多技术类网站在国内早有镜像,但由于镜像并非众所周知,其索引权重在百度上微不足道,非专门搜索不可得。

    本文介绍一种技术,可重定向国外网址至国内镜像,极大的提高国外引擎的体验,让更多用户更客观的理解全球技术。

    diff --git a/zh/rjs/index.html b/zh/rjs/index.html index feaedef..2bab83a 100644 --- a/zh/rjs/index.html +++ b/zh/rjs/index.html @@ -50,16 +50,14 @@

    特定网址用户脚本

    全局脚本位于js子目录, 长按[☰]按钮配置。点击以下链
    接安装:
    -<a target=_self" href="i:0hjs/记住密码.js:https://fastly.jsdelivr.net/gh/torappinfo/uweb/searchurl/txt/passwdsave.js">记住密码
    +<a target=_self" href="i:0hjs/记住密码.js:../searchurl/txt/passwdsave.js">记住密码
    极速网页

    大型脚本可安装到"bookmarklet"目录下(长按js按钮):
    -google翻译

    -

    Eruda
    -彩云小译
    -Performance
    -移除覆盖物

    +google翻译

    +

    Eruda

    +

    Performance
    +移除覆盖物

    远程脚本配置文件default.rjs样列如下,点击以下链接自动安装 (清空后台重启浏览器,长按搜索按钮,则弹出远程脚本菜单):

    -

    彩云小译:['https://caiyunapp.com/dest/trs.js']

    Selection to sentence:;let g='sentence';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

    Selection to line:;let g='line';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

    Selection to paragraph:;let g='paragraph';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

    @@ -68,7 +66,7 @@

    站内搜索:;open('i:15site:' + location.hostname)

    编辑器拼写检查:;let t=document.getElementsByTagName('textarea');let v=t[0].spellcheck;if(v==null)v=false;t[0].spellcheck=!v

    远程及小型脚本可安装到default.rjs文件中。远程脚本对CSP网站仍然有效。:
    -点击安装google翻译、背景图等

    +点击安装google翻译、背景图等

    远程脚本配置文件default.rjs每行格式如下 (url部分支持js代码运算):
    [远程脚本名]:[返回url数组的javascript代码]

    其中url可以为本地http脚本地址。譬如'https://local/...' (本地html5应用离线缓存)。此时,js脚本也可使用.link文件方式调用。

    diff --git a/zh/searchurl/bml/content/exportsvg.js b/zh/searchurl/bml/content/exportsvg.js new file mode 100644 index 0000000..679fdb9 --- /dev/null +++ b/zh/searchurl/bml/content/exportsvg.js @@ -0,0 +1,121 @@ +{ + const svgns = "http://www.w3.org/2000/svg"; + const textAttributes = new Set([ + 'color', + 'dominant-baseline', + 'font-family', + 'font-size', + 'font-size-adjust', + 'font-stretch', + 'font-style', + 'font-variant', + 'font-weight', + 'direction', + 'letter-spacing', + 'text-decoration', + 'text-anchor', + 'text-decoration', + 'text-rendering', + 'unicode-bidi', + 'word-spacing', + 'writing-mode', + 'user-select', + ]); + function copyTextStyles(styles, svgElement){ + for (const textProperty of textAttributes) { + const value = styles.getPropertyValue(textProperty) + if (value) { + svgElement.setAttribute(textProperty, value) + } + } + // tspan uses fill, CSS uses color + svgElement.setAttribute('fill', styles.color) + } + function handleSVGElement(svg, element){ + const contentContainer = Document.createElementNS(svgns, 'g'); + contentContainer.innerHTML = element.innerHTML; + contentContainer.dataset.viewBox = element.getAttribute('viewBox'); + contentContainer.dataset.width = element.getAttribute('width'); + contentContainer.dataset.height = element.getAttribute('height'); + let viewBoxTransformMatrix = element.getScreenCTM(); + contentContainer.transform.baseVal.appendItem( contentContainer.transform.baseVal.createSVGTransformFromMatrix(viewBoxTransformMatrix)); + svg.appendChild(contentContainer); + } + + function createSVG(svg, node){ + let rect; + if(Node.TEXT_NODE === node.nodeType) { + let str = node.textContent; + if(str.match(/^\s+$/)) return; + rect = node.parentElement.getBoundingClientRect(); + const text = document.createElementNS(svgns, 'text'); + text.innerHTML = str; + text.setAttribute("x", rect.left); + text.setAttribute("y", rect.top); + svg.appendChild(text); + return; + } + if(Node.ELEMENT_NODE!=node.nodeType) return; + let element = node; + if("SCRIPT" == element.tagName || + "STYLE" == element.tagName) return; + rect = element.getBoundingClientRect(); + if("SVG" == element.tagName) { + handleSVGElement(svg,element); + /* + let clone = element.cloneNode(true); + clone.setAttribute("x", rect.left); + clone.setAttribute("y", rect.top); + clone.setAttribute("width", rect.width); + clone.setAttribute("height", rect.height); + svg.appendChild(clone); + */ + return; + } + //const styles = window.getComputedStyle(element); + let children = element.childNodes; + let nChildren = children.length; + + // Get the HTML element's style + //var style = window.getComputedStyle(element); + //svg.setAttribute("style", style); + + // Iterate through the HTML element's children + for (let i = 0; i < nChildren; i++) { + createSVG(svg, children[i]); + } + } + // Get the HTML element to be converted + let element = document.body; + // Append the SVG element to the HTML document + let svg = document.createElementNS(svgns,'svg'); + let rect = element.getBoundingClientRect(); +// svg.setAttribute("x", rect.left); +// svg.setAttribute("y", rect.top); + svg.setAttribute("width", rect.width); + svg.setAttribute("height", rect.height); + createSVG(svg, element); + //document.body.appendChild(svg); + + // Create a Blob of the string + let svgS = new XMLSerializer().serializeToString(svg); + const blob = new Blob([svgS], { type: 'text/plain' }); + + // Create a link element + const link = document.createElement('a'); + // Create the url + link.href = window.URL.createObjectURL(blob); + + // Set the file name + link.download = 'uweb.svg'; + + // Append the link to the DOM + document.body.appendChild(link); + + // Click the link + link.click(); + + // Remove the link from the DOM + document.body.removeChild(link); +} + diff --git a/zh/tcron/index.html b/zh/tcron/index.html index dd108cb..136e08b 100644 --- a/zh/tcron/index.html +++ b/zh/tcron/index.html @@ -61,7 +61,7 @@ set PATH=/system/bin:/data/data/info.torapp.uweb/files/bin
    tcron /sdcard/a "cloud189-go sign;toybox touch /sdcard/a" 24
    #每30天清空baidu目录
    tcron /sdcard/b "rm -rf /sdcard/baidu/*;toybox touch /sdcard/b" 720

    -

    安装default.rc模板文件(termux)

    +

    安装default.rc模板文件(termux)

    可能用到的命令:
    termux中安装remind,可配置各类提醒功能,十分强大。
    apt install remind

    diff --git a/zh/topposts/index.xml b/zh/topposts/index.xml index 5f45d1a..9e0425d 100644 --- a/zh/topposts/index.xml +++ b/zh/topposts/index.xml @@ -194,16 +194,14 @@ tgz install::toybox tar -xzf %f -C / 特定网址用户脚本 全局脚本位于js子目录, 长按[☰]按钮配置。点击以下链 接安装: -&lt;a target=_self&quot; href=&quot;i:0hjs/记住密码.js:https://fastly.jsdelivr.net/gh/torappinfo/uweb/searchurl/txt/passwdsave.js&quot;&gt;记住密码 +&lt;a target=_self&quot; href=&quot;i:0hjs/记住密码.js:../searchurl/txt/passwdsave.js&quot;&gt;记住密码 极速网页 大型脚本可安装到&quot;bookmarklet&quot;目录下(长按js按钮): google翻译 Eruda -彩云小译 Performance 移除覆盖物 远程脚本配置文件default.rjs样列如下,点击以下链接自动安装 (清空后台重启浏览器,长按搜索按钮,则弹出远程脚本菜单): -彩云小译:['https://caiyunapp.com/dest/trs.js'] Selection to sentence:;let g='sentence';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g); Selection to line:;let g='line';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g); Selection to paragraph:;let g='paragraph';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);