Code easy to read by suggestion from code review

Co-authored-by: Samantaz Fox <coding@samantaz.fr>
This commit is contained in:
bonjinnorenka 2023-09-23 18:13:54 +09:00 committed by GitHub
parent c3ea7fb72c
commit 00ae96a7e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 7 deletions

View File

@ -83,7 +83,20 @@ function return_message(message, target_window) {
} }
if (message.message_kind === 'event') { if (message.message_kind === 'event') {
if (message.eventname === 'timeupdate' || message.eventname === 'loadedmetadata') { if (message.eventname === 'timeupdate' || message.eventname === 'loadedmetadata') {
additional_info['value'] = { getvolume: player.volume(), getduration: player.duration(), getcurrenttime: player.currentTime(), getplaystatus: player.paused(), getplaybackrate: player.playbackRate(), getloopstatus: player.loop(), getmutestatus: player.muted(), getfullscreenstatus: player.isFullscreen(), getavailableplaybackrates: options.playbackRates, gettitle: player_data.title, getplaylistindex: video_data.index, getplaylistid: video_data.plid }; additional_info['value'] = {
getvolume: player.volume(),
getduration: player.duration(),
getcurrenttime: player.currentTime(),
getplaystatus: player.paused(),
getplaybackrate: player.playbackRate(),
getloopstatus: player.loop(),
getmutestatus: player.muted(),
getfullscreenstatus: player.isFullscreen(),
getavailableplaybackrates: options.playbackRates,
gettitle: player_data.title,
getplaylistindex: video_data.index,
getplaylistid: video_data.plid
};
} }
} }
if (message.eventname === 'error') { if (message.eventname === 'error') {

View File

@ -54,11 +54,7 @@ class invidious_embed {
const instance_stats = await fetch(instance_origin + '/api/v1/stats'); const instance_stats = await fetch(instance_origin + '/api/v1/stats');
if (instance_stats.ok) { if (instance_stats.ok) {
const instance_stats_json = await instance_stats.json(); const instance_stats_json = await instance_stats.json();
if (instance_stats_json.software.name === 'invidious') { return_status = (instance_stats_json.software.name === 'invidious');
return_status = true;
} else {
return_status = false;
}
} else { } else {
return_status = false; return_status = false;
} }
@ -139,7 +135,24 @@ class invidious_embed {
this.volume = 100; this.volume = 100;
this.loop = false; this.loop = false;
this.playlistVideoIds = []; this.playlistVideoIds = [];
this.eventobject = { ready: [], ended: [], error: [], ratechange: [], volumechange: [], waiting: [], timeupdate: [], loadedmetadata: [], play: [], seeking: [], seeked: [], playerresize: [], pause: [], statechange: [] };
this.eventobject = {
ready: [],
ended: [],
error: [],
ratechange: [],
volumechange: [],
waiting: [],
timeupdate: [],
loadedmetadata: [],
play: [],
seeking: [],
seeked: [],
playerresize: [],
pause: [],
statechange: []
};
let replace_elemnt; let replace_elemnt;
this.isPlaylistVideoList = false; this.isPlaylistVideoList = false;
if (element === undefined || element === null) { if (element === undefined || element === null) {