Permalink
Browse files

feat: add photoswip CDN (#115)

  • Loading branch information...
shalk authored and xianmin committed Sep 11, 2018
1 parent 91a6156 commit 5fb2c8a6648128e985c177af9f9b1f0c5e6c262b
Showing with 12 additions and 1 deletion.
  1. +4 −0 exampleSite/config.toml
  2. +1 −1 layouts/_default/baseof.html
  3. +3 −0 layouts/partials/photoswipe.html
  4. +4 −0 layouts/partials/scripts.html
View
@@ -114,6 +114,10 @@ defaultContentLanguage = "en" # Default language to use
slideout = '<script src="https://cdn.jsdelivr.net/npm/slideout@1.0.1/dist/slideout.min.js" integrity="sha256-t+zJ/g8/KXIJMjSVQdnibt4dlaDxc9zXr/9oNPeWqdg=" crossorigin="anonymous"></script>'
gitmentJS = '<script src="https://cdn.jsdelivr.net/npm/gitment@0.0.3/dist/gitment.browser.min.js" crossorigin="anonymous"></script>'
gitmentCSS = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitment@0.0.3/style/default.min.css" crossorigin="anonymous">'
photoswipe = '<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/photoswipe.min.js" integrity="sha256-iG1tiE5xJSJQhKdeOW4cPiSy+RTrnRKjjjrVQ0hexug=" crossorigin="anonymous"></script>'
photoswipe-ui = '<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/photoswipe-ui-default.min.js" integrity="sha256-XvSk6Opq7XZ8oUcx213MtikXtbl5bbe4Q9tr4+NJBCg=" crossorigin="anonymous"></script>'
photoswipeCSS = '<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/photoswipe.min.css" integrity="undefined" crossorigin="anonymous"></script>'
photoswipeSKIN = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.2/dist/default-skin/default-skin.css" integrity="sha256-c0uckgykQ9v5k+IqViZOZKc47Jn7KQil4/MP3ySA3F8=" crossorigin="anonymous">'
[params.utteranc] # utteranc is a comment system based on GitHub issues. see https://utteranc.es
enable = false
@@ -14,7 +14,7 @@
{{ partial "slideout.html" . }}
{{ if or .Site.Params.photoswipe .Site.Params.fancybox }}
{{ partial "photoswipe.html" }}
{{ partial "photoswipe.html" . }}
{{ end }}
{{ if .Site.Params.forkMeOnGithub }}
@@ -17,6 +17,9 @@
{{ if .Site.Params.bootcdn }}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/photoswipe.min.css" integrity="sha256-sCl5PUOGMLfFYctzDW3MtRib0ctyUvI9Qsmq2wXOeBY=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/default-skin/default-skin.min.css" integrity="sha256-BFeI1V+Vh1Rk37wswuOYn5lsTcaU96hGaI7OUVCLjPc=" crossorigin="anonymous" />
{{ else if .Site.Params.publicCDN.enable }}
{{ .Site.Params.publicCDN.photoswipeCSS | safeHTML }}
{{ .Site.Params.publicCDN.photoswipeSkin | safeHTML }}
{{ else }}
<link rel="stylesheet" href="{{ "/lib/photoswipe/photoswipe.min.css" | relURL }}" />
<link rel="stylesheet" href="{{ "/lib/photoswipe/default-skin/default-skin.min.css" | relURL }}" />
@@ -74,6 +74,10 @@
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/photoswipe-ui-default.min.js" integrity="sha256-PWHOlUzc96pMc8ThwRIXPn8yH4NOLu42RQ0b9SpnpFk="
crossorigin="anonymous"></script>
{{ else if .Site.Params.publicCDN.enable }}
<script type="text/javascript" src="{{ "/js/load-photoswipe.js" | relURL }}"></script>
{{ .Site.Params.publicCDN.photoswipe | safeHTML }}
{{ .Site.Params.publicCDN.photoswipeUI | safeHTML }}
{{ else }}
<script type="text/javascript" src="{{ "/js/load-photoswipe.js" | relURL }}"></script>
<script type="text/javascript" src="{{ "/lib/photoswipe/photoswipe.min.js" | relURL}}"></script>

0 comments on commit 5fb2c8a

Please sign in to comment.