Remove: node on spotify/tips/showOnTL.js #86
This commit is contained in:
parent
7da16a7428
commit
d146776b17
|
@ -38,9 +38,15 @@ onmessage = function (e) {
|
||||||
} else if (e.data[0] == "themeJsonCreate") {
|
} else if (e.data[0] == "themeJsonCreate") {
|
||||||
ipc.send('theme-json-create', e.data[1]);
|
ipc.send('theme-json-create', e.data[1]);
|
||||||
} else if (e.data[0] == "themeJsonRequest") {
|
} 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") {
|
} else if (e.data[0] == "ha") {
|
||||||
ipc.send('ha', had);
|
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
|
//version.js
|
||||||
|
@ -215,6 +221,17 @@ ipc.on('theme-json-create-complete', function (event, args) {
|
||||||
clearCustomImport()
|
clearCustomImport()
|
||||||
ctLoad()
|
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');
|
var webviewDom = document.getElementById('webview');
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -1,21 +1,13 @@
|
||||||
function spotifyConnect() {
|
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";
|
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 {
|
var platform = localStorage.getItem("platform");
|
||||||
shell
|
|
||||||
} = require('electron');
|
|
||||||
|
|
||||||
|
|
||||||
var electron = require("electron");
|
|
||||||
var remote = electron.remote;
|
|
||||||
var platform = remote.process.platform;
|
|
||||||
if (platform == "win32") {
|
if (platform == "win32") {
|
||||||
shell.openExternal(auth);
|
postMessage(["openUrl", auth], "*")
|
||||||
var ipc = electron.ipcRenderer;
|
postMessage(["sendSinmpleIpc", "quit"], "*")
|
||||||
ipc.send('quit', 'go');
|
|
||||||
} else {
|
} else {
|
||||||
auth = auth + "&state=code";
|
auth = auth + "&state=code";
|
||||||
$("#spotify-code-show").removeClass("hide");
|
$("#spotify-code-show").removeClass("hide");
|
||||||
shell.openExternal(auth);
|
postMessage(["openUrl", auth], "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,11 +77,9 @@ function nowplaying(mode) {
|
||||||
}
|
}
|
||||||
var item = json.item;
|
var item = json.item;
|
||||||
var img = item.album.images[0].url;
|
var img = item.album.images[0].url;
|
||||||
var electron = require("electron");
|
|
||||||
var ipc = electron.ipcRenderer;
|
|
||||||
var flag = localStorage.getItem("artwork");
|
var flag = localStorage.getItem("artwork");
|
||||||
if (flag) {
|
if (flag) {
|
||||||
ipc.send('bmp-image', [img, 0]);
|
postMessage(["bmpImage", [img, 0]], "*")
|
||||||
}
|
}
|
||||||
var content = localStorage.getItem("np-temp");
|
var content = localStorage.getItem("np-temp");
|
||||||
if (!content || content == "" || content == "null") {
|
if (!content || content == "" || content == "null") {
|
||||||
|
@ -121,59 +111,51 @@ function nowplaying(mode) {
|
||||||
alert(lang.lang_spotify_acct);
|
alert(lang.lang_spotify_acct);
|
||||||
}
|
}
|
||||||
} else if (mode == "itunes") {
|
} else if (mode == "itunes") {
|
||||||
var electron = require("electron");
|
postMessage(["itunes", ""], "*")
|
||||||
var ipc = electron.ipcRenderer;
|
|
||||||
if (ipc.listenerCount('itunes-np') > 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ipc.send('itunes', "");
|
|
||||||
ipc.once('itunes-np', function (event, arg) {
|
|
||||||
if (arg.cmd) {
|
|
||||||
console.error(arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.table(arg);
|
|
||||||
var content = localStorage.getItem("np-temp");
|
|
||||||
if (!content || content == "" || content == "null") {
|
|
||||||
var content = "#NowPlaying {song} / {album} / {artist}\n{url}";
|
|
||||||
}
|
|
||||||
var flag = localStorage.getItem("artwork");
|
|
||||||
var remote = electron.remote;
|
|
||||||
var platform = remote.process.platform;
|
|
||||||
if (platform == "win32") {
|
|
||||||
if (flag && arg.path) {
|
|
||||||
media(arg.path, "image/png", "new");
|
|
||||||
}
|
|
||||||
} else if (platform == "darwin") {
|
|
||||||
if (flag && arg.existsArtwork) {
|
|
||||||
media(arg.artworks[0].data, "image/png", "new");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var regExp = new RegExp("{song}", "g");
|
|
||||||
content = content.replace(regExp, arg.name);
|
|
||||||
var regExp = new RegExp("{album}", "g");
|
|
||||||
content = content.replace(regExp, arg.album);
|
|
||||||
var regExp = new RegExp("{artist}", "g");
|
|
||||||
content = content.replace(regExp, arg.artist);
|
|
||||||
var regExp = new RegExp("{url}", "g");
|
|
||||||
content = content.replace(regExp, "");
|
|
||||||
var regExp = new RegExp("{composer}", "g");
|
|
||||||
content = content.replace(regExp, arg.composer);
|
|
||||||
var regExp = new RegExp("{hz}", "g");
|
|
||||||
content = content.replace(regExp, arg.sampleRate / 1000 + "kHz");
|
|
||||||
var regExp = new RegExp("{lyricist}", "g");
|
|
||||||
content = content.replace(regExp, "");
|
|
||||||
var regExp = new RegExp("{bpm}", "g");
|
|
||||||
content = content.replace(regExp, "");
|
|
||||||
var regExp = new RegExp("{bitRate}", "g");
|
|
||||||
content = content.replace(regExp, arg.bitRate + "kbps");
|
|
||||||
var regExp = new RegExp("{genre}", "g");
|
|
||||||
content = content.replace(regExp, arg.genre);
|
|
||||||
$("#textarea").val(content);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
function npCore(arg) {
|
||||||
|
if (arg.cmd) {
|
||||||
|
console.error(arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.table(arg);
|
||||||
|
var content = localStorage.getItem("np-temp");
|
||||||
|
if (!content || content == "" || content == "null") {
|
||||||
|
var content = "#NowPlaying {song} / {album} / {artist}\n{url}";
|
||||||
|
}
|
||||||
|
var flag = localStorage.getItem("artwork");
|
||||||
|
var platform = localStorage.getItem("platform");
|
||||||
|
if (platform == "win32") {
|
||||||
|
if (flag && arg.path) {
|
||||||
|
media(arg.path, "image/png", "new");
|
||||||
|
}
|
||||||
|
} else if (platform == "darwin") {
|
||||||
|
if (flag && arg.existsArtwork) {
|
||||||
|
media(arg.artworks[0].data, "image/png", "new");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var regExp = new RegExp("{song}", "g");
|
||||||
|
content = content.replace(regExp, arg.name);
|
||||||
|
var regExp = new RegExp("{album}", "g");
|
||||||
|
content = content.replace(regExp, arg.album);
|
||||||
|
var regExp = new RegExp("{artist}", "g");
|
||||||
|
content = content.replace(regExp, arg.artist);
|
||||||
|
var regExp = new RegExp("{url}", "g");
|
||||||
|
content = content.replace(regExp, "");
|
||||||
|
var regExp = new RegExp("{composer}", "g");
|
||||||
|
content = content.replace(regExp, arg.composer);
|
||||||
|
var regExp = new RegExp("{hz}", "g");
|
||||||
|
content = content.replace(regExp, arg.sampleRate / 1000 + "kHz");
|
||||||
|
var regExp = new RegExp("{lyricist}", "g");
|
||||||
|
content = content.replace(regExp, "");
|
||||||
|
var regExp = new RegExp("{bpm}", "g");
|
||||||
|
content = content.replace(regExp, "");
|
||||||
|
var regExp = new RegExp("{bitRate}", "g");
|
||||||
|
content = content.replace(regExp, arg.bitRate + "kbps");
|
||||||
|
var regExp = new RegExp("{genre}", "g");
|
||||||
|
content = content.replace(regExp, arg.genre);
|
||||||
|
$("#textarea").val(content);
|
||||||
}
|
}
|
||||||
function spotifySave() {
|
function spotifySave() {
|
||||||
var temp = $("#np-temp").val();
|
var temp = $("#np-temp").val();
|
||||||
|
@ -194,9 +176,8 @@ function npprovider() {
|
||||||
M.toast({ html: lang.lang_setting_npprovide.replace("{{set}}", provd), displayLength: 3000 })
|
M.toast({ html: lang.lang_setting_npprovide.replace("{{set}}", provd), displayLength: 3000 })
|
||||||
}
|
}
|
||||||
localStorage.setItem("np_provider", provd);
|
localStorage.setItem("np_provider", provd);
|
||||||
var electron = require("electron");
|
postMessage(["itunes", ["set", provd]], "*")
|
||||||
var ipc = electron.ipcRenderer;
|
|
||||||
ipc.send('itunes', ["set", provd]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (location.search) {
|
if (location.search) {
|
||||||
|
|
|
@ -20,9 +20,7 @@ function bottomReverse() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function tips(mode) {
|
function tips(mode) {
|
||||||
var electron = require("electron");
|
postMessage(["sendSinmpleIpc", "endmem"], "*")
|
||||||
var ipc = electron.ipcRenderer;
|
|
||||||
ipc.send('endmem', "");
|
|
||||||
clearInterval(clockint);
|
clearInterval(clockint);
|
||||||
clearInterval(spotStart);
|
clearInterval(spotStart);
|
||||||
if (mode == "ver") {
|
if (mode == "ver") {
|
||||||
|
@ -50,15 +48,10 @@ function tips(mode) {
|
||||||
}
|
}
|
||||||
//メモリ
|
//メモリ
|
||||||
function startmem() {
|
function startmem() {
|
||||||
var electron = require("electron");
|
postMessage(["sendSinmpleIpc", "startmem"], "*")
|
||||||
var ipc = electron.ipcRenderer;
|
}
|
||||||
ipc.send('startmem', "");
|
function renderMem(use, cpu, total){
|
||||||
ipc.on('memory', function (event, arg) {
|
$("#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) + "%)")
|
||||||
var use = arg[0];
|
|
||||||
var cpu = arg[1];
|
|
||||||
var total = arg[2]
|
|
||||||
$("#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() {
|
function trendTagonTip() {
|
||||||
|
|
|
@ -40,9 +40,7 @@ function udgEx(user, acct_id) {
|
||||||
var id = json.accounts[0].id;
|
var id = json.accounts[0].id;
|
||||||
udg(id, acct_id);
|
udg(id, acct_id);
|
||||||
} else {
|
} else {
|
||||||
var url = "https://" + user.split('@')[1] + "/@" + user.split('@')[0];
|
postMessage(["openUrl", url], "*")
|
||||||
const { shell } = require('electron');
|
|
||||||
shell.openExternal(url);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user