thedesk/app/view/make/update.sample.html
2019-02-27 01:51:37 +09:00

208 lines
6.2 KiB
HTML

<!doctype html>
<html lang="en">
<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">
{{comment-start}}
<script type="text/javascript">
var _jipt = [];
_jipt.push(['project', 'thedesk']);
</script>
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
{{comment-end}}
</head>
<body>
<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;
}
.skipbtn{
display:block;
float:left;
width:200px;
height:200px;
border:1px solid;
margin-left:5px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid;
overflow: hidden;
}
.skipbtn:hover{
background-color: #b3e5fc;
transition: all 0.3s ease-in-out;
}
#prog{
font-size:200%;
}
.linux, .mac{
display:none;
}
</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>
<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">
<div id="box" class="show">
<h2>TheDesk</h2>
<p>{{updatehere}}</p>
<span id="now"></span><b id="ver"></b><br>
<span id="det"></span><br>
<button class="waves-effect btn windows" onclick="update('install')" style="margin-left:15px;">{{installer}}</button>
<button class="waves-effect btn windows" onclick="update('portable')" style="margin-left:15px;">{{portable}}</button>
<button class="waves-effect btn linux" onclick="update('linux')" style="margin-left:15px;">{{download}}</button>
<button class="waves-effect btn mac" onclick="update('mac')" style="margin-left:15px;">{{download}}</button>
<br>
{{problem1}}<br>{{problem2}}
</div>
<div id="skipper" class="hide">
<h4>{{sureupd}}</h4>
{{skipupd}}<br>
<div id="updskip">
<a onclick="window.close();" class="pointer skipbtn waves-effect waves-light"><div>{{nexttl}}</div></a>
<a onclick="nextv();" class="pointer skipbtn waves-effect waves-light"><div>{{nextver}}</div></a>
</div>
<a class="pointer waves-effect" onclick="skipper();" style="margin-top:5px">{{continue}}</a>
</div>
<div id="dlnow" class="hide">
<h4>{{dlnow}}</h4>
<h4 id="prog"></h4>
</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");
}
}
var electron = require("electron");
var ipc = electron.ipcRenderer;
verck();
function update(sel){
$("#box").toggleClass("show");
$("#box").toggleClass("hide");
$("#dlnow").toggleClass("hide");
$("#dlnow").toggleClass("show");
$("#prog").text("");
var remote=electron.remote;
var bit=process.arch;
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) {
if(sel=="installer"){
if(bit=="64"){
var url=json["winx64"];
}else if(bit=="32"){
var url=json["winia32"];
}
}else if(sel=="portable"){
if(bit=="64"){
var url=json["winx64p"];
}else if(bit=="32"){
var url=json["winia32p"];
}
}
ipc.send('download-btn', url);
});
}
function quit(){
ipc.send('quit', 'go');
}
ipc.on('prog', function (event, arg) {
console.log(arg);
$("body").css('background','linear-gradient(#fff 0%,#fff '+(1-arg)*100+'%, #d7ccc8 '+(1-arg)*100+'%, #d7ccc8 100%)');
$("#prog").text(Math.floor(arg*100)+"%");
})
ipc.on('mess', function (event, arg) {
console.log(arg);
$("#prog").text(arg);
})
function verck(){
var remote=electron.remote;
var platform=remote.process.platform;
var bit=process.arch;
if(platform=="linux"){
$('.windows').hide()
$('.linux').show()
}else if(platform=="mac"){
$('.windows').hide()
$('.mac').show()
}
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").html(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>