Remove: node on post.js #86

This commit is contained in:
Cutls 2019-06-15 01:15:45 +09:00
parent e2cde71831
commit 3c276b329b
3 changed files with 34 additions and 27 deletions

View File

@ -13,6 +13,8 @@ onmessage = function (e) {
ipc.send("dialogStore", e.data[1]) ipc.send("dialogStore", e.data[1])
} else if (e.data[0] == "bmpImage") { } else if (e.data[0] == "bmpImage") {
ipc.send('bmp-image', e.data[1]); ipc.send('bmp-image', e.data[1]);
} else if (e.data[0] == "dialogCW") {
ipc.send("dialogCW", e.data[1])
} }
} }
//version.js //version.js
@ -50,26 +52,38 @@ function nano() {
} }
//first.js //first.js
ipc.on('custom-css-response', function (event, arg) { ipc.on('custom-css-response', function (event, arg) {
if (arg == "") { return false; } if (arg == "") { return false; }
var styleNode = document.createElement("style"); var styleNode = document.createElement("style");
styleNode.setAttribute("type", "text/css") styleNode.setAttribute("type", "text/css")
var content = document.createTextNode(arg) var content = document.createTextNode(arg)
styleNode.append(content) styleNode.append(content)
document.getElementsByTagName("head")[0].append(styleNode) document.getElementsByTagName("head")[0].append(styleNode)
}) })
ipc.on('theme-css-response', function (event, arg) { ipc.on('theme-css-response', function (event, arg) {
if (arg == "") { return false; } if (arg == "") { return false; }
var styleNode = document.createElement("style"); var styleNode = document.createElement("style");
styleNode.setAttribute("type", "text/css") styleNode.setAttribute("type", "text/css")
var content = document.createTextNode(arg) var content = document.createTextNode(arg)
styleNode.append(content) styleNode.append(content)
document.getElementsByTagName("head")[0].append(styleNode) document.getElementsByTagName("head")[0].append(styleNode)
}) })
//img.js //img.js
ipc.on('bmp-img-comp', function (event, b64) { ipc.on('bmp-img-comp', function (event, b64) {
media(b64[0], "image/png", b64[1]); media(b64[0], "image/png", b64[1]);
});
//post.js
ipc.on('dialogCWRender', function (event, arg) {
if (arg === 1) {
$("#cw-text").show();
$("#cw").addClass("yellow-text");
$("#cw").addClass("cw-avail");
$("#cw-text").val(plus);
post("pass");
} else if (arg === 2) {
post("pass");
}
}); });
/* /*
var webviewDom = document.getElementById('webview'); var webviewDom = document.getElementById('webview');

View File

@ -47,9 +47,6 @@ function post(mode, postvis) {
} }
if (domain != "kirishima.cloud") { if (domain != "kirishima.cloud") {
if (mode != "pass" && !$("#cw").hasClass("cw-avail") && (str.length > cw_sent || (str.split("\n").length - 1) > cw_ltres)) { if (mode != "pass" && !$("#cw").hasClass("cw-avail") && (str.length > cw_sent || (str.split("\n").length - 1) > cw_ltres)) {
var electron = require("electron");
var remote = electron.remote;
var dialog = remote.dialog;
var plus = str.replace(/\n/g, "").slice(0, 10) + "..."; var plus = str.replace(/\n/g, "").slice(0, 10) + "...";
const options = { const options = {
type: 'info', type: 'info',
@ -57,17 +54,7 @@ function post(mode, postvis) {
message: lang.lang_post_cwtxt + plus, message: lang.lang_post_cwtxt + plus,
buttons: [lang.lang_post_btn1, lang.lang_post_btn2, lang.lang_post_btn3] buttons: [lang.lang_post_btn1, lang.lang_post_btn2, lang.lang_post_btn3]
} }
dialog.showMessageBox(options, function (arg) { postMessage(["dialogCW", options], "*")
if (arg === 1) {
$("#cw-text").show();
$("#cw").addClass("yellow-text");
$("#cw").addClass("cw-avail");
$("#cw-text").val(plus);
post("pass");
} else if (arg === 2) {
post("pass");
}
})
return false; return false;
} }
} }

View File

@ -61,6 +61,12 @@ function system(mainWindow, dir, lang) {
} }
}); });
}) })
//CWのダイアログ
ipc.on('dialogCW', function (e, args) {
dialog.showMessageBox(args, function (arg) {
e.sender.webContents.send('dialogCWRender', arg);
});
})
//ハードウェアアクセラレーションの無効化 //ハードウェアアクセラレーションの無効化
ipc.on('ha', function (e, arg) { ipc.on('ha', function (e, arg) {