Remove: node in firest/img(post).js #86

This commit is contained in:
Cutls 2019-06-15 01:10:32 +09:00
parent 861ee3250d
commit e2cde71831
4 changed files with 27 additions and 80 deletions

View File

@ -89,27 +89,7 @@ function formattimeutc(date) {
} }
return escapeHTML(str); return escapeHTML(str);
} }
var electron = require("electron"); postMessage(["sendSinmpleIpc", "custom-css-request"], "*")
var ipc = electron.ipcRenderer;
ipc.send('custom-css-request', "");
ipc.on('custom-css-response', function (event, arg) {
if (arg == "") { return false; }
var styleNode = document.createElement("style");
styleNode.setAttribute("type", "text/css")
var content = document.createTextNode(arg)
styleNode.append(content)
document.getElementsByTagName("head")[0].append(styleNode)
})
ipc.on('theme-css-response', function (event, arg) {
if (arg == "") { return false; }
var styleNode = document.createElement("style");
styleNode.setAttribute("type", "text/css")
var content = document.createTextNode(arg)
styleNode.append(content)
document.getElementsByTagName("head")[0].append(styleNode)
})
function makeCID() { function makeCID() {
return randomStr(8) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(12); return randomStr(8) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(12);
} }

View File

@ -11,6 +11,8 @@ onmessage = function (e) {
ipc.send(e.data[1], "") ipc.send(e.data[1], "")
} else if (e.data[0] == "dialogStore") { } else if (e.data[0] == "dialogStore") {
ipc.send("dialogStore", e.data[1]) ipc.send("dialogStore", e.data[1])
} else if (e.data[0] == "bmpImage") {
ipc.send('bmp-image', e.data[1]);
} }
} }
//version.js //version.js
@ -46,6 +48,29 @@ ipc.on('shownotf', function (event, args) {
function nano() { function nano() {
ipc.send('nano', ""); ipc.send('nano', "");
} }
//first.js
ipc.on('custom-css-response', function (event, arg) {
if (arg == "") { return false; }
var styleNode = document.createElement("style");
styleNode.setAttribute("type", "text/css")
var content = document.createTextNode(arg)
styleNode.append(content)
document.getElementsByTagName("head")[0].append(styleNode)
})
ipc.on('theme-css-response', function (event, arg) {
if (arg == "") { return false; }
var styleNode = document.createElement("style");
styleNode.setAttribute("type", "text/css")
var content = document.createTextNode(arg)
styleNode.append(content)
document.getElementsByTagName("head")[0].append(styleNode)
})
//img.js
ipc.on('bmp-img-comp', function (event, b64) {
media(b64[0], "image/png", b64[1]);
});
/* /*
var webviewDom = document.getElementById('webview'); var webviewDom = document.getElementById('webview');
const { const {

View File

@ -1,51 +0,0 @@
var electron = require("electron");
const fs = require("fs");
const os = require('os')
const shell = electron.shell;
const path = require('path')
function shot() {
//screenshotMsg.textContent = 'Gathering screens...'
$(window).height
let options = {
types: ['screen'],
thumbnailSize: {
width: window.parent.screen.width,
height: window.parent.screen.height
}
}
const desktopCapturer = electron.desktopCapturer;
desktopCapturer.getSources(options, function (error, sources) {
if (error) return console.log(error)
sources.forEach(function (source) {
if (location.search) {
var m = location.search.match(/\?id=([a-zA-Z-0-9]+)/);
var title = m[1];
} else {
var title = "screenshot";
}
if (source.name === 'Screen 1' || source.name === 'TheDesk') {
var durl = source.thumbnail.toDataURL();
var b64 = durl.match(
/data:image\/png;base64,(.+)/
);
const screenshotPath = path.join(os.tmpdir(), 'screenshot.png');
const savePath = path.join(os.tmpdir(), 'screenshot.png');
var ipc = electron.ipcRenderer;
var h = $(window).height() - 150;
var w = $(window).width();
ipc.send('shot', ['file://' + screenshotPath, w, h, b64[1], title]);
if ($(".img-parsed").length > 0) {
for (i = 0; i < $(".img-parsed").length; i++) {
var url = $(".img-parsed").eq(i).attr("data-url");
ipc.send('shot-img-dl', [url, title + "_img" + i + ".png"]);
}
}
window.close();
return;
const message = `Saved screenshot to: ${screenshotPath}`
//screenshotMsg.textContent = message
}
})
})
}

View File

@ -40,9 +40,7 @@ function pimg(files) {
for (i = 0; i < files.length; i++) { for (i = 0; i < files.length; i++) {
var dot = files[i].path.match(/\.(.+)$/)[1]; var dot = files[i].path.match(/\.(.+)$/)[1];
if (dot == "bmp" || dot == "BMP") { if (dot == "bmp" || dot == "BMP") {
var electron = require("electron"); postMessage(["bmpImage", [files[i].path, i]], "*")
var ipc = electron.ipcRenderer;
ipc.send('bmp-image', [files[i].path, i]);
todo(lang.lang_progress); todo(lang.lang_progress);
} else { } else {
@ -50,11 +48,6 @@ function pimg(files) {
} }
} }
} }
var electron = require("electron");
var ipc = electron.ipcRenderer;
ipc.on('bmp-img-comp', function (event, b64) {
media(b64[0], "image/png", b64[1]);
});
//ドラッグ・アンド・ドロップを終了 //ドラッグ・アンド・ドロップを終了
function closedrop() { function closedrop() {
$("#drag").css('display', 'none'); $("#drag").css('display', 'none');