uweb/zh/searchurl/config.js

54 lines
1.9 KiB
JavaScript
Raw Normal View History

2023-06-01 13:46:11 +00:00
let labels = ["<a href='https://jamesfengcao.codeberg.page/zh/redirect/index.html'>全局重定向网址</a>","下载目录(选项'下载至可卸存储'下生效)","网页默认字体族","cursive字体族","Fantasy字体族","Fixed字体族","Sans-Serif字体族","Serif字体族"];
2023-06-01 08:22:41 +00:00
let names = ["redirecturl","downloadpath","font","cursive","fantasy","fixed","sansserif","serif"];
let d=document;
2023-03-04 14:17:12 +00:00
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>
<datalist id="family">
<option value="sans-serif">
<option value="sans-serif-condensed">
<option value="sans-serif-smallcaps">
<option value="serif">
<option value="serif-monospace">
<option value="monospace">
<option value="cursive">
</datalist>
2023-06-02 02:44:29 +00:00
<form onsubmit="let d=document;let f=d.forms[0];d.location.href='i:b1保存配置%0A%0Ai:8lconfig.html%0Ai:0i/data/data/info.torapp.uweb/files/config.html:'
2023-04-11 23:40:52 +00:00
+f.redirecturl.value+
2023-06-01 08:22:41 +00:00
'&'+ f.downloadpath.value+
2023-04-11 23:40:52 +00:00
'&'+ f.font.value+
'&'+ f.cursive.value +
'&'+ f.fantasy.value +
'&'+ f.fixed.value +
'&'+ f.sansserif.value +
'&'+ f.serif.value +
2023-04-27 01:24:01 +00:00
':https://jamesfengcao.codeberg.page/zh/searchurl/template/config.html';return false;" accept-charset=utf-8 >`];
2022-12-16 09:48:23 +00:00
function gen(text) {
let strs = text.split('\n');
2023-06-01 08:22:41 +00:00
let i;
for (i=0; i<2; i++)
sa.push("<label>"+labels[i]+"<input type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
for (i = 2; i < labels.length; i++){
2022-12-16 09:48:23 +00:00
sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
}
2022-12-16 09:48:23 +00:00
sa.push('<input type="submit" value="Save"></form>');
let r = sa.join('<br>');
2023-03-13 13:38:48 +00:00
d.write(r);
d.close();
}
2022-12-16 09:48:23 +00:00
if(d.body){
2023-04-12 05:16:15 +00:00
var r=new XMLHttpRequest;
r.onload=function(){
var t=r.responseText;
gen(t);
}
r.open("GET",location.href,!0);
r.send(null);
2022-12-16 09:48:23 +00:00
}else {
let text = "\n".repeat(labels.length-1);
gen(text);
}