UNPKG

theophile

Version:

A templating module that transforms a web page into a (Powerpoint-like) presentation

400 lines (387 loc) 9.52 kB
:root { --th-slide-ratio: 1.78; --th-slide-nlines: 18; } .th-slideshow > *:not(.th-slide-backdrop):not(#th-contactsheet) { display: none !important; } .th-slideshow > .th-slide-backdrop { display: flex; } .th-slideshow .th-slide { --font-size: calc(100vw / (var(--th-slide-nlines) * var(--th-slide-ratio))); font-size: var(--font-size); } .th-slideshow .th-web-only { display: none; } body:not(.th-slideshow) .th-slide-only { display: none; } .th-slide-backdrop { align-items: center; justify-content: center; overflow: hidden; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-image: repeating-linear-gradient(to right, hsl(340, 100%, 20%), hsl(340, 100%, 23%), hsl(340, 100%, 20%), hsl(340, 100%, 17%) 4.5%, hsl(340, 100%, 20%) 5%); display: grid; justify-items: center; align-content: center; } .th-slide-backdrop .th-only-screen { display: none; } .th-slide { background-color: black; color: white; width: calc(1em * var(--th-slide-nlines) * var(--th-slide-ratio)); height: calc(1em * var(--th-slide-nlines)); display: grid; grid-template-rows: auto 1fr auto; align-content: space-between; position: relative; box-sizing: border-box; } .th-slide > header { padding: 0 1ch; order: -1000; display: flex; align-items: baseline; gap: 1ch; } .th-slide > header h1, .th-slide > header h2, .th-slide > header h3, .th-slide > header p { margin: 0 !important; font-size: inherit !important; background: none !important; } .th-slide > footer { order: 1000; padding: 0 1ch; } .th-slide > .th-slide-body { padding: 1em; overflow: auto; display: grid; align-content: center; justify-content: center; } .th-slide > .th-slide-body > :first-child { margin-top: 0; } .th-slide > .th-slide-body > :last-child { margin-bottom: 0; } .th-slide.th-slide-no-header, .th-slide.th-slide-full { grid-template-rows: 1fr auto; } .th-slide.th-slide-no-header > header, .th-slide.th-slide-full > header { display: none; } .th-slide.th-slide-no-footer { grid-template-rows: auto 1fr; } .th-slide.th-slide-no-footer > footer { display: none; } .th-slide.th-slide-no-header.th-slide-no-footer { grid-template-rows: 1fr; } .th-slide iframe[src^=http], .th-slide iframe[src^="data:"], .th-slide object[data^=http], .th-slide object[data^="data:"] { pointer-events: none; } .th-slide.th-slide-continued > header > :last-child::after { font-size: 0.6em; margin-left: 1ch; content: "...continued"; } .th-slide-navigation { position: fixed; top: 0; bottom: 0; left: 0; right: 0; z-index: 1000; display: grid; grid-template-columns: 15px min-content 1fr min-content 15px; grid-template-rows: min-content 1fr min-content; pointer-events: none; } .th-slide-navigation > * { pointer-events: all; display: flex; align-items: center; justify-content: center; font-family: "Material Icons"; opacity: 0; color: white; text-shadow: 0.1em 0.1em 0.1em rgba(0, 0, 0, 0.5333333333); position: relative; transition-property: opacity; transition-duration: 0.5s; } .th-slide-navigation > *:hover { opacity: 1; } .th-slide-navigation .th-slide-previous { background-image: linear-gradient(to left, rgba(136, 136, 136, 0), rgba(136, 136, 136, 0.8)); grid-row: 1/-1; grid-column: 1/span 2; font-size: 6vmax; } .th-slide-navigation .th-slide-previous::before { content: "arrow_back"; } .th-slide-navigation .th-slide-next { background-image: linear-gradient(to right, rgba(136, 136, 136, 0), rgba(136, 136, 136, 0.8)); grid-row: 1/-1; grid-column: -3/span 2; font-size: 6vmax; } .th-slide-navigation .th-slide-next::before { content: "arrow_forward"; } .th-slide-navigation .th-slide-first, .th-slide-navigation .th-slide-last { grid-row: 1/-1; font-size: 6vmax; } .th-slide-navigation .th-slide-first::before, .th-slide-navigation .th-slide-last::before { position: absolute; } .th-slide-navigation .th-slide-first:not(:hover)::before, .th-slide-navigation .th-slide-last:not(:hover)::before { display: none; } .th-slide-navigation .th-slide-first { background-image: linear-gradient(to left, rgba(136, 136, 136, 0), #888888); grid-column: 1/span 1; justify-content: start; } .th-slide-navigation .th-slide-first::before { content: "first_page"; } .th-slide-navigation .th-slide-last { background-image: linear-gradient(to right, rgba(136, 136, 136, 0), #888888); grid-column: -2/span 1; justify-content: end; } .th-slide-navigation .th-slide-last::before { content: "last_page"; } .th-slide-navigation .th-slide-options { background-image: linear-gradient(to bottom, rgba(136, 136, 136, 0), rgba(136, 136, 136, 0.8)); grid-row: -2/span 1; grid-column: 1/-1; align-items: stretch; } .th-slide-navigation .th-slide-options > * { padding: 0.25em; cursor: pointer; flex: 1 0 1.5em; gap: 1em; opacity: 0.5; display: flex; align-items: center; justify-content: center; } .th-slide-navigation .th-slide-options > *:hover { opacity: 1; background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2666666667)); } .th-slide-navigation .th-slide-options .th-option-contactsheet::before { content: "calendar_view_month"; } .th-slide-navigation .th-slide-options .th-option-stopslideshow { flex-grow: 0; } .th-slide-navigation .th-slide-options .th-option-stopslideshow::before { content: "cancel_presentation"; } .th-slide-navigation .th-slide-options .th-option-slideshow::before { content: "crop_16_9"; } .th-slide-navigation .th-slide-options .th-option-continous::before { content: "splitscreen"; } .th-slide-navigation .th-slide-options .th-option-print::before { content: "print"; } .th-slide-navigation .th-slide-options .th-option-menu { flex-grow: 0; } .th-slide-navigation .th-slide-options .th-option-menu::before { content: "menu"; } .th-slide-number { display: flex; align-items: center; gap: 0.25ch; justify-content: end; } .th-slide-number::after { font-family: Material Icons; display: flex; align-items: center; justify-content: center; width: 1.5em; height: 1em; } .th-slide-number::after { content: "auto_stories"; } .th-slide-clock::after { content: "schedule"; } .th-slide-time::after { content: "watch"; } .th-slideshow-time::after { content: "av_timer"; } .th-slide-status { width: 6ch; color: rgba(255, 255, 255, 0.1333333333); cursor: pointer; } .th-slide-status > * { display: flex; align-items: center; gap: 0.25ch; justify-content: end; } .th-slide-status > *::after { font-family: Material Icons; display: flex; align-items: center; justify-content: center; width: 1.5em; height: 1em; } .th-slide-feedback { --size: 0.25in; background-color: rgba(255, 255, 255, 0.1333333333); position: absolute; padding: var(--size); border-radius: var(--size); margin-top: calc(-1 * var(--size)); margin-left: -var(--size); box-shadow: inset 0 0 var(--size) rgba(255, 255, 255, 0.3333333333); mix-blend-mode: exclusion; } :root.th-contactsheet .th-slide-navigation { display: none; } #th-contactsheet { position: absolute; background-color: rgba(255, 255, 0, 0.2); top: 0; right: 0; bottom: 0; left: 0; display: grid; padding: 1em; grid-template-columns: 100%; grid-template-rows: 100%; align-content: stretch; justify-content: stretch; } #th-contactsheet > .th-contactsheet-container { box-sizing: border-box; padding: 0.5em; border-radius: 1em; border: 2px solid #222; box-shadow: inset 2px 2px 4px black; background-color: #303030; background-image: repeating-linear-gradient(-45deg, transparent, transparent 0.25em, rgba(0, 0, 0, 0.2) 0.25em, rgba(0, 0, 0, 0.2) 0.5em); } #th-contactsheet div.th-contactsheet-grid { box-sizing: border-box; overflow-y: auto; outline: none; scroll-behavior: smooth; display: grid; gap: 0.5em 1ch; grid-template-columns: repeat(auto-fill, 169px); justify-content: space-around; height: 100%; padding: 0.5em 0.5em; } #th-contactsheet div.th-contactsheet-thumbnail { display: flex; align-items: center; flex-direction: column; position: relative; } #th-contactsheet div.th-contactsheet-caption { display: grid; grid-template-columns: 1fr auto; gap: 1ch; font-size: 12px; } #th-contactsheet div.th-contactsheet-number { display: flex; align-items: end; justify-content: center; grid-template-columns: 1fr auto; gap: 1ch; font-size: 12px; top: 0; right: 0; position: absolute; background-color: yellow; width: 4ch; border-bottom-left-radius: 0.5em; border-bottom-right-radius: 0.5em; color: black; box-shadow: 0 1px 1px black; font-weight: bold; line-height: 1; height: 2em; padding-bottom: 0.1em; } #th-contactsheet .th-slide { --font-size: 5px; pointer-events: none; } #th-contactsheet .th-slide-body { overflow: hidden; } #th-contactsheet .th-contactsheet-group { grid-column: 1; } #th-contactsheet .th-contactsheet-current { outline: solid 3px yellow; transform: scale(1.1); } #th-contactsheet .th-contactsheet-exit-btn { position: absolute; background-color: white; color: black; top: 0.75em; right: 0.75em; width: 1em; height: 1em; display: flex; align-items: center; justify-content: center; border-radius: 50%; opacity: 0.5; } #th-contactsheet .th-contactsheet-exit-btn:hover { opacity: 1; } #th-contactsheet .th-contactsheet-exit-btn::before { content: "close"; font-family: "Material Icons"; }