It works for the most part - it is supposed to find a string within the names of activities and when found, remove that string. This works everywhere (like breadcrumb, activity-page-title etc.), except in the courseindex-drawer. I suspect, that the drawer populates after the custom script is already done.
This is only part of the script - the enclosing function is called for a list of shortcodes ("text")
// Remove shortcode: page caption > WORKS
$('#page-header H1').contents().each(function(_, node) {
if (node.nodeValue && node.nodeValue.includes(text)) {
node.nodeValue = node.nodeValue.replace(text, "");
}
})
// Remove shortcode: breadcrumb > WORKS
$('.breadcrumb span').contents().each(function(_, node) {
if (node.nodeValue && node.nodeValue.includes(text)) {
node.nodeValue = node.nodeValue.replace(text, "");
}
})
// Remove shortcode: courseindex-link > DOES NOT WORK
$('.courseindex-link').contents().each(function(_, node) {
if (node.nodeValue && node.nodeValue.includes(text)) {
node.nodeValue = node.nodeValue.replace(text, "");
}
})
Is there any way to make this work in the drawer as well?