Skip to content

Instantly share code, notes, and snippets.

@DylanCodeCabin
Created January 5, 2024 11:08
Show Gist options
  • Save DylanCodeCabin/2edf8a16727170015cf90cfe49210402 to your computer and use it in GitHub Desktop.
Save DylanCodeCabin/2edf8a16727170015cf90cfe49210402 to your computer and use it in GitHub Desktop.
jQuery(($) => {
WPGMZA.Map.prototype.addMarker = function(marker){
if(!(marker instanceof WPGMZA.Marker))
throw new Error("Argument must be an instance of WPGMZA.Marker");
let englishOnly = window.location.href.indexOf('/en/') !== -1 ? true : false;
if(englishOnly){
if(marker.link.indexOf('/en/') === -1){
marker.setVisible(false);
return;
}
} else {
if(marker.link.indexOf('/en/') !== -1){
marker.setVisible(false);
return;
}
}
marker.map = this;
marker.parent = this;
this.markers.push(marker);
this.dispatchEvent({type: "markeradded", marker: marker});
marker.dispatchEvent({type: "added"});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment