Compare commits

...

2 commits

Author SHA1 Message Date
James Feng Cao
3d6951e99a add command bookmarks 2022-10-15 08:55:26 +08:00
James Feng Cao
a79d00b323 add command bookmarks 2022-10-15 08:47:23 +08:00
9 changed files with 224 additions and 27 deletions

View file

@ -117,14 +117,8 @@ Enable selection</description>
<guid>/en/bookmark/</guid> <guid>/en/bookmark/</guid>
<description>Wait for url from other devices <description>Wait for url from other devices
Templates Click following links to install bookmark templates, bookmarks saved to the template have corresponding features enabled. Commands Clicking to run is only allowed from local pages for bookmarks in this section. Users need to either save the bookmarks to local or long press the link =&amp;gt; &amp;quot;open in new tab&amp;quot; to execute.
&amp;quot;novel.html&amp;quot;: auto reader&#39;s mode To save the bookmarks to local, users firstly need to install &amp;quot;bookmark&amp;quot; menu by clicking corresponding link in the url services page, then long press the bookmark link =&amp;gt; &amp;quot;open in new tab&amp;quot; =&amp;gt; &amp;quot;Commands&amp;quot; =&amp;gt; &amp;quot;bookmark&amp;quot; to save the bookmark.</description>
Termux The following bookmarks need termux. Clicking to run is only allowed from local pages.
GNU bc (basic calculator)
bc with all extensions
Science Physics Feynman lectures
Chemistry chemspider
molecule SMILES</description>
</item> </item>
<item> <item>

View file

@ -53,9 +53,7 @@ output;plot %25s'%0A">GNUPlot plot (2D function), needs uweb adapted termux &amp
output;splot %25s'%0A">GNUPlot plot (3D function), needs uweb adapted termux &amp; gnuplot</a></p> output;splot %25s'%0A">GNUPlot plot (3D function), needs uweb adapted termux &amp; gnuplot</a></p>
<h4 id="shell-command-mode">Shell command mode</h4> <h4 id="shell-command-mode">Shell command mode</h4>
<p>Click the following links to make commands appear in address bar, then press &quot;enter&quot; to execute:<br> <p>Click the following links to make commands appear in address bar, then press &quot;enter&quot; to execute:<br>
<a href="i:15cd;toybox mkdir -p /sdcard/Download/app;toybox ln -s /sdcard/Download/app">symbolic link &quot;app&quot; folder to be under the &quot;Download&quot; folder</a></p> <a href="i:15cd /data/data/com.termux/files/home;ln -s ../../../info.torapp.uweb/files uweb">Make uweb configuration folder accessible by file managers with termux installed</a><br>
<p><a href="i:15cd;cd ../..;toybox cp -r files /sdcard/Download/uweb;toybox rm -rf files;toybox ln -s /sdcard/Download/uweb files">symbolic link configuration folder to &quot;/sdcard/Download/uweb&quot;</a></p>
<p><a href="i:15cd /data/data/com.termux/files/home;ln -s ../../../info.torapp.uweb/files uweb">Make uweb configuration folder accessible by file managers with termux installed</a><br>
(<a href="https://wiki.termux.com/wiki/Internal_and_external_storage">File manager list at end of the page</a>)</p> (<a href="https://wiki.termux.com/wiki/Internal_and_external_storage">File manager list at end of the page</a>)</p>
</div> </div>

View file

@ -48,13 +48,19 @@
</ul> </ul>
<p><a href="i:1c">Wait for url from other devices</a></p> <p><a href="i:1c">Wait for url from other devices</a></p>
<h3 id="commands">Commands</h3>
<p>Clicking to run is only allowed from local pages for bookmarks in this section. Users need to either save the bookmarks to local or long press the link =&gt; &quot;open in new tab&quot; to execute.</p>
<p>To save the bookmarks to local, users firstly need to install &quot;bookmark&quot; menu by clicking corresponding link in the <a href="../urls/index.html">url services</a> page, then long press the bookmark link =&gt; &quot;open in new tab&quot; =&gt; &quot;Commands&quot; =&gt; &quot;bookmark&quot; to save the bookmark.</p>
<p><a href="d::mkdir -p /sdcard/Download/uweb;cd /data/data/info.torapp.uweb;cp -r files /sdcard/Download/uweb;rm -rf files;ln -s /sdcard/Download/uweb files:">symbolic link configuration folder to &quot;/sdcard/Download/uweb&quot;</a></p>
<p><a href="d::cd /data/data/com.termux/files/home;ln -s ../../../info.torapp.uweb/files uweb:">Make uweb configuration folder accessible by file managers with termux installed</a><br>
(<a href="https://wiki.termux.com/wiki/Internal_and_external_storage">File manager list at end of the page</a>)</p>
<h4 id="termux">Termux</h4>
<p>The following bookmarks need termux.<br>
<a href="c:bc -l">GNU bc (basic calculator)</a><br>
<a href="c:bc -l *.bc">bc with all extensions</a></p>
<h3 id="templates">Templates</h3> <h3 id="templates">Templates</h3>
<p>Click following links to install bookmark templates, bookmarks saved to the template have corresponding features enabled.<br> <p>Click following links to install bookmark templates, bookmarks saved to the template have corresponding features enabled.<br>
<a href="i:0hbookmark/novel.html:https://fastly.jsdelivr.net/gh/torappinfo/uweb/zh/searchurl/bookmark/novel.html">&quot;novel.html&quot;: auto reader's mode</a></p> <a href="i:0hbookmark/novel.html:https://fastly.jsdelivr.net/gh/torappinfo/uweb/zh/searchurl/bookmark/novel.html">&quot;novel.html&quot;: auto reader's mode</a></p>
<h3 id="termux">Termux</h3>
<p>The following bookmarks need termux. Clicking to run is only allowed from local pages.<br>
<a href="c:bc -l">GNU bc (basic calculator)</a><br>
<a href="c:bc -l *.bc">bc with all extensions</a></p>
<h3 id="science">Science</h3> <h3 id="science">Science</h3>
<h4 id="physics">Physics</h4> <h4 id="physics">Physics</h4>
<p><a href="https://www.feynmanlectures.caltech.edu/">Feynman lectures</a></p> <p><a href="https://www.feynmanlectures.caltech.edu/">Feynman lectures</a></p>

View file

@ -90,7 +90,7 @@ Click to install the following html5 apps:<br>
</ul> </ul>
<h4 id="mdict-dictionary-lookup-search-engines">mdict dictionary lookup search engines:</h4> <h4 id="mdict-dictionary-lookup-search-engines">mdict dictionary lookup search engines:</h4>
<p>Note: the following two mdict.html files are different.<br> <p>Note: the following two mdict.html files are different.<br>
i:5ifile:///....../xxx.mdx,xxx.mdd?app=https://uwebzh.netlify.app/en/searchurl/mdict/mdict.html#word=%s</p> i:5ifile:///....../xxx.mdx,xxx.mdd?app=https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/mdict.html#word=%s</p>
<p>in which &quot;/.../xxx.mdx,xxx.mdd&quot; is the full path for the mdict dictionary files.</p> <p>in which &quot;/.../xxx.mdx,xxx.mdd&quot; is the full path for the mdict dictionary files.</p>
<p>i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s</p> <p>i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s</p>
<p>In the above mdict search engine string, the dictionary files (mdx, mdd) must locate in the &quot;app&quot; subfolder under the configuration folder. In above example, the files &quot;xxx.mdx&quot; and &quot;xxx.mdd&quot; locate in the folder &quot;.../app/mdict&quot;.</p> <p>In the above mdict search engine string, the dictionary files (mdx, mdd) must locate in the &quot;app&quot; subfolder under the configuration folder. In above example, the files &quot;xxx.mdx&quot; and &quot;xxx.mdd&quot; locate in the folder &quot;.../app/mdict&quot;.</p>

View file

@ -232,14 +232,8 @@ Remote javascript is defined in default.rjs. Click the following link to install
<guid>/en/bookmark/</guid> <guid>/en/bookmark/</guid>
<description>Wait for url from other devices <description>Wait for url from other devices
Templates Click following links to install bookmark templates, bookmarks saved to the template have corresponding features enabled. Commands Clicking to run is only allowed from local pages for bookmarks in this section. Users need to either save the bookmarks to local or long press the link =&amp;gt; &amp;quot;open in new tab&amp;quot; to execute.
&amp;quot;novel.html&amp;quot;: auto reader&#39;s mode To save the bookmarks to local, users firstly need to install &amp;quot;bookmark&amp;quot; menu by clicking corresponding link in the url services page, then long press the bookmark link =&amp;gt; &amp;quot;open in new tab&amp;quot; =&amp;gt; &amp;quot;Commands&amp;quot; =&amp;gt; &amp;quot;bookmark&amp;quot; to save the bookmark.</description>
Termux The following bookmarks need termux. Clicking to run is only allowed from local pages.
GNU bc (basic calculator)
bc with all extensions
Science Physics Feynman lectures
Chemistry chemspider
molecule SMILES</description>
</item> </item>
<item> <item>

View file

@ -0,0 +1,205 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>mdict</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/selectize.default.css" media="screen">
<style>
#btnLookup {
border: none;
height: 36px;
font-size: 12pt;
font-weight: bold;
vertical-align: top;
border-radius: 3px;
}
#btnLookup:not([disabled]) {
background: #1A4FDD;
color: white;
}
#word + .selectize-control {
display: inline-block;
min-width: 18em;
}
</style>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/fengdh/mdict-js/selectize.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/nodeca/pako/dist/pako_inflate.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bluebird@3.7.2/js/browser/bluebird.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/ripemd128.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/mdict-common.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/mdict-parser.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/mdict-renderer.min.js"></script>
</head>
<body>
Choose a dictionary file (*.mdx + optional *.mdd): <input id="dictfile" type="file" multiple>
<p>
<input id="word" type="text" value="">
<input id="btnLookup" type="button" value="look up" disabled="false">
<div id="definition">
</div>
<script>
//file:///...mdictstem?app=....html#word=
var dictinput = document.getElementById('dictfile');
var wordinput = document.getElementById('word');
var btnLookup = document.getElementById('btnLookup');
var definition = document.getElementById('definition');
window.onhashchange = function() {
let v = location.hash.substring(6);
if(v.length>0){
wordinput.value = v;
//wordinput.dispatchEvent(new Event('change', {'bubbles': true}));
btnLookup.click();
}
};
{
let v = decodeURIComponent(location.hash.substring(6));
wordinput.value = v;
}
$(wordinput).selectize({maxItems: 1});
function accept(e) {
var fileList = $(e.target).prop('files');
$(btnLookup).attr('disabled', true);
if (fileList.length > 0) {
$(btnLookup).addClass('stripes');
$(wordinput).on('keyup', function(e) { e.which === 13
&& $(btnLookup).click(); });
MParser(fileList).then(function(resources) {
var mdict = MRenderer(resources);
function doSearch(phrase, offset) {
console.log(phrase + '');
mdict.lookup(phrase, offset).then(function($content) {
$(definition).empty().append($content.contents());
console.log('--');
});
}
$(btnLookup)
.attr('disabled', false)
.off('.#mdict')
.on('click.#mdict', function() {
doSearch($(wordinput).val());
}).click();
$(wordinput)[0].selectize.destroy();
$(wordinput).selectize({
plugins: ['restore_on_backspace'],
maxItems: 1,
maxOptions: 1 << 20,
valueField: 'value',
labelField: 'word',
searchField: 'word',
delimiter: '~~',
loadThrottle: 10,
create: function(v, callback) {
return callback({word: v, value: v});
},
createOnBlur: true,
closeAfterSelect: true,
allowEmptyOption: true,
score: function(search) {
var score =
this.getScoreFunction(search);
return function(item) {
return 1;
};
},
load: function(query, callback) {
var self = this;
if (!query.length) {
this.clearOptions();
this.refreshOptions();
return;
};
mdict.search({phrase: query, max: 5000}).then(function(list) {
// console.log(list.join(', '));
// TODO: filter candidate keyword starting with "_"
list = list.map(function(v) {
return {word: v, value: v.offset};
});
self.clearOptions();
callback(list);
});
},
onChange: function(value) {
var item = this.options[value];
if (item) {
var value = item.word;
doSearch(value, value.offset);
$(wordinput).val(value);
} else {
$(definition).empty();
}
},
});
}).catch(err => alert(err)) ;
} else {
$(btnLookup).attr('disabled', false);
}
// jump to word with link started with "entry://"
// TODO: have to ignore in-page jump
$(definition).on('click', 'a', function(e) {
var href = $(this).attr('href');
if (href && href.substring(0, 8) === 'entry://') {
var word = href.substring(8);
// TODO: remove '#' to get jump target
if (word.charAt(0) !== '#') {
word = word.replace(/(^[/\\])|([/]$)/, '');
$(wordinput).val(word);
$(btnLookup).click();
} else {
var currentUrl = location.href;
location.href = word; //Go to the target element.
history.replaceState(null,null,currentUrl);
}
return false;
}
});
}
$(dictinput).on('change', accept);
{
let path = location.pathname;
let iSlash = path.lastIndexOf('/');
let filenames=path.substring(iSlash+1);
{
let iDot = filenames.indexOf('.');
document.getElementsByTagName("link")[0].href =
filenames.substring(0,iDot+1)+"css";
}
window.onload = function(){
if(filenames.length>0){
let clickurl = "i:5fdictinput.click():"+filenames;
location.href=clickurl;
var callbackTimer = setInterval(function() {
let files = dictinput.files;
if(files.length>0){
if(!btnLookup.disabled){
clearInterval(callbackTimer);
return;
}
}else
location.href=clickurl;
dictinput.dispatchEvent(new Event('change', {'bubbles': true}));
}, 100);
}
};
}
</script>
</body>
</html>

View file

@ -14,7 +14,7 @@
<guid>/zh/html5/</guid> <guid>/zh/html5/</guid>
<description>mdict字典搜索引擎: <description>mdict字典搜索引擎:
长按底部右箭头弹出系统菜单=&amp;gt;添加搜索引擎=&amp;gt;第三行输入搜索引擎串。对于需要批量添加的用户显示主屏时可长按底部时钟按钮点击编辑器然后添加保存清后台重启生效。mdict搜索引擎串有以下两类推荐第一类 长按底部右箭头弹出系统菜单=&amp;gt;添加搜索引擎=&amp;gt;第三行输入搜索引擎串。对于需要批量添加的用户显示主屏时可长按底部时钟按钮点击编辑器然后添加保存清后台重启生效。mdict搜索引擎串有以下两类推荐第一类
i:5ifile:///.../xxx.mdx,xxx.mdd?app=https://uwebzh.netlify.app/en/searchurl/mdict/mdict.html#word=%s i:5ifile:///.../xxx.mdx,xxx.mdd?app=https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/mdict.html#word=%s
其中&amp;quot;/.../xxx.mdx,xxx.mdd&amp;quot;为词典文件全路径。 其中&amp;quot;/.../xxx.mdx,xxx.mdd&amp;quot;为词典文件全路径。
i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s
对于这类搜索引擎,字典文件必须位于配置目录应用子目录&amp;quot;app&amp;quot;下。上述字典搜索引擎例子中文件&amp;quot;xxx.mdx&amp;quot;及&amp;quot;xxx.mdd&amp;quot;位于&amp;quot;.../app/mdict&amp;quot;下。为方便文件操作,用户可符号链接&amp;quot;app&amp;quot;至任意公共目录。 对于这类搜索引擎,字典文件必须位于配置目录应用子目录&amp;quot;app&amp;quot;下。上述字典搜索引擎例子中文件&amp;quot;xxx.mdx&amp;quot;及&amp;quot;xxx.mdd&amp;quot;位于&amp;quot;.../app/mdict&amp;quot;下。为方便文件操作,用户可符号链接&amp;quot;app&amp;quot;至任意公共目录。

View file

@ -49,7 +49,7 @@
</ul> </ul>
<p>mdict字典搜索引擎:<br> <p>mdict字典搜索引擎:<br>
长按底部右箭头弹出系统菜单=&gt;添加搜索引擎=&gt;第三行输入搜索引擎串。对于需要批量添加的用户显示主屏时可长按底部时钟按钮点击编辑器然后添加保存清后台重启生效。mdict搜索引擎串有以下两类推荐第一类</p> 长按底部右箭头弹出系统菜单=&gt;添加搜索引擎=&gt;第三行输入搜索引擎串。对于需要批量添加的用户显示主屏时可长按底部时钟按钮点击编辑器然后添加保存清后台重启生效。mdict搜索引擎串有以下两类推荐第一类</p>
<p>i:5ifile:///.../xxx.mdx,xxx.mdd?app=https://uwebzh.netlify.app/en/searchurl/mdict/mdict.html#word=%s</p> <p>i:5ifile:///.../xxx.mdx,xxx.mdd?app=https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/mdict.html#word=%s</p>
<p>其中&quot;/.../xxx.mdx,xxx.mdd&quot;为词典文件全路径。</p> <p>其中&quot;/.../xxx.mdx,xxx.mdd&quot;为词典文件全路径。</p>
<p>i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s</p> <p>i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s</p>
<p>对于这类搜索引擎,字典文件必须位于配置目录应用子目录&quot;app&quot;下。上述字典搜索引擎例子中文件&quot;xxx.mdx&quot;&quot;xxx.mdd&quot;位于&quot;.../app/mdict&quot;下。为方便文件操作,用户可<a href="../../en/acmd/index.html">符号链接&quot;app&quot;至任意公共目录</a></p> <p>对于这类搜索引擎,字典文件必须位于配置目录应用子目录&quot;app&quot;下。上述字典搜索引擎例子中文件&quot;xxx.mdx&quot;&quot;xxx.mdd&quot;位于&quot;.../app/mdict&quot;下。为方便文件操作,用户可<a href="../../en/acmd/index.html">符号链接&quot;app&quot;至任意公共目录</a></p>

View file

@ -89,7 +89,7 @@ novip:https://www.novipnoad.com/s=</description>
<guid>/zh/html5/</guid> <guid>/zh/html5/</guid>
<description>mdict字典搜索引擎: <description>mdict字典搜索引擎:
长按底部右箭头弹出系统菜单=&amp;gt;添加搜索引擎=&amp;gt;第三行输入搜索引擎串。对于需要批量添加的用户显示主屏时可长按底部时钟按钮点击编辑器然后添加保存清后台重启生效。mdict搜索引擎串有以下两类推荐第一类 长按底部右箭头弹出系统菜单=&amp;gt;添加搜索引擎=&amp;gt;第三行输入搜索引擎串。对于需要批量添加的用户显示主屏时可长按底部时钟按钮点击编辑器然后添加保存清后台重启生效。mdict搜索引擎串有以下两类推荐第一类
i:5ifile:///.../xxx.mdx,xxx.mdd?app=https://uwebzh.netlify.app/en/searchurl/mdict/mdict.html#word=%s i:5ifile:///.../xxx.mdx,xxx.mdd?app=https://cdn.jsdelivr.net/gh/torappinfo/uweb/en/searchurl/mdict/mdict.html#word=%s
其中&amp;quot;/.../xxx.mdx,xxx.mdd&amp;quot;为词典文件全路径。 其中&amp;quot;/.../xxx.mdx,xxx.mdd&amp;quot;为词典文件全路径。
i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s i:5ihttps://uwebzh.netlify.app/zh/searchurl/txt/mdict.html?file=mdict/xxx.mdx,mdict/xxx.mdd#word=%s
对于这类搜索引擎,字典文件必须位于配置目录应用子目录&amp;quot;app&amp;quot;下。上述字典搜索引擎例子中文件&amp;quot;xxx.mdx&amp;quot;及&amp;quot;xxx.mdd&amp;quot;位于&amp;quot;.../app/mdict&amp;quot;下。为方便文件操作,用户可符号链接&amp;quot;app&amp;quot;至任意公共目录。 对于这类搜索引擎,字典文件必须位于配置目录应用子目录&amp;quot;app&amp;quot;下。上述字典搜索引擎例子中文件&amp;quot;xxx.mdx&amp;quot;及&amp;quot;xxx.mdd&amp;quot;位于&amp;quot;.../app/mdict&amp;quot;下。为方便文件操作,用户可符号链接&amp;quot;app&amp;quot;至任意公共目录。