i hav a javascript for autoplay a youtube a javascript ist in file1.js and Jetpack infninity scroll file2.js the file 1 work only in the posts thej ar not from infinity scroll and at the posts thej ar loaded from jetpack infinity scroll don't work i tray a lot of posibilitys i tray to load the javascript with infnity scroll agen to the header but thets dont work to replace the js at the header thets wont work i don't know what can i do more. i nead a stacoverflow people help i am sory my english is not so good and i am new in javascript world
FILE1
window.onload = function ani2() {
var LoadVideo = function (player_id) {
var Program = {
Init: function () {
this.NewPlayer();
this.EventHandler();
},
NewPlayer: function () {
var _this = this;
this.Player = new YT.Player(player_id, {
events: {
'onStateChange': onPlayerStateChange,
}
});
_this.Player.$element = $('#' + player_id);
}
}
}
}
FILE 2
thets the file from wher play the jetpack infinity scroll
if (type == 'click') {
if (response.lastbatch) {
if (self.click_handle) {
$('#infinite-handle').remove();
// Update body classes
self.body.addClass('infinity-end').removeClass('infinity-success');
} else {
self.body.trigger('infinite-scroll-posts-end');
}
} else {
if (self.click_handle) {
self.element.append(self.handle);
} else {
self.body.trigger('infinite-scroll-posts-more');
}
}
} else if (response.lastbatch) {
self.disabled = true;
self.body.addClass('infinity-end').removeClass('infinity-success');
}