update AI engines
[uweb.git] / zh / searchurl / config.js
blobabd142ba195747162f9d057a5f4aabcf39f8eabb
1 let labels = ["<a href='https://jamesfengcao.codeberg.page/zh/redirect/index.html'>全局重定向网址</a>","下载目录(选项'下载至可卸存储'下生效)","网页默认字体族","cursive字体族","Fantasy字体族","Fixed字体族","Sans-Serif字体族","Serif字体族"];
2 let names = ["redirecturl","downloadpath","font","cursive","fantasy","fixed","sansserif","serif"];
4 let d=document;
6 let sa = [`<head><meta charset="utf-8"><meta name="viewport" content="width=device-width" /></head><style>input{height:40px;width:100%;border-radius:50px;}</style>
7 <datalist id="family">
8 <option value="sans-serif">
9 <option value="sans-serif-condensed">
10 <option value="sans-serif-smallcaps">
11 <option value="serif">
12 <option value="serif-monospace">
13 <option value="monospace">
14 <option value="cursive">
15 </datalist>
16 <script>
17 function save(){
18 let d=document;let f=d.forms[0];
19 let inputs = Array.from(f.querySelectorAll('input')).map(input => input.value);
20 inputs.pop();
21 inputs.push('<script charset="utf-8" type="application/javascript" src="https://gitee.com/jamesfengcao/uweb/raw/master/zh/searchurl/config.js#"><\\/script>');
22 let str = inputs.join('\\n');
23 let url = 'i:b1保存配置%0A%0Ai:8lconfig.html%0Ai:0lconfig.html:'+btoa(str);
24 d.location.href=url;
25 return false;
27 </script>
28 <form onsubmit="return save()" accept-charset=utf-8 >`];
30 function gen(text) {
31 let strs = text.split('\n');
32 let i;
33 for (i=0; i<2; i++)
34 sa.push("<label>"+labels[i]+"<input type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
35 for (i = 2; i < labels.length; i++){
36 sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
39 sa.push('<input type="submit" value="Save"></form>');
40 let r = sa.join('<br>');
41 d.write(r);
42 d.close();
45 if(d.body){
46 var r=new XMLHttpRequest;
47 r.onload=function(){
48 var t=r.responseText;
49 gen(t);
51 r.open("GET",location.href,!0);
52 r.send(null);
53 }else {
54 let text = "\n".repeat(labels.length-1);
55 gen(text);