1/* globals jQuery, window */ 2 3// Print link 4(function ($) { 5 var settings = { 6 defaultLanguage: 'sv', 7 icon: '<svg role="presentation" aria-hidden="true" class="lp-icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/rest-api/svg-sources/lp-icons.svg#lp-print"></use></svg>', 8 translations: { 9 sv: 'Skriv ut', 10 en: 'Print', 11 de: 'Drucken' 12 } 13 }; 14 15 $.printLink = function(options) { 16 options = options || {}; 17 var pageLanguage = $('html').attr('lang') || settings.defaultLanguage; 18 var printLabel = settings.translations[pageLanguage] || settings.translations[settings.defaultLanguage]; 19 20 var htmlClass = options.htmlClass ? ' class="' + options.htmlClass + '"' : ''; 21 var link = $('<a href="#"' + htmlClass + '>' + settings.icon + printLabel + '</a>'); 22 23 link.on('click', function (event) { 24 event.preventDefault(); 25 window.print(); 26 }); 27 28 return link; 29 }; 30 31 /** 32 * Init code 33 */ 34 $(function () { 35 $.printLink({ htmlClass: 'normal' }).appendTo('.lp-byline').wrap('<div class="lp-print-link"></div>'); 36 }); 37 38}($svjq || 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.