1/* global jQuery, dms_front */ 2 3jQuery(document).ready(function () { 4 5 //Load the selected URL as an image inside the [dms_target] container 6 function showAsImage($select, url) { 7 var $target = jQuery('.dms-target-container'); 8 9 if ($target.length === 0) { 10 window.alert(dms_front.no_target); 11 return; 12 } 13 14 var image = jQuery('<img>').attr({ 15 src: url, 16 alt: jQuery.trim($select.find('option:selected').text()) 17 }); 18 19 $target.empty().append(image); 20 } 21 22 //Act on the visitor's choice: either redirect, or swap the target image 23 jQuery('.dms-select').on('change', function () { 24 var $select = jQuery(this); 25 var url = $select.val(); 26 27 //The placeholder carries no value - nothing to do 28 if (url === '') { 29 return; 30 } 31 32 if ($select.data('dms-behaviour') === 'as-image') { 33 showAsImage($select, url); 34 return; 35 } 36 37 if ($select.hasClass('open-in-new-tab')) { 38 window.open(url, '_blank'); 39 } else { 40 window.location.href = url; 41 } 42 }); 43});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.