default-layout-wrapper.hamlet 2.15 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$newline never
\<!doctype html>
\<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
\<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
\<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
\<!--[if gt IE 8]><!-->
<html class="no-js" lang="en"> <!--<![endif]-->
  <head>
    <meta charset="UTF-8">

    <title>#{pageTitle pc}
    <meta name="description" content="">
    <meta name="author" content="">

    <meta name="viewport" content="width=device-width,initial-scale=1">

    ^{pageHead pc}

    \<!--[if lt IE 9]>
    \<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    \<![endif]-->

    <script>
      /* The `defaultCsrfMiddleware` Middleware added in Foundation.hs adds a CSRF token to the request cookies. */
      /* AJAX requests should add that token to a header to be validated by the server. */
      /* See the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package for details. */
      var csrfHeaderName = "#{TE.decodeUtf8 $ CI.foldedCase defaultCsrfHeaderName}";

      var csrfCookieName = "#{TE.decodeUtf8 defaultCsrfCookieName}";
      var csrfToken = Cookies.get(csrfCookieName);


      if (csrfToken) {
      \  $.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
      \      if (!options.crossDomain) {
      \          jqXHR.setRequestHeader(csrfHeaderName, csrfToken);
      \      }
      \  });
      }

    <script>
      document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/,'js');
  <body>
    ^{pageBody pc}

    $maybe analytics <- appAnalytics $ appSettings master
      <script>
        if(!window.location.href.match(/localhost/)){
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

            ga('create', '#{analytics}', 'auto');
            ga('send', 'pageview');
        }