Skip to content
Snippets Groups Projects
Commit d6bc86a3 authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Made OpenURL functionality more reusable.

parent eeac58f4
No related merge requests found
...@@ -35,20 +35,32 @@ function embedOpenUrlLinks(element) { ...@@ -35,20 +35,32 @@ function embedOpenUrlLinks(element) {
} }
} }
$(document).ready(function() { // Assign actions to the OpenURL links. This can be called with a container e.g. when
// assign action to the openUrlWindow link class // combined results fetched with AJAX are loaded.
$('a.openUrlWindow').click(function(){ function setupOpenUrlLinks(container)
{
if (typeof(container) == 'undefined') {
container = $('body');
}
// assign action to the openUrlWindow link class
container.find('a.openUrlWindow').click(function() {
var params = extractClassParams(this); var params = extractClassParams(this);
var settings = params.window_settings; var settings = params.window_settings;
window.open($(this).attr('href'), 'openurl', settings); window.open($(this).attr('href'), 'openurl', settings);
return false; return false;
}); });
// assign action to the openUrlEmbed link class // assign action to the openUrlEmbed link class
$('.openUrlEmbed a').click(function() { container.find('.openUrlEmbed a').click(function() {
embedOpenUrlLinks($(this)); embedOpenUrlLinks($(this));
return false; return false;
}); });
$('.openUrlEmbed.openUrlEmbedAutoLoad a').trigger("click"); container.find('.openUrlEmbed.openUrlEmbedAutoLoad a').trigger('click');
}
$(document).ready(function() {
setupOpenUrlLinks();
}); });
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment