diff options
author | Tom Doan <tom.doan@borngroup.com> | 2020-11-23 21:57:33 +0300 |
---|---|---|
committer | Tom Doan <tom.doan@borngroup.com> | 2020-11-23 21:57:33 +0300 |
commit | c977923850a198114cfb3ddac66c5a54386806f6 (patch) | |
tree | 5aacb6d6fde0e018a17782a1c4b3f24ae76b26c6 | |
parent | 58f88c1f1364dcf3d10eb74a50b7772b019210c5 (diff) |
Update Snipcart to v3.0.25; fix Snipcart JS errors
-rw-r--r-- | layouts/partials/footer.html | 119 | ||||
-rw-r--r-- | layouts/partials/head.html | 19 |
2 files changed, 66 insertions, 72 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 3e116d7..38a2378 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -24,7 +24,7 @@ <li class="mb-3"><i class="ti-location-pin text-primary mr-2"></i> {{ site.Params.location }} </li> </ul> - <!-- social icon --> + <!-- Social Icons --> <ul class="list-inline"> {{ range site.Params.social }} <li class="list-inline-item"><a href="{{ .link | safeURL }}"><i class="{{ .icon }} text-primary"></i></a></li> @@ -49,84 +49,75 @@ </div> </footer> -{{ "<!-- Google Map API -->" | safeHTML }} +{{ with site.Params.snipcartApiKey }} +{{ "<!-- Snipcart -->" | safeHTML }} +<div id="snipcart" data-api-key="{{ site.Params.snipcartApiKey }}" hidden></div> +{{ end }} + +{{ "<!-- Google Maps API -->" | safeHTML }} <script src="{{ site.Params.gmapAPI | absURL }}"></script> {{ "<!-- JS Plugins -->" | safeHTML }} {{ range site.Params.plugins.js}} <script src="{{ .link | absURL }}"></script> {{ end }} -<!-- snipcart --> -{{ with site.Params.snipcartApiKey }} -<script type="text/javascript" id="snipcart" src="https://cdn.snipcart.com/themes/v3.0.21/default/snipcart.js" - data-api-key="{{ site.Params.snipcartApiKey }}"></script> -<script> - Snipcart.execute('registerLocale', 'en', { - powered_by: "Enlazaa" - }); -</script> -{{ end }} - {{ "<!-- Main Script -->" | safeHTML }} {{ $script := resources.Get "js/script.js" | minify}} <script src="{{ $script.Permalink }}"></script> - {{ with site.Params.googleAnalitycsID }} -{{ "<!-- google analitycs -->" | safeHTML }} +{{ "<!-- Google Analytics -->" | safeHTML }} <script> - (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', '//www.google-analytics.com/analytics.js', 'ga'); - ga('create', '{{ . }}', 'auto'); - ga('send', 'pageview'); +(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', '//www.google-analytics.com/analytics.js', 'ga'); +ga('create', '{{ . }}', 'auto'); +ga('send', 'pageview'); </script> {{ end }} -<!-- product rating --> {{ if site.Params.rating.enable }} -<script type="text/javascript"> - (function (d, t, e, m) { - - // Async Rating-Widget initialization. - window.RW_Async_Init = function () { - - RW.init({ - huid: "{{ site.Params.rating.websiteID }}", - uid: "{{ site.Params.rating.publicKey }}", - source: "website", - options: { - "size": "medium", - "style": "oxygen", - "isDummy": false - } - }); - RW.render(); - }; - // Append Rating-Widget JavaScript library. - var rw, s = d.getElementsByTagName(e)[0], - id = "rw-js", - l = d.location, - ck = "Y" + t.getFullYear() + - "M" + t.getMonth() + "D" + t.getDate(), - p = l.protocol, - f = ((l.search.indexOf("DBG=") > -1) ? "" : ".min"), - a = ("https:" == p ? "secure." + m + "js/" : "js." + m); - if (d.getElementById(id)) return; - rw = d.createElement(e); - rw.id = id; - rw.async = true; - rw.type = "text/javascript"; - rw.src = p + "//" + a + "external" + f + ".js?ck=" + ck; - s.parentNode.insertBefore(rw, s); - }(document, new Date(), "script", "rating-widget.com/")); +{{ "<!-- Product Ratings -->" | safeHTML }} +<script> +(function (d, t, e, m) { + // Async Rating-Widget initialization + window.RW_Async_Init = function () { + RW.init({ + huid: "{{ site.Params.rating.websiteID }}", + uid: "{{ site.Params.rating.publicKey }}", + source: "website", + options: { + "size": "medium", + "style": "oxygen", + "isDummy": false + } + }); + RW.render(); + }; + // Append Rating-Widget JavaScript library + var rw, s = d.getElementsByTagName(e)[0], + id = "rw-js", + l = d.location, + ck = "Y" + t.getFullYear() + + "M" + t.getMonth() + "D" + t.getDate(), + p = l.protocol, + f = ((l.search.indexOf("DBG=") > -1) ? "" : ".min"), + a = ("https:" == p ? "secure." + m + "js/" : "js." + m); + if (d.getElementById(id)) return; + rw = d.createElement(e); + rw.id = id; + rw.async = true; + rw.type = "text/javascript"; + rw.src = p + "//" + a + "external" + f + ".js?ck=" + ck; + s.parentNode.insertBefore(rw, s); +}(document, new Date(), "script", "rating-widget.com/")); </script> {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 551cc54..43d3537 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -2,27 +2,30 @@ <meta charset="utf-8"> <title>{{ .Title }}</title> - {{ "<!-- mobile responsive meta -->" | safeHTML }} + {{ "<!-- Mobile Responsive Meta -->" | safeHTML }} <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}"> {{ with site.Params.author }}<meta name="author" content="{{ . }}">{{ end }} {{ hugo.Generator }} - {{ "<!-- plugins -->" | safeHTML }} + {{ "<!-- Plugins -->" | safeHTML }} {{ range site.Params.plugins.css }} <link rel="stylesheet" href="{{ .link | absURL }}"> {{ end }} - <link rel="preconnect" href="https://app.snipcart.com"> - <link rel="preconnect" href="https://cdn.snipcart.com"> - <link id="snipcart-theme" type="text/css" href="https://cdn.snipcart.com/themes/v3.0.21/default/snipcart.css" rel="stylesheet"> - <script async src="https://cdn.snipcart.com/themes/v3.0.21/default/snipcart.js"></script> + + {{ with site.Params.snipcartApiKey }} + {{ "<!-- Snipcart -->" | safeHTML }} + <link rel="preconnect" href="https://app.snipcart.com/"> + <link rel="preconnect" href="https://cdn.snipcart.com/"> + <link rel="stylesheet" href="https://cdn.snipcart.com/themes/v3.0.25/default/snipcart.css"> + <script async src="https://cdn.snipcart.com/themes/v3.0.25/default/snipcart.js"></script> + {{ end }} {{ "<!-- Main Stylesheet -->" | safeHTML }} {{ $styles := resources.Get "scss/style.scss" | toCSS | minify }} <link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen"> - {{ "<!--Favicon-->" | safeHTML }} + {{ "<!-- Favicon -->" | safeHTML }} <link rel="shortcut icon" href="{{ `images/favicon.png` | absURL }} " type="image/x-icon"> <link rel="icon" href="{{ `images/favicon.png` | absURL }} " type="image/x-icon"> - </head> |