diff --git a/hugo/assets/js/main.js b/hugo/assets/js/main.js deleted file mode 100644 index 26b9fca..0000000 --- a/hugo/assets/js/main.js +++ /dev/null @@ -1,46 +0,0 @@ -var root = document.documentElement; -let vh = window.innerHeight * 0.01; -root.style.setProperty('--vh', `${vh}px`); - -// We listen to the resize event -window.addEventListener('resize', () => { - // We execute the same script as before - let vh = window.innerHeight * 0.01; - root.style.setProperty('--vh', `${vh}px`); -}); - -function timeDifference(current, previous) { - - var msPerMinute = 60 * 1000; - var msPerHour = msPerMinute * 60; - var msPerDay = msPerHour * 24; - var msPerMonth = msPerDay * 30; - var msPerYear = msPerDay * 365; - - var elapsed = current - previous; - - if (elapsed < msPerMinute) { - return Math.round(elapsed/1000) + ' seconds ago'; - } - - else if (elapsed < msPerHour) { - return Math.round(elapsed/msPerMinute) + ' minutes ago'; - } - - else if (elapsed < msPerDay ) { - return Math.round(elapsed/msPerHour ) + ' hours ago'; - } - - else if (elapsed < msPerMonth) { - return 'approximately ' + Math.round(elapsed/msPerDay) + ' days ago'; - } - - else if (elapsed < msPerYear) { - return 'approximately ' + Math.round(elapsed/msPerMonth) + ' months ago'; - } - - else { - return 'approximately ' + Math.round(elapsed/msPerYear ) + ' years ago'; - } -} - diff --git a/hugo/assets/scripts/main.js b/hugo/assets/scripts/main.js new file mode 100644 index 0000000..b336f2a --- /dev/null +++ b/hugo/assets/scripts/main.js @@ -0,0 +1,15 @@ +/* +Use a window's inner dimensions for viewport units. +This fixes some mobile bugs +*/ + +var root = document.documentElement; +let vh = window.innerHeight * 0.01; +root.style.setProperty('--vh', `${vh}px`); + +// We listen to the resize event +window.addEventListener('resize', () => { + // We execute the same script as before + let vh = window.innerHeight * 0.01; + root.style.setProperty('--vh', `${vh}px`); +}); \ No newline at end of file diff --git a/hugo/assets/scripts/search.js b/hugo/assets/scripts/search.js new file mode 100644 index 0000000..e8dc3ef --- /dev/null +++ b/hugo/assets/scripts/search.js @@ -0,0 +1,225 @@ +/* +tutorials used: +- https://aaronluna.dev/blog/add-search-to-static-site-lunrjs-hugo-vanillajs/#codepen-with-final-code +- https://victoria.dev/blog/add-search-to-hugo-static-sites-with-lunr/ +*/ + +let pagesIndex, searchIndex +const MAX_SUMMARY_LENGTH = 30 +const SENTENCE_BOUNDARY_REGEX = /\b\.\s/gm +const WORD_REGEX = /\b(\w*)[\W|\s|\b]?/gm + +async function initSearch() { + try { + const response = await fetch("/index.json"); + pagesIndex = await response.json(); + searchIndex = lunr(function () { + this.field("title"); + this.field("content"); + this.ref("href"); + pagesIndex.forEach((page) => this.add(page)); + }); + } catch (e) { + console.log(e); + } + console.log("Search index initialized") + // Get the query parameter(s) + const params = new URLSearchParams(window.location.search) + const query = params.get('query') + + // Perform a search if there is a query + if (query) { + // Retain the search input in the form when displaying results + document.getElementById('search-input').setAttribute('value', query) + + // Update the list with results + console.log("search performed") + let results = searchSite(query) + renderSearchResults(query, results) + } +} + +initSearch(); + +function searchSite(query) { + const originalQuery = query; + query = getLunrSearchQuery(query); + let results = getSearchResults(query); + return results.length + ? results + : query !== originalQuery + ? getSearchResults(originalQuery) + : []; +} + +function getLunrSearchQuery(query) { + const searchTerms = query.split(" "); + if (searchTerms.length === 1) { + return query; + } + query = ""; + for (const term of searchTerms) { + query += `+${term} `; + } + return query.trim(); +} + +function getSearchResults(query) { + return searchIndex.search(query).flatMap((hit) => { + if (hit.ref == "undefined") return []; + let pageMatch = pagesIndex.filter((page) => page.href === hit.ref)[0]; + pageMatch.score = hit.score; + return [pageMatch]; + }); +} + +function renderSearchResults(query, results) { + clearSearchResults(); + updateSearchResults(query, results); +} + +function clearSearchResults() { + const results = document.querySelector("#search-results"); + while (results.firstChild) results.removeChild(results.firstChild); +} + +function updateSearchResults(query, results) { + document.getElementById("results-query").innerHTML = query; + document.querySelector("#search-results").innerHTML = results + .map( + (hit) => ` +
  • + ${createTitleBlurb(query, hit.title)} +

    ${createSearchResultBlurb(query, hit.content)}

    +
  • + ` + ) + .join(""); + const searchResultListItems = document.querySelectorAll("#search-results li"); + document.getElementById("results-count").innerHTML = searchResultListItems.length; + document.getElementById("results-count-text").innerHTML = searchResultListItems.length === 1 ? "result" : "results"; + // searchResultListItems.forEach( + // (li) => (li.firstElementChild.style.color = getColorForSearchResult(li.dataset.score)) + // ); +} + +function createTitleBlurb(query, title) { + const searchQueryRegex = new RegExp(createQueryStringRegex(query), "gmi"); + return title.replace( + searchQueryRegex, + "$&" + ) +} + +function createSearchResultBlurb(query, pageContent) { + const searchQueryRegex = new RegExp(createQueryStringRegex(query), "gmi"); + const searchQueryHits = Array.from( + pageContent.matchAll(searchQueryRegex), + (m) => m.index + ); + const sentenceBoundaries = Array.from( + pageContent.matchAll(SENTENCE_BOUNDARY_REGEX), + (m) => m.index + ); + let searchResultText = ""; + let lastEndOfSentence = 0; + for (const hitLocation of searchQueryHits) { + if (hitLocation > lastEndOfSentence) { + for (let i = 0; i < sentenceBoundaries.length; i++) { + if (sentenceBoundaries[i] > hitLocation) { + const startOfSentence = i > 0 ? sentenceBoundaries[i - 1] + 1 : 0; + const endOfSentence = sentenceBoundaries[i]; + lastEndOfSentence = endOfSentence; + parsedSentence = pageContent.slice(startOfSentence, endOfSentence).trim(); + searchResultText += `${parsedSentence} ... `; + break; + } + } + } + const searchResultWords = tokenize(searchResultText); + const pageBreakers = searchResultWords.filter((word) => word.length > 50); + if (pageBreakers.length > 0) { + searchResultText = fixPageBreakers(searchResultText, pageBreakers); + } + if (searchResultWords.length >= MAX_SUMMARY_LENGTH) break; + } + return ellipsize(searchResultText, MAX_SUMMARY_LENGTH).replace( + searchQueryRegex, + "$&" + ); +} + +function createQueryStringRegex(query) { + const searchTerms = query.split(" "); + if (searchTerms.length == 1) { + return query; + } + query = ""; + for (const term of searchTerms) { + query += `${term}|`; + } + query = query.slice(0, -1); + return `(${query})`; +} + +function tokenize(input) { + const wordMatches = Array.from(input.matchAll(WORD_REGEX), (m) => m); + return wordMatches.map((m) => ({ + word: m[0], + start: m.index, + end: m.index + m[0].length, + length: m[0].length, + })); +} + +function fixPageBreakers(input, largeWords) { + largeWords.forEach((word) => { + const chunked = chunkify(word.word, 20); + input = input.replace(word.word, chunked); + }); + return input; +} + +function chunkify(input, chunkSize) { + let output = ""; + let totalChunks = (input.length / chunkSize) | 0; + let lastChunkIsUneven = input.length % chunkSize > 0; + if (lastChunkIsUneven) { + totalChunks += 1; + } + for (let i = 0; i < totalChunks; i++) { + let start = i * chunkSize; + let end = start + chunkSize; + if (lastChunkIsUneven && i === totalChunks - 1) { + end = input.length; + } + output += input.slice(start, end) + " "; + } + return output; +} + +function ellipsize(input, maxLength) { + const words = tokenize(input); + if (words.length <= maxLength) { + return input; + } + return input.slice(0, words[maxLength].end) + "..."; +} + +if (!String.prototype.matchAll) { + String.prototype.matchAll = function (regex) { + "use strict"; + function ensureFlag(flags, flag) { + return flags.includes(flag) ? flags : flags + flag; + } + function* matchAll(str, regex) { + const localCopy = new RegExp(regex, ensureFlag(regex.flags, "g")); + let match; + while ((match = localCopy.exec(str))) { + match.index = localCopy.lastIndex - match[0].length; + yield match; + } + } + return matchAll(this, regex); + }; +} \ No newline at end of file diff --git a/hugo/assets/scss/base/links.scss b/hugo/assets/scss/base/links.scss deleted file mode 100644 index 67593a3..0000000 --- a/hugo/assets/scss/base/links.scss +++ /dev/null @@ -1,30 +0,0 @@ -a { - transition: all 0.1s ease-out; - @media (prefers-reduced-motion) { - transition: none; - } - &:link { - color: var(--link-color); - text-decoration-thickness: .125rem; - text-underline-offset: 0.125em; - text-decoration-skip-ink: none; - } - &:visited { - color: var(--link-visited); - } - &:focus { - outline: none; - background: var(--primary-accent); - color: var(--primary-accent-text); - padding: 4px; - border-radius: 2px; - text-decoration: none; - } - &:hover { - text-decoration-thickness: 0.25em; - text-underline-offset: 0.25em; - } - &:active { - - } - } \ No newline at end of file diff --git a/hugo/assets/scss/base/list.scss b/hugo/assets/scss/base/list.scss deleted file mode 100644 index 399da53..0000000 --- a/hugo/assets/scss/base/list.scss +++ /dev/null @@ -1,50 +0,0 @@ -.list { - .container { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); - gap: 3em; - } - .list-item { - color: inherit; - text-decoration: none; - transition: color 0.2s ease-in-out; - &__link { - display: block; - &:focus { - background: unset; - padding: unset; - @include focus-outline; - &:link { - color: var(--link-color); - } - &:visited { - color: var(--link-visited); - } - } - - &:hover { - } - - &:active { - - } - } - &__image { - width: 100%; - height: auto; - } - &__title { - font-size: 1.5em; - font-weight: 700; - margin: 1.5em 0 0.5em; - } - &__summary { - margin-bottom: 0.5em; - line-height: 1.4; - } - &__date { - display: block; - margin-bottom: 1em; - } - } -} \ No newline at end of file diff --git a/hugo/assets/scss/base/mixins.scss b/hugo/assets/scss/base/mixins.scss deleted file mode 100644 index 42ea976..0000000 --- a/hugo/assets/scss/base/mixins.scss +++ /dev/null @@ -1,42 +0,0 @@ -@mixin box-shadow { - box-shadow: 0 1px 1px rgba(0,0,0,0.11), - 0 2px 2px rgba(0,0,0,0.11), - 0 4px 4px rgba(0,0,0,0.11), - 0 6px 8px rgba(0,0,0,0.11), - 0 8px 16px rgba(0,0,0,0.11); -} - -@mixin box-shadow-heavy { - box-shadow: 0 2px 1px rgba(0,0,0,0.09), - 0 4px 2px rgba(0,0,0,0.09), - 0 8px 4px rgba(0,0,0,0.09), - 0 16px 8px rgba(0,0,0,0.09), - 0 32px 16px rgba(0,0,0,0.09); -} - -@mixin focus-outline { - outline: solid; - outline-color: var(--primary-accent); - outline-offset: 4px; -} - -@function css-function( $function, $values... ) { - @return - $function - + unquote( '(' ) - + $values - + unquote( ')' ) - ; -} - -@function css-min( $values... ) { - @return css-function( min, $values ); -} - -@function css-max( $values... ) { - @return css-function( max, $values ); -} - -@function css-clamp( $values... ) { - @return css-function( clamp, $values ); -} \ No newline at end of file diff --git a/hugo/assets/scss/base/page.scss b/hugo/assets/scss/base/page.scss deleted file mode 100644 index 38937ef..0000000 --- a/hugo/assets/scss/base/page.scss +++ /dev/null @@ -1,152 +0,0 @@ -.page-title {font-size: 2.5em; font-weight: 700} -.page { - font-size: 1em; - @media (min-width: 600px) {font-size: 1.25em;} - max-width: 960px; - margin: 0 auto; - @media (min-width: 960px) { - display: grid; - grid-template-columns: minmax(45ch,65ch) 1fr; - grid-template-rows: auto auto; - grid-template-areas: - "header header" - "content meta"; - } - .section { - padding: 1em 0; - grid-area: content; - - } - .page-header { - padding: 2em 0; - grid-area: header; - } - .meta { - grid-area: meta; - } - .page-summary {margin: 1em 0;} - .page-cover {width: 100%;} - - h1,h2,h3,h4,h5,h6 { - line-height: 1.2; - margin-bottom: 1rem; - margin-top: 2rem; - font-weight: 700; - } - p { - line-height: 1.4; - margin-bottom: 1em; - } - a {word-wrap: break-word;} - h1 {font-size: 2.49em} - h2 {font-size: 2.07em} - h3 {font-size: 1.728em} - h4 {font-size: 1.44em} - h5 {font-size: 1.2em} - h6 {font-size: 1em} - - h1 {font-size: 1.8em} - h2 {font-size: 1.600em} - h3 {font-size: 1.423em} - h4 {font-size: 1.265em} - h5 {font-size: 1.125em} - h6 {font-size: 1em} - - blockquote { - font-size: 1em; - margin: 1em 0; - border-left: 0.25rem solid black; - padding-left: 0.5em; - line-height: 1.4; - } - - pre { - font-family: monospace; - background: #333; - color: white; - padding: 1em; - line-height: 1.4; - overflow-x: scroll; - margin-bottom: 1em; - } - ul {list-style: disc; margin: 1em 0;} - li {margin-bottom: 1em; line-height: 1.4; margin-left: 1em;} - ol {list-style: decimal; margin: 1em 0;} - dl {margin: 1em 0; line-height: 1.4;} - dt {font-weight: 700;} - dd {margin-left: 1em;} - em {font-style: italic} - strong {font-weight: 700} - sup { - position: relative; - font-size: 0.8em; - a {position: relative; top: -0.5em;} - } - table { - text-align: center; - thead { - font-weight: 700; - } - th, td {border: 1px solid black; padding: 0.5em;} - } - figure { - img { - width: 100%; - margin-bottom: -0.125em; - } - figcaption { - background: #212121; - color: white; - font-style: italic; - padding: 1em; - font-size: 0.8em; - line-height: 1.2; - } - margin-bottom: 1em; - } - - img { - width: 100%; - margin-bottom: 1em; - } - -} - -.tags { - display: flex; - flex-flow: row wrap; - gap: 0.25em; - li { - list-style: none; - border-radius: 4px; - margin-left: 1em; - margin-bottom: 0; - } -} - -.meta .container {height: 100%; margin-top: 0.75rem;} -article .container *:first-child {margin-top: 0;} - -#TableOfContents { - position: sticky; - top: 2rem; - @media (min-width: 960px) {top: 96px;} - max-width: max-content; - font-size: 0.75em; - margin: 2em 0; - ul {list-style: none; margin: 0;} - li {margin-bottom: 0; margin-left: 0;} - li li {margin-left: 1em;} - a { - background: unset; - text-decoration-thickness: unset; - text-underline-offset: unset; - color: inherit; - text-decoration: none; - transition: color 0.2s ease-in-out; - &:hover { - color: #0060ff; - text-decoration: underline; - } - } -} \ No newline at end of file diff --git a/hugo/assets/scss/base/paper.scss b/hugo/assets/scss/base/paper.scss deleted file mode 100644 index 6940658..0000000 --- a/hugo/assets/scss/base/paper.scss +++ /dev/null @@ -1,22 +0,0 @@ -:root { - --paper-padding: 4em; -} - -body {position: relative;} -main {background: #ddd; z-index: 1; position: relative;} -main:before { - content: ''; - position: absolute; - width: calc(var(--container-width) + 2 * var(--paper-padding)); - height: 100%; - z-index: 0; - left: calc(50% - (var(--container-width) + 2 * var(--paper-padding)) / 2); - box-shadow: 0px 0px 6px rgba(0,0,0,0.2); - background: white; -} -footer {z-index: 1;} -main > * {position: relative; z-index: 1} - -.site-header {box-shadow: 0px 2px 6px rgba(0,0,0,0.2);} -.site-nav {box-shadow: 0px -2px 6px rgba(0,0,0,0.2);} -.site-footer {box-shadow: 0px -2px 3px rgba(0,0,0,0.2);} \ No newline at end of file diff --git a/hugo/assets/scss/base/sections.scss b/hugo/assets/scss/base/sections.scss deleted file mode 100644 index b7b5f7d..0000000 --- a/hugo/assets/scss/base/sections.scss +++ /dev/null @@ -1,21 +0,0 @@ -html { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - scroll-behavior: smooth; -} -body { - display: flex; - flex-flow: column; - min-height: calc(var(--vh, 1vh) * 100); -} -main {flex-grow: 1;} -.section { - padding: 2em 0; - @media (min-width: 600px) {padding: 3em 0} - @media (min-width: 62em) {padding: 4em 0} -} -.container { - width: 100%; - max-width: 960px; - margin: 0 auto; - padding: 0 1em; -} \ No newline at end of file diff --git a/hugo/assets/scss/base/variables.scss b/hugo/assets/scss/base/variables.scss deleted file mode 100644 index 215cf00..0000000 --- a/hugo/assets/scss/base/variables.scss +++ /dev/null @@ -1,14 +0,0 @@ -$container-width: 960px; -$nav-height: 4em; -$header-height: 4em; - -:root { - --container-width: #{$container-width}; - --nav-height: #{$nav-height}; - --header-height: #{$header-height}; - --link-color: rgb(0,96,255); - --link-visited: rgb(140, 74, 194); - --primary-accent: rgb(0,96,255); - --primary-accent-transparent: rgba(0,96,255,0.25); - --primary-accent-text: #fff; -} \ No newline at end of file diff --git a/hugo/assets/scss/components/button.scss b/hugo/assets/scss/components/button.scss deleted file mode 100644 index 14418aa..0000000 --- a/hugo/assets/scss/components/button.scss +++ /dev/null @@ -1,84 +0,0 @@ -.button { - width: 100%; - @media (min-width: 33.75em) { - width: max-content; - } - font-size: clamp(1em,2vw,1em); - padding: 1em; - display: flex; - justify-content: center; - align-items: center; - text-decoration: none; - border-radius: 0.25em; - font-weight: 700; - gap: 1em; - &:link { - - } - - &:visited { - - } - - &:focus { - padding: 1em; - border-radius: 0.25em; - @include focus-outline; - } - - &:hover { - - } - - &:active { - - } -} - -.button.primary { - background: var(--primary-accent); - color: var(--primary-accent-text); - &:link { - - } - - &:visited { - - } - - &:focus { - - } - - &:hover { - background: var(--primary-accent-transparent); - } - - &:active { - - } -} -.button.secondary { - background: white; - border: 2px solid var(--primary-accent); - color: var(--primary-accent); - &:link { - - } - - &:visited { - - } - - &:focus { - - } - - &:hover { - background: var(--primary-accent-transparent); - } - - &:active { - - } -} \ No newline at end of file diff --git a/hugo/assets/scss/components/pullquote.scss b/hugo/assets/scss/components/pullquote.scss deleted file mode 100644 index 9cfa309..0000000 --- a/hugo/assets/scss/components/pullquote.scss +++ /dev/null @@ -1,20 +0,0 @@ -@mixin pullquote { - content: attr(data-pullquote); - font-size: 1em; - line-height: 1.2; - display: flex; - font-family: serif; - color: #555; - padding: 1em; - font-size: 1.25em; -} -.has-pullquote{ - &.before:before { - @include pullquote; - margin-bottom: 1rem; - } - &.after:after { - @include pullquote; - margin-top: 1rem; - } -} \ No newline at end of file diff --git a/hugo/assets/scss/content/index.scss b/hugo/assets/scss/content/index.scss deleted file mode 100644 index ddee674..0000000 --- a/hugo/assets/scss/content/index.scss +++ /dev/null @@ -1,72 +0,0 @@ -#index { - .h-feed { - display: grid; - overflow: auto; - .heading { - font-size: 1.5em; - font-weight: 700; - margin: 1em 0; - } - hr { - margin: 0; - } - } - .h-card { - place-self: center; - max-width: 60ch; - width: 100%; - } - .h-entry { - margin: 1em 0; - padding: 1em 0; - header { - display: flex; - align-items: center; - gap: 1em; - margin-bottom: 0.5em; - .icon { - padding: 0.5rem; - display: inline-flex; - background: black; - border-radius: 100em; - svg { - width: 20px; - height: 20px; - fill: white; - } - } - } - } - .reply { - line-height: 1.5; - - .p-name { - margin-bottom: 1em; - display: flex; - align-items: center; - gap: 0.5em; - - .u-url { - - } - } - .p-summary { - font-style: italic; - } - .meta { - margin-top: 1em; - } - } - .note { - line-height: 1.5; - .e-content { - font-size: 1.2em; - p { - margin: 1em 0; - } - } - .meta { - margin-top: 1em; - } - } -} \ No newline at end of file diff --git a/hugo/assets/scss/libraries/photoswipe.scss b/hugo/assets/scss/libraries/photoswipe.scss deleted file mode 100644 index fb9f3e8..0000000 --- a/hugo/assets/scss/libraries/photoswipe.scss +++ /dev/null @@ -1,663 +0,0 @@ -/*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */ -/* - Styles for basic PhotoSwipe functionality (sliding area, open/close transitions) -*/ -/* pswp = photoswipe */ -.pswp { - display: none; - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - overflow: hidden; - -ms-touch-action: none; - touch-action: none; - z-index: 1500; - -webkit-text-size-adjust: 100%; - /* create separate layer, to avoid paint on window.onscroll in webkit/blink */ - -webkit-backface-visibility: hidden; - outline: none; } - .pswp * { - -webkit-box-sizing: border-box; - box-sizing: border-box; } - .pswp img { - max-width: none; } - - /* style is added when JS option showHideOpacity is set to true */ - .pswp--animate_opacity { - /* 0.001, because opacity:0 doesn't trigger Paint action, which causes lag at start of transition */ - opacity: 0.001; - will-change: opacity; - /* for open/close transition */ - -webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); - transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); } - - .pswp--open { - display: block; } - - .pswp--zoom-allowed .pswp__img { - /* autoprefixer: off */ - cursor: -webkit-zoom-in; - cursor: -moz-zoom-in; - cursor: zoom-in; } - - .pswp--zoomed-in .pswp__img { - /* autoprefixer: off */ - cursor: -webkit-grab; - cursor: -moz-grab; - cursor: grab; } - - .pswp--dragging .pswp__img { - /* autoprefixer: off */ - cursor: -webkit-grabbing; - cursor: -moz-grabbing; - cursor: grabbing; } - - /* - Background is added as a separate element. - As animating opacity is much faster than animating rgba() background-color. - */ - .pswp__bg { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - background: #000; - opacity: 0; - -webkit-transform: translateZ(0); - transform: translateZ(0); - -webkit-backface-visibility: hidden; - will-change: opacity; } - - .pswp__scroll-wrap { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - overflow: hidden; } - - .pswp__container, - .pswp__zoom-wrap { - -ms-touch-action: none; - touch-action: none; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; } - - /* Prevent selection and tap highlights */ - .pswp__container, - .pswp__img { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-tap-highlight-color: transparent; - -webkit-touch-callout: none; } - - .pswp__zoom-wrap { - position: absolute; - width: 100%; - -webkit-transform-origin: left top; - -ms-transform-origin: left top; - transform-origin: left top; - /* for open/close transition */ - -webkit-transition: -webkit-transform 333ms cubic-bezier(0.4, 0, 0.22, 1); - transition: transform 333ms cubic-bezier(0.4, 0, 0.22, 1); } - - .pswp__bg { - will-change: opacity; - /* for open/close transition */ - -webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); - transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1); } - - .pswp--animated-in .pswp__bg, - .pswp--animated-in .pswp__zoom-wrap { - -webkit-transition: none; - transition: none; } - - .pswp__container, - .pswp__zoom-wrap { - -webkit-backface-visibility: hidden; } - - .pswp__item { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - overflow: hidden; } - - .pswp__img { - position: absolute; - width: auto; - height: auto; - top: 0; - left: 0; } - - /* - stretched thumbnail or div placeholder element (see below) - style is added to avoid flickering in webkit/blink when layers overlap - */ - .pswp__img--placeholder { - -webkit-backface-visibility: hidden; } - - /* - div element that matches size of large image - large image loads on top of it - */ - .pswp__img--placeholder--blank { - background: #222; } - - .pswp--ie .pswp__img { - width: 100% !important; - height: auto !important; - left: 0; - top: 0; } - - /* - Error message appears when image is not loaded - (JS option errorMsg controls markup) - */ - .pswp__error-msg { - position: absolute; - left: 0; - top: 50%; - width: 100%; - text-align: center; - font-size: 14px; - line-height: 16px; - margin-top: -8px; - color: #CCC; } - - .pswp__error-msg a { - color: #CCC; - text-decoration: underline; } - -/*! PhotoSwipe Default UI CSS by Dmitry Semenov | photoswipe.com | MIT license */ -/* - - Contents: - - 1. Buttons - 2. Share modal and links - 3. Index indicator ("1 of X" counter) - 4. Caption - 5. Loading indicator - 6. Additional styles (root element, top bar, idle state, hidden state, etc.) - -*/ -/* - - 1. Buttons - - */ -/*