-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.js
More file actions
64 lines (58 loc) · 1.86 KB
/
common.js
File metadata and controls
64 lines (58 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// Around Spotify Setting
//
function spotifySettingFileWrite(loc, track, idx, content) {
var filename = rootDirectory + "spotify\\" + loc.slice(8).replace(":", "-") + "-" + track + ".txt";
var rewriteLine = idx + "|" + content;
try{
old = utils.ReadTextFile(filename);
params = old.split('\n');
rewrite = false;
for(i=0; i<params.length; i++){
if(params[i].startsWith(idx + "|")){
consoleWrite(filename + ": " + params[i] + "->" + content);
params[i] = rewriteLine;
rewrite = true;
break;
}
}
if(!rewrite){
params.push(rewriteLine);
}
}
catch{
consoleWrite("New spotSetting: " + filename);
params = [rewriteLine];
}
finally{
utils.WriteTextFile(filename, params.join("\n"));
consoleWrite("spotSetting write:" + filename );
}
}
function spotifySettingFileLoad(loc, track, idx){
try{
var filename = rootDirectory + "spotify\\" + loc.slice(8).replace(":", "-") + "-" + track + ".txt";
old = utils.ReadTextFile(filename);
params = old.split('\n');
rewrite = false;
for(i=0; i<params.length; i++){
if(params[i].startsWith(idx + "|")){
param = params[i].replace("\n", "").replace("\r","").split("|");
return param[1];
}
}
}
catch{
consoleWrite("Spotify Setting File isn't found");
}
return "";
}
//
// Around Clipboard
//
function getClipboard() { // クリップボードを取得する関数
return new ActiveXObject("htmlfile").parentWindow.clipboardData.getData("text")
}
function setClipboard(text) { // クリップボードにコピーする関数
return new ActiveXObject("htmlfile").parentWindow.clipboardData.setData("text", text)
}