thedesk/app/view/zh-TW/update.html

303 lines
9.7 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="zh-TW">
<head>
<title>Update - TheDesk</title>
<link href="../../node_modules/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet" />
<link href="../../css/master.css" type="text/css" rel="stylesheet" />
<meta charset="utf-8" />
<!--
<script type="text/javascript">
var _jipt = []
_jipt.push(['project', 'thedesk'])
</script>
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
-->
<style>
body {
font-family: 'Open Sans';
-webkit-app-region: drag;
cursor: move;
padding: 10px;
text-align: right;
}
#start {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: calc(100vh - 2.5rem);
text-align: center;
}
#checkbox {
text-align: left;
}
a,
button,
input,
label,
i {
-webkit-app-region: no-drag;
}
#updskip {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.skipbtn {
display: block;
width: 100%;
height: 100px;
border: 1px solid;
margin-left: 5px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid #c26363;
overflow: hidden;
color: #c26363;
margin-bottom: 5px;
font-size: 1.5rem;
}
.skipbtn:hover {
background-color: #c26363;
transition: all 0.3s ease-in-out;
color: white;
}
#prog {
font-size: 200%;
}
</style>
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" rel="stylesheet" />
<script>var pwa = false;</script>
</head>
<body>
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="../../js/platform/first.js"></script>
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
<i class="material-icons pointer waves-effect" onclick="about();">info</i>
<i class="material-icons pointer waves-effect" onclick="skipper();">clear</i>
<!--a href="update.html">Reload</a-->
<div id="start" style="filter: brightness(100%)">
<div id="box" class="show">
<h2>TheDesk</h2>
<p>取得最新的 TheDesk</p>
<span id="now"></span><b id="ver"></b><br />
<a href="" id="github" class="btn waves-effect grey darken-1"><i class="fab fa-github left"></i>新功能?</a><br />
<button class="waves-effect btn windows hide" onclick="update('install')" style="margin-left: 15px;">安裝程式 (建議)</button>
<button class="waves-effect btn windows hide" onclick="update('portable')" style="margin-left: 15px;">可攜式版本</button>
<button class="waves-effect btn linux hide" onclick="update('linux')" style="margin-left: 15px;">zip 壓縮檔</button>
<button class="waves-effect btn linux hide" onclick="update('linuxdeb')" style="margin-left: 15px;">deb (建議於 Ubuntu 與 Debian 使用)</button>
<button class="waves-effect btn linux hide" onclick="update('linuxsnap')" style="margin-left: 15px;">snap 軟體包裹</button>
<button class="waves-effect btn mac hide" onclick="update('mac')" style="margin-left: 15px;">開始</button>
<br />
有些問題嗎?<br />請於 <a href='https://thedesk.top'>Oficial HP</a> 下載。
</div>
<div id="skipper" class="hide">
<h4>掠過這個更新</h4>
您可能會失去很酷的體驗!<br />
<div id="updskip">
<a onclick="window.close();" class="pointer skipbtn waves-effect waves-light">
<div>隱藏直到下個時間軸讀取時</div>
</a>
<a onclick="nextv();" class="pointer skipbtn waves-effect waves-light">
<div>隱藏直到下個版本</div>
</a>
</div>
<a class="pointer waves-effect" onclick="skipper();" style="margin-top: 5px;">持續更新</a>
</div>
<div id="dlnow" class="hide" style="width: 70%;">
<h4>正在下載...</h4>
<h4 id="prog"></h4>
<div class="progress">
<div class="determinate" style="width: 0%;"></div>
</div>
</div>
</div>
<script type="text/javascript" src="../../js/common/about.js"></script>
<script type="text/javascript" src="../../js/platform/end.js"></script>
<script>
function skipper() {
$('#dlnow').addClass('hide')
$('#box').toggleClass('show')
if ($('#box').hasClass('hide') && $('#skipper').hasClass('hide')) {
$('#skipper').removeClass('hide')
$('#skipper').addClass('show')
} else {
$('#box').toggleClass('hide')
$('#skipper').toggleClass('hide')
$('#skipper').toggleClass('show')
}
}
verck()
function update(sel) {
$('#box').toggleClass('show')
$('#box').toggleClass('hide')
$('#dlnow').toggleClass('hide')
$('#dlnow').toggleClass('show')
$('#prog').text('')
var bit = localStorage.getItem('bit')
var start = 'https://thedesk.top/ver.json'
fetch(start, {
method: 'GET',
headers: { 'content-type': 'application/json' },
})
.then(function (response) {
if (!response.ok) {
response.text().then(function (text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
if (sel == 'install') {
if (bit == 'x64') {
var url = json['winx64']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '-setup.exe'
} else {
var file = 'TheDesk-setup.exe'
}
var filesize = json.winx64_size
} else if (bit == 'ia32') {
var url = json['winia32']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '-setup-ia32.exe'
} else {
var file = 'TheDesk-setup-ia32.exe'
}
var filesize = json.winia32_size
}
} else if (sel == 'portable') {
if (bit == 'x64') {
var url = json['winx64p']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '.exe'
} else {
var file = 'TheDesk.exe'
}
var filesize = json.winx64p_size
} else if (bit == 'ia32') {
var url = json['winia32p']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'TheDesk-' + json.unique + '-ia32.exe'
} else {
var file = 'TheDesk-ia32.exe'
}
var filesize = json.winia32p_size
}
} else if (sel == 'linux') {
var url = json['linuxx64']
if (localStorage.getItem('dl-win') == 'yes') {
var file = 'thedesk-' + json.unique_linux + '.zip'
} else {
var file = 'thedesk.zip'
}
var filesize = json.linuxx64_size
} else if (sel == 'linuxdeb') {
var url = json['linuxdeb']
var file = 'thedesk_' + json.unique_linux + '_amd64.deb'
var filesize = json.linuxdeb_size
} else if (sel == 'linuxsnap') {
var url = json['linuxsnap']
var file = 'thedesk_' + json.unique_linux + '_amd64.snap'
var filesize = json.linuxsnap_size
} else if (sel == 'mac') {
var url = json['mac']
var file = 'TheDesk-' + json.unique_mac + '.dmg'
var filesize = json.mac_size
}
postMessage(['downloadButton', [url, file, filesize]], '*')
})
}
function quit() {
postMessage(['sendSinmpleIpc', 'quit'], '*')
}
function updateProg(arg) {
$('.determinate').css('width', arg[0].percent * 100 + '%')
$('#prog').html(`${Math.floor(arg[0].percent * 100)}%<br />(${Math.floor(arg[0].percent*arg[1]/1024/1024*10)/10} MB / ${Math.floor(arg[1]/1024/1024*10)/10} MB)`)
}
function updateMess(arg) {
console.log(arg)
$('#prog').text(arg)
}
function verck() {
var platform = localStorage.getItem('platform')
var bit = localStorage.getItem('bit')
if (platform == 'win32') {
$('.windows').removeClass('hide')
} else if (platform == 'linux') {
$('.linux').removeClass('hide')
} else if (platform == 'darwin') {
$('.mac').removeClass('hide')
}
var start = 'https://thedesk.top/ver.json'
fetch(start, {
method: 'GET',
headers: { 'content-type': 'application/json' },
})
.then(function (response) {
if (!response.ok) {
response.text().then(function (text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
console.log(json)
if (platform == 'win32') {
$('#ver').text(json.desk)
localStorage.setItem('next-ver', json.desk)
var url = 'https://github.com/cutls/TheDesk/releases/tag/v' + json.unique
} else if (platform == 'linux') {
$('#ver').text(json.desk_linux)
localStorage.setItem('next-ver', json.desk_linux)
var url = 'https://github.com/cutls/TheDesk/releases/tag/v' + json.unique_linux
} else if (platform == 'darwin') {
$('#ver').text(json.desk_mac)
localStorage.setItem('next-ver', json.desk_mac)
var url = 'https://github.com/cutls/TheDesk/releases/tag/v' + json.unique_mac
}
$('#github').attr('href', url)
$('#now').text(localStorage.getItem('ver'))
})
}
function nextv() {
localStorage.setItem('new-ver-skip', 'true')
window.close()
}
function enc(ver) {
var ver = ver.replace(/\s/g, '')
var ver = ver.replace(/\(/g, '-')
var ver = ver.replace(/\)/g, '')
var ver = ver.replace(/\[/g, '_')
var ver = ver.replace(/\]/g, '')
return ver
}
</script>
</body>
</html>