2019-11-25 01:53:35 +11:00
|
|
|
'use strict'
|
2018-01-28 23:22:43 +11:00
|
|
|
//設定(setting.html)で読む
|
2019-03-15 22:12:11 +11:00
|
|
|
var envView = new Vue({
|
2019-11-04 03:10:06 +11:00
|
|
|
el: "#envView",
|
2019-05-19 17:39:30 +10:00
|
|
|
data: { config: envConstruction },
|
2019-03-15 22:12:11 +11:00
|
|
|
methods: {
|
2019-11-04 03:10:06 +11:00
|
|
|
complete: function(i, val) {
|
2019-05-19 17:39:30 +10:00
|
|
|
var ls = envView.config[i].storage;
|
2019-11-04 03:10:06 +11:00
|
|
|
M.toast({ html: "Complete", displayLength: 3000 });
|
2019-05-19 17:39:30 +10:00
|
|
|
if (!val) {
|
|
|
|
var id = envView.config[i].id;
|
2019-11-04 03:10:06 +11:00
|
|
|
var val = $("#" + id).val();
|
2019-03-16 16:05:04 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem(ls, val);
|
2019-05-19 17:39:30 +10:00
|
|
|
if (ls == "ha") {
|
2019-11-04 03:10:06 +11:00
|
|
|
hardwareAcceleration(val);
|
2019-03-15 22:12:11 +11:00
|
|
|
}
|
2019-10-26 03:16:33 +11:00
|
|
|
if (ls == "ua_setting") {
|
2019-11-04 03:10:06 +11:00
|
|
|
useragent(val);
|
2019-10-26 03:16:33 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
return true;
|
2019-03-15 22:12:11 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
var tlView = new Vue({
|
2019-11-04 03:10:06 +11:00
|
|
|
el: "#tlView",
|
2019-05-19 17:39:30 +10:00
|
|
|
data: { config: tlConstruction },
|
2019-03-15 22:12:11 +11:00
|
|
|
methods: {
|
2019-11-04 03:10:06 +11:00
|
|
|
complete: function(i, val) {
|
2019-06-26 01:33:32 +10:00
|
|
|
var ls = tlView.config[i];
|
|
|
|
if (val) {
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem(ls.storage, val);
|
2019-06-26 01:33:32 +10:00
|
|
|
} else {
|
|
|
|
if (!ls.data) {
|
2019-11-04 03:10:06 +11:00
|
|
|
ls = [ls];
|
2019-06-26 01:33:32 +10:00
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
ls = ls.data;
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
|
|
|
for (var j = 0; j < ls.length; j++) {
|
2019-11-04 03:10:06 +11:00
|
|
|
M.toast({ html: "Complete", displayLength: 3000 });
|
2019-06-26 01:33:32 +10:00
|
|
|
var id = ls[j].id;
|
2019-11-04 03:10:06 +11:00
|
|
|
var val = $("#" + id).val();
|
|
|
|
localStorage.setItem(ls[j].storage, val);
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
2019-03-16 16:05:04 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
return true;
|
2019-03-15 22:12:11 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
var postView = new Vue({
|
2019-11-04 03:10:06 +11:00
|
|
|
el: "#postView",
|
|
|
|
data: { config: postConstruction, kirishima: localStorage.getItem("kirishima"), quoters: localStorage.getItem("quoters") },
|
2019-03-15 22:12:11 +11:00
|
|
|
methods: {
|
2019-11-04 03:10:06 +11:00
|
|
|
complete: function(i, val) {
|
2019-06-26 01:33:32 +10:00
|
|
|
var ls = postView.config[i];
|
|
|
|
if (val) {
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem(ls.storage, val);
|
2019-06-26 01:33:32 +10:00
|
|
|
} else {
|
|
|
|
if (!ls.data) {
|
2019-11-04 03:10:06 +11:00
|
|
|
ls = [ls];
|
2019-06-26 01:33:32 +10:00
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
ls = ls.data;
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
|
|
|
for (var j = 0; j < ls.length; j++) {
|
2019-11-04 03:10:06 +11:00
|
|
|
M.toast({ html: "Complete", displayLength: 3000 });
|
2019-06-26 01:33:32 +10:00
|
|
|
var id = ls[j].id;
|
2019-11-04 03:10:06 +11:00
|
|
|
var val = $("#" + id).val();
|
|
|
|
localStorage.setItem(ls[j].storage, val);
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
2019-03-16 16:05:04 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
return true;
|
2019-03-15 22:12:11 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2018-01-28 23:22:43 +11:00
|
|
|
//設定ボタン押した。
|
|
|
|
function settings() {
|
|
|
|
var cd = $("[name=theme]:checked").val();
|
2019-10-14 02:44:12 +11:00
|
|
|
var ct = $("[data-ct=" + cd + "]").html();
|
2019-05-19 17:39:30 +10:00
|
|
|
if (cd == "custom" && !$("#custom-sel-sel").val()) {
|
2019-03-08 05:19:26 +11:00
|
|
|
var theme = localStorage.getItem("theme");
|
|
|
|
if (!theme) {
|
|
|
|
var theme = "white";
|
|
|
|
}
|
|
|
|
$("#" + theme).prop("checked", true);
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2019-03-08 05:19:26 +11:00
|
|
|
if (cd != localStorage.getItem("theme")) {
|
2019-11-04 03:10:06 +11:00
|
|
|
M.toast({ html: lang.lang_setting_theme.replace("{{set}}", ct), displayLength: 3000 });
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
|
|
|
//テーマはこの場で設定
|
|
|
|
themes(cd);
|
|
|
|
localStorage.setItem("theme", cd);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2018-07-05 11:26:07 +10:00
|
|
|
var fontd = $("#font").val();
|
2019-05-19 17:39:30 +10:00
|
|
|
if (fontd) {
|
2018-07-05 11:26:07 +10:00
|
|
|
if (fontd != localStorage.getItem("font")) {
|
2019-11-04 03:10:06 +11:00
|
|
|
M.toast({ html: lang.lang_setting_font.replace("{{set}}", ct), displayLength: 3000 });
|
2018-07-05 11:26:07 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("font", fontd);
|
|
|
|
themes();
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
|
|
|
if (localStorage.getItem("font")) {
|
2018-07-07 03:51:48 +10:00
|
|
|
localStorage.removeItem("font");
|
2019-11-04 03:10:06 +11:00
|
|
|
M.toast({ html: lang.lang_setting_font.replace("{{set}}", ct), displayLength: 3000 });
|
2018-07-07 03:51:48 +10:00
|
|
|
themes();
|
|
|
|
}
|
2018-07-05 11:26:07 +10:00
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
//読み込み時の設定ロード
|
|
|
|
function load() {
|
2019-05-19 17:39:30 +10:00
|
|
|
var max = envView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = envView.config[i].storage;
|
|
|
|
if (localStorage.getItem(ls)) {
|
2019-11-04 03:10:06 +11:00
|
|
|
envView.config[i].setValue = localStorage.getItem(ls);
|
2019-03-19 02:24:46 +11:00
|
|
|
}
|
2019-03-15 22:12:11 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
var max = tlView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
2019-07-02 01:32:28 +10:00
|
|
|
var ls = tlView.config[i].storage;
|
2019-06-26 01:33:32 +10:00
|
|
|
if (ls) {
|
|
|
|
if (localStorage.getItem(ls)) {
|
2019-11-04 03:10:06 +11:00
|
|
|
tlView.config[i].setValue = localStorage.getItem(ls);
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
ls = tlView.config[i].data;
|
2019-06-26 01:33:32 +10:00
|
|
|
for (var j = 0; j < ls.length; j++) {
|
2019-08-29 02:33:06 +10:00
|
|
|
if (localStorage.getItem(tlView.config[i].data[j].storage)) {
|
2019-11-04 03:10:06 +11:00
|
|
|
tlView.config[i].data[j].setValue = localStorage.getItem(tlView.config[i].data[j].storage);
|
2019-08-29 02:33:06 +10:00
|
|
|
}
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
2019-03-19 02:24:46 +11:00
|
|
|
}
|
2019-03-15 22:12:11 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
var max = postView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = postView.config[i].storage;
|
2019-06-26 01:33:32 +10:00
|
|
|
if (ls) {
|
|
|
|
if (localStorage.getItem(ls)) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postView.config[i].setValue = localStorage.getItem(ls);
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
ls = postView.config[i].data;
|
2019-06-26 01:33:32 +10:00
|
|
|
for (var j = 0; j < ls.length; j++) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postView.config[i].data[j].setValue = localStorage.getItem(ls[j].storage);
|
2019-06-26 01:33:32 +10:00
|
|
|
}
|
2019-03-19 02:24:46 +11:00
|
|
|
}
|
2019-03-15 22:12:11 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
if (localStorage.getItem("imas")) {
|
2018-04-16 23:58:14 +10:00
|
|
|
$(".imas").removeClass("hide");
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
if (localStorage.getItem("kirishima")) {
|
2018-07-30 03:35:29 +10:00
|
|
|
$(".kirishima").removeClass("hide");
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
var theme = localStorage.getItem("theme");
|
|
|
|
if (!theme) {
|
|
|
|
var theme = "white";
|
|
|
|
}
|
|
|
|
$("#" + theme).prop("checked", true);
|
2018-07-05 11:26:07 +10:00
|
|
|
var font = localStorage.getItem("font");
|
|
|
|
if (!font) {
|
|
|
|
var font = "";
|
|
|
|
}
|
|
|
|
$("#font").val(font);
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#c1-file").text(localStorage.getItem("custom1"));
|
2019-04-15 01:45:04 +10:00
|
|
|
$("#c2-file").text(localStorage.getItem("custom2"));
|
|
|
|
$("#c3-file").text(localStorage.getItem("custom3"));
|
|
|
|
$("#c4-file").text(localStorage.getItem("custom4"));
|
2019-11-04 03:10:06 +11:00
|
|
|
var cvol = localStorage.getItem("customVol");
|
2019-09-17 01:59:25 +10:00
|
|
|
if (cvol) {
|
|
|
|
$("#soundvol").val(cvol * 100);
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#soundVolVal").text(cvol * 100);
|
2019-09-17 01:59:25 +10:00
|
|
|
}
|
2019-05-26 21:42:52 +10:00
|
|
|
//$("#log").val(localStorage.getItem("errors"))
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2019-09-17 01:59:25 +10:00
|
|
|
function customVol() {
|
2019-11-04 03:10:06 +11:00
|
|
|
var cvol = $("#soundvol").val();
|
|
|
|
$("#soundVolVal").text(cvol);
|
|
|
|
localStorage.setItem("customVol", cvol / 100);
|
2019-09-17 01:59:25 +10:00
|
|
|
var sound = localStorage.getItem("favSound");
|
|
|
|
if (sound == "default") {
|
2019-11-04 03:10:06 +11:00
|
|
|
var file = "../../source/notif.wav";
|
|
|
|
} else {
|
2019-09-17 01:59:25 +10:00
|
|
|
if (sound == "c1") {
|
|
|
|
var file = localStorage.getItem("custom1");
|
|
|
|
} else if (sound == "c2") {
|
|
|
|
var file = localStorage.getItem("custom2");
|
|
|
|
} else if (sound == "c3") {
|
|
|
|
var file = localStorage.getItem("custom3");
|
|
|
|
} else if (sound == "c4") {
|
|
|
|
var file = localStorage.getItem("custom4");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
request = new XMLHttpRequest();
|
|
|
|
request.open("GET", file, true);
|
|
|
|
request.responseType = "arraybuffer";
|
|
|
|
request.onload = playSound;
|
|
|
|
request.send();
|
|
|
|
}
|
2019-03-08 05:19:26 +11:00
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
function climute() {
|
2018-03-11 01:22:59 +11:00
|
|
|
//クライアントミュート
|
|
|
|
var cli = localStorage.getItem("client_mute");
|
|
|
|
var obj = JSON.parse(cli);
|
2019-05-19 17:39:30 +10:00
|
|
|
if (!obj) {
|
2019-01-26 14:24:26 +11:00
|
|
|
$("#mute-cli").html(lang.lang_setting_nomuting);
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
|
|
|
if (!obj[0]) {
|
2019-01-26 14:24:26 +11:00
|
|
|
$("#mute-cli").html(lang.lang_setting_nomuting);
|
2018-03-11 01:22:59 +11:00
|
|
|
return;
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
var templete;
|
2019-11-04 03:10:06 +11:00
|
|
|
Object.keys(obj).forEach(function(key) {
|
2019-05-19 17:39:30 +10:00
|
|
|
var cli = obj[key];
|
|
|
|
var list = key * 1 + 1;
|
2019-11-04 03:10:06 +11:00
|
|
|
templete = '<div class="acct" id="acct_' + key + '">' + list + "." + escapeHTML(cli) + '<button class="btn waves-effect red disTar" onclick="cliMuteDel(' + key + ')">' + lang.lang_del + "</button><br></div>";
|
2019-05-19 17:39:30 +10:00
|
|
|
$("#mute-cli").append(templete);
|
|
|
|
});
|
|
|
|
}
|
2018-03-11 01:22:59 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function cliMuteDel(key) {
|
2018-03-11 01:22:59 +11:00
|
|
|
var cli = localStorage.getItem("client_mute");
|
|
|
|
var obj = JSON.parse(cli);
|
|
|
|
obj.splice(key, 1);
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
localStorage.setItem("client_mute", json);
|
2019-05-07 23:43:30 +10:00
|
|
|
climute();
|
2018-03-11 01:22:59 +11:00
|
|
|
}
|
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
function wordmute() {
|
2018-03-11 01:22:59 +11:00
|
|
|
var word = localStorage.getItem("word_mute");
|
|
|
|
var obj = JSON.parse(word);
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!obj) {
|
|
|
|
obj = [];
|
|
|
|
}
|
|
|
|
$("#wordmute").chips({
|
|
|
|
data: obj
|
2019-05-19 17:39:30 +10:00
|
|
|
});
|
2018-03-11 01:22:59 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function wordmuteSave() {
|
2019-06-16 22:52:41 +10:00
|
|
|
var word = M.Chips.getInstance($("#wordmute")).chipsData;
|
2018-03-11 01:22:59 +11:00
|
|
|
var json = JSON.stringify(word);
|
|
|
|
localStorage.setItem("word_mute", json);
|
|
|
|
}
|
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
function wordemp() {
|
2018-03-11 01:22:59 +11:00
|
|
|
var word = localStorage.getItem("word_emp");
|
|
|
|
var obj = JSON.parse(word);
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!obj) {
|
|
|
|
obj = [];
|
|
|
|
}
|
|
|
|
$("#wordemp").chips({
|
|
|
|
data: obj
|
2018-03-11 01:22:59 +11:00
|
|
|
});
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function wordempSave() {
|
2019-06-16 22:52:41 +10:00
|
|
|
var word = M.Chips.getInstance($("#wordemp")).chipsData;
|
2018-03-11 01:22:59 +11:00
|
|
|
var json = JSON.stringify(word);
|
|
|
|
localStorage.setItem("word_emp", json);
|
2018-05-26 05:00:04 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function notftest() {
|
2019-06-15 03:01:38 +10:00
|
|
|
var os = localStorage.getItem("platform");
|
2019-05-19 17:39:30 +10:00
|
|
|
var options = {
|
2019-11-04 03:10:06 +11:00
|
|
|
body: lang.lang_setting_notftest + "(" + lang.lang_setting_notftestprof + ")",
|
2019-05-19 17:39:30 +10:00
|
|
|
icon: localStorage.getItem("prof_0")
|
|
|
|
};
|
2019-11-04 03:10:06 +11:00
|
|
|
var n = new Notification("TheDesk" + lang.lang_setting_notftest, options);
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function oks(no) {
|
|
|
|
var txt = $("#oks-" + no).val();
|
|
|
|
localStorage.setItem("oks-" + no, txt);
|
2019-11-04 03:10:06 +11:00
|
|
|
M.toast({ html: lang.lang_setting_ksref, displayLength: 3000 });
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function oksload() {
|
2019-11-04 03:10:06 +11:00
|
|
|
if (localStorage.getItem("oks-1")) {
|
|
|
|
$("#oks-1").val(localStorage.getItem("oks-1"));
|
|
|
|
}
|
|
|
|
if (localStorage.getItem("oks-2")) {
|
|
|
|
$("#oks-2").val(localStorage.getItem("oks-2"));
|
|
|
|
}
|
|
|
|
if (localStorage.getItem("oks-3")) {
|
|
|
|
$("#oks-3").val(localStorage.getItem("oks-3"));
|
|
|
|
}
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function changelang(lang) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["lang", lang], "*");
|
2018-09-12 02:49:41 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function exportSettings() {
|
2019-06-22 02:06:32 +10:00
|
|
|
Swal.fire({
|
|
|
|
title: lang.lang_setting_exportwarn,
|
2019-11-04 03:10:06 +11:00
|
|
|
type: "warning",
|
2019-06-22 02:06:32 +10:00
|
|
|
showCancelButton: true,
|
2019-11-04 03:10:06 +11:00
|
|
|
confirmButtonColor: "#3085d6",
|
|
|
|
cancelButtonColor: "#d33",
|
2019-06-22 02:06:32 +10:00
|
|
|
confirmButtonText: lang.lang_yesno,
|
|
|
|
cancelButtonText: lang.lang_no
|
2019-11-04 03:10:06 +11:00
|
|
|
}).then(result => {
|
2019-06-22 02:06:32 +10:00
|
|
|
if (result.value) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["exportSettings", ""], "*");
|
2019-06-22 02:06:32 +10:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
});
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
function exportSettingsCore() {
|
|
|
|
var exp = {};
|
|
|
|
//Accounts
|
|
|
|
var multi = localStorage.getItem("multi");
|
|
|
|
var acct = JSON.parse(multi);
|
|
|
|
exp.accts = acct;
|
|
|
|
//Columns
|
|
|
|
var multi = localStorage.getItem("column");
|
|
|
|
var column = JSON.parse(multi);
|
|
|
|
exp.columns = column;
|
|
|
|
//Themes
|
|
|
|
var config = {};
|
|
|
|
config.theme = localStorage.getItem("theme");
|
|
|
|
//Other configs
|
|
|
|
var max = envView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = envView.config[i].storage;
|
2019-11-04 03:10:06 +11:00
|
|
|
config[ls] = localStorage.getItem(ls);
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
var max = tlView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = tlView.config[i].storage;
|
2019-11-04 03:10:06 +11:00
|
|
|
config[ls] = localStorage.getItem(ls);
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
var max = postView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = postView.config[i].storage;
|
2019-11-04 03:10:06 +11:00
|
|
|
config[ls] = localStorage.getItem(ls);
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
//Font
|
|
|
|
config.font = localStorage.getItem("font");
|
|
|
|
exp.config = config;
|
|
|
|
//keysc
|
2019-11-04 03:10:06 +11:00
|
|
|
exp.ksc = [localStorage.getItem("oks-1"), localStorage.getItem("oks-2"), localStorage.getItem("oks-3")];
|
2019-06-15 03:01:38 +10:00
|
|
|
//climu
|
|
|
|
var cli = localStorage.getItem("client_mute");
|
|
|
|
var climu = JSON.parse(cli);
|
|
|
|
exp.clientMute = climu;
|
|
|
|
//wordmu
|
|
|
|
var wdm = localStorage.getItem("word_mute");
|
|
|
|
var wordmu = JSON.parse(wdm);
|
|
|
|
exp.wordMute = wordmu;
|
|
|
|
//spotify
|
2019-11-04 03:10:06 +11:00
|
|
|
exp.spotifyArtwork = localStorage.getItem("artwork");
|
2019-06-15 03:01:38 +10:00
|
|
|
var content = localStorage.getItem("np-temp");
|
|
|
|
if (content || content == "" || content == "null") {
|
|
|
|
exp.spotifyTemplete = content;
|
|
|
|
} else {
|
|
|
|
exp.spotifyTemplete = null;
|
|
|
|
}
|
|
|
|
//tags
|
|
|
|
var tagarr = localStorage.getItem("tag");
|
|
|
|
var favtag = JSON.parse(tagarr);
|
|
|
|
exp.favoriteTags = favtag;
|
2019-11-04 03:10:06 +11:00
|
|
|
exp.revisons = 2.1;
|
|
|
|
exp.meta = {};
|
|
|
|
exp.meta.date = new Date();
|
|
|
|
exp.meta.thedesk = localStorage.getItem("ver");
|
|
|
|
exp.meta.platform = localStorage.getItem("platform");
|
2019-06-15 03:01:38 +10:00
|
|
|
return exp;
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function importSettings() {
|
2019-06-22 02:06:32 +10:00
|
|
|
Swal.fire({
|
|
|
|
title: lang.lang_setting_importwarn,
|
2019-11-04 03:10:06 +11:00
|
|
|
type: "warning",
|
2019-06-22 02:06:32 +10:00
|
|
|
showCancelButton: true,
|
2019-11-04 03:10:06 +11:00
|
|
|
confirmButtonColor: "#3085d6",
|
|
|
|
cancelButtonColor: "#d33",
|
2019-06-22 02:06:32 +10:00
|
|
|
confirmButtonText: lang.lang_yesno,
|
|
|
|
cancelButtonText: lang.lang_no
|
2019-11-04 03:10:06 +11:00
|
|
|
}).then(result => {
|
2019-06-22 02:06:32 +10:00
|
|
|
if (result.value) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["importSettings", ""], "*");
|
2019-06-22 02:06:32 +10:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
});
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
2019-08-29 02:20:47 +10:00
|
|
|
function importSettingsCore(obj) {
|
2019-06-15 03:01:38 +10:00
|
|
|
if (obj) {
|
|
|
|
localStorage.clear();
|
|
|
|
localStorage.setItem("multi", JSON.stringify(obj.accts));
|
|
|
|
for (var key = 0; key < obj.accts.length; key++) {
|
|
|
|
var acct = obj.accts[key];
|
|
|
|
localStorage.setItem("name_" + key, acct.name);
|
|
|
|
localStorage.setItem("user_" + key, acct.user);
|
|
|
|
localStorage.setItem("user-id_" + key, acct.id);
|
|
|
|
localStorage.setItem("prof_" + key, acct.prof);
|
|
|
|
localStorage.setItem("domain_" + key, acct.domain);
|
|
|
|
localStorage.setItem("acct_" + key + "_at", acct.at);
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2019-06-15 03:01:38 +10:00
|
|
|
localStorage.setItem("column", JSON.stringify(obj.columns));
|
|
|
|
if (obj.config) {
|
2019-08-29 02:20:47 +10:00
|
|
|
//Version 2~
|
2019-06-15 03:01:38 +10:00
|
|
|
var max = envView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = envView.config[i].storage;
|
|
|
|
if (obj.config[ls]) {
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem(ls, obj.config[ls]);
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
var max = tlView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = tlView.config[i].storage;
|
|
|
|
if (obj.config[ls]) {
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem(ls, obj.config[ls]);
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
var max = postView.config.length;
|
|
|
|
for (var i = 0; i < max; i++) {
|
|
|
|
var ls = postView.config[i].storage;
|
|
|
|
if (obj.config[ls]) {
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem(ls, obj.config[ls]);
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
|
|
|
}
|
2019-06-15 03:01:38 +10:00
|
|
|
} else {
|
|
|
|
//Version 1
|
|
|
|
localStorage.setItem("theme", obj.theme);
|
|
|
|
if (obj.width) {
|
|
|
|
localStorage.setItem("width", obj.width);
|
|
|
|
}
|
|
|
|
if (obj.font) {
|
|
|
|
localStorage.setItem("font", obj.font);
|
|
|
|
}
|
|
|
|
if (obj.size) {
|
|
|
|
localStorage.setItem("size", obj.size);
|
|
|
|
}
|
|
|
|
themes(obj.theme);
|
|
|
|
if (obj.imgheight) {
|
|
|
|
localStorage.setItem("img-height", obj.imgheight);
|
|
|
|
}
|
|
|
|
localStorage.setItem("mainuse", obj.mainuse);
|
|
|
|
if (obj.cw) {
|
|
|
|
localStorage.setItem("cwtext", obj.cw);
|
|
|
|
}
|
|
|
|
localStorage.setItem("vis", obj.vis);
|
|
|
|
//End
|
|
|
|
}
|
|
|
|
if (obj.ksc[0]) {
|
|
|
|
localStorage.setItem("oks-1", obj.ksc[0]);
|
|
|
|
}
|
|
|
|
if (obj.ksc[1]) {
|
|
|
|
localStorage.setItem("oks-2", obj.ksc[1]);
|
|
|
|
}
|
|
|
|
if (obj.ksc[2]) {
|
|
|
|
localStorage.setItem("oks-3", obj.ksc[2]);
|
|
|
|
}
|
|
|
|
if (obj.clientMute) {
|
|
|
|
localStorage.setItem("client_mute", JSON.stringify(obj.clientMute));
|
|
|
|
}
|
|
|
|
if (obj.wordMute) {
|
|
|
|
localStorage.setItem("word_mute", JSON.stringify(obj.wordMute));
|
|
|
|
}
|
|
|
|
if (obj.favoriteTags) {
|
|
|
|
localStorage.setItem("tag", JSON.stringify(obj.favoriteTags));
|
|
|
|
}
|
|
|
|
|
|
|
|
localStorage.setItem("np-temp", obj.spotifyTemplete);
|
|
|
|
for (var i = 0; i < obj.columns.length; i++) {
|
|
|
|
localStorage.setItem("card_" + i, "true");
|
|
|
|
localStorage.removeItem("catch_" + i);
|
|
|
|
}
|
|
|
|
location.href = "index.html";
|
|
|
|
} else {
|
2019-06-22 02:06:32 +10:00
|
|
|
Swal.fire({
|
2019-11-04 03:10:06 +11:00
|
|
|
type: "error",
|
|
|
|
title: "Error"
|
|
|
|
});
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
2018-09-06 02:47:27 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function savefolder() {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["sendSinmpleIpc", "savefolder"], "*");
|
2018-12-09 05:46:01 +11:00
|
|
|
}
|
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
function font() {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["sendSinmpleIpc", "fonts"], "*");
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
function fontList(arg) {
|
|
|
|
$("#fonts").removeClass("hide");
|
|
|
|
for (var i = 0; i < arg.length; i++) {
|
|
|
|
var font = arg[i];
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#fonts").append('<div class="font pointer" style="font-family:' + font.family + '" onclick="insertFont(\'' + font.family + "')\">" + font.family + "</div>");
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
2018-12-09 05:46:01 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function insertFont(name) {
|
2018-12-09 05:46:01 +11:00
|
|
|
$("#font").val(name);
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
$(".color-picker").each(function(i, elem) {
|
2019-05-19 17:39:30 +10:00
|
|
|
pickerDefine(i, "fff");
|
2019-03-08 05:19:26 +11:00
|
|
|
});
|
2019-05-19 17:39:30 +10:00
|
|
|
function pickerDefine(i, color) {
|
2019-03-08 05:19:26 +11:00
|
|
|
var pickr = new Pickr({
|
2019-11-04 03:10:06 +11:00
|
|
|
el: "#color-picker" + i,
|
2019-03-08 05:19:26 +11:00
|
|
|
default: color,
|
|
|
|
showAlways: true,
|
|
|
|
appendToBody: true,
|
2019-11-04 03:10:06 +11:00
|
|
|
closeWithKey: "Escape",
|
2019-03-08 05:19:26 +11:00
|
|
|
comparison: false,
|
|
|
|
components: {
|
|
|
|
preview: true, // Left side color comparison
|
|
|
|
opacity: false, // Opacity slider
|
2019-11-04 03:10:06 +11:00
|
|
|
hue: true, // Hue slider
|
2019-03-08 07:18:49 +11:00
|
|
|
interaction: {
|
|
|
|
rgba: false, // rgba option (red green blue and alpha)
|
2019-11-04 03:10:06 +11:00
|
|
|
input: true // input / output element
|
2019-03-08 07:18:49 +11:00
|
|
|
}
|
2019-03-08 05:19:26 +11:00
|
|
|
},
|
|
|
|
strings: {
|
2019-11-04 03:10:06 +11:00
|
|
|
save: "Save", // Default for save button
|
|
|
|
clear: "Clear" // Default for clear button
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
});
|
2019-11-04 03:10:06 +11:00
|
|
|
pickr.on("change", (...args) => {
|
|
|
|
var rgb = "rgb(" + args[0].toRGBA()[0] + "," + args[0].toRGBA()[1] + "," + args[0].toRGBA()[2] + ")";
|
|
|
|
$("#color-picker" + i + "_value").val(rgb);
|
2019-05-19 17:39:30 +10:00
|
|
|
});
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function customComp() {
|
|
|
|
var nameC = $("#custom_name").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!nameC) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
var descC = $("#custom_desc").val();
|
|
|
|
var primaryC = $("#color-picker0_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!primaryC) {
|
|
|
|
primaryC = "rgb(255,255,255)";
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
var secondaryC = $("#color-picker1_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!secondaryC) {
|
|
|
|
secondaryC = "rgb(255,255,255)";
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
var textC = $("#color-picker2_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!textC) {
|
|
|
|
textC = "rgb(255,255,255)";
|
|
|
|
}
|
2019-03-08 05:19:26 +11:00
|
|
|
var multi = localStorage.getItem("multi");
|
2019-11-04 03:10:06 +11:00
|
|
|
if ($("#pickers").hasClass("advanceTheme")) {
|
2019-10-09 03:14:27 +11:00
|
|
|
var accentC = $("#color-picker3_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!accentC) {
|
|
|
|
accentC = null;
|
|
|
|
}
|
2019-10-09 03:14:27 +11:00
|
|
|
var activeC = $("#color-picker4_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!activeC) {
|
|
|
|
activeC = null;
|
|
|
|
}
|
2019-10-09 03:14:27 +11:00
|
|
|
var modalC = $("#color-picker5_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!modalC) {
|
|
|
|
modalC = null;
|
|
|
|
}
|
2019-10-09 03:14:27 +11:00
|
|
|
var bottomC = $("#color-picker6_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!bottomC) {
|
|
|
|
bottomC = null;
|
|
|
|
}
|
2019-10-09 03:14:27 +11:00
|
|
|
var postboxC = $("#color-picker7_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!postboxC) {
|
|
|
|
postboxC = null;
|
|
|
|
}
|
2019-10-09 03:14:27 +11:00
|
|
|
var subcolorC = $("#color-picker8_value").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
if (!subcolorC) {
|
|
|
|
subcolorC = null;
|
2019-10-09 03:14:27 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
var advanceTheme = {
|
|
|
|
TheDeskAccent: accentC,
|
|
|
|
TheDeskActive: activeC,
|
|
|
|
TheDeskModal: modalC,
|
|
|
|
TheDeskBottom: bottomC,
|
|
|
|
TheDeskPostbox: postboxC,
|
|
|
|
TheDeskSubcolor: subcolorC
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
var advanceTheme = {};
|
2019-10-09 03:14:27 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
var my = JSON.parse(multi)[0].name;
|
|
|
|
var id = $("#custom-edit-sel").val();
|
|
|
|
if (id == "add_new") {
|
|
|
|
id = makeCID();
|
2019-03-08 07:18:49 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem("customtheme-id", id);
|
2019-05-19 17:39:30 +10:00
|
|
|
var json = {
|
2019-11-04 03:10:06 +11:00
|
|
|
name: nameC,
|
|
|
|
author: my,
|
|
|
|
desc: descC,
|
|
|
|
base: $("[name=direction]:checked").val(),
|
|
|
|
vars: {
|
|
|
|
primary: primaryC,
|
|
|
|
secondary: secondaryC,
|
|
|
|
text: textC
|
2019-03-08 05:19:26 +11:00
|
|
|
},
|
2019-11-04 03:10:06 +11:00
|
|
|
props: advanceTheme,
|
|
|
|
id: id
|
|
|
|
};
|
2019-05-19 17:39:30 +10:00
|
|
|
$("#custom_json").val(JSON.stringify(json));
|
2019-10-09 03:14:27 +11:00
|
|
|
themes("custom");
|
|
|
|
$("#custom").prop("checked", true);
|
2019-05-19 17:39:30 +10:00
|
|
|
$("#custom_name").val("");
|
|
|
|
$("#custom_desc").val("");
|
|
|
|
$("#dark").prop("checked", true);
|
|
|
|
$("#custom_json").val("");
|
2019-11-04 03:10:06 +11:00
|
|
|
for (var i = 0; i <= 8; i++) {
|
|
|
|
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
2019-10-09 03:14:27 +11:00
|
|
|
$("#color-picker" + i + "_value").val("");
|
|
|
|
pickerDefine(i, "fff");
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["themeJsonCreate", JSON.stringify(json)], "*");
|
2019-03-08 07:18:49 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function deleteIt() {
|
|
|
|
var id = $("#custom-sel-sel").val();
|
2019-03-08 07:18:49 +11:00
|
|
|
$("#custom_name").val("");
|
|
|
|
$("#custom_desc").val("");
|
|
|
|
$("#dark").prop("checked", true);
|
|
|
|
$("#custom_json").val("");
|
2019-11-04 03:10:06 +11:00
|
|
|
for (var i = 0; i <= 8; i++) {
|
|
|
|
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
2019-10-09 03:14:27 +11:00
|
|
|
$("#color-picker" + i + "_value").val("");
|
|
|
|
pickerDefine(i, "fff");
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["themeJsonDelete", id], "*");
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function ctLoad() {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["sendSinmpleIpc", "theme-json-list"], "*");
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
function ctLoadCore(args) {
|
|
|
|
var templete = "";
|
2019-11-04 03:10:06 +11:00
|
|
|
Object.keys(args).forEach(function(key) {
|
2019-06-15 03:01:38 +10:00
|
|
|
var theme = args[key];
|
2019-11-04 03:10:06 +11:00
|
|
|
var themeid = theme.id;
|
|
|
|
templete = templete + '<option value="' + themeid + '">' + theme.name + "</option>";
|
2019-03-08 05:19:26 +11:00
|
|
|
});
|
2019-06-15 03:01:38 +10:00
|
|
|
if (args[0]) {
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem("customtheme-id", args[0].id);
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
$("#custom-sel-sel").html(templete);
|
2019-11-04 03:10:06 +11:00
|
|
|
templete = '<option value="add_new">' + $("#edit-selector").attr("data-add") + "</option>" + templete;
|
2019-06-15 03:01:38 +10:00
|
|
|
$("#custom-edit-sel").html(templete);
|
2019-11-04 03:10:06 +11:00
|
|
|
$("select").formSelect();
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function customSel() {
|
|
|
|
var id = $("#custom-sel-sel").val();
|
2019-11-04 03:10:06 +11:00
|
|
|
localStorage.setItem("customtheme-id", id);
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function custom() {
|
|
|
|
var id = $("#custom-edit-sel").val();
|
|
|
|
if (id == "add_new") {
|
2019-03-08 05:19:26 +11:00
|
|
|
$("#custom_name").val("");
|
|
|
|
$("#custom_desc").val("");
|
|
|
|
$("#dark").prop("checked", true);
|
|
|
|
$("#custom_json").val("");
|
2019-11-04 03:10:06 +11:00
|
|
|
for (var i = 0; i <= 8; i++) {
|
|
|
|
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
2019-10-09 03:14:27 +11:00
|
|
|
$("#color-picker" + i + "_value").val("");
|
|
|
|
pickerDefine(i, "fff");
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#delTheme").addClass("disabled");
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#delTheme").removeClass("disabled");
|
|
|
|
postMessage(["themeJsonRequest", id], "*");
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
|
|
|
}
|
2019-10-10 01:00:46 +11:00
|
|
|
function customConnect(raw) {
|
2019-11-04 03:10:06 +11:00
|
|
|
var args = raw[0];
|
2019-06-15 03:01:38 +10:00
|
|
|
$("#custom_name").val(args.name);
|
|
|
|
$("#custom_desc").val(args.desc);
|
|
|
|
$("#" + args.base).prop("checked", true);
|
2019-10-09 03:14:27 +11:00
|
|
|
//Primary
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>');
|
|
|
|
pickerDefine(0, rgbToHex(args.vars.primary));
|
2019-06-15 03:01:38 +10:00
|
|
|
$("#color-picker0_value").val(args.vars.primary);
|
2019-10-09 03:14:27 +11:00
|
|
|
//Secondary
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>');
|
|
|
|
pickerDefine(1, rgbToHex(args.vars.secondary));
|
2019-06-15 03:01:38 +10:00
|
|
|
$("#color-picker1_value").val(args.vars.secondary);
|
2019-10-09 03:14:27 +11:00
|
|
|
//Text
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>');
|
2019-06-15 03:01:38 +10:00
|
|
|
$("#color-picker2_value").val(args.vars.text);
|
2019-11-04 03:10:06 +11:00
|
|
|
pickerDefine(2, rgbToHex(args.vars.text));
|
2019-10-09 03:14:27 +11:00
|
|
|
//TheDesk Only
|
2019-11-04 03:10:06 +11:00
|
|
|
advancedConncet(args, "TheDeskAccent", "secondary", 3);
|
|
|
|
advancedConncet(args, "TheDeskActive", "primary", 4);
|
|
|
|
advancedConncet(args, "TheDeskModal", "secondary", 5);
|
|
|
|
advancedConncet(args, "TheDeskBottom", "primary", 6);
|
|
|
|
advancedConncet(args, "TheDeskPostbox", "primary", 7);
|
|
|
|
advancedConncet(args, "TheDeskSubcolor", "primary", 8);
|
2019-10-10 01:00:46 +11:00
|
|
|
$("#custom_json").val(raw[1]);
|
2019-10-09 03:14:27 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
function advancedConncet(args, tar, sub, i) {
|
2019-06-15 03:01:38 +10:00
|
|
|
if (args.props) {
|
2019-10-09 03:14:27 +11:00
|
|
|
if (args.props[tar]) {
|
|
|
|
var color = args.props[tar];
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#pickers").addClass("advanceTheme");
|
|
|
|
$(".advanced").removeClass("hide");
|
2019-06-15 03:01:38 +10:00
|
|
|
} else {
|
2019-10-09 03:14:27 +11:00
|
|
|
var color = args.vars[sub];
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
} else {
|
2019-10-09 03:14:27 +11:00
|
|
|
var color = args.vars[sub];
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
|
|
|
$("#color-picker" + i + "_value").val(color);
|
|
|
|
pickerDefine(i, rgbToHex(color));
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function customImp() {
|
|
|
|
var json = $("#custom_import").val();
|
|
|
|
if (JSON5.parse(json)) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["themeJsonCreate", json], "*");
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2019-06-22 02:06:32 +10:00
|
|
|
Swal.fire({
|
2019-11-04 03:10:06 +11:00
|
|
|
type: "error",
|
|
|
|
title: "Error"
|
|
|
|
});
|
2019-03-08 05:19:26 +11:00
|
|
|
}
|
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
function advanced() {
|
|
|
|
$(".advanced").toggleClass("hide");
|
|
|
|
$("#pickers").toggleClass("advanceTheme");
|
2019-10-09 03:14:27 +11:00
|
|
|
}
|
2019-06-15 03:01:38 +10:00
|
|
|
function clearCustomImport() {
|
|
|
|
$("#custom_import").val("");
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function hardwareAcceleration(had) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["ha", had], "*");
|
2019-03-09 23:17:54 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
function useragent(val) {
|
|
|
|
postMessage(["ua", val], "*");
|
2019-10-26 03:16:33 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
function customSound(key) {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["customSound", key], "*");
|
2019-06-15 03:01:38 +10:00
|
|
|
}
|
|
|
|
function customSoundSave(key, file) {
|
|
|
|
localStorage.setItem("custom" + key, file);
|
2019-11-04 03:10:06 +11:00
|
|
|
$("#c1-file").text(file);
|
2019-04-15 01:45:04 +10:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
window.onload = function() {
|
2019-03-15 22:12:11 +11:00
|
|
|
//最初に読む
|
2019-05-19 17:39:30 +10:00
|
|
|
load();
|
|
|
|
climute();
|
|
|
|
wordmute();
|
|
|
|
wordemp();
|
|
|
|
checkSpotify();
|
|
|
|
voiceSettingLoad();
|
|
|
|
oksload();
|
2019-11-04 03:10:06 +11:00
|
|
|
ctLoad();
|
2019-05-19 17:39:30 +10:00
|
|
|
};
|
2019-10-05 02:57:53 +10:00
|
|
|
//設定画面で未読マーカーは要らない
|
|
|
|
function asReadEnd() {
|
2019-11-04 03:10:06 +11:00
|
|
|
postMessage(["asReadComp", ""], "*");
|
2019-10-05 02:57:53 +10:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
function checkupd() {
|
2019-10-20 22:04:00 +11:00
|
|
|
var ver = localStorage.getItem("ver");
|
|
|
|
var start = "https://thedesk.top/ver.json";
|
|
|
|
fetch(start, {
|
2019-11-04 03:10:06 +11:00
|
|
|
method: "GET"
|
|
|
|
})
|
|
|
|
.then(function(response) {
|
|
|
|
if (!response.ok) {
|
|
|
|
response.text().then(function(text) {
|
|
|
|
setLog(response.url, response.status, text);
|
|
|
|
});
|
2019-10-20 22:04:00 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
return response.json();
|
|
|
|
})
|
|
|
|
.catch(function(error) {
|
|
|
|
todo(error);
|
|
|
|
setLog(start, "JSON", error);
|
|
|
|
console.error(error);
|
|
|
|
})
|
|
|
|
.then(function(mess) {
|
|
|
|
console.table(mess);
|
|
|
|
if (mess) {
|
|
|
|
var platform = localStorage.getItem("platform");
|
|
|
|
if (platform == "darwin") {
|
|
|
|
var newest = mess.desk_mac;
|
|
|
|
} else {
|
|
|
|
var newest = mess.desk;
|
|
|
|
}
|
|
|
|
if (newest == ver) {
|
|
|
|
Swal.fire({
|
|
|
|
type: "info",
|
|
|
|
title: lang.lang_setting_noupd,
|
|
|
|
html: ver
|
|
|
|
});
|
|
|
|
} else if (ver.indexOf("beta") != -1 || winstore) {
|
|
|
|
Swal.fire({
|
|
|
|
type: "info",
|
|
|
|
title: lang.lang_setting_thisisbeta,
|
|
|
|
html: ver
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
localStorage.removeItem("new-ver-skip");
|
|
|
|
location.href = "index.html";
|
|
|
|
}
|
2019-10-20 22:04:00 +11:00
|
|
|
}
|
2019-11-04 03:10:06 +11:00
|
|
|
});
|
|
|
|
}
|