Embed Javascript in footer.html to open View Online Tab, Title link or Thumbnail in a new window.
- Article Type: General
- Product: Primo
- Product Version: 4
Desired Outcome Goal:
Improve the search experience by opening results in a new window when a user clicks on the View Online tab, Title link or Thumbnail in the Primo brief results list.
Procedure:
1. Open the default or customized version of the footer.html using a text editor (eg: notepad)
2. Add the following javascript code to the footer.html file >
<script type="text/javascript">
$('h2.EXLResultTitle > a').attr('target','_new');
$('div.coverImageDiv > a').attr('target','_new');
</script>
<script type="text/javascript">
$('.EXLViewOnlineTab a').each(function(){
$link = $(this);
if ($link.attr('title').substring(0, 13)=='viewOnlineTab') {
$link.parent().addClass("EXLResultTabIconPopout");
$parent = $(this).parent().parent().parent().parent().parent();
$a = $parent.find(".EXLSummaryContainer > .EXLSummaryFields > h2.EXLResultTitle > a");
$parent.children(".EXLContainer-viewOnlineTab").remove();
$link.attr('target','_new');
}
});
</script>
3. Save the .txt file with an .html extension eg: footer.html, as a local file.
4. Upload the customized footer.html file to the Primo server (using the file-uploader tool)
5. Search Primo to retrieve a list of brief results.
6. Click on the ViewOnlineTab,Title link,or thumbnail to confirm that results open in a new window.
Additional Information
Adding javascript to the static html file to open the Viewit tab in a new window is a common customer request and saves the end user from having to open the i-frame and then click an additional linke to open a new window.
This solution can be customized at the institution-level in Primo by editing and uploading a custom static html file.
Key to javascript functions:
Section #1 - Opens Title link in a new window
$('h2.EXLResultTitle > a').attr('target','_new');
Section #2 > Opens thumbnail in a new window
$('div.coverImageDiv > a').attr('target','_new');
Section #3 > Opens the View Online Tab
$('.EXLViewOnlineTab a').each(function(){
$link = $(this);
if ($link.attr('title').substring(0, 13)=='viewOnlineTab') {
$link.parent().addClass("EXLResultTabIconPopout");
$parent = $(this).parent().parent().parent().parent().parent();
$a = $parent.find(".EXLSummaryContainer > .EXLSummaryFields > h2.EXLResultTitle > a");
$parent.children(".EXLContainer-viewOnlineTab").remove();
$link.attr('target','_new');
}
});
</script>
Category: Front End- Primo
Subject: Brief Results - Primo
- Article last edited: 6/30/2014