add global redirect url support

This commit is contained in:
James Feng Cao 2023-04-12 07:40:52 +08:00
parent 668562f292
commit 96b13242b5
4 changed files with 21 additions and 14 deletions

View file

@ -1,6 +1,6 @@
Serif

View file

@ -1,9 +1,9 @@
let labels = ["Default font","Cursive","Fantasy","Fixed","Sans-Serif","Serif"]; let labels = ["Redirect url","Default font","Cursive","Fantasy","Fixed","Sans-Serif","Serif"];
let names = ["font","cursive","fantasy","fixed","sansserif","serif"]; let names = ["redirecturl","font","cursive","fantasy","fixed","sansserif","serif"];
let d=document; let d=document;
let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style> 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"> <datalist id="family">
<option value="sans-serif"> <option value="sans-serif">
<option value="sans-serif-condensed"> <option value="sans-serif-condensed">
@ -13,24 +13,28 @@ let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style>
<option value="monospace"> <option value="monospace">
<option value="cursive"> <option value="cursive">
</datalist> </datalist>
<form onsubmit="let d=document;let f=d.forms[0];d.location.href='i:0i/data/data/info.torapp.uweb/files/config.html:'+f.font.value+ <form onsubmit="let d=document;let f=d.forms[0];d.location.href='i:0i/data/data/info.torapp.uweb/files/config.html:'
+f.redirecturl.value+
'&'+ f.font.value+
'&'+ f.cursive.value + '&'+ f.cursive.value +
'&'+ f.fantasy.value + '&'+ f.fantasy.value +
'&'+ f.fixed.value + '&'+ f.fixed.value +
'&'+ f.sansserif.value + '&'+ f.sansserif.value +
'&'+ f.serif.value + '&'+ f.serif.value +
':https://fastly.jsdelivr.net/gh/torappinfo/uweb/searchurl/template/config.html';return false;" accept-charset=utf-8 >`]; ':https://fastly.jsdelivr.net/gh/torappinfo/uweb/zh/searchurl/template/config.html';return false;" accept-charset=utf-8 >`];
function gen(text) { function gen(text) {
let strs = text.split('\n'); let strs = text.split('\n');
let i=0; let i=0;
for (i = 0; i < labels.length; i++){ sa.push("<label>"+labels[i]+"<input type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
for (i = 1; i < labels.length; i++){
sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>"); sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
} }
sa.push('<input type="submit" value="Save"></form>'); sa.push('<input type="submit" value="Save"></form>');
let r = sa.join('<br>'); let r = sa.join('<br>');
d.documentElement.innerHTML = r; d.write(r);
d.close();
} }
if(d.body){ if(d.body){

View file

@ -1,5 +1,5 @@
let labels = ["网页默认字体族","cursive字体族","Fantasy字体族","Fixed字体族","Sans-Serif字体族","Serif字体族"]; let labels = ["全局重定向网址","网页默认字体族","cursive字体族","Fantasy字体族","Fixed字体族","Sans-Serif字体族","Serif字体族"];
let names = ["font","cursive","fantasy","fixed","sansserif","serif"]; let names = ["redirecturl","font","cursive","fantasy","fixed","sansserif","serif"];
let d=document; let d=document;
@ -13,18 +13,21 @@ let sa = [`<head><meta charset="utf-8"><meta name="viewport" content="width=devi
<option value="monospace"> <option value="monospace">
<option value="cursive"> <option value="cursive">
</datalist> </datalist>
<form onsubmit="let d=document;let f=d.forms[0];d.location.href='i:0i/data/data/info.torapp.uweb/files/config.html:'+f.font.value+ <form onsubmit="let d=document;let f=d.forms[0];d.location.href='i:0i/data/data/info.torapp.uweb/files/config.html:'
+f.redirecturl.value+
'&'+ f.font.value+
'&'+ f.cursive.value + '&'+ f.cursive.value +
'&'+ f.fantasy.value + '&'+ f.fantasy.value +
'&'+ f.fixed.value + '&'+ f.fixed.value +
'&'+ f.sansserif.value + '&'+ f.sansserif.value +
'&'+ f.serif.value + '&'+ f.serif.value +
':https://fastly.jsdelivr.net/gh/torappinfo/uweb/searchurl/template/config.html';return false;" accept-charset=utf-8 >`]; ':https://fastly.jsdelivr.net/gh/torappinfo/uweb/zh/searchurl/template/config.html';return false;" accept-charset=utf-8 >`];
function gen(text) { function gen(text) {
let strs = text.split('\n'); let strs = text.split('\n');
let i=0; let i=0;
for (i = 0; i < labels.length; i++){ sa.push("<label>"+labels[i]+"<input type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
for (i = 1; i < labels.length; i++){
sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>"); sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
} }

View file

@ -4,7 +4,7 @@
%4% %4%
%5% %5%
%6% %6%
%7%