address bar: :! to add example command line file web.js & web.sh

This commit is contained in:
James Feng Cao 2023-01-08 19:59:57 +08:00
parent aeec3960f5
commit cd87cc793c
6 changed files with 63 additions and 31 deletions

View file

@ -49,7 +49,9 @@
<p><a href="https://releases.pagure.org/uweb/">pagure</a></p>
<p><a href="https://sourceforge.net/projects/uwebbrowser/files/v1/">sourceforge</a></p>
<h4 id="change-logs">Change logs</h4>
<p>949: Address bar: &quot;:p [width in milliInch]x[height]&quot; to generate PDF in custom size<br>
<p>954: Address bar: &quot;:!&quot; for command line support (.js/.sh files as executables).<br>
953: hardware keyboard: &quot;:&quot;, &quot;!&quot; to set focus on address bar<br>
949: Address bar: &quot;:p [width in milliInch]x[height]&quot; to generate PDF in custom size<br>
946: Option &quot;use offline cache&quot; to support serverless local websites.</p>
<p>945: commands to support evaluation of generated js code.</p>
<p>943: Multiple home screens support .mht (offline webpage), .search &amp; .html local files.</p>
@ -63,26 +65,6 @@
<li>Serverless local sites: PWA-kind web extension (chrome .crx &amp; firefox .xpi) support.</li>
<li>PWAs and web extensions to be used as search engines, ex. kiwix zim as search engines.</li>
</ul>
<p>925:</p>
<ul>
<li>remote js: wait for remote js to be fully loaded.</li>
<li>html5 apps are as powerful as native ones now and still secure.</li>
<li>Security enhancements.</li>
</ul>
<p>921: fix remote file decompression.</p>
<p>917:</p>
<ul>
<li>re-implement html5 enhancement for better mdict lookup support.</li>
</ul>
<p>908:</p>
<ul>
<li>Add internal links &quot;i:1d&quot; to launch apps. (to fix &quot;am&quot; issues for Android 8+)</li>
<li>File sending now supports pseudo file manager (page url faked as a file url for folder), thus scripts of internal links &quot;d:&quot; can generate any kind of pseudo file manager for file transfer.</li>
<li>Better support for naked Termux (without any initial packages with updateonly version).</li>
</ul>
<p>903: Enhance html5 apps. (ex. mdict-js, a dictionary lookup<br>
app, works like native with minimal change)<br>
901: Use in-app files folder for configuration</p>
</div>

View file

@ -59,13 +59,12 @@ uweb, termux &amp;amp; history versions
github
pagure
sourceforge
Change logs 949: Address bar: &amp;quot;:p [width in milliInch]x[height]&amp;quot; to generate PDF in custom size
Change logs 954: Address bar: &amp;quot;:!&amp;quot; for command line support (.js/.sh files as executables).
953: hardware keyboard: &amp;quot;:&amp;quot;, &amp;quot;!&amp;quot; to set focus on address bar
949: Address bar: &amp;quot;:p [width in milliInch]x[height]&amp;quot; to generate PDF in custom size
946: Option &amp;quot;use offline cache&amp;quot; to support serverless local websites.
945: commands to support evaluation of generated js code.
943: Multiple home screens support .mht (offline webpage), .search &amp;amp; .html local files.
940: Any url as website with local html processing (&amp;quot;i:0m/..../xxx.html:url&amp;quot;)
935:
Pipe support: command line output to uweb tabs.</description>
943: Multiple home screens support .</description>
</item>
<item>

View file

@ -102,6 +102,8 @@ Socks proxy</p>
The command line could be a &quot;.js&quot;, &quot;.sh&quot; or other executable with arguments. Ex. &quot;:!s youtube keyword&quot; could invoke &quot;s.js&quot; executable with the whole string as arguments (&quot;s.sh&quot; or &quot;s&quot; if file exists); &quot;:! youtube keyword&quot; would invoke the file &quot;.js&quot; or &quot;.sh&quot; as executable.</li>
</ul>
<p>For regular (non-js) executables, the standard output of the command line will be treated as lines of web urls.</p>
<p><a href="i:0h.sh:../searchurl/txt/web.sh">Click to install the example file &quot;.sh&quot;</a><br>
<a href="i:0hs.js:../searchurl/txt/web.js">Click to install the example file &quot;s.js&quot;</a></p>
<ul>
<li>:p [width in milliInch]x[height] [top margin]:[right margin]:[bottom margin]:[left margin]<br>
Generate/Print PDF file in the &quot;/sdcard/Download&quot; folder, all units are milliinch.<br>

15
en/searchurl/txt/web.js Normal file
View file

@ -0,0 +1,15 @@
let ess = {};
ess["g"]=["https://google.com/search?q=",];
ess["v"]=["https://www.youtube.com/results?search_query=",];
ess["b"]=["http://www.bing.com/search?q=",];
ess["w"]=["https://encyclopedia.thefreedictionary.com/",];
let url=arguments[1];
let iS1 = url.search(/ [^ ]/);
let iS2 = url.indexOf(' ',iS1+2);
let name = url.substring(iS1+1,iS2)
let keywords = url.substring(iS2+1);
let es = ess[name];
if(es){
location.href=es[0]+keywords;
}

35
en/searchurl/txt/web.sh Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/dash
#usage: g [engine] word1 word2 ...
default=''
g="https://www.google.com.hk/search?q="
yt="https://www.youtube.com/results?search_query="
m="http://www.merriam-webster.com/dictionary/"
w="http://en.wikipedia.org/wiki/"
wd="https://en.wiktionary.org/wiki/"
b="http://www.bing.com/search?intlF=1&q="
ks="http://www.iciba.com/"
en="http://www.enacademic.com/searchall.php?SWord="
gen="http://gen.lib.rus.ec/search.php?req="
abb="http://audiobookbay.li/?s="
bd="https://www.baidu.com/s?wd="
gb="https://www.gigablast.com/search?q="
yd="http://dict.youdao.com/search?q="
a="http://www.amazon.com/s?url=search-alias%3Daps&field-keywords="
bdic="http://cn.bing.com/dict/search?q="
be="http://www.britannica.com/search?query="
u="http://www.urbandictionary.com/define.php?term="
o="http://en.oxforddictionaries.com/definition/"
eval engine=\$${1:-default} #engine=$(eval echo \${$1})
shift #concate second argument to the last one with +
string=$1
shift
for a in "$@"
do
string+="+$a"
done
echo $engine$string

View file

@ -17,13 +17,12 @@ uweb, termux &amp;amp; history versions
github
pagure
sourceforge
Change logs 949: Address bar: &amp;quot;:p [width in milliInch]x[height]&amp;quot; to generate PDF in custom size
Change logs 954: Address bar: &amp;quot;:!&amp;quot; for command line support (.js/.sh files as executables).
953: hardware keyboard: &amp;quot;:&amp;quot;, &amp;quot;!&amp;quot; to set focus on address bar
949: Address bar: &amp;quot;:p [width in milliInch]x[height]&amp;quot; to generate PDF in custom size
946: Option &amp;quot;use offline cache&amp;quot; to support serverless local websites.
945: commands to support evaluation of generated js code.
943: Multiple home screens support .mht (offline webpage), .search &amp;amp; .html local files.
940: Any url as website with local html processing (&amp;quot;i:0m/..../xxx.html:url&amp;quot;)
935:
Pipe support: command line output to uweb tabs.</description>
943: Multiple home screens support .</description>
</item>
<item>