mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
enhance config.js
This commit is contained in:
parent
75546688a1
commit
f6d1022757
3 changed files with 40 additions and 35 deletions
|
@ -1,12 +1,7 @@
|
||||||
let labels = ["Default font","Cursive","Fantasy","Fixed","Sans-Serif","Serif"];
|
let labels = ["Default font","Cursive","Fantasy","Fixed","Sans-Serif","Serif"];
|
||||||
let names = ["font","cursive","fantasy","fixed","sansserif","serif"];
|
let names = ["font","cursive","fantasy","fixed","sansserif","serif"];
|
||||||
|
|
||||||
let text;
|
|
||||||
let d=document;
|
let d=document;
|
||||||
if(d.body)
|
|
||||||
text = d.body.innerHTML;
|
|
||||||
else
|
|
||||||
text = "\n".repeat(labels.length-1);
|
|
||||||
|
|
||||||
let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style>
|
let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style>
|
||||||
<datalist id="family">
|
<datalist id="family">
|
||||||
|
@ -24,15 +19,27 @@ let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style>
|
||||||
'&'+ f.fixed.value +
|
'&'+ f.fixed.value +
|
||||||
'&'+ f.sansserif.value +
|
'&'+ f.sansserif.value +
|
||||||
'&'+ f.serif.value +
|
'&'+ f.serif.value +
|
||||||
':https://fastly.jsdelivr.net/gh/torappinfo/uwebzh/searchurl/template/config.html';return false;" accept-charset=utf-8 >`];
|
':https://fastly.jsdelivr.net/gh/torappinfo/uweb/searchurl/template/config.html';return false;" accept-charset=utf-8 >`];
|
||||||
|
|
||||||
|
function gen(text) {
|
||||||
|
let strs = text.split('\n');
|
||||||
|
let i=0;
|
||||||
|
for (i = 0; i < labels.length; i++){
|
||||||
|
sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
|
||||||
|
}
|
||||||
|
|
||||||
let strs = text.split('\n');
|
sa.push('<input type="submit" value="Save"></form>');
|
||||||
let i=0;
|
let r = sa.join('<br>');
|
||||||
for (i = 0; i < labels.length; i++){
|
d.documentElement.innerHTML = r;
|
||||||
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>');
|
if(d.body){
|
||||||
let r = sa.join('<br>');
|
fetch(location.href)
|
||||||
d.documentElement.innerHTML = r;
|
.then(res => res.text())
|
||||||
|
.then(text => {
|
||||||
|
gen(text);
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
let text = "\n".repeat(labels.length-1);
|
||||||
|
gen(text);
|
||||||
|
}
|
||||||
|
|
11
index.html
11
index.html
|
@ -1,10 +1 @@
|
||||||
<!DOCTYPE html>
|
<meta http-equiv="refresh" content="0; url=en/index.html">
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>en/</title>
|
|
||||||
<link rel="canonical" href="en/">
|
|
||||||
<meta name="robots" content="noindex">
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="refresh" content="0; url=en/">
|
|
||||||
</head>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
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 = ["font","cursive","fantasy","fixed","sansserif","serif"];
|
||||||
|
|
||||||
let text;
|
|
||||||
let d=document;
|
let d=document;
|
||||||
if(d.body)
|
|
||||||
text = d.body.innerHTML;
|
|
||||||
else
|
|
||||||
text = "\n".repeat(labels.length-1);
|
|
||||||
|
|
||||||
let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style>
|
let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style>
|
||||||
<datalist id="family">
|
<datalist id="family">
|
||||||
|
@ -26,13 +21,25 @@ let sa = [`<style>input{height:40px;width:100%;border-radius:50px;}</style>
|
||||||
'&'+ 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/searchurl/template/config.html';return false;" accept-charset=utf-8 >`];
|
||||||
|
|
||||||
|
function gen(text) {
|
||||||
|
let strs = text.split('\n');
|
||||||
|
let i=0;
|
||||||
|
for (i = 0; i < labels.length; i++){
|
||||||
|
sa.push("<label>"+labels[i]+"<input list='family' type='text' name='"+names[i]+"' value='"+strs[i]+"'/></label>");
|
||||||
|
}
|
||||||
|
|
||||||
let strs = text.split('\n');
|
sa.push('<input type="submit" value="Save"></form>');
|
||||||
let i=0;
|
let r = sa.join('<br>');
|
||||||
for (i = 0; i < labels.length; i++){
|
d.documentElement.innerHTML = r;
|
||||||
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>');
|
if(d.body){
|
||||||
let r = sa.join('<br>');
|
fetch(location.href)
|
||||||
d.documentElement.innerHTML = r;
|
.then(res => res.text())
|
||||||
|
.then(text => {
|
||||||
|
gen(text);
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
let text = "\n".repeat(labels.length-1);
|
||||||
|
gen(text);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue