1// $Id$ 2(function ($) { 3 Drupal.behaviors.external = { 4 attach: function (context, settings) { 5 // Open external links in new tabs. 6 $("a[href^=http\\:\\/\\/]:not(.external-processed)", context).each(function() { 7 if(this.href.toLowerCase().indexOf(location.hostname) == -1 || this.href.toLowerCase().indexOf(location.hostname) > 13) { 8 9 $(this).click(externalNewWindow); 10 } 11 }).addClass('external-processed'); 12 // If the setting is enabled, open PDFs in new tabs. 13 if (Drupal.settings.externalpdf) { 14 $("a[href*=\\.pdf]:not(.external-processed)", context).each(function() { 15 $(this).click(externalNewWindow); 16 }).addClass('external-processed'); 17 }; 18 // Open any links with class="newtab" in new tabs 19 $("a.newtab:not(.external-processed)", context).click(externalNewWindow).addClass('external-processed'); 20 21 // Utility function that does the work. 22 function externalNewWindow() { 23 window.open(this.href); 24 return false; 25 } 26 } 27 }; 28}(jQuery)); 29;
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.