1/** 2 * @file 3 */ 4 5 (function($, Drupal, once) { 6 7 'use strict'; 8 9 /** 10 * Render Meta tags for print version of the page. 11 */ 12 Drupal.behaviors.printHelpers = { 13 attach: function (context, settings) { 14 $(once('html', 'html', context)).each(function() { 15 const title = document.title; 16 const $descriptionEl = $('meta[name="description"]'); 17 const $ogTitleEl = $('meta[property="og:title"]'); 18 const $ogDescriptionEl = $('meta[property="og:description"]'); 19 20 const $metaTags = $('<div/>', {'class': 'meta-tags'}); 21 const $metaTagsContent = '<div>Title: ' + title + '</div>' + 22 fetchMetatags($descriptionEl, 'Description') + 23 fetchMetatags($ogTitleEl, 'Open Graph Title') + 24 fetchMetatags($ogDescriptionEl, 'Open Graph Description') 25 ; 26 27 $metaTags.hide().append($metaTagsContent).prependTo('body'); 28 }); 29 } 30 }; 31 32 function fetchMetatags($el, label) { 33 if (!$el.length > 0) { 34 return ''; 35 } 36 const content = $el.attr('content'); 37 return `<div>${label}: ${content}</div>`; 38 } 39 40})(jQuery, Drupal, once);
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.