Tiggles ツ of Speak Creative
11/28/2018 - 5:41 PM

Turn Address Wrap into link

grab the address wrap and make it into a google maps link with its contents

<!-- Converts location address to a clickable link -->
$(document).ready(function () {
$('.lmlw-addr-wrap').each(function () {
var link = "<a href='http://maps.google.com/maps?q=" + encodeURIComponent( $(this).text() ) + "' target='_blank'>" + $(this).text() + "</a>";
$(this).html(link);
});
});


///this was later modified to:


function checkForItem(elementName) {
            if ($(elementName).length >= 1) {
                clearInterval(elementChecker); //these lines will chck to see if element exists before performing fn below
                    $('.places-app-location-item').each(function () {
                        $(this).find(".places-app-location-street").next('span.places-app-location-citystatezip').andSelf().wrapAll('<div class="wrapped"></div>');
                        $('.wrapped').each(function () {
                            var link = "<a href='http://maps.google.com/maps?q=" + encodeURIComponent($(this).text()) + "' target='_blank'>" + $(this).text() + "</a>";
                            $(this).html(link);
                        });
                    });
            }
        }
        var elementChecker = setInterval(function() { checkForItem(".location-selector"); }, 500);