|
| 1 | +<meta charset="utf-8"> |
| 2 | +<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> |
| 3 | +<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 4 | +<title><%= content_for?(:title) ? yield(:title) : " MIT Libraries" %></title> |
| 5 | +<%= csrf_meta_tags %> |
| 6 | +<%= csp_meta_tag %> |
| 7 | + |
| 8 | +<%= yield :additional_meta_tag %> |
| 9 | + |
| 10 | +<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> |
| 11 | +<!--[if lt IE 9]> |
| 12 | + <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script> |
| 13 | +<![endif]--> |
| 14 | +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.1.1/normalize.min.css" integrity="sha512-4oJiHyX3IWAdU3YotQW0piF3VIAU+vzoBYFoBj8fEzqXK9e9N3GUUvgRAgrQxDmtWnbwzZ27BD85R7oQEag55Q==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
| 15 | +<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic&subset=latin,latin-ext" type="text/css"> |
| 16 | +<%= stylesheet_link_tag 'application', media: 'all', 'data-turbo-track': 'reload' %> |
| 17 | + |
| 18 | +<!-- For all other devices --> |
| 19 | +<!-- Size should be 32 x 32 pixels --> |
| 20 | +<%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %> |
| 21 | + |
| 22 | +<%= render partial: "layouts/js_exception_handler" %> |
| 23 | +<%= javascript_importmap_tags %> |
| 24 | + |
| 25 | +<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js" integrity="sha512-3n19xznO0ubPpSwYCRRBgHh63DrV+bdZfHK52b1esvId4GsfwStQNPJFjeQos2h3JwCmZl0/LgLxSKMAI55hgw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> |
| 26 | + |
| 27 | +<%= yield :additional_js %> |
| 28 | + |
| 29 | +<% if (ENV['MATOMO_URL'].present? && ENV['MATOMO_SITE_ID'].present?) %> |
| 30 | +<!-- Matomo --> |
| 31 | +<script type="text/javascript"> |
| 32 | + var _paq = window._paq || []; |
| 33 | + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ |
| 34 | + _paq.push(['trackPageView']); |
| 35 | + _paq.push(['enableLinkTracking']); |
| 36 | + (function() { |
| 37 | + var u='<%= ENV['MATOMO_URL'] %>'; |
| 38 | + _paq.push(['setTrackerUrl', u+'matomo.php']); |
| 39 | + _paq.push(['setSiteId', '<%= ENV['MATOMO_SITE_ID'] %>']); |
| 40 | + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; |
| 41 | + g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); |
| 42 | + })(); |
| 43 | + |
| 44 | + // Lightly modified from https://github.com/turbolinks/turbolinks/issues/436 |
| 45 | + // Send Matomo a new event when navigating to a new page using Turbolinks |
| 46 | + // (see https://developer.matomo.org/guides/spa-tracking) |
| 47 | + (function() { |
| 48 | + var previousPageUrl = null; |
| 49 | + addEventListener('turbo:load', function(event) { |
| 50 | + if (previousPageUrl) { |
| 51 | + _paq.push(['setReferrerUrl', previousPageUrl]); |
| 52 | + _paq.push(['setCustomUrl', window.location.href]); |
| 53 | + _paq.push(['setDocumentTitle', document.title]); |
| 54 | + if (event.data && event.data.timing) { |
| 55 | + _paq.push(['setGenerationTimeMs', event.data.timing.visitEnd - event.data.timing.visitStart]); |
| 56 | + } |
| 57 | + _paq.push(['trackPageView']); |
| 58 | + } |
| 59 | + previousPageUrl = window.location.href; |
| 60 | + }); |
| 61 | + })(); |
| 62 | +</script> |
| 63 | +<!-- End Matomo Code --> |
| 64 | +<% end %> |
0 commit comments