Remove: node on spotify/tips/showOnTL.js #86

This commit is contained in:
Cutls 2019-06-15 02:10:11 +09:00
parent 7da16a7428
commit d146776b17
4 changed files with 75 additions and 86 deletions

View File

@ -38,9 +38,15 @@ onmessage = function (e) {
} 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);
ipc.send('theme-json-request', e.data[1]);
} else if (e.data[0] == "ha") {
ipc.send('ha', had);
} else if (e.data[0] == "itunes") {
if (ipc.listenerCount('itunes-np') > 0) {
return false;
}else{
ipc.send("itunes", e.data[1])
}
}
}
//version.js
@ -215,6 +221,17 @@ ipc.on('theme-json-create-complete', function (event, args) {
clearCustomImport()
ctLoad()
});
//spotify.js
ipc.once('itunes-np', function (event, arg) {
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)
})
/*
var webviewDom = document.getElementById('webview');
const {

View File

@ -1,21 +1,13 @@
function spotifyConnect() {
var auth = "https://accounts.spotify.com/authorize?client_id=0f18e54abe0b4aedb4591e353d3aff69&redirect_uri=https://thedesk.top/spotify-connect&response_type=code&scope=user-read-currently-playing";
const {
shell
} = require('electron');
var electron = require("electron");
var remote = electron.remote;
var platform = remote.process.platform;
var platform = localStorage.getItem("platform");
if (platform == "win32") {
shell.openExternal(auth);
var ipc = electron.ipcRenderer;
ipc.send('quit', 'go');
postMessage(["openUrl", auth], "*")
postMessage(["sendSinmpleIpc", "quit"], "*")
} else {
auth = auth + "&state=code";
$("#spotify-code-show").removeClass("hide");
shell.openExternal(auth);
postMessage(["openUrl", auth], "*")
}
@ -85,11 +77,9 @@ function nowplaying(mode) {
}
var item = json.item;
var img = item.album.images[0].url;
var electron = require("electron");
var ipc = electron.ipcRenderer;
var flag = localStorage.getItem("artwork");
if (flag) {
ipc.send('bmp-image', [img, 0]);
postMessage(["bmpImage", [img, 0]], "*")
}
var content = localStorage.getItem("np-temp");
if (!content || content == "" || content == "null") {
@ -121,14 +111,10 @@ function nowplaying(mode) {
alert(lang.lang_spotify_acct);
}
} else if (mode == "itunes") {
var electron = require("electron");
var ipc = electron.ipcRenderer;
if (ipc.listenerCount('itunes-np') > 0) {
return false;
postMessage(["itunes", ""], "*")
}
ipc.send('itunes', "");
ipc.once('itunes-np', function (event, arg) {
}
function npCore(arg) {
if (arg.cmd) {
console.error(arg);
return;
@ -139,8 +125,7 @@ function nowplaying(mode) {
var content = "#NowPlaying {song} / {album} / {artist}\n{url}";
}
var flag = localStorage.getItem("artwork");
var remote = electron.remote;
var platform = remote.process.platform;
var platform = localStorage.getItem("platform");
if (platform == "win32") {
if (flag && arg.path) {
media(arg.path, "image/png", "new");
@ -171,9 +156,6 @@ function nowplaying(mode) {
var regExp = new RegExp("{genre}", "g");
content = content.replace(regExp, arg.genre);
$("#textarea").val(content);
})
}
}
function spotifySave() {
var temp = $("#np-temp").val();
@ -194,9 +176,8 @@ function npprovider() {
M.toast({ html: lang.lang_setting_npprovide.replace("{{set}}", provd), displayLength: 3000 })
}
localStorage.setItem("np_provider", provd);
var electron = require("electron");
var ipc = electron.ipcRenderer;
ipc.send('itunes', ["set", provd]);
postMessage(["itunes", ["set", provd]], "*")
}
}
if (location.search) {

View File

@ -20,9 +20,7 @@ function bottomReverse() {
}
}
function tips(mode) {
var electron = require("electron");
var ipc = electron.ipcRenderer;
ipc.send('endmem', "");
postMessage(["sendSinmpleIpc", "endmem"], "*")
clearInterval(clockint);
clearInterval(spotStart);
if (mode == "ver") {
@ -50,15 +48,10 @@ function tips(mode) {
}
//メモリ
function startmem() {
var electron = require("electron");
var ipc = electron.ipcRenderer;
ipc.send('startmem', "");
ipc.on('memory', function (event, arg) {
var use = arg[0];
var cpu = arg[1];
var total = arg[2]
postMessage(["sendSinmpleIpc", "startmem"], "*")
}
function renderMem(use, cpu, total){
$("#tips-text").html(escapeHTML(cpu) + "<br>Memory:" + Math.floor(use / 1024 / 1024 / 102.4) / 10 + "/" + Math.floor(total / 1024 / 1024 / 102.4) / 10 + "GB(" + Math.floor(use / total * 100) + "%)")
})
}
//トレンドタグ
function trendTagonTip() {

View File

@ -40,9 +40,7 @@ function udgEx(user, acct_id) {
var id = json.accounts[0].id;
udg(id, acct_id);
} else {
var url = "https://" + user.split('@')[1] + "/@" + user.split('@')[0];
const { shell } = require('electron');
shell.openExternal(url);
postMessage(["openUrl", url], "*")
}
});
return true;