Last active
December 7, 2018 18:03
-
-
Save Garconis/f789c1a7ce08b7d36b2c813cc23eb4a1 to your computer and use it in GitHub Desktop.
Progress Maps | Trigger the search form box if a button is clicked, and also wrap URLs with a link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($, undefined) { | |
// when the search form button is clicked | |
$("a.fs-partner-map-search-link").livequery("click", function() { | |
// get the ID of the button (which is the Maps ID) | |
var a = $("div.search_form_btn").attr("id"); | |
// if the search form container is visible, then proceed | |
if ( $("div.search_form_container_" + a).not(":visible") ) ( | |
$("div.search_form_container_" + a).removeClass("slideOutLeft").addClass("cspm_animated fadeInUp").css({ display: "block" }), | |
setTimeout(function() { $("form#search_form_" + a + " input[name=cspm_address]").focus() }, 400) | |
) | |
}) | |
// wrap map listing content links | |
function wrapMapLinks(){ | |
$(".cspml_details_container .cspml_details_content").each(function(){ | |
$(this).contents().filter(function() { | |
return this.nodeName == '#text'; | |
}).replaceWith(function(){ | |
return this.nodeValue.replace(/((http|https):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g, '<a href="$1" class="fs-map-partner-link">$1</a>'); | |
}); | |
}); | |
} | |
$(document).ready(wrapMapLinks); | |
$(document).ajaxComplete(wrapMapLinks); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment