97 lines
2.6 KiB
HTML
97 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta content="width=device-width, initial-scale=1 user-scalable=0" name="viewport"/>
|
|
<script type="text/javascript">
|
|
window.onload = () => {
|
|
const url = 'https://jjins.github.io/fyfuzhi/torn-trans-zhcn.user.js';
|
|
const $textarea = document.querySelector('textarea');
|
|
const $text = document.getElementById('text');
|
|
const $btn = document.querySelector('button');
|
|
const $refresh = document.getElementById('refresh');
|
|
|
|
fetch(url, {cache: 'no-cache'})
|
|
.catch(e => console.error(e))
|
|
.then(data => data.text())
|
|
.then(text => {
|
|
$textarea.value = text;
|
|
const iStart = 37;
|
|
const dtimeStr = text.slice(iStart, iStart + 12);
|
|
const last = {
|
|
year: dtimeStr.slice(0, 4),
|
|
month: dtimeStr.slice(4, 6),
|
|
day: dtimeStr.slice(6, 8),
|
|
h: dtimeStr.slice(8, 10),
|
|
m: dtimeStr.slice(10)
|
|
};
|
|
$text.innerText = `加载完成,更新时间${last.year}年${last.month}月${last.day}日${last.h}:${last.m}`;
|
|
$btn.disabled = false;
|
|
});
|
|
|
|
$btn.onclick = () => {
|
|
$textarea.select();
|
|
document.execCommand('Copy');
|
|
$text.innerText = "已复制";
|
|
$textarea.blur();
|
|
};
|
|
|
|
$refresh.onclick = () => {
|
|
location.reload();
|
|
};
|
|
|
|
};
|
|
</script>
|
|
<style>html, body, p {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
p {
|
|
font-size: 16px;
|
|
text-align: center;
|
|
padding: 2em 0;
|
|
}
|
|
|
|
textarea {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
opacity: 0;
|
|
z-index: -10;
|
|
}
|
|
|
|
button {
|
|
-webkit-appearance: none;
|
|
display: block;
|
|
border-radius: 0;
|
|
border: 0;
|
|
width: 100%;
|
|
padding: 2em 0;
|
|
margin: 0;
|
|
background-color: #32CD32;
|
|
color: white;
|
|
font-size: 16px;
|
|
}
|
|
|
|
button[disabled] {
|
|
background-color: grey;
|
|
}
|
|
|
|
a {
|
|
display: block;
|
|
padding: 1.5em 0;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
<title>翻译助手快捷复制</title>
|
|
</head>
|
|
<body>
|
|
<p id="text">请稍后,正在加载...</p>
|
|
<textarea></textarea>
|
|
<button disabled>点击复制</button>
|
|
<!--<a>备用链接</a>-->
|
|
<a id="refresh">刷新页面</a>
|
|
</body>
|
|
</html>
|