1(function ($) { 2 "use strict"; 3 4 $(document).ready(function () { 5 var link = $("a.external-link-popup-warning"); 6 var popup = $("div.external-link-popup-warning"); 7 8 // Hide popup content, at first. 9 popup.css("display", "none"); 10 11 // Stick a button in the body. 12 var button = $('<button class="popup-redirect">Yes, proceed to external website</button>'); 13 var cancel_btn = $('<button class="popup-close">No, return to www.scd.org</button>'); 14 $(popup).find(".field--name-body").append(button); 15 $(popup).find(".field--name-body").append(cancel_btn); 16 17 // Show popup when link marked with warning is clicked. 18 link.click(function(e) { 19 e.preventDefault(); 20 popup.css("display", "block"); 21 $("a.external-link-popup-warning").colorbox({inline: true, width: "50%", close: "Cancel/close"}); 22 $(popup).data('original_href', $(this).attr('href')); 23 $(this).attr('href', '#block-externallinkpopupwarning'); 24 }); 25 26 // Redirect only after popup displays. 27 button.click(function(e) { 28 // window.location = $(popup).data('original_href'); 29 window.open($(popup).data('original_href'), '_blank'); 30 }); 31 32 // Close colorbox when closed button is clicked. 33 cancel_btn.click(function(e) { 34 $.colorbox.close(); 35 }); 36 }); 37 38 // Re-hide the popup content after closing the lightbox. 39 $(document).bind('cbox_cleanup', function () { 40 var link = $("a.external-link-popup-warning"); 41 var popup = $("div.external-link-popup-warning"); 42 var target = $(popup).data('original_href'); 43 $(link).attr('href', target); 44 $("div.external-link-popup-warning").css("display", "none"); 45 }); 46 47 // Prevent links marked with warning from default behavior. 48 function preventDefault(e) { 49 e.preventDefault(); 50 } 51})(jQuery);
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.