@cagatay in case you’re still following this thread, I found a far more efficient way of adding the classes using jQuery
. To this end, you can change this block above with this code
// Target those elements already loaded in the DOM
$(document).ready(function() {
$(window).on('action:ajaxify.end', function(data) {
$('li[component="post"]').each(function(i, obj) {
if (!$(this).hasClass('self-post') || (!$(this).hasClass('self-post'))) {
console.log("Adding required classes for messenger type view");
$(this).addClass('topic-response-post');
}
});
});
});
// Target elements dynamically added to the DOM on post load
$(document).ready(function() {
$(window).on('action:ajaxify.loaded', function(data) {
$('li[component="post"]').each(function(i, obj) {
if (!$(this).hasClass('self-post') || (!$(this).hasClass('self-post'))) {
console.log("Adding required classes for messenger type view");
$(this).addClass('topic-response-post');
}
});
});
});