uweb/en/textprocess/index.html

117 lines
5.3 KiB
HTML
Raw Normal View History

2023-12-01 08:09:30 +00:00
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
2023-12-11 07:23:07 +00:00
2024-04-01 13:51:55 +00:00
<link rel="stylesheet" href="../style.css#" type="text/css" />
2023-12-01 08:09:30 +00:00
<title>Text selection/processing</title>
<script type="text/javascript">
function findLang(){
let href = location.href;
for(let i=href.length-1;i>0;i--){
if('/'==href.charAt(i) && '/'==href.charAt(i-3))
return i;
}
return 0;
}
function nav2(page){
let i = findLang();
location.href = location.href.substring(0,i+1)+page;
}
function nav2Lang(lang){
let i = findLang();
let href = location.href;
location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
}
</script>
</head>
<body>
<header class='header'>
2024-04-02 05:42:43 +00:00
<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>
2023-12-01 08:09:30 +00:00
<a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
<nav>
</nav>
</header>
<br />
<div class="container">
<h1 class="title">Text selection/processing
<br>
<span class="subtitle"></span>
</h1>
<ul class="tags">
2024-04-01 13:51:55 +00:00
<li><a href="../tags/termux/index.html#">termux</a> </li>
2023-12-01 08:09:30 +00:00
2024-04-01 13:51:55 +00:00
<li><a href="../tags/ssh/index.html#">ssh</a> </li>
2023-12-01 08:09:30 +00:00
2024-04-01 13:51:55 +00:00
<li><a href="../tags/clipboard/index.html#">clipboard</a> </li>
2023-12-01 08:09:30 +00:00
2024-04-01 13:51:55 +00:00
<li><a href="../tags/windows/index.html#">windows</a> </li>
2023-12-01 08:09:30 +00:00
</ul>
<p>Click the following links to install menus for long pressing the button &quot;link&quot;:<br>
<a href="i:0gdefault.select::copyHtml:html/clip:%0A">Copy selected text with html format to clipboard</a></p>
<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>
<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>
<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>
<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>
<p>The file &quot;default.select&quot; 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>
[Name]:[mimetype]:[command line]</p>
<p>[mimetype] specifies input/output for [command line].<br>
It formats as &quot;[input mimetype]/[output mimetype]&quot;.<br>
[input mimetype] can be the following:</p>
<ul>
<li>&quot;html&quot;: rich text</li>
<li>&quot;&quot; (empty): text</li>
<li>&quot;.js&quot; file name under configuration folder. The js file is evaluated and its return value is passed to [command line] as standard input.</li>
</ul>
<p>[output mimetype] is same as the one defined in &quot;<a href="../cmds/index.html">Commands</a>&quot;.</p>
<ul>
<li>regular mimetype such as &quot;text/html&quot;: output as the mimetype</li>
<li>&quot;uweb&quot;: output as links</li>
<li>&quot;uwebA&quot;: output as &quot;A&quot; link, all characters including newlines are part of the link.</li>
<li>&quot;clip&quot;: output to clipboard</li>
<li>&quot;termux&quot;: output as termux command</li>
</ul>
<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 &quot;/&quot;, optionally append &quot;?[prefix][<em>[postfix]]&quot;. For example, &quot;file:///sdcard/?</em>.png&quot; lists all .png files under the folder &quot;/sdcard&quot;. Select files and process them with checked.js(such as &quot;copy to PC&quot; as the later example).</p>
<p>default.select sample file:<br>
copy2addressbar:/uweb:printf i:15;cat<br>
copy2PCClipboard::ssh [user:password]@192.168.2.102 &quot;DISPLAY=:0 xsel -i&quot;<br>
richtext2PCClipboard:html:ssh [user:password]@192.168.2.102 &quot;DISPLAY=:0 xsel -i&quot;<br>
copyFiles:checked.js:while read fname;do scp $fname [user:password]@192.168.2.102:Downloads/.; done</p>
<p>Here we assume that the user PC has IP address as &quot;192.168.2.102&quot;.<br>
2024-04-02 05:42:43 +00:00
To use ssh or scp, users need to install uweb compatible Termux provided on the <a href="../../en/">uweb apk download page</a>, and install openssl under termux (apt install openssl).<br>
2023-12-01 08:09:30 +00:00
PCs need command &quot;xsel&quot; available to operate on copy/paste.</p>
</div>
2024-04-02 05:42:43 +00:00
<p>Last Modified: 2 April 2024<br>
add js function in README<br>
2023-12-01 08:09:30 +00:00
<pre></pre>
</p>
2024-03-21 01:04:37 +00:00
2023-12-01 08:09:30 +00:00
<script id='jsgiscus'
src='https://giscus.app/client.js'
data-repo="torappinfo/uweb"
data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
data-category="Announcements"
data-category-id="DIC_kwDOEgNLGc4CQjsh"
data-mapping="title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="light"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous" async>
</script>
</body>
</html>