Skip to content

Commit

Permalink
set_bg_vid
Browse files Browse the repository at this point in the history
  • Loading branch information
Miala-python authored Oct 30, 2024
1 parent 72d33d3 commit b9d9f99
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
22 changes: 22 additions & 0 deletions lib/pl_view.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
// https://i.ytimg.com/vi/dvuhQEDXvN8/hqdefault.jpg
console.log('PLVIEW v¤>44<');

function set_bg_vid(){
// Set the correct bg for active video and last active video

// var pl_view_active def in pl_load to false
// var id def in pl_load to 0

try {
if (pl_view_active !== false) {
document.getElementById('pl_view_article_' + pl_view_active).classList.remove('has-background-grey-dark');
}
} catch (error) { }
pl_view_active = id;

// Known ERR: loop.js:81 TypeError: Cannot read properties of null (reading 'classList') at changeVideo (loop.js:78:61)
// => just stop try...
// console.log('Try add dark bg to article with id:'+id); //-> Return ID 0
// => Need set first ID for first time ...
document.getElementById('pl_view_article_' + id).classList.add('has-background-grey-dark');
}

function plv_load_pict(){
let pl_view_HTML = `
<div class="card has-background-info-dark has-text-primary-light list-container scroll" style="border-radius: 18px;">
Expand Down Expand Up @@ -45,6 +65,8 @@ function plv_load_pict(){

var pl_view = document.getElementById("pl_view");
pl_view.innerHTML = pl_view_HTML;

set_bg_vid();
}

function setYouTubeVideoTitle(my_id, videoId) {
Expand Down
13 changes: 1 addition & 12 deletions loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,7 @@ function changeVideo(nid, pgs_rest = true) {

try {
if ($PLAYLIST_VIEW !== false) {
try {
if (pl_view_active !== false) {
document.getElementById('pl_view_article_' + pl_view_active).classList.remove('has-background-grey-dark');
}
} catch (error) { }
pl_view_active = id;

// Known ERR: loop.js:81 TypeError: Cannot read properties of null (reading 'classList') at changeVideo (loop.js:78:61)
// => just stop try...
// console.log('Try add dark bg to article with id:'+id); //-> Return ID 0
// => Need set first ID for first time ...
document.getElementById('pl_view_article_' + id).classList.add('has-background-grey-dark');
set_bg_vid();
}

} catch (error) { console.log(error) }
Expand Down

0 comments on commit b9d9f99

Please # to comment.