jQuery(document).ready(function($) {
// 1. Run a background loop that constantly watches for the map popups
setInterval(function() {
// Target Jetpack 'Share this' and 'Related posts' if they creep into the map
$('.fm-popup, .html5map-popup').each(function() {
// Delete containers explicitly based on their third-party classes
$(this).find('.sharedaddy, .jetpack-relatedposts, #jp-relatedposts, .relatedposts').remove();
// Wreak havoc on any generic block containing the forbidden text strings
$(this).find('div, h3, p, span').each(function() {
var text = $(this).text().toLowerCase();
if (text.indexOf('share this') !== -1 || text.indexOf('related') !== -1) {
$(this).closest('div').remove(); // Deletes the section and its parent block
$(this).remove(); // Safety double-delete
}
});
});
}, 100); // Scans every 100 milliseconds so it reacts instantly when a user clicks a state
});