Fix: 'about' preload #86

This commit is contained in:
Cutls 2019-06-15 18:52:28 +09:00
parent eba54d0906
commit a5f8e34ee6
7 changed files with 29 additions and 19 deletions

View File

@ -107,9 +107,9 @@
postMessage(["sendSinmpleIpc", "aboutData"], "*")
function renderAbout(args) {
$("#now").text(localStorage.getItem("ver"));
$("#node").text(args.version);
$("#chrome").text(args.versions.chrome);
$("#electron").text(args.versions.electron);
$("#node").text(args[0]);
$("#chrome").text(args[1]);
$("#electron").text(args[2]);
}
if (location.search) {
var m = location.search.match(/\?ver=([a-zA-Z-0-9.]+)/);

View File

@ -1,3 +1 @@
//jQuery読む
window.jQuery = window.$ = require('./js/common/jquery.js');
var Hammer = require('./js/common/hammer.min.js');

View File

@ -244,7 +244,7 @@ ipc.on('mess', function (event, arg) {
updateMess(arg)
})
//about.html
ipc.on('aboutData', function (event, arg) {
ipc.on('aboutDataRender', function (event, arg) {
renderAbout(arg)
})
var webviewDom = document.getElementById('webview');

View File

@ -1,4 +1,4 @@
var dirname = __dirname;
var dir = 'file://' + __dirname;
var base = dir + '/view/';
// Electronのモジュール
@ -179,13 +179,13 @@ function createWindow() {
//CSS
css.css(mainWindow);
//アップデータとダウンロード
dl.dl(mainWindow, lang_path, base);
dl.dl(mainWindow, lang_path, base, dirname);
//画像選択と画像処理
img.img(mainWindow, dir);
//NowPlaying
np.TheDeskNowPlaying(mainWindow);
//その他system
systemFunc.system(mainWindow, dir, lang);
systemFunc.system(mainWindow, dir, lang, dirname);
}
// Electronの初期化完了後に実行
app.on('ready', createWindow);

View File

@ -1,4 +1,4 @@
function dl(mainWindow, lang_path, base) {
function dl(mainWindow, lang_path, base, dirname) {
const electron = require("electron");
const shell = electron.shell;
const fs = require("fs");
@ -16,7 +16,10 @@ function dl(mainWindow, lang_path, base) {
if (platform != "others") {
updatewin = new BrowserWindow({
webPreferences: {
nodeIntegration: true
webviewTag: false,
nodeIntegration: false,
contextIsolation: true,
preload: "../js/platform/preload.js"
},
width: 600,
height: 400,
@ -35,7 +38,7 @@ function dl(mainWindow, lang_path, base) {
})
//アプデDL
ipc.on('download-btn', (e, args) => {
function dl(url, file, dir,e) {
function dl(url, file, dir, e) {
e.sender.webContents.send('mess', "ダウンロードを開始します。");
const opts = {

View File

@ -73,7 +73,10 @@ function templete(lang, mainWindow, packaged, dir) {
var ver = app.getVersion()
var window = new BrowserWindow({
webPreferences: {
nodeIntegration:true
webviewTag: false,
nodeIntegration: false,
contextIsolation: true,
preload: "../js/platform/preload.js"
},
width: 300, height: 460,
"transparent": false, // ウィンドウの背景を透過

View File

@ -1,4 +1,4 @@
function system(mainWindow, dir, lang) {
function system(mainWindow, dir, lang, dirname) {
const electron = require("electron");
const app = electron.app;
const join = require('path').join;
@ -145,19 +145,22 @@ function system(mainWindow, dir, lang) {
about();
});
ipc.on('aboutData', (e, args) => {
e.sender.webContents.send('aboutDataRender', process);
e.sender.webContents.send('aboutDataRender', [process.version, process.versions.chrome, process.versions.electron]);
});
function about() {
var ver = app.getVersion()
var window = new BrowserWindow({
webPreferences: {
nodeIntegration: true
webviewTag: false,
nodeIntegration: false,
contextIsolation: false,
preload: join(dirname,"js", "platform", "preload.js")
},
width: 300,
height: 480,
"transparent": false, // ウィンドウの背景を透過
"frame": false, // 枠の無いウィンドウ
"resizable": false
"frame": true, // 枠の無いウィンドウ
"resizable": true
});
window.loadURL(dir + '/about.html?ver=' + ver);
return "true"
@ -182,7 +185,10 @@ function system(mainWindow, dir, lang) {
}
var nanowindow = new BrowserWindow({
webPreferences: {
nodeIntegration: true
webviewTag: false,
nodeIntegration: false,
contextIsolation: true,
preload: join(dirname,"js", "platform", "preload.js")
},
width: 350,
height: 200,