thedesk/app/update.sample.html

92 lines
3.0 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="{{lang}}">
<head>
<title>Update - TheDesk</title>
<link href="./css/materialize.css" type="text/css" rel="stylesheet">
<link href="./css/master.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Open+Sans:300" rel="stylesheet">
<meta charset="utf-8">
</head>
<body>
<style>
body{
font-family:'Open Sans';
-webkit-app-region: drag;
cursor: move;
padding:10px;
}
a,button{
-webkit-app-region: no-drag;
}</style>
<script type="text/javascript" src="./js/common/jquery.js"></script>
<script type="text/javascript" src="./js/platform/first.js"></script>
<script type="text/javascript" src="./js/common/materialize.js"></script>
<h5>{{updatehere}}[TheDesk <span id="ver"></span>]</h5>
<span id="det"></span><br>
{{nowver}}<span id="now"></span><br>
{{afterdl}}<br>
<button id="update" class="waves-effect btn" onclick="update('true')">{{download}}</button>
<p id="prog"></p>
<div class="progress">
<div class="determinate" style="width: 0%"></div>
</div><br>
{{cdn}}<br>
{{releasenote1}}<a href="https://github.com/cutls/TheDesk/blob/master/LATEST.md">GitHub</a>{{releasenote2}}<br><br>
{{skipupd}}(<a onclick="window.close();" class="pointer">{{nexttl}}</a>/<a onclick="nextv();" class="pointer">{{nextver}}</a>)<br>
<a onclick="quit()" class="pointer">{{endthedesk}}</a><br>
<a onclick="about()" class="pointer">{{about}}</a><br>
{{problem1}}<a href="https://thedesk.top">TheDesk HP</a>{{problem2}}
<script type="text/javascript" src="./js/common/about.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script>
<script>
var electron = require("electron");
var ipc = electron.ipcRenderer;
verck();
function update(sel){
$("#prog").text("");
ipc.send('download-btn', [sel,enc(localStorage.getItem("next-ver"))]);
}
function quit(){
ipc.send('quit', 'go');
}
ipc.on('prog', function (event, arg) {
console.log(arg);
$(".determinate").css('width',arg*100+"%");
$("#prog").text("{{dlnow}}:"+Math.floor(arg*100)+"%");
})
ipc.on('mess', function (event, arg) {
console.log(arg);
$("#prog").text(arg);
})
function verck(){
var start="https://thedesk.top/ver.json";
fetch(start, {
method: 'GET',
headers: {'content-type': 'application/json'},
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
$("#ver").text(json.desk);
localStorage.setItem("next-ver",json.desk);
$("#det").text(json.detail);
$("#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>