-
Notifications
You must be signed in to change notification settings - Fork 0
/
watcher.js
193 lines (171 loc) · 7.83 KB
/
watcher.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
console.log('MiWatcher v¤>44<');
// File: Create Watcher Page
// Globals Vars
var htmlElement = document.querySelector('html');
var head = document.querySelector('head');
var body = document.querySelector('body');
var scr_list = [
"https://www.youtube.com/iframe_api",
"https://mialaprog.github.io/MiYT/lib/lcl_svg.js", // + Math.random(), //MàJ auto
"https://mialaprog.github.io/MiYT/lib/utilities.js",
"https://mialaprog.github.io/MiYT/lib/inFile_svg.js",
"https://mialaprog.github.io/MiYT/ext/jquery.js",
"https://mialaprog.github.io/MiYT/lib/stop_pub.js"
];
function rsrcLoaded_watcher() {
console.log('Une ressource à été chargée <= MiWatcher');
}
// Dark Theme
htmlElement.removeAttribute('style');
htmlElement.setAttribute('class', 'has-background-dark has-text-danger-light');
body.setAttribute('class', 'has-background-dark has-text-danger-light');
// reset
window.stop();
// Head Set
// <link rel="icon" href="https://mialaprog.github.io/MiYT/lib/icon.png" type="image/png"></link>
head.innerHTML = `
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="https://mialaprog.github.io/MiYT/lib/MiYT.webmanifest">
<link rel="stylesheet" href="https://mialaprog.github.io/MiYT/ext/bulma.min.css">
<link rel="stylesheet" href="https://mialaprog.github.io/MiYT/ext/bulma-switch.min.css">
<title>Chargement en cours... | MialaMusic</title>
<link rel="stylesheet" href="https://mialaprog.github.io/MiYT/lib/style.css">
<link rel="stylesheet" href="https://mialaprog.github.io/MiYT/lib/loading.css">
<link rel="stylesheet" href="https://mialaprog.github.io/MiYT/ext/fonts.css">`
scr_list.forEach(element => {
let js = document.createElement("script");
js.type = "text/javascript";
js.src = element;
body.appendChild(js);
});
let link_icon = document.querySelector("link[rel~='icon']");
if (!link_icon) {
link_icon = document.createElement('link');
link_icon.rel = 'icon';
document.head.appendChild(link_icon);
}
link_icon.href = 'https://mialaprog.github.io/MiYT/lib/icon.png';
// Body set
body.innerHTML =
`
<div id='inProgress' class='block'>
<div class="loaderPlay"></div><div class="loaderFactory"></div><div class="loaderSlash"></div><div class="loaderFilm top"></div><div class="loaderFilm down"></div>
<div class='content'>
<br>
<progress id="loading_progress" class="progress is-large is-danger" value="0" max="100">Attente de votre réponse...</progress><br><br>
<h1 class="txtop">Veuillez répondre à la question: OK = Oui , Annuler = Non</h1><br>
<p class="image is-128x128 is-centered">
<img class="is-rounded" src="https://mialaprog.github.io/MiYT/lib/icon.png" alt="Lecteur MiYT">
</p><br><br>
</div></div>
`
+ body.innerHTML +
`
<div id="pageContent" class="block is-hidden">
<div class="columns is-desktop is-variable is-8">
<div class="column has-text-danger-light has-background-dark">
<div class="tags are-medium">
<span class="tag is-primary"><a href="https://yt.mi.42web.io/" class="has-text-warning-light">Lecteur MiYT</a></span>
<span class="tag is-danger"><a id="pllink" href="#" class="has-text-warning-light">Playlist</a></span>
<span class="tag is-danger"><a href="https://www.youtube.com/?Mi=Music" class="has-text-warning-light">YouTube</a></span>
</div>
<br><br>
<div id="player-box"><div id="player"></div></div>
<br>
<span id="infos_vid" class="tag">Chargement en cours... - MialaMusic</span><br><br>
<br>
<div class="buttons">
<button id="prev_btn" class="button is-danger">
<span class="material-symbols-outlined gfonticon_button icon is-small">
skip_previous
</span>
</button>
<button id="next_btn" class="button is-success">
<span class="material-symbols-outlined gfonticon_button icon is-small">
skip_next
</span></button>
<!--
<button id="PiP_btn" class="button is-info" onclick="if (document.pictureInPictureElement) {
document.exitPictureInPicture();
} else if (document.pictureInPictureEnabled) {
video.requestPictureInPicture();
}">
PiP</button> -->
<span style="display:inline-block;width: 4vw;"></span>
<button id="reset_btn" class="button is-danger">
<span class="material-symbols-outlined gfonticon_button icon is-small">
playlist_remove
</span>
</button>
</div>
<div class="box" style="
background-color: #005b42;
border-radius: 18px;
box-shadow: 0 0.5em 1em -0.125em rgb(10 10 10), 0 0 0 1px rgb(10 10 10);
color: #fff;
">
<div class="field">
<input id="SkipIndispoSw" type="checkbox" name="SkipIndispoSw" class="switch is-outlined is-warning" checked>
<label for="SkipIndispoSw" style="height: 0.5em; padding-left: 3.5rem;">Passer les vidéos indisponibles</label>
</div>
<br>
<div class="field">
<input id="SkipOutroSw" type="checkbox" name="SkipOutroSw" class="switch is-success" checked>
<label for="SkipOutroSw" style="height: 0.5em; padding-left: 3.5rem;">Skipper les outro</label>
</div>
<div class="field">
<label for="PauseForbidSw">Lecture automatique (pause interdite):</label><br><span style="display:inline-block;width: 2vw;"></span>
<label for="PauseForbidSw">Au début uniquement</label>
<input id="PauseForbidSw" type="checkbox" name="PauseForbidSw" class="switch is-danger">
<label for="PauseForbidSw" style="height: 0.5em; padding-left: 3.5rem;">Pendant toute la video</label>
</div>
<div class="field">
<label for="LoopPlaySw">Lecture de la playlist en boucle:</label><br><span style="display:inline-block;width: 2vw;"></span>
<label for="LoopPlaySw">Désactivée</label>
<input id="LoopPlaySw" type="checkbox" name="LoopPlaySw" class="switch is-link">
<label for="LoopPlaySw" style="height: 0.5em; padding-left: 3.5rem;">Activée</label>
</div>
<div class="field is-grouped">
<p class="control">
<button id="SaveButton" class="button is-success">
<span class="material-symbols-outlined gfonticon_button icon is-small">
download_for_offline
</span>
</button>
</p>
<p class="control">
<div class="file is-warning">
<label class="file-label">
<input class="file-input" type="file" name="resume" id="RestFile">
<span class="file-cta">
<span class="file-icon">
<span class="material-symbols-outlined gfonticon_button icon is-small">
backup
</span>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
</label>
</div>
</p>
</div>
</div>
<br>
</div>
<div class="column has-text-danger-light has-background-dark" id="pl_view">
</div>
<div id="pl_view_iframe" class="is-hidden"></div>
</div>
`;
// => pl_load
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "https://mialaprog.github.io/MiYT/pl_load.js";
js.onreadystatechange = rsrcLoaded_watcher;
js.onload = rsrcLoaded_watcher;
js.id = "PlLoad";
//Ajout de la balise dans la page
document.body.appendChild(js);