Compare commits

...

2 Commits

Author SHA1 Message Date
James Feng Cao 68fa9617be make config.js robust 2024-03-10 13:14:14 +08:00
James Feng Cao a894ae8777 fix config.js chinese version 2024-03-10 11:25:42 +08:00
2 changed files with 14 additions and 13 deletions

View File

@ -13,16 +13,19 @@ let sa = [`<head><meta charset="utf-8"><meta name="viewport" content="width=devi
<option value="monospace">
<option value="cursive">
</datalist>
<form onsubmit="let d=document;let f=d.forms[0];d.location.href='i:b1Save config.html%0A%0Ai:8lconfig.html%0Ai:0i/data/data/info.torapp.uweb/files/config.html:'
+f.redirecturl.value+
'&'+ f.downloadpath.value+
'&'+ f.font.value+
'&'+ f.cursive.value +
'&'+ f.fantasy.value +
'&'+ f.fixed.value +
'&'+ f.sansserif.value +
'&'+ f.serif.value +
':https://jamesfengcao.codeberg.page/en/searchurl/template/config.html';return false;" accept-charset=utf-8 >`];
<script>
function save(){
let d=document;let f=d.forms[0];
let inputs = Array.from(f.querySelectorAll('input')).map(input => input.value);
inputs.pop();
inputs.push('<script charset="utf-8" src="https://jamesfengcao.codeberg.page/en/searchurl/config.js"><\\/script>');
let str = inputs.join('\\n');
let url = 'i:b1Save config.html%0A%0Ai:8lconfig.html%0Ai:0lconfig.html:'+btoa(str);
d.location.href=url;
return false;
}
</script>
<form onsubmit="return save()" accept-charset=utf-8 >`];
function gen(text) {
let strs = text.split('\n');

View File

@ -20,9 +20,7 @@ function save(){
inputs.pop();
inputs.push('<script charset="utf-8" src="https://jamesfengcao.codeberg.page/zh/searchurl/config.js"><\\/script>');
let str = inputs.join('\\n');
const encoder = new TextEncoder();
const bytes = encoder.encode(str);
let url = 'i:b1保存配置%0A%0Ai:8lconfig.html%0Ai:0lconfig.html:'+btoa(bytes);
let url = 'i:b1保存配置%0A%0Ai:8lconfig.html%0Ai:0lconfig.html:'+btoa(str);
d.location.href=url;
return false;
}