From 334fbdab3f583429a08fd12aa587fd0efd9410ee Mon Sep 17 00:00:00 2001 From: Cutls Date: Sat, 15 Jun 2019 23:07:18 +0900 Subject: [PATCH] TheDesk Usamin (18.6.0) --- app/css/master.css | 1 + app/css/post.css | 3 ++ app/js/platform/end.js | 47 ++++++++++++++++++++ app/js/platform/preload.js | 74 +++++++++++++++---------------- app/js/tl/parse.js | 2 +- app/js/ui/layout.js | 4 +- app/main/dl.js | 14 +++--- app/main/system.js | 7 ++- app/package.json | 2 +- app/view/en/index.html | 14 +++--- app/view/en/setting.html | 18 ++++---- app/view/en/update.html | 8 ++-- app/view/ja/index.html | 14 +++--- app/view/ja/setting.html | 18 ++++---- app/view/ja/update.html | 8 ++-- app/view/make/index.sample.html | 12 +++-- app/view/make/make.js | 2 +- app/view/make/setting.sample.html | 18 ++++---- app/view/make/update.sample.html | 8 ++-- app/view/ps/index.html | 14 +++--- app/view/ps/setting.html | 18 ++++---- app/view/ps/update.html | 8 ++-- 22 files changed, 171 insertions(+), 143 deletions(-) diff --git a/app/css/master.css b/app/css/master.css index f81355bd..373fc9c0 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -50,6 +50,7 @@ option { max-height: 100vh; position: fixed; z-index: 9; + top: 0 !important; } #videomodal, #tootmodal { diff --git a/app/css/post.css b/app/css/post.css index 41d4f7ae..466ae736 100644 --- a/app/css/post.css +++ b/app/css/post.css @@ -12,6 +12,9 @@ padding: 5px; border-radius: 5px; } +textarea{ + min-height: 100px !important; +} .cancel { font-size: 0.5rem; diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 9d383cba..f81cfa8e 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -119,4 +119,51 @@ function playSound() { volumeControl.connect(context.destination); volumeControl.gain.value = 0.8 source.start(0); +} +onmessage = function (e) { + if (e.data[0] == "details") { + details(e.data[1][0], e.data[1][1]) + } else if (e.data[0] == "udg") { + udg(e.data[1][0], e.data[1][1]) + } else if (e.data[0] == "media") { + media(e.data[1][0], e.data[1][1], e.data[1][2]) + } else if (e.data[0] == "post") { + post("pass") + } else if (e.data[0] == "toastSaved") { + M.toast({ html: lang.lang_img_DLDone + e.data[1][0] + '', displayLength: 5000 }) + } else if (e.data[0] == "toastMute") { + M.toast({ html: escapeHTML(e.data[1]) + lang.lang_parse_mute, displayLength: 2000 }) + } else if (e.data[0] == "toastEmp") { + M.toast({ html: escapeHTML(e.data[1]) + lang.lang_status_emphas, displayLength: 2000 }) + } else if (e.data[0] == "toastUnEmp") { + M.toast({ html: escapeHTML(e.data[1]) + lang.lang_status_unemphas, displayLength: 2000 }) + } else if (e.data[0] == "parseColumn") { + parseColumn() + } else if (e.data[0] == "sortload") { + sortload() + } else if (e.data[0] == "exportSettingsCore") { + exportSettingsCore() + } else if (e.data[0] == "fontList") { + fontList(e.data[1]) + } else if (e.data[0] == "customSoundSave") { + customSoundSave(e.data[1][0], e.data[1][1]) + } else if (e.data[0] == "ctLoadCore") { + ctLoadCore(e.data[1]) + } else if (e.data[0] == "ctLoad") { + ctLoad() + } else if (e.data[0] == "customConnect") { + customConnect(e.data[1]) + } else if (e.data[0] == "clearCustomImport") { + clearCustomImport() + } else if (e.data[0] == "npCore") { + npCore(e.data[1]); + } else if (e.data[0] == "renderMem") { + renderMem(e.data[1][0], e.data[1][1], e.data[1][2]) + } else if (e.data[0] == "updateProg") { + updateProg(e.data[1]); + } else if (e.data[0] == "updateMess") { + updateMess(e.data[1]); + } else if (e.data[0] == "renderAbout") { + renderAbout(e.data[1]); + } } \ No newline at end of file diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 78045616..3d845c71 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -16,6 +16,7 @@ onmessage = function (e) { } else if (e.data[0] == "dialogCW") { ipc.send("dialogCW", e.data[1]) } else if (e.data[0] == "nativeNotf") { + console.log(e.data[1]) ipc.send('native-notf', e.data[1]); } else if (e.data[0] == "dialogClient") { ipc.send("dialogClient", e.data[1]) @@ -42,7 +43,8 @@ onmessage = function (e) { } else if (e.data[0] == "ha") { ipc.send('ha', had); } else if (e.data[0] == "itunes") { - if (ipc.listenerCount('itunes-np') > 0) { + console.log("NowPlaying" + ipc.listenerCount('itunes-np')) + if (ipc.listenerCount('itunes-np') > 1) { return false; } else { ipc.send("itunes", e.data[1]) @@ -55,8 +57,9 @@ onmessage = function (e) { } //version.js ipc.send("getPlatform", "") -ipc.on('platform', function (event, arg) { - localStorage.setItem("platform", arg) +ipc.on('platform', function (event, args) { + localStorage.setItem("platform", args[0]) + localStorage.setItem("bit", args[1]) }) ipc.on('winstore', function (event, arg) { localStorage.setItem("winstore", arg) @@ -65,22 +68,12 @@ ipc.on('winstore', function (event, arg) { ipc.on('reload', function (event, arg) { location.reload(); }) -ipc.on('mess', function (event, arg) { - if (arg == "unzip") { - if (lang == "ja") { - $("body").text("アップデートを展開中です。"); - } else { - $("body").text("Unzipping..."); - } - - } -}) //Native Notf ipc.on('shownotf', function (event, args) { if (args["type"] == "toot") { - details(id, acct_id) + postMessage(["details", [id, acct_id]], "*") } else if (args["type"] == "userdata") { - udg(user, acct_id) + postMessage(["udg", [user, acct_id]], "*") } }) function nano() { @@ -107,7 +100,7 @@ ipc.on('theme-css-response', function (event, arg) { }) //img.js ipc.on('bmp-img-comp', function (event, b64) { - media(b64[0], "image/png", b64[1]); + postMessage(["media", [b64[0], "image/png", b64[1]]], "*") }); //post.js ipc.on('dialogCWRender', function (event, arg) { @@ -116,9 +109,9 @@ ipc.on('dialogCWRender', function (event, arg) { $("#cw").addClass("yellow-text"); $("#cw").addClass("cw-avail"); $("#cw-text").val(plus); - post("pass"); + postMessage(["post", ""], "*") } else if (arg === 2) { - post("pass"); + postMessage(["post", ""], "*") } }); //parse.js @@ -129,7 +122,7 @@ ipc.on('dialogClientRender', function (event, arg) { if (!obj) { var obj = []; obj.push(name); - M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 }) + postMessage(["toastEmp", name], "*") } else { var can; Object.keys(obj).forEach(function (key) { @@ -139,12 +132,12 @@ ipc.on('dialogClientRender', function (event, arg) { } else { can = true; obj.splice(key, 1); - M.toast({ html: escapeHTML(name) + lang.lang_status_unemphas, displayLength: 2000 }) + postMessage(["toastUnEmp", name], "*") } }); if (!can) { obj.push(name); - M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 }) + postMessage(["toastEmp", name], "*") } else { } @@ -160,7 +153,7 @@ ipc.on('dialogClientRender', function (event, arg) { obj.push(name); var json = JSON.stringify(obj); localStorage.setItem("client_mute", json); - M.toast({ html: escapeHTML(name) + lang.lang_parse_mute, displayLength: 2000 }) + postMessage(["toastMute", name], "*") } else { return; } @@ -172,11 +165,14 @@ ipc.on('general-dl-prog', function (event, arg) { }) ipc.on('general-dl-message', function (event, arg) { var argC = arg.replace(/\\/g, "\\\\") + "\\\\."; - M.toast({ html: lang.lang_img_DLDone + arg + '', displayLength: 5000 }) + console.log("saved") + postMessage(["toastSaved", [arg, argC]], "*") }) //layout.js ipc.on('column-del-reply', function (event, args) { if (args[0] === 1) { + var multi = localStorage.getItem("column"); + var obj = JSON.parse(multi); localStorage.removeItem("card_" + args[1]); obj.splice(args[1], 1); for (var i = 0; i < obj.length; i++) { @@ -185,8 +181,8 @@ ipc.on('column-del-reply', function (event, args) { } var json = JSON.stringify(obj); localStorage.setItem("column", json); - parseColumn(); - sortload() + postMessage(["parseColumn", ""], "*") + postMessage(["sortload", ""], "*") } }) //setting.js @@ -201,54 +197,54 @@ ipc.on('exportSettingsFile', function (event, savedFiles) { //lang }); ipc.on('config', function (event, arg) { - importSettingsCore(arg) + postMessage(["importSettingsCore", arg], "*") }); ipc.on('savefolder', function (event, arg) { localStorage.setItem("savefolder", arg); }); ipc.on('font-list', function (event, arg) { - fontList(arg) + postMessage(["fontList", arg], "*") }); ipc.on('customSoundRender', function (event, args) { - customSoundSave(args[0], args[1]) + postMessage(["customSoundSave", [args[0], args[1]]], "*") }); ipc.on('theme-json-list-response', function (event, args) { - ctLoadCore(args) + postMessage(["ctLoadCore", args], "*") }); ipc.on('theme-json-delete-complete', function (event, args) { - ctLoad() + postMessage(["ctLoad", ""], "*") }); ipc.on('theme-json-response', function (event, args) { - customConnect(args) + postMessage(["customConnect", args], "*") }); ipc.on('theme-json-create-complete', function (event, args) { - clearCustomImport() - ctLoad() + postMessage(["clearCustomImport", ""], "*") + postMessage(["ctLoad", ""], "*") }); //spotify.js ipc.once('itunes-np', function (event, arg) { - npCore(arg) + postMessage(["npCore", arg], "*") }) //tips.js ipc.on('memory', function (event, arg) { var use = arg[0]; var cpu = arg[1]; var total = arg[2] - renderMem(use, cpu, total) + postMessage(["renderMem", [use, cpu, total]], "*") }) //update.html ipc.on('prog', function (event, arg) { - updateProg(arg) + postMessage(["updateProg", arg], "*") }) ipc.on('mess', function (event, arg) { - updateMess(arg) + postMessage(["updateMess", arg], "*") }) //about.html ipc.on('aboutDataRender', function (event, arg) { - renderAbout(arg) + postMessage(["renderAbout", arg], "*") }) var webviewDom = document.getElementById('webview'); -if(webviewDom){ +if (webviewDom) { webviewDom.addEventListener('new-window', function (e) { shell.openExternal(e.url); }); diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 04754c4c..3b9068e7 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -712,7 +712,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { } if (toot.pinned) { var if_pin = "blue-text"; - var pin_app = "pinned"; + var pin_app = "pinnedToot"; } else { var if_pin = ""; var pin_app = ""; diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index 29d21f01..17074f20 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -364,8 +364,6 @@ function addselCk() { function removeColumn(tlid) { $("#sort-box").addClass("hide"); $("#sort-box").removeClass("show"); - var multi = localStorage.getItem("column"); - var obj = JSON.parse(multi); //聞く postMessage(["columnDel", tlid], "*") } @@ -512,4 +510,4 @@ function leftFoldRemove(key) { var json = JSON.stringify(obj); localStorage.setItem("column", json); parseColumn(); -} +} \ No newline at end of file diff --git a/app/main/dl.js b/app/main/dl.js index 0601a452..e7869cc1 100644 --- a/app/main/dl.js +++ b/app/main/dl.js @@ -19,13 +19,13 @@ function dl(mainWindow, lang_path, base, dirname) { webviewTag: false, nodeIntegration: false, contextIsolation: true, - preload: "../js/platform/preload.js" + preload: join(dirname,"js", "platform", "preload.js") }, width: 600, height: 400, "transparent": false, // ウィンドウの背景を透過 - "frame": false, // 枠の無いウィンドウ - "resizable": false, + "frame": true, // 枠の無いウィンドウ + "resizable": true, "modal": true }); var lang = fs.readFileSync(lang_path, 'utf8'); @@ -44,7 +44,7 @@ function dl(mainWindow, lang_path, base, dirname) { const opts = { directory: dir, openFolderWhenDone: true, - onProgress: function (e) { + onProgress: function (event) { e.sender.webContents.send('prog', e); }, saveAs: false @@ -91,7 +91,7 @@ function dl(mainWindow, lang_path, base, dirname) { } - ipc.on('general-dl', (e, args) => { + ipc.on('general-dl', (event, args) => { var name = ""; var platform = process.platform; @@ -110,14 +110,14 @@ function dl(mainWindow, lang_path, base, dirname) { filename: name, openFolderWhenDone: false, onProgress: function (e) { - e.sender.webContents.send('general-dl-prog', e); + event.sender.webContents.send('general-dl-prog', e); }, saveAs: false }; download(BrowserWindow.getFocusedWindow(), args[0], opts) .then(dl => { - e.sender.webContents.send('general-dl-message', dir); + event.sender.webContents.send('general-dl-message', dir); }) .catch(console.error); }); diff --git a/app/main/system.js b/app/main/system.js index 4290b551..13a08b37 100644 --- a/app/main/system.js +++ b/app/main/system.js @@ -42,7 +42,7 @@ function system(mainWindow, dir, lang, dirname) { }); //プラットフォーム ipc.on('getPlatform', function (e, arg) { - e.sender.webContents.send('platform', process.platform); + e.sender.webContents.send('platform', [process.platform, process.arch]); }) //言語 ipc.on('lang', function (e, arg) { @@ -120,7 +120,7 @@ function system(mainWindow, dir, lang, dirname) { { name: 'All', extensions: ['*'] }, ] }, (fileNames) => { - e.sender.webContents.send('customSoundRender', [key, fileNames[0]]); + e.sender.webContents.send('customSoundRender', [arg, fileNames[0]]); }); }) @@ -166,8 +166,7 @@ function system(mainWindow, dir, lang, dirname) { return "true" } ipc.on('column-del', (e, tlid) => { - - console.log(lang); + console.log(tlid); var options = language.delsel(lang) dialog.showMessageBox(options, function (index) { e.sender.webContents.send('column-del-reply', [index, tlid]); diff --git a/app/package.json b/app/package.json index 9e12131d..38753e31 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "thedesk", - "version": "18.5.1", + "version": "18.6.0", "description": "TheDesk is a Mastodon client for PC.", "repository": "https://github.com/cutls/TheDesk", "main": "main.js", diff --git a/app/view/en/index.html b/app/view/en/index.html index 90cfb5bd..d95f705b 100644 --- a/app/view/en/index.html +++ b/app/view/en/index.html @@ -36,7 +36,7 @@