thedesk/app/language.html
2018-08-05 01:26:34 +09:00

76 lines
2.7 KiB
HTML

<!doctype html>
<html lang="ja">
<head>
<title>Languages - TheDesk</title>
<meta content="width=device-width,initial-scale=1.0" name="viewport">
<link href="./css/materialize.css" type="text/css" rel="stylesheet">
<link href="./css/themes.css" type="text/css" rel="stylesheet">
<link href="./css/master.css" type="text/css" rel="stylesheet">
<link href='./css/font-awesome.css' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Open+Sans" rel="stylesheet">
<meta charset="utf-8">
</head>
<body style="max-width:100vw; width:500px; padding:10px;">
<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>
<script type="text/javascript" src="./js/lang/lang.js"></script>
<script type="text/javascript" src="./js/ui/theme.js"></script>
<h3 id="language"></h3>
<select id="language-sel" style="color:black" onchange="btn();"></select>
<button class="btn waves-effect indigo nex" style="width:100%; max-width:200px;" onclick="sel()" id="sel"></button>
<a href="index.html" class="btn waves-effect orange nex" style="width:100%; max-width:200px;" id="back"></a><br>
<br>
<span id="notice"></span>
<script>
//コード受信
localStorage.removeItem("lang")
if(location.search){
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)/);
var mode=m[1];
if(mode=="redirect"){
if(localStorage.getItem("lang")){
changelang(localStorage.getItem("lang"))
}
}
}
var fstlang="";
var langtxt="";
var addit="";
Object.keys(lang_lang).forEach(function(i) {
if(langtxt==""){
langtxt=lang_lang[i];
$("#sel").text(lang_set[i]);
$("#back").text(lang_back[i]);
}else{
langtxt=langtxt+"/"+lang_lang[i];
}
addit=addit+"<br>"+lang_langadd[i];
var loc=lang_langlocale[i];
$("#language-sel").append('<option value="'+i+'">'+loc+'</option>');
});
$("#language").text(langtxt)
$("#notice").html(addit)
$('select').material_select('update');
function sel(){
var val=$("#language-sel").val();
changelang(val);
}
function changelang(val){
var electron = require("electron");
var ipc = electron.ipcRenderer;
localStorage.setItem("lang",val);
ipc.send('lang', val);
ipc.on('langres', function (event, arg) {
location.href="index.html";
})
}
function btn(){
var val=$("#language-sel").val();
$("#sel").text(lang_set[val]);
$("#back").text(lang_back[val]);
}
</script>
<script type="text/javascript" src="./js/platform/end.js"></script>