Код: Выделить всё
#add_yt_event_listeners(row_class){
var yt_play_btns = document.querySelectorAll('.yt_play_icon_container');
yt_play_btns.forEach(btn => {
btn.addEventListener('click', (e) => {
var vid_id = btn.getAttribute('ext_loc');
var row_c = row_class+'_yt_player';
var post_args = {video_id:vid_id,row:row_c};
var yt_player = new LOAD_YT_MEDIA_PLAYER(post_args,row_class);
document.addEventListener('player_closed', (e) => {
console.log(e.detail.closed);
yt_player.destruct();
yt_player = null;
this.#option_btn_clicked == 'latest';
this.#set_post_args_call_ajax();
})
});
})
}
Код: Выделить всё
destruct() {
this.#search_close_toggles_container.removeEventListener('click', this.search_options_toggle_event);
const yt_playlist_option_btns_container = this.#this_player.querySelector('.yt_playlist_option_btns_container');
const interaction_ics = yt_playlist_option_btns_container.querySelectorAll('.interaction_ic');
interaction_ics.forEach(option => {
option.removeEventListener('click', this.playlist_options_interactions_event);
});
const playlist_items = this.#this_player.querySelectorAll('.playlist_item_cont');
playlist_items.forEach(video => {
video.removeEventListener('click', this.playlist_video_event);
});
const pod_des_read = document.querySelector('.pod_des_read');
if (pod_des_read != null) {
const pod_des_rest = document.querySelector('.pod_des_rest');
pod_des_read.removeEventListener('click', this.#media_description_event);
}
const player_close_btn = this.#this_player.querySelector('.media_row_close_btn');
player_close_btn.removeEventListener('click', this.close_player_event);
this.#row.classList.remove('yt_player');
this.#row.classList.add('exp');
this.#snippets_container.classList.add('news_snippets');
this.#snippets_container.classList.remove('yt_player');
this.#player_id = null;
this.#bias = null;
this.#post_args = null;
this.#this_player = null;
this.#player_playlist = null;
this.#search_close_toggles_container = null;
this.#ajax_url = null;
this.#post_values = null;
this.#snippets_container = null;
this.#row = null;
this.#row_title = null;
this.#player_closed = null;
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... s-of-class