diff --git a/js/foundationExtendEBI.js b/js/foundationExtendEBI.js index 2be793838e44cf55fbfddc3be5ed57554243d3fe..7c7a611120cb3fa30d27dad46d3f010a1124998d 100644 --- a/js/foundationExtendEBI.js +++ b/js/foundationExtendEBI.js @@ -37,10 +37,10 @@ ebiGaIndicateLoaded(0,2); /** * Utility method to get the last in an array * @returns {var} the last item in the array - * @example linkName = jQuery(actedOnItem).attr('src').split('/').last(); + * @example linkName = jQuery(actedOnItem).attr('src').split('/').ebiLast(); */ -if (!Array.prototype.last){ - Array.prototype.last = function(){ +if (!Array.prototype.ebiLast){ + Array.prototype.ebiLast = function(){ return this[this.length - 1]; }; }; @@ -76,7 +76,7 @@ function analyticsTrackInteraction(actedOnItem, parentContainer, customEventName } else { // then derive a value var linkName = jQuery(actedOnItem).text().toString(); // if there's no text, it's probably and image - if (linkName.length == 0 && jQuery(actedOnItem).attr('src')) linkName = jQuery(actedOnItem).attr('src').split('/').last(); + if (linkName.length == 0 && jQuery(actedOnItem).attr('src')) linkName = jQuery(actedOnItem).attr('src').split('/').ebiLast(); if (linkName.length == 0 && jQuery(actedOnItem).val()) linkName = jQuery(actedOnItem).val(); // special things for gloabl search box