Remove: node on setting/system.js #86
This commit is contained in:
parent
7b46145114
commit
7da16a7428
|
@ -25,6 +25,22 @@ onmessage = function (e) {
|
||||||
ipc.send('open-finder', e.data[1]);
|
ipc.send('open-finder', e.data[1]);
|
||||||
} else if (e.data[0] == "columnDel") {
|
} else if (e.data[0] == "columnDel") {
|
||||||
ipc.send('column-del', e.data[1]);
|
ipc.send('column-del', e.data[1]);
|
||||||
|
} else if (e.data[0] == "lang") {
|
||||||
|
ipc.send('lang', e.data[1]);
|
||||||
|
} else if (e.data[0] == "exportSettings") {
|
||||||
|
ipc.send('exportSettings', e.data[1]);
|
||||||
|
} else if (e.data[0] == "importSettings") {
|
||||||
|
ipc.send('importSettings', e.data[1]);
|
||||||
|
} else if (e.data[0] == "customSound") {
|
||||||
|
ipc.send('customSound', e.data[1]);
|
||||||
|
} else if (e.data[0] == "themeJsonDelete") {
|
||||||
|
ipc.send('theme-json-delete', e.data[1]);
|
||||||
|
} else if (e.data[0] == "themeJsonCreate") {
|
||||||
|
ipc.send('theme-json-create', e.data[1]);
|
||||||
|
} else if (e.data[0] == "themeJsonRequest") {
|
||||||
|
ipc.send('theme-json-request', id);
|
||||||
|
} else if (e.data[0] == "ha") {
|
||||||
|
ipc.send('ha', had);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//version.js
|
//version.js
|
||||||
|
@ -163,6 +179,42 @@ ipc.on('column-del-reply', function (event, args) {
|
||||||
sortload()
|
sortload()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
//setting.js
|
||||||
|
ipc.on('langres', function (event, arg) {
|
||||||
|
location.href = "../" + lang + "/setting.html"
|
||||||
|
});
|
||||||
|
ipc.on('exportSettingsFile', function (event, savedFiles) {
|
||||||
|
var exp = exportSettingsCore()
|
||||||
|
ipc.send('export', [savedFiles, JSON.stringify(exp)]);
|
||||||
|
alert("Done.")
|
||||||
|
//cards
|
||||||
|
//lang
|
||||||
|
});
|
||||||
|
ipc.on('config', function (event, arg) {
|
||||||
|
importSettingsCore(arg)
|
||||||
|
});
|
||||||
|
ipc.on('savefolder', function (event, arg) {
|
||||||
|
localStorage.setItem("savefolder", arg);
|
||||||
|
});
|
||||||
|
ipc.on('font-list', function (event, arg) {
|
||||||
|
fontList(arg)
|
||||||
|
});
|
||||||
|
ipc.on('customSoundRender', function (event, args) {
|
||||||
|
customSoundSave(args[0], args[1])
|
||||||
|
});
|
||||||
|
ipc.on('theme-json-list-response', function (event, args) {
|
||||||
|
ctLoadCore(args)
|
||||||
|
});
|
||||||
|
ipc.on('theme-json-delete-complete', function (event, args) {
|
||||||
|
ctLoad()
|
||||||
|
});
|
||||||
|
ipc.on('theme-json-response', function (event, args) {
|
||||||
|
customConnect(args)
|
||||||
|
});
|
||||||
|
ipc.on('theme-json-create-complete', function (event, args) {
|
||||||
|
clearCustomImport()
|
||||||
|
ctLoad()
|
||||||
|
});
|
||||||
/*
|
/*
|
||||||
var webviewDom = document.getElementById('webview');
|
var webviewDom = document.getElementById('webview');
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -51,6 +51,5 @@ $(function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
function help() {
|
function help() {
|
||||||
const { shell } = require('electron');
|
postMessage(["openUrl", "https://docs.thedesk.top"], "*")
|
||||||
shell.openExternal("https://docs.thedesk.top");
|
|
||||||
}
|
}
|
|
@ -190,9 +190,7 @@ function wordempSave() {
|
||||||
localStorage.setItem("word_emp", json);
|
localStorage.setItem("word_emp", json);
|
||||||
}
|
}
|
||||||
function notftest() {
|
function notftest() {
|
||||||
var electron = require("electron");
|
var os = localStorage.getItem("platform");
|
||||||
var ipc = electron.ipcRenderer;
|
|
||||||
var os = electron.remote.process.platform;
|
|
||||||
var options = {
|
var options = {
|
||||||
body: lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')',
|
body: lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')',
|
||||||
icon: localStorage.getItem("prof_0")
|
icon: localStorage.getItem("prof_0")
|
||||||
|
@ -200,7 +198,8 @@ function notftest() {
|
||||||
if (os == "darwin") {
|
if (os == "darwin") {
|
||||||
var n = new Notification('TheDesk' + lang.lang_setting_notftest, options);
|
var n = new Notification('TheDesk' + lang.lang_setting_notftest, options);
|
||||||
} else {
|
} else {
|
||||||
ipc.send('native-notf', ['TheDesk' + lang.lang_setting_notftest, lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', localStorage.getItem('prof_0'), "", ""]);
|
var nativeNotfOpt = ['TheDesk' + lang.lang_setting_notftest, lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', localStorage.getItem('prof_0'), "", ""]
|
||||||
|
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -215,228 +214,183 @@ function oksload() {
|
||||||
if (localStorage.getItem("oks-3")) { $("#oks-3").val(localStorage.getItem("oks-3")) }
|
if (localStorage.getItem("oks-3")) { $("#oks-3").val(localStorage.getItem("oks-3")) }
|
||||||
}
|
}
|
||||||
function changelang(lang) {
|
function changelang(lang) {
|
||||||
var electron = require("electron");
|
postMessage(["lang", lang], "*")
|
||||||
var ipc = electron.ipcRenderer;
|
|
||||||
ipc.send('lang', lang);
|
|
||||||
ipc.on('langres', function (event, arg) {
|
|
||||||
location.href = "../" + lang + "/setting.html"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function exportSettings() {
|
function exportSettings() {
|
||||||
if (!confirm(lang.lang_setting_exportwarn)) {
|
if (!confirm(lang.lang_setting_exportwarn)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var electron = require("electron");
|
postMessage(["exportSettings", ""], "*")
|
||||||
var remote = electron.remote;
|
}
|
||||||
var dialog = remote.dialog;
|
function exportSettingsCore() {
|
||||||
var ipc = electron.ipcRenderer;
|
var exp = {};
|
||||||
dialog.showSaveDialog(null, {
|
//Accounts
|
||||||
title: 'Export',
|
var multi = localStorage.getItem("multi");
|
||||||
properties: ['openFile', 'createDirectory'],
|
var acct = JSON.parse(multi);
|
||||||
defaultPath: "export.thedeskconfigv2"
|
exp.accts = acct;
|
||||||
}, (savedFiles) => {
|
//Columns
|
||||||
if (!savedFiles) {
|
var multi = localStorage.getItem("column");
|
||||||
return false;
|
var column = JSON.parse(multi);
|
||||||
}
|
exp.columns = column;
|
||||||
var exp = {};
|
//Themes
|
||||||
//Accounts
|
var config = {};
|
||||||
var multi = localStorage.getItem("multi");
|
config.theme = localStorage.getItem("theme");
|
||||||
var acct = JSON.parse(multi);
|
//Other configs
|
||||||
exp.accts = acct;
|
var max = envView.config.length;
|
||||||
//Columns
|
for (var i = 0; i < max; i++) {
|
||||||
var multi = localStorage.getItem("column");
|
var ls = envView.config[i].storage;
|
||||||
var column = JSON.parse(multi);
|
config[ls] = localStorage.getItem(ls)
|
||||||
exp.columns = column;
|
}
|
||||||
//Themes
|
var max = tlView.config.length;
|
||||||
var config = {};
|
for (var i = 0; i < max; i++) {
|
||||||
config.theme = localStorage.getItem("theme");
|
var ls = tlView.config[i].storage;
|
||||||
//Other configs
|
config[ls] = localStorage.getItem(ls)
|
||||||
var max = envView.config.length;
|
}
|
||||||
for (var i = 0; i < max; i++) {
|
var max = postView.config.length;
|
||||||
var ls = envView.config[i].storage;
|
for (var i = 0; i < max; i++) {
|
||||||
config[ls] = localStorage.getItem(ls)
|
var ls = postView.config[i].storage;
|
||||||
}
|
config[ls] = localStorage.getItem(ls)
|
||||||
var max = tlView.config.length;
|
}
|
||||||
for (var i = 0; i < max; i++) {
|
//Font
|
||||||
var ls = tlView.config[i].storage;
|
config.font = localStorage.getItem("font");
|
||||||
config[ls] = localStorage.getItem(ls)
|
exp.config = config;
|
||||||
}
|
//keysc
|
||||||
var max = postView.config.length;
|
exp.ksc = [
|
||||||
for (var i = 0; i < max; i++) {
|
localStorage.getItem("oks-1"),
|
||||||
var ls = postView.config[i].storage;
|
localStorage.getItem("oks-2"),
|
||||||
config[ls] = localStorage.getItem(ls)
|
localStorage.getItem("oks-3")
|
||||||
}
|
];
|
||||||
//Font
|
//climu
|
||||||
config.font = localStorage.getItem("font");
|
var cli = localStorage.getItem("client_mute");
|
||||||
exp.config = config;
|
var climu = JSON.parse(cli);
|
||||||
//keysc
|
exp.clientMute = climu;
|
||||||
exp.ksc = [
|
//wordmu
|
||||||
localStorage.getItem("oks-1"),
|
var wdm = localStorage.getItem("word_mute");
|
||||||
localStorage.getItem("oks-2"),
|
var wordmu = JSON.parse(wdm);
|
||||||
localStorage.getItem("oks-3")
|
exp.wordMute = wordmu;
|
||||||
];
|
//spotify
|
||||||
//climu
|
exp.spotifyArtwork = localStorage.getItem("artwork")
|
||||||
var cli = localStorage.getItem("client_mute");
|
var content = localStorage.getItem("np-temp");
|
||||||
var climu = JSON.parse(cli);
|
if (content || content == "" || content == "null") {
|
||||||
exp.clientMute = climu;
|
exp.spotifyTemplete = content;
|
||||||
//wordmu
|
} else {
|
||||||
var wdm = localStorage.getItem("word_mute");
|
exp.spotifyTemplete = null;
|
||||||
var wordmu = JSON.parse(wdm);
|
}
|
||||||
exp.wordMute = wordmu;
|
//tags
|
||||||
//spotify
|
var tagarr = localStorage.getItem("tag");
|
||||||
exp.spotifyArtwork = localStorage.getItem("artwork")
|
var favtag = JSON.parse(tagarr);
|
||||||
var content = localStorage.getItem("np-temp");
|
exp.favoriteTags = favtag;
|
||||||
if (content || content == "" || content == "null") {
|
return exp;
|
||||||
exp.spotifyTemplete = content;
|
|
||||||
} else {
|
|
||||||
exp.spotifyTemplete = null;
|
|
||||||
}
|
|
||||||
//tags
|
|
||||||
var tagarr = localStorage.getItem("tag");
|
|
||||||
var favtag = JSON.parse(tagarr);
|
|
||||||
exp.favoriteTags = favtag;
|
|
||||||
ipc.send('export', [savedFiles, JSON.stringify(exp)]);
|
|
||||||
alert("Done.")
|
|
||||||
//cards
|
|
||||||
//lang
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function importSettings() {
|
function importSettings() {
|
||||||
if (!confirm(lang.lang_setting_importwarn)) {
|
if (!confirm(lang.lang_setting_importwarn)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var electron = require("electron");
|
postMessage(["importSettings", ""], "*")
|
||||||
var remote = electron.remote;
|
}
|
||||||
var dialog = remote.dialog;
|
function importSettingsCore(arg) {
|
||||||
var ipc = electron.ipcRenderer;
|
var obj = JSON.parse(arg);
|
||||||
dialog.showOpenDialog(null, {
|
if (obj) {
|
||||||
title: 'Import',
|
localStorage.clear();
|
||||||
properties: ['openFile'],
|
localStorage.setItem("multi", JSON.stringify(obj.accts));
|
||||||
filters: [
|
for (var key = 0; key < obj.accts.length; key++) {
|
||||||
{ name: 'TheDesk Config', extensions: ['thedeskconfig', 'thedeskconfigv2'] },
|
var acct = obj.accts[key];
|
||||||
]
|
localStorage.setItem("name_" + key, acct.name);
|
||||||
}, (fileNames) => {
|
localStorage.setItem("user_" + key, acct.user);
|
||||||
if (!fileNames) {
|
localStorage.setItem("user-id_" + key, acct.id);
|
||||||
return false;
|
localStorage.setItem("prof_" + key, acct.prof);
|
||||||
|
localStorage.setItem("domain_" + key, acct.domain);
|
||||||
|
localStorage.setItem("acct_" + key + "_at", acct.at);
|
||||||
}
|
}
|
||||||
ipc.send('import', fileNames[0]);
|
localStorage.setItem("column", JSON.stringify(obj.columns));
|
||||||
ipc.on('config', function (event, arg) {
|
if (obj.config) {
|
||||||
var obj = JSON.parse(arg);
|
//Version 2
|
||||||
if (obj) {
|
var max = envView.config.length;
|
||||||
localStorage.clear();
|
for (var i = 0; i < max; i++) {
|
||||||
localStorage.setItem("multi", JSON.stringify(obj.accts));
|
var ls = envView.config[i].storage;
|
||||||
for (var key = 0; key < obj.accts.length; key++) {
|
if (obj.config[ls]) {
|
||||||
var acct = obj.accts[key];
|
localStorage.setItem(ls, obj.config[ls])
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
localStorage.setItem("column", JSON.stringify(obj.columns));
|
|
||||||
if (obj.config) {
|
|
||||||
//Version 2
|
|
||||||
var max = envView.config.length;
|
|
||||||
for (var i = 0; i < max; i++) {
|
|
||||||
var ls = envView.config[i].storage;
|
|
||||||
if (obj.config[ls]) {
|
|
||||||
localStorage.setItem(ls, obj.config[ls])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var max = tlView.config.length;
|
|
||||||
for (var i = 0; i < max; i++) {
|
|
||||||
var ls = tlView.config[i].storage;
|
|
||||||
if (obj.config[ls]) {
|
|
||||||
localStorage.setItem(ls, obj.config[ls])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var max = postView.config.length;
|
|
||||||
for (var i = 0; i < max; i++) {
|
|
||||||
var ls = postView.config[i].storage;
|
|
||||||
if (obj.config[ls]) {
|
|
||||||
localStorage.setItem(ls, obj.config[ls])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} 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 {
|
|
||||||
alert("Error.")
|
|
||||||
}
|
}
|
||||||
})
|
var max = tlView.config.length;
|
||||||
//cards
|
for (var i = 0; i < max; i++) {
|
||||||
//lang
|
var ls = tlView.config[i].storage;
|
||||||
});
|
if (obj.config[ls]) {
|
||||||
|
localStorage.setItem(ls, obj.config[ls])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var max = postView.config.length;
|
||||||
|
for (var i = 0; i < max; i++) {
|
||||||
|
var ls = postView.config[i].storage;
|
||||||
|
if (obj.config[ls]) {
|
||||||
|
localStorage.setItem(ls, obj.config[ls])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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 {
|
||||||
|
alert("Error.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function savefolder() {
|
function savefolder() {
|
||||||
var electron = require("electron");
|
postMessage(["sendSinmpleIpc", "savefolder"], "*")
|
||||||
var remote = electron.remote;
|
|
||||||
var dialog = remote.dialog;
|
|
||||||
dialog.showOpenDialog(null, {
|
|
||||||
title: 'Save folder',
|
|
||||||
properties: ['openDirectory'],
|
|
||||||
}, (fileNames) => {
|
|
||||||
localStorage.setItem("savefolder", fileNames[0]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function font() {
|
function font() {
|
||||||
var electron = require("electron");
|
postMessage(["sendSinmpleIpc", "fonts"], "*")
|
||||||
var ipc = electron.ipcRenderer;
|
}
|
||||||
ipc.send('fonts', []);
|
function fontList(arg) {
|
||||||
ipc.on('font-list', function (event, arg) {
|
$("#fonts").removeClass("hide");
|
||||||
$("#fonts").removeClass("hide");
|
for (var i = 0; i < arg.length; i++) {
|
||||||
for (var i = 0; i < arg.length; i++) {
|
var font = arg[i];
|
||||||
var font = arg[i];
|
$("#fonts").append('<div class="font pointer" style="font-family:' + font.family + '" onclick="insertFont(\'' + font.family + '\')">' + font.family + "</div>")
|
||||||
$("#fonts").append('<div class="font pointer" style="font-family:' + font.family + '" onclick="insertFont(\'' + font.family + '\')">' + font.family + "</div>")
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function insertFont(name) {
|
function insertFont(name) {
|
||||||
$("#font").val(name);
|
$("#font").val(name);
|
||||||
|
@ -522,7 +476,7 @@ function customComp() {
|
||||||
pickerDefine(1, "fff");
|
pickerDefine(1, "fff");
|
||||||
pickerDefine(2, "fff");
|
pickerDefine(2, "fff");
|
||||||
pickerDefine(3, "fff");
|
pickerDefine(3, "fff");
|
||||||
ipc.send('theme-json-create', JSON.stringify(json));
|
postMessage(["themeJsonCreate", JSON.stringify(json)], "*")
|
||||||
}
|
}
|
||||||
function deleteIt() {
|
function deleteIt() {
|
||||||
var id = $("#custom-sel-sel").val();
|
var id = $("#custom-sel-sel").val();
|
||||||
|
@ -542,28 +496,25 @@ function deleteIt() {
|
||||||
pickerDefine(1, "fff");
|
pickerDefine(1, "fff");
|
||||||
pickerDefine(2, "fff");
|
pickerDefine(2, "fff");
|
||||||
pickerDefine(3, "fff");
|
pickerDefine(3, "fff");
|
||||||
ipc.on('theme-json-delete-complete', function (event, args) {
|
postMessage(["themeJsonDelete", id], "*")
|
||||||
ctLoad()
|
|
||||||
});
|
|
||||||
ipc.send('theme-json-delete', id);
|
|
||||||
}
|
}
|
||||||
function ctLoad() {
|
function ctLoad() {
|
||||||
ipc.send('theme-json-list', "");
|
postMessage(["sendSinmpleIpc", "theme-json-list"], "*")
|
||||||
ipc.on('theme-json-list-response', function (event, args) {
|
}
|
||||||
var templete = "";
|
function ctLoadCore(args) {
|
||||||
Object.keys(args).forEach(function (key) {
|
var templete = "";
|
||||||
var theme = args[key];
|
Object.keys(args).forEach(function (key) {
|
||||||
var themeid = theme.id
|
var theme = args[key];
|
||||||
templete = templete + '<option value="' + themeid + '">' + theme.name + '</option>';
|
var themeid = theme.id
|
||||||
});
|
templete = templete + '<option value="' + themeid + '">' + theme.name + '</option>';
|
||||||
if (args[0]) {
|
|
||||||
localStorage.setItem("customtheme-id", args[0].id)
|
|
||||||
}
|
|
||||||
$("#custom-sel-sel").html(templete);
|
|
||||||
templete = '<option value="add_new">' + $("#edit-selector").attr("data-add") + '</option>' + templete;
|
|
||||||
$("#custom-edit-sel").html(templete);
|
|
||||||
$('select').formSelect();
|
|
||||||
});
|
});
|
||||||
|
if (args[0]) {
|
||||||
|
localStorage.setItem("customtheme-id", args[0].id)
|
||||||
|
}
|
||||||
|
$("#custom-sel-sel").html(templete);
|
||||||
|
templete = '<option value="add_new">' + $("#edit-selector").attr("data-add") + '</option>' + templete;
|
||||||
|
$("#custom-edit-sel").html(templete);
|
||||||
|
$('select').formSelect();
|
||||||
}
|
}
|
||||||
function customSel() {
|
function customSel() {
|
||||||
var id = $("#custom-sel-sel").val();
|
var id = $("#custom-sel-sel").val();
|
||||||
|
@ -591,66 +542,55 @@ function custom() {
|
||||||
$("#delTheme").addClass("disabled")
|
$("#delTheme").addClass("disabled")
|
||||||
} else {
|
} else {
|
||||||
$("#delTheme").removeClass("disabled")
|
$("#delTheme").removeClass("disabled")
|
||||||
ipc.send('theme-json-request', id);
|
postMessage(["themeJsonRequest", id], "*")
|
||||||
ipc.on('theme-json-response', function (event, args) {
|
|
||||||
$("#custom_name").val(args.name);
|
|
||||||
$("#custom_desc").val(args.desc);
|
|
||||||
$("#" + args.base).prop("checked", true);
|
|
||||||
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>')
|
|
||||||
pickerDefine(0, rgbToHex(args.vars.primary))
|
|
||||||
$("#color-picker0_value").val(args.vars.primary);
|
|
||||||
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>')
|
|
||||||
pickerDefine(1, rgbToHex(args.vars.secondary))
|
|
||||||
$("#color-picker1_value").val(args.vars.secondary);
|
|
||||||
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>')
|
|
||||||
$("#color-picker2_value").val(args.vars.text);
|
|
||||||
pickerDefine(2, rgbToHex(args.vars.text))
|
|
||||||
if (args.props) {
|
|
||||||
if (args.props.TheDeskAccent) {
|
|
||||||
var accent = args.props.TheDeskAccent;
|
|
||||||
} else {
|
|
||||||
var accent = args.vars.secondary;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var accent = args.vars.secondary;
|
|
||||||
}
|
|
||||||
$("#color-picker3-wrap").html('<div class="color-picker" id="color-picker3"></div>')
|
|
||||||
pickerDefine(3, rgbToHex(accent))
|
|
||||||
$("#custom_json").val(JSON.stringify(args));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function customConnect(args) {
|
||||||
|
$("#custom_name").val(args.name);
|
||||||
|
$("#custom_desc").val(args.desc);
|
||||||
|
$("#" + args.base).prop("checked", true);
|
||||||
|
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>')
|
||||||
|
pickerDefine(0, rgbToHex(args.vars.primary))
|
||||||
|
$("#color-picker0_value").val(args.vars.primary);
|
||||||
|
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>')
|
||||||
|
pickerDefine(1, rgbToHex(args.vars.secondary))
|
||||||
|
$("#color-picker1_value").val(args.vars.secondary);
|
||||||
|
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>')
|
||||||
|
$("#color-picker2_value").val(args.vars.text);
|
||||||
|
pickerDefine(2, rgbToHex(args.vars.text))
|
||||||
|
if (args.props) {
|
||||||
|
if (args.props.TheDeskAccent) {
|
||||||
|
var accent = args.props.TheDeskAccent;
|
||||||
|
} else {
|
||||||
|
var accent = args.vars.secondary;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var accent = args.vars.secondary;
|
||||||
|
}
|
||||||
|
$("#color-picker3-wrap").html('<div class="color-picker" id="color-picker3"></div>')
|
||||||
|
pickerDefine(3, rgbToHex(accent))
|
||||||
|
$("#custom_json").val(JSON.stringify(args));
|
||||||
|
}
|
||||||
function customImp() {
|
function customImp() {
|
||||||
var json = $("#custom_import").val();
|
var json = $("#custom_import").val();
|
||||||
if (JSON5.parse(json)) {
|
if (JSON5.parse(json)) {
|
||||||
ipc.send('theme-json-create', json);
|
postMessage(["themeJsonCreate", json], "*")
|
||||||
} else {
|
} else {
|
||||||
alert("Error")
|
alert("Error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function hardwareAcceleration(had) {
|
function clearCustomImport() {
|
||||||
ipc.send('ha', had);
|
|
||||||
}
|
|
||||||
|
|
||||||
ipc.on('theme-json-create-complete', function (event, args) {
|
|
||||||
$("#custom_import").val("");
|
$("#custom_import").val("");
|
||||||
ctLoad()
|
}
|
||||||
});
|
function hardwareAcceleration(had) {
|
||||||
|
postMessage(["ha", had], "*")
|
||||||
|
}
|
||||||
function customSound(key) {
|
function customSound(key) {
|
||||||
var electron = require("electron");
|
postMessage(["customSound", key], "*")
|
||||||
var remote = electron.remote;
|
}
|
||||||
var dialog = remote.dialog;
|
function customSoundSave(key, file) {
|
||||||
dialog.showOpenDialog(null, {
|
localStorage.setItem("custom" + key, file);
|
||||||
title: 'Custom sound',
|
$("#c1-file").text(file)
|
||||||
properties: ['openFile'],
|
|
||||||
filters: [
|
|
||||||
{ name: 'Audio', extensions: ['mp3', 'aac', 'wav', 'flac', 'm4a'] },
|
|
||||||
{ name: 'All', extensions: ['*'] },
|
|
||||||
]
|
|
||||||
}, (fileNames) => {
|
|
||||||
localStorage.setItem("custom" + key, fileNames[0]);
|
|
||||||
$("#c1-file").text(fileNames[0])
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
//最初に読む
|
//最初に読む
|
||||||
|
|
|
@ -73,6 +73,56 @@ function system(mainWindow, dir, lang) {
|
||||||
e.sender.webContents.send('dialogClientRender', arg);
|
e.sender.webContents.send('dialogClientRender', arg);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
//エクスポートのダイアログ
|
||||||
|
ipc.on('exportSettings', function (e, args) {
|
||||||
|
dialog.showSaveDialog(null, {
|
||||||
|
title: 'Export',
|
||||||
|
properties: ['openFile', 'createDirectory'],
|
||||||
|
defaultPath: "export.thedeskconfigv2"
|
||||||
|
}, (savedFiles) => {
|
||||||
|
if (!savedFiles) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
e.sender.webContents.send('exportSettingsFile', savedFiles);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
//インポートのダイアログ
|
||||||
|
ipc.on('importSettings', function (e, args) {
|
||||||
|
dialog.showOpenDialog(null, {
|
||||||
|
title: 'Import',
|
||||||
|
properties: ['openFile'],
|
||||||
|
filters: [
|
||||||
|
{ name: 'TheDesk Config', extensions: ['thedeskconfig', 'thedeskconfigv2'] },
|
||||||
|
]
|
||||||
|
}, (fileNames) => {
|
||||||
|
if (!fileNames) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
e.sender.webContents.send('config', fs.readFileSync(arg, 'utf8'));
|
||||||
|
})
|
||||||
|
})
|
||||||
|
//保存フォルダのダイアログ
|
||||||
|
ipc.on('savefolder', function (e, args) {
|
||||||
|
dialog.showOpenDialog(null, {
|
||||||
|
title: 'Save folder',
|
||||||
|
properties: ['openDirectory'],
|
||||||
|
}, (fileNames) => {
|
||||||
|
e.sender.webContents.send('savefolder', fileNames[0]);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
//カスタムサウンドのダイアログ
|
||||||
|
ipc.on('customSound', function (e, arg) {
|
||||||
|
dialog.showOpenDialog(null, {
|
||||||
|
title: 'Custom sound',
|
||||||
|
properties: ['openFile'],
|
||||||
|
filters: [
|
||||||
|
{ name: 'Audio', extensions: ['mp3', 'aac', 'wav', 'flac', 'm4a'] },
|
||||||
|
{ name: 'All', extensions: ['*'] },
|
||||||
|
]
|
||||||
|
}, (fileNames) => {
|
||||||
|
e.sender.webContents.send('customSoundRender', [key, fileNames[0]]);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
//ハードウェアアクセラレーションの無効化
|
//ハードウェアアクセラレーションの無効化
|
||||||
ipc.on('ha', function (e, arg) {
|
ipc.on('ha', function (e, arg) {
|
||||||
|
@ -169,9 +219,6 @@ function system(mainWindow, dir, lang) {
|
||||||
ipc.on('export', (e, args) => {
|
ipc.on('export', (e, args) => {
|
||||||
fs.writeFileSync(args[0], args[1]);
|
fs.writeFileSync(args[0], args[1]);
|
||||||
});
|
});
|
||||||
ipc.on('import', (e, arg) => {
|
|
||||||
e.sender.webContents.send('config', fs.readFileSync(arg, 'utf8'));
|
|
||||||
});
|
|
||||||
//フォント
|
//フォント
|
||||||
function object_array_sort(data, key, order, fn) {
|
function object_array_sort(data, key, order, fn) {
|
||||||
//デフォは降順(DESC)
|
//デフォは降順(DESC)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user