5 <meta name=
"viewport" content=
"width=device-width, initial-scale=1" />
7 <link rel=
"stylesheet" href=
"../style.css#" type=
"text/css" />
8 <title>Text selection/processing
</title>
9 <script type=
"text/javascript">
11 let href
= location
.href
;
12 for(let i
=href
.length
-1;i
>0;i
--){
13 if('/'==href
.charAt(i
) && '/'==href
.charAt(i
-3))
20 location
.href
= location
.href
.substring(0,i
+1)+page
;
22 function nav2Lang(lang
){
24 let href
= location
.href
;
25 location
.href
= location
.href
.substring(0,i
-2)+lang
+location
.href
.substring(i
);
30 <header class='header'
>
31 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('index.html#')">Home
</a> <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('tags/index.html#')">Tags
</a>
34 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2Lang('zh')">简体中文
</a>
42 <div class=
"container">
43 <h1 class=
"title">Text selection/processing
45 <span class=
"subtitle"></span>
49 <li><a href=
"../tags/termux/index.html#">termux
</a> </li>
51 <li><a href=
"../tags/ssh/index.html#">ssh
</a> </li>
53 <li><a href=
"../tags/clipboard/index.html#">clipboard
</a> </li>
55 <li><a href=
"../tags/windows/index.html#">windows
</a> </li>
58 <p>Click the following links to install menus for long pressing the button
"link
":
<br>
59 <a href=
"i:0gdefault.select::copyHtml:html/clip:%0A">Copy selected text with html format to clipboard
</a></p>
60 <p><a href=
"i:0gdefault.select::Home:/uweb:printf file://data/data/info.torapp.uweb/files/home5.search%5C location.href=%5C%22i:15;cat;printf %5C%22%0A">Search with home screen
</a></p>
61 <p><a href=
"i:0gdefault.select::google Translate:/uweb:printf 'https://translate.google.com/?sl=auto&tl=en&op=translate&text=';cat|tr ' ' '%2B'%0A">google Translate
</a></p>
62 <p><a href=
"i:0gdefault.select::bing Translate:/uweb:printf 'https://cn.bing.com/translator/?from=&to=en&text=';cat|tr ' ' '%2B'%0A">bing translate
</a></p>
63 <p><a href=
"i:0gdefault.select::deepL:/uweb:printf https://www.deepl.com/translator-mobile#auto/en/;cat|sed 's/ /%2520/g'%0A">deepL
</a></p>
64 <p>The file
"default.select
" defines text processing menus for selected text. If no text is selected, the menu item operates on the whole page. Each line of the file has the following format:
<br>
65 [Name]:[mimetype]:[command line]
</p>
66 <p>[mimetype] specifies input/output for [command line].
<br>
67 It formats as
"[input mimetype]/[output mimetype]
".
<br>
68 [input mimetype] can be the following:
</p>
70 <li>"html
": rich text
</li>
71 <li>"" (empty): text
</li>
72 <li>".js
" file name under configuration folder. The js file is evaluated and its return value is passed to [command line] as standard input.
</li>
74 <p>[output mimetype] is same as the one defined in
"<a href=
"../cmds/index.html#">Commands
</a>".
</p>
76 <li>regular mimetype such as
"text/html
": output as the mimetype
</li>
77 <li>"uweb
": output as links
</li>
78 <li>"uwebA
": output as
"A
" link, all characters including newlines are part of the link.
</li>
79 <li>"clip
": output to clipboard
</li>
80 <li>"termux
": output as termux command
</li>
82 <p><a target=
"_self" href=
"i:0hcheck.js:../../zh/searchurl/txt/check.js">checked.js
</a>: Evaluate checked.js and return value as standard input for the command line. For any file url ending with
"/
", optionally append
"?[prefix][
<em>[postfix]]
". For example,
"file:///sdcard/?
</em>.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).
</p>
83 <p>default.select sample file:
<br>
84 copy2addressbar:/uweb:printf i:
15;cat
<br>
85 copy2PCClipboard::ssh [user:password]@
192.168.2.102 "DISPLAY=:
0 xsel -i
"<br>
86 richtext2PCClipboard:html:ssh [user:password]@
192.168.2.102 "DISPLAY=:
0 xsel -i
"<br>
87 copyFiles:checked.js:while read fname;do scp $fname [user:password]@
192.168.2.102:Downloads/.; done
</p>
88 <p>Here we assume that the user PC has IP address as
"192.168.2.102".
<br>
89 To use ssh or scp, users need to install uweb compatible Termux provided on the
<a href=
"../index.html#">uweb apk download page
</a>, and install openssl under termux (apt install openssl).
<br>
90 PCs need command
"xsel
" available to operate on copy/paste.
</p>
93 <p>Last Modified:
2 April
2024<br>
94 add js function in README
<br>
99 src='https://giscus.app/client.js'
100 data-repo=
"torappinfo/uweb"
101 data-repo-id=
"MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
102 data-category=
"Announcements"
103 data-category-id=
"DIC_kwDOEgNLGc4CQjsh"
106 data-reactions-enabled=
"1"
107 data-emit-metadata=
"0"
108 data-input-position=
"top"
112 crossorigin=
"anonymous" async
>
115 <footer class=
"site-footer">
116 <div class=
"container">
117 © 2018-
2024 Richard H. Cao
120 <!-- This document is licensed under the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at <https://www.gnu.org/licenses/>. -->