From 8fc6e1553281617535233fc45994b44fdf910768 Mon Sep 17 00:00:00 2001 From: Steel Wagstaff Date: Tue, 6 Jul 2021 12:08:08 -0700 Subject: [PATCH] Update version & pressbooks-build-tools compatibility (#795) * Update version & changelog * Fix typo * Update Buckram version * Update to use Mix 6 and lint * Disable eslint nags * Update localizations * Update style.css Update version for next release * Update README.md Update readme * Update localizations Co-authored-by: Ho Man Chan --- README.md | 8 +- assets/src/scripts/book.js | 2 +- assets/src/scripts/collapse-sections.js | 6 + assets/src/scripts/pane.js | 8 +- assets/src/scripts/routes/common.js | 19 ++ assets/src/scripts/util/Router.js | 12 +- assets/src/scripts/util/camelCase.js | 4 +- dist/mix-manifest.json | 108 ++++++++++- dist/scripts/book.js | 2 +- dist/scripts/collapse-sections.js | 2 +- dist/scripts/details-element-polyfill.js | 2 +- dist/scripts/lightbox.js | 2 +- dist/scripts/lity.js | 2 +- dist/scripts/pane.js | 2 +- dist/styles/book.css | 2 +- dist/styles/lity.css | 199 +------------------- dist/styles/web-house-style.css | 2 +- languages/bg_BG.mo | Bin 12442 -> 12442 bytes languages/bg_BG.po | 4 +- languages/de_DE.mo | Bin 10258 -> 10258 bytes languages/de_DE.po | 4 +- languages/en_GB.mo | Bin 10389 -> 10389 bytes languages/en_GB.po | 4 +- languages/es_CR.mo | Bin 10864 -> 10864 bytes languages/es_CR.po | 4 +- languages/es_ES.mo | Bin 10960 -> 10960 bytes languages/es_ES.po | 4 +- languages/fr_FR.mo | Bin 10781 -> 10781 bytes languages/fr_FR.po | 4 +- languages/he.mo | Bin 3328 -> 3328 bytes languages/he.po | 4 +- languages/hr.mo | Bin 10020 -> 10020 bytes languages/hr.po | 4 +- languages/lv.mo | Bin 6517 -> 6517 bytes languages/lv.po | 4 +- languages/nl_NL.mo | Bin 10370 -> 10370 bytes languages/nl_NL.po | 4 +- languages/pl.mo | Bin 5340 -> 5340 bytes languages/pl.po | 4 +- languages/pressbooks-book.pot | 4 +- languages/ru_RU.mo | Bin 8727 -> 8727 bytes languages/ru_RU.po | 4 +- languages/tr_TR.mo | Bin 10694 -> 10694 bytes languages/tr_TR.po | 4 +- package.json | 15 +- packages/buckram/CHANGELOG.md | 7 + packages/buckram/assets/styles/buckram.scss | 2 +- packages/buckram/package-lock.json | 2 +- packages/buckram/package.json | 2 +- style.css | 2 +- webpack.mix.js | 25 +-- 51 files changed, 209 insertions(+), 284 deletions(-) diff --git a/README.md b/README.md index d60bb8c48..806a8f740 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ This theme is named after Canadian media theorist Marshall McLuhan, who coined t ## Requirements * PHP >= 7.3 -* WordPress >= 5.6.2 -* Pressbooks >= 5.20.0 +* WordPress >= 5.7.2 +* Pressbooks >= 5.24.0 ## Installation @@ -41,7 +41,7 @@ Then, from the GitHub Updater interface, navigate to the "Install Theme" tab. En ## Changelog -### 2.11.2 +### 2.11.3 -* See: https://github.com/pressbooks/pressbooks-book/releases/tag/2.11.2 +* See: https://github.com/pressbooks/pressbooks-book/releases/tag/2.11.3 * Full release history available at: https://github.com/pressbooks/pressbooks-book/releases diff --git a/assets/src/scripts/book.js b/assets/src/scripts/book.js index 791cbda94..6e1b65223 100644 --- a/assets/src/scripts/book.js +++ b/assets/src/scripts/book.js @@ -1,10 +1,10 @@ // import external dependencies // import local dependencies -import Router from './util/Router'; import common from './routes/common'; import home from './routes/home'; import single from './routes/single'; +import Router from './util/Router'; /** Populate Router instance with DOM routes */ const routes = new Router( { diff --git a/assets/src/scripts/collapse-sections.js b/assets/src/scripts/collapse-sections.js index 7be97647a..8f48be76b 100644 --- a/assets/src/scripts/collapse-sections.js +++ b/assets/src/scripts/collapse-sections.js @@ -43,6 +43,9 @@ document.addEventListener( 'DOMContentLoaded', function () { // Function to create a node list // of the content between this

and the next + /** + * @param elem + */ const getContent = elem => { let elems = []; while ( @@ -82,6 +85,9 @@ document.addEventListener( 'DOMContentLoaded', function () { // Assign the button let btn = heading.querySelector( 'button' ); + /** + * + */ btn.onclick = () => { // Cast the state as a boolean let expanded = btn.getAttribute( 'aria-expanded' ) === 'true' || false; diff --git a/assets/src/scripts/pane.js b/assets/src/scripts/pane.js index 7a641d688..c3624ed60 100644 --- a/assets/src/scripts/pane.js +++ b/assets/src/scripts/pane.js @@ -1,7 +1,13 @@ +/** + * + */ window.hypothesisConfig = () => { return { openSidebar: ( pressbooksHypothesis.openSidebar === '1' ) ? true : false, showHighlights: ( pressbooksHypothesis.showHighlights === '1' ) ? true : false, + /** + * @param layoutParams + */ onLayoutChange: layoutParams => { const navReading = document.querySelector( '.nav-reading' ); if ( layoutParams.expanded === true ) { @@ -20,5 +26,5 @@ window.hypothesisConfig = () => { } } }, - } + }; }; diff --git a/assets/src/scripts/routes/common.js b/assets/src/scripts/routes/common.js index f735ab09e..106db0c7d 100644 --- a/assets/src/scripts/routes/common.js +++ b/assets/src/scripts/routes/common.js @@ -1,4 +1,8 @@ +/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */ export default { + /** + * + */ init() { // JavaScript to be fired on all pages document.body.classList.remove( 'no-js' ); @@ -66,6 +70,9 @@ export default { // Handle list items and events Array.prototype.forEach.call( links, link => { // Collapse the content menu if user tabs out. + /** + * @param e + */ link.onblur = e => { if ( link === links[links.length - 1] && e.relatedTarget.parentNode.nodeName !== 'LI' ) { btn.setAttribute( 'aria-expanded', false ); @@ -92,6 +99,9 @@ export default { } } ); + /** + * @param e + */ document.onclick = e => { const downloadClass = 'book-header__cover__downloads'; const $target = jQuery( e.target ); @@ -109,6 +119,9 @@ export default { } }; + /** + * @param e + */ document.onkeydown = e => { // Hide the content when 'Esc' key is pressed (and content is showing) if ( e.which === 27 && ! content.hidden ) { @@ -154,6 +167,9 @@ export default { // Assign the button let btn = entityTitle.querySelector( 'button' ); + /** + * + */ btn.onclick = () => { // Cast the state as a boolean let expanded = btn.getAttribute( 'aria-expanded' ) === 'true' || false; @@ -201,6 +217,9 @@ export default { } ); }, + /** + * + */ finalize() { // JavaScript to be fired on all pages, after page specific JS is fired }, diff --git a/assets/src/scripts/util/Router.js b/assets/src/scripts/util/Router.js index 0e4281e2a..264d048a3 100644 --- a/assets/src/scripts/util/Router.js +++ b/assets/src/scripts/util/Router.js @@ -11,7 +11,8 @@ import camelCase from './camelCase'; class Router { /** * Create a new Router - * @param {Object} routes + * + * @param {object} routes */ constructor( routes ) { this.routes = routes; @@ -19,6 +20,7 @@ class Router { /** * Fire Router events + * * @param {string} route DOM-based route derived from body classes (``) * @param {string} [event] Events on the route. By default, `init` and `finalize` events are called. * @param {string} [arg] Any custom argument to be passed to the event. @@ -37,10 +39,10 @@ class Router { * Automatically load and fire Router events * * Events are fired in the following order: - * * common init - * * page-specific init - * * page-specific finalize - * * common finalize + * common init + * page-specific init + * page-specific finalize + * common finalize */ loadEvents() { // Fire common init JS diff --git a/assets/src/scripts/util/camelCase.js b/assets/src/scripts/util/camelCase.js index fac85dfc7..c6097ccc4 100644 --- a/assets/src/scripts/util/camelCase.js +++ b/assets/src/scripts/util/camelCase.js @@ -1,7 +1,9 @@ +/* eslint import/no-anonymous-default-export: [2, {"allowArrowFunction": true}] */ /** * the most terrible camelizer on the internet, guaranteed! + * * @param {string} str String that isn't camel-case, e.g., CAMeL_CaSEiS-harD - * @return {string} String converted to camel-case, e.g., camelCaseIsHard + * @returns {string} String converted to camel-case, e.g., camelCaseIsHard */ export default str => `${str.charAt( 0 ).toLowerCase()}${str.replace( /[\W_]/g, '|' ).split( '|' ) .map( part => `${part.charAt( 0 ).toUpperCase()}${part.slice( 1 )}` ) diff --git a/dist/mix-manifest.json b/dist/mix-manifest.json index 96f689b27..567f165d0 100644 --- a/dist/mix-manifest.json +++ b/dist/mix-manifest.json @@ -1,12 +1,106 @@ { - "/scripts/book.js": "/scripts/book.js?id=af07185482a38384a7bf", - "/styles/book.css": "/styles/book.css?id=3cbb775c3b4e63c64468", - "/styles/web-house-style.css": "/styles/web-house-style.css?id=d3c1aedc7525b0f30ccd", - "/scripts/collapse-sections.js": "/scripts/collapse-sections.js?id=ba8eb815cea5fd273013", - "/scripts/lightbox.js": "/scripts/lightbox.js?id=f3698731576f981b3aa8", - "/scripts/pane.js": "/scripts/pane.js?id=4173f00e886097d83339", + "/scripts/book.js": "/scripts/book.js?id=f97a2577f4e0b419ab12", + "/scripts/pane.js": "/scripts/pane.js?id=7e5b385cb135973c79f7", + "/scripts/collapse-sections.js": "/scripts/collapse-sections.js?id=83a9f50d491bda850fbc", + "/scripts/lightbox.js": "/scripts/lightbox.js?id=cb2b7b2a5fb303c3095d", + "/styles/web-house-style.css": "/styles/web-house-style.css?id=f2ec506de7eae2e9ddc5", + "/styles/book.css": "/styles/book.css?id=4bdd582985aebfe20328", "/scripts/sharer.js": "/scripts/sharer.js?id=40da80ac58b2606eaedf", "/scripts/lity.js": "/scripts/lity.js?id=57482ac9aa162ba60708", "/scripts/details-element-polyfill.js": "/scripts/details-element-polyfill.js?id=60ad7c2161011e153d53", - "/styles/lity.css": "/styles/lity.css?id=9fc32fbde0b6f07a3ced" + "/styles/lity.css": "/styles/lity.css?id=9fc32fbde0b6f07a3ced", + "/images/amazon.png": "/images/amazon.png?id=800edd49516c95950aaf", + "/images/android-chrome-192x192.png": "/images/android-chrome-192x192.png?id=d3a1f2244b2f7abba374", + "/images/android-chrome-512x512.png": "/images/android-chrome-512x512.png?id=e5ca2f211159d7d43b26", + "/images/apple-touch-icon-120x120.png": "/images/apple-touch-icon-120x120.png?id=0056597639528e87f658", + "/images/apple-touch-icon-152x152.png": "/images/apple-touch-icon-152x152.png?id=19875d7ed3bc5c0ee970", + "/images/apple-touch-icon-180x180.png": "/images/apple-touch-icon-180x180.png?id=649d9918ed6dc0385895", + "/images/apple-touch-icon-60x60.png": "/images/apple-touch-icon-60x60.png?id=1a84de4d2c1f6c6bab46", + "/images/apple-touch-icon-76x76.png": "/images/apple-touch-icon-76x76.png?id=337b96a38827de76d2af", + "/images/apple-touch-icon.png": "/images/apple-touch-icon.png?id=649d9918ed6dc0385895", + "/images/asterisk.png": "/images/asterisk.png?id=574f731dcd3c5a4a462c", + "/images/barnes-and-noble.png": "/images/barnes-and-noble.png?id=3d0eb1de8fcf7f7705e3", + "/images/bg.png": "/images/bg.png?id=be16824e61a1c68f60a9", + "/images/blockquote-close.png": "/images/blockquote-close.png?id=7a2e053ceb8d0aee35c2", + "/images/blockquote-open.png": "/images/blockquote-open.png?id=900534c5c993f32d75fc", + "/images/book-info-detail.png": "/images/book-info-detail.png?id=41a1a3f3b73417c7b984", + "/images/book-info-stroke.png": "/images/book-info-stroke.png?id=ba2ffb1983ef06bb2b63", + "/images/buy-page-border-bottom-stroke.png": "/images/buy-page-border-bottom-stroke.png?id=5965d387f2781b3872b8", + "/images/by.svg": "/images/by.svg?id=7813b5794d8ba96aec20", + "/images/cc.svg": "/images/cc.svg?id=e3defa79f640d165173a", + "/images/em-dash.png": "/images/em-dash.png?id=e1962cf9acd587c8e8de", + "/images/epub-36.png": "/images/epub-36.png?id=75abde76f471b3f876cc", + "/images/epub-48.png": "/images/epub-48.png?id=74455b89af304d08cf1a", + "/images/epub-72.png": "/images/epub-72.png?id=cf929c4b6062eda850b9", + "/images/epub-96.png": "/images/epub-96.png?id=323850d19c2aaf13c568", + "/images/epub3-36.png": "/images/epub3-36.png?id=f1d1c2f13ac265913d1c", + "/images/epub3-48.png": "/images/epub3-48.png?id=acbd1ebb656d94d6b63d", + "/images/epub3-72.png": "/images/epub3-72.png?id=59467439597843410ebc", + "/images/epub3-96.png": "/images/epub3-96.png?id=55a03ff97534a7074b0b", + "/images/facebook-icon.png": "/images/facebook-icon.png?id=a0073ec3a8c90a012bc5", + "/images/favicon-16x16.png": "/images/favicon-16x16.png?id=454616a9f8584e8da1f0", + "/images/favicon-32x32.png": "/images/favicon-32x32.png?id=a6aaebb716b6ea46273f", + "/images/favicon.ico": "/images/favicon.ico?id=0c56238d5180176e5917", + "/images/footer-inner.png": "/images/footer-inner.png?id=b6238761317ce72ac352", + "/images/footer-shadow.png": "/images/footer-shadow.png?id=a1212f13533bbd741fbe", + "/images/google-plus-icon.png": "/images/google-plus-icon.png?id=3a8b54c93cc8975f0d9e", + "/images/ibooks.png": "/images/ibooks.png?id=a8a2dbb70773853ebc6b", + "/images/icml-36.png": "/images/icml-36.png?id=2d89e18440d4b8da476a", + "/images/icml-48.png": "/images/icml-48.png?id=5beaa6e95ab74a585dff", + "/images/icml-72.png": "/images/icml-72.png?id=624b62758f11d5eda43a", + "/images/icml-96.png": "/images/icml-96.png?id=e237bb6dc0c9d3d2da57", + "/images/jpg-36.png": "/images/jpg-36.png?id=21cb4555794bb1a611d5", + "/images/jpg-48.png": "/images/jpg-48.png?id=818f82c0f89155af5504", + "/images/jpg-72.png": "/images/jpg-72.png?id=ee928eee12b33af39c34", + "/images/jpg-96.png": "/images/jpg-96.png?id=46b82276430d098f27de", + "/images/kobo.png": "/images/kobo.png?id=1d0affb385b3b0dfd081", + "/images/login-formwrap.png": "/images/login-formwrap.png?id=47b07b7de9597420046f", + "/images/logo-login.png": "/images/logo-login.png?id=59b5464065612a7221d4", + "/images/mobi-36.png": "/images/mobi-36.png?id=49f06b9a43a158122ee5", + "/images/mobi-48.png": "/images/mobi-48.png?id=525046825b33acfff52d", + "/images/mobi-72.png": "/images/mobi-72.png?id=53512bd9f520a8886aae", + "/images/mobi-96.png": "/images/mobi-96.png?id=06ee2b29236fdf919af2", + "/images/mstile-144x144.png": "/images/mstile-144x144.png?id=94ba7618c01973460be6", + "/images/mstile-150x150.png": "/images/mstile-150x150.png?id=0471d5dac60a846dddfd", + "/images/mstile-310x150.png": "/images/mstile-310x150.png?id=7d2e1d9397bfa34b44e3", + "/images/mstile-310x310.png": "/images/mstile-310x310.png?id=a0ebc01ec5b581e4a012", + "/images/mstile-70x70.png": "/images/mstile-70x70.png?id=18d3275b663e12fe7534", + "/images/nc.svg": "/images/nc.svg?id=e378f908a7f49e2a3812", + "/images/nd.svg": "/images/nd.svg?id=81b46c341b114ea96a5c", + "/images/odt-36.png": "/images/odt-36.png?id=f11a0f89bd448fc7742f", + "/images/odt-48.png": "/images/odt-48.png?id=45b80fb4b9184d5a75d5", + "/images/odt-72.png": "/images/odt-72.png?id=0a1db47f9479358d3883", + "/images/odt-96.png": "/images/odt-96.png?id=d0d502a47b1d6aeef3c7", + "/images/oreilly.png": "/images/oreilly.png?id=11cc749c91fdf936cd2c", + "/images/pdf-36.png": "/images/pdf-36.png?id=c6d9e4fd7bbd0d81f33a", + "/images/pdf-48.png": "/images/pdf-48.png?id=0652db008a130af18473", + "/images/pdf-72.png": "/images/pdf-72.png?id=4af572cf75d29b9efb24", + "/images/pdf-96.png": "/images/pdf-96.png?id=6a7b4a0041cf18aaca6b", + "/images/pressbooks-branding-2x.png": "/images/pressbooks-branding-2x.png?id=55fa2aae7decbf404ade", + "/images/pressbooks-branding.png": "/images/pressbooks-branding.png?id=0ae8f99cf89bd9ed301d", + "/images/pressbooks-logo.svg": "/images/pressbooks-logo.svg?id=54f98c061a5ecdfd77d3", + "/images/print-pdf-36.png": "/images/print-pdf-36.png?id=378d2a9d718dbcabee64", + "/images/print-pdf-48.png": "/images/print-pdf-48.png?id=100556ba19e22bbdc7a7", + "/images/print-pdf-72.png": "/images/print-pdf-72.png?id=40a454e46c7e77b50cf5", + "/images/print-pdf-96.png": "/images/print-pdf-96.png?id=b041015b682dcab185df", + "/images/publicdomain.svg": "/images/publicdomain.svg?id=c2b57d946c5ce46a5fd2", + "/images/remix.svg": "/images/remix.svg?id=5d817e37e145f6a5b3af", + "/images/sa.svg": "/images/sa.svg?id=978acd9d54dfd3c39cd9", + "/images/safari-pinned-tab.svg": "/images/safari-pinned-tab.svg?id=fdc3041c7198fae52920", + "/images/share.svg": "/images/share.svg?id=fb8bd57a03731cfffe4d", + "/images/sprite-book-info.png": "/images/sprite-book-info.png?id=f0e7ea508b404bc5ca24", + "/images/sprite.png": "/images/sprite.png?id=6eb2205118e5005c1828", + "/images/twitter-icon.png": "/images/twitter-icon.png?id=e9d2e24ba38f498c4840", + "/images/vanillawxr-36.png": "/images/vanillawxr-36.png?id=699096f1ea666ec48bd9", + "/images/vanillawxr-48.png": "/images/vanillawxr-48.png?id=7bfb2dcbb3398aef9628", + "/images/vanillawxr-72.png": "/images/vanillawxr-72.png?id=6bde3554e180a05e8609", + "/images/vanillawxr-96.png": "/images/vanillawxr-96.png?id=6f248dbfbe525efeac75", + "/images/wxr-36.png": "/images/wxr-36.png?id=a0eecf15ffa491bb55d0", + "/images/wxr-48.png": "/images/wxr-48.png?id=907e785a36ffb5634962", + "/images/wxr-72.png": "/images/wxr-72.png?id=aad01763ee5c8754eaa3", + "/images/wxr-96.png": "/images/wxr-96.png?id=461e358f0757be252cf2", + "/images/xhtml-36.png": "/images/xhtml-36.png?id=f151cb946ae36f9ac65a", + "/images/xhtml-48.png": "/images/xhtml-48.png?id=09837d9c9a18ea6c6b1f", + "/images/xhtml-72.png": "/images/xhtml-72.png?id=c3182b3d50e84d79cd23", + "/images/xhtml-96.png": "/images/xhtml-96.png?id=a722bb0e5a6e6b1748fb" } diff --git a/dist/scripts/book.js b/dist/scripts/book.js index 3075954fb..23718eb7f 100644 --- a/dist/scripts/book.js +++ b/dist/scripts/book.js @@ -1 +1 @@ -!function(t){var e={};function n(o){if(e[o])return e[o].exports;var a=e[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(o,a,function(e){return t[e]}.bind(null,a));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=0)}({0:function(t,e,n){n("oy8a"),n("nTgg"),t.exports=n("7++m")},"7++m":function(t,e){},nTgg:function(t,e){},oy8a:function(t,e,n){"use strict";n.r(e);var o=function(t){return"".concat(t.charAt(0).toLowerCase()).concat(t.replace(/[\W_]/g,"|").split("|").map((function(t){return"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1))})).join("").slice(1))};function a(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"init",n=arguments.length>2?arguments[2]:void 0,o=""!==t&&this.routes[t]&&"function"==typeof this.routes[t][e];o&&this.routes[t][e](n)}},{key:"loadEvents",value:function(){var t=this;this.fire("common"),document.body.className.toLowerCase().replace(/-/g,"_").split(/\s+/).map(o).forEach((function(e){t.fire(e),t.fire(e,"finalize")})),this.fire("common","finalize")}}])&&a(e.prototype,n),i&&a(e,i),t}())({common:{init:function(){if(document.body.classList.remove("no-js"),document.body.classList.add("js"),function(){for(var t=document.getElementsByTagName("section"),e=0,n=t.length;e p, .dropdown > div.reading-header__toc__title"),Array.prototype.forEach.call(n,(function(t){t.innerHTML='\n\t\t\t\t\n\t\t\t\t');var e=t.nextElementSibling;e.hidden=!0;var n=t.querySelector("button"),o=t.querySelector("button > .arrow"),a=e.querySelectorAll("a");Array.prototype.forEach.call(a,(function(t){t.onblur=function(o){t===a[a.length-1]&&"LI"!==o.relatedTarget.parentNode.nodeName&&(n.setAttribute("aria-expanded",!1),e.hidden=!0)}}));var i=jQuery("button[aria-expanded] > svg"),r=jQuery("button[aria-expanded]");jQuery(r,i).on("click",(function(t){var a="true"===n.getAttribute("aria-expanded")||!1;n===t.target||o===t.target.closest("svg")?(n.setAttribute("aria-expanded",!a),e.hidden=a):(n.setAttribute("aria-expanded",!1),e.hidden=!0)})),document.onclick=function(t){var o=jQuery(t.target),a=jQuery(".".concat("book-header__cover__downloads")).find("button");0===a.length||o.closest("div").hasClass("book-header__cover__downloads")||o.hasClass("dropdown-item")||"true"===a.attr("aria-expanded")&&(n.setAttribute("aria-expanded",!1),e.hidden=!0)},document.onkeydown=function(t){27!==t.which||e.hidden||(n.setAttribute("aria-expanded",!1),e.hidden=!0)}})),o=document.querySelectorAll(".toc__part--full > .toc__title, .toc__chapter--full > .toc__title, .toc__front-matter--full > .toc__title, .toc__back-matter--full > .toc__title"),a=document.body.classList.contains("home"),Array.prototype.forEach.call(o,(function(t){var e=!!(a&&t.parentNode.classList.contains("toc__part")||!a&&t.parentNode.classList.contains("toc__parent")),n="".concat(pressbooksBook.toggle_contents," '").concat(t.innerText,"'");t.innerHTML="\n\t\t\t\t".concat(t.innerHTML,'\n\t\t\t\t\n\t\t\t\t');var o=t.nextElementSibling;!1===e||!a&&!t.parentNode.classList.contains("toc__parent")?o.hidden=!0:a&&t.parentNode.classList.contains("toc__parent")&&(o.hidden=!1);var i=t.querySelector("button");i.onclick=function(){var t="true"===i.getAttribute("aria-expanded")||!1;i.setAttribute("aria-expanded",!t),o.hidden=t}})),jQuery((function(t){var e=t(".h5p-row-item"),n=t(".h5p-activity-container");n.hide(),t("#h5p-show-hide").text(t("#h5p-show-hide").attr("show-all-text")),t(".h5p-row-item").text(t(".h5p-row-item").attr("show-activity-text")),e.on("click",(function(){t(this).text()===t(this).attr("show-activity-text")?(n.hide(),t(this).closest("tr").next(this).show("slow"),t(this).text(t(this).attr("hide-activity-text")),window.dispatchEvent(new Event("resize"))):(t(this).closest("tr").next(this).hide(),t(this).text(t(this).attr("show-activity-text")))})),t("#h5p-show-hide").on("click",(function(){t(this).text()===t(this).attr("show-all-text")?(n.show(),t(this).text(t(this).attr("hide-all-text")),t(".h5p-row-item").text(t(".h5p-row-item").attr("hide-activity-text")),window.dispatchEvent(new Event("resize"))):(n.hide(),t(this).text(t(this).attr("show-all-text")),t(".h5p-row-item").text(t(".h5p-row-item").attr("show-activity-text")))}))}))},finalize:function(){}},home:{init:function(){jQuery((function(t){t(document.body).on("click",".js-toggle-block",(function(e){var n=t(this);n.parents(".js-block").toggleClass("block-toggle--visible"),n.toggleClass("--visible")})),t(document.body).on("click",".toc__toggle #show",(function(e){var n=t(this);t('.toc [class*="--full"]').each((function(e){t(this).find("button").attr("aria-expanded","true"),t(this).find("ol").prop("hidden",!1)})),n.parents(".toc__toggle").attr("aria-expanded","true")})),t(document.body).on("click",".toc__toggle #hide",(function(e){var n=t(this);t('.toc [class*="--full"]').each((function(e){t(this).find("button").attr("aria-expanded","false"),t(this).find("ol").attr("hidden","true")})),n.parents(".toc__toggle").attr("aria-expanded","false")}))}))},finalize:function(){}},single:{init:function(){jQuery((function(t){var e=t(".block-reading-meta__compare__toggle");e.on("click",(function(n){var o=t(".block-reading-meta__compare__activity"),a=t(".alert"),i=t(".block-reading-meta__compare__comparison"),r=t(".block-reading-meta__compare__stats"),c=t(".block-reading-meta__compare__current");if(a.addClass("visually-hidden"),"false"===t(n.currentTarget).attr("aria-expanded"))if(e.attr("aria-expanded",!0),o.prop("hidden",!1),i.hasClass("populated"))i.prop("hidden",!1),o.attr("hidden",!0);else{a.text(pressbooksBook.comparison_loading);var s=c.html(),d=c.attr("data-source-endpoint");fetch(d).then((function(e){if(200!==e.status)return a.addClass("alert--error").removeClass("visually-hidden").text(pressbooksBook.chapter_not_loaded),void o.attr("hidden",!0);e.json().then((function(e){var n=t("
"+e.content.raw+"
").html();t.post(pressbooksBook.ajaxurl,{action:"text_diff",security:pressbooksBook.text_diff_nonce,left:n,right:s},(function(e){if(!0===e.success){var n=JSON.parse(e.data);i.append(n),i.children("table");var c=t(".diff del").length,s=t(".diff ins").length;r.children("ins").children(".num").text(s),r.children("del ").children(".num").text(c),o.attr("hidden",!0),a.text(pressbooksBook.comparison_loaded),i.prop("hidden",!1)}}))}))})).catch((function(t){a.addClass("alert--error").removeClass("visually-hidden").text(pressbooksBook.chapter_not_loaded),o.attr("hidden",!0)}))}else e.attr("aria-expanded",!1),i.attr("hidden",!0),t(".diff").remove()})),t(document).ready((function(){var e;t(window).on("scroll",(function(){t(window).scrollTop()>250&&t(".nav-reading__up").animate({opacity:1},0),t(window).scrollTop()<250&&t(".nav-reading__up").animate({opacity:0},0)})),t(".nav-reading__up").on("click",(function(e){return e.preventDefault(),t(".nav-reading__up").blur().animate({opacity:0},0),t("html, body").animate({scrollTop:0},0),!1})),t(document).on("keydown",(function(e){if(!t("body").hasClass("no-navigation")){var n=!1;37===e.which?n=t(".nav-previous a, .js-nav-previous a").attr("href"):39===e.which&&(n=t(".nav-next a, .js-nav-next a").attr("href")),n&&!t("textarea, input").is(":focus")&&(window.location=n)}})),(e=t("iframe[src*='//player.vimeo.com'], iframe[src*='//www.youtube.com']")).each((function(){t(this).data("aspectRatio",this.height/this.width).removeAttr("height").removeAttr("width")})),t(window).on("resize",(function(){e.each((function(){var e=t(this),n=e.parent().parent().width();e.width(n).height(n*e.data("aspectRatio"))}))})).trigger("resize")}))}))},finalize:function(){}}});jQuery(document).ready((function(){return i.loadEvents()}))}}); \ No newline at end of file +(()=>{"use strict";var t,e={875:()=>{const t={init:function(){if(document.body.classList.remove("no-js"),document.body.classList.add("js"),function(){for(var t=document.getElementsByTagName("section"),e=0,n=t.length;e p, .dropdown > div.reading-header__toc__title"),Array.prototype.forEach.call(n,(function(t){t.innerHTML='\n\t\t\t\t\n\t\t\t\t');var e=t.nextElementSibling;e.hidden=!0;var n=t.querySelector("button"),o=t.querySelector("button > .arrow"),a=e.querySelectorAll("a");Array.prototype.forEach.call(a,(function(t){t.onblur=function(o){t===a[a.length-1]&&"LI"!==o.relatedTarget.parentNode.nodeName&&(n.setAttribute("aria-expanded",!1),e.hidden=!0)}}));var i=jQuery("button[aria-expanded] > svg"),r=jQuery("button[aria-expanded]");jQuery(r,i).on("click",(function(t){var a="true"===n.getAttribute("aria-expanded")||!1;n===t.target||o===t.target.closest("svg")?(n.setAttribute("aria-expanded",!a),e.hidden=a):(n.setAttribute("aria-expanded",!1),e.hidden=!0)})),document.onclick=function(t){var o="book-header__cover__downloads",a=jQuery(t.target),i=jQuery(".".concat(o)).find("button");0===i.length||a.closest("div").hasClass(o)||a.hasClass("dropdown-item")||"true"===i.attr("aria-expanded")&&(n.setAttribute("aria-expanded",!1),e.hidden=!0)},document.onkeydown=function(t){27!==t.which||e.hidden||(n.setAttribute("aria-expanded",!1),e.hidden=!0)}})),o=document.querySelectorAll(".toc__part--full > .toc__title, .toc__chapter--full > .toc__title, .toc__front-matter--full > .toc__title, .toc__back-matter--full > .toc__title"),a=document.body.classList.contains("home"),Array.prototype.forEach.call(o,(function(t){var e=!!(a&&t.parentNode.classList.contains("toc__part")||!a&&t.parentNode.classList.contains("toc__parent")),n="".concat(pressbooksBook.toggle_contents," '").concat(t.innerText,"'");t.innerHTML="\n\t\t\t\t".concat(t.innerHTML,'\n\t\t\t\t\n\t\t\t\t');var o=t.nextElementSibling;!1===e||!a&&!t.parentNode.classList.contains("toc__parent")?o.hidden=!0:a&&t.parentNode.classList.contains("toc__parent")&&(o.hidden=!1);var i=t.querySelector("button");i.onclick=function(){var t="true"===i.getAttribute("aria-expanded")||!1;i.setAttribute("aria-expanded",!t),o.hidden=t}})),jQuery((function(t){var e=t(".h5p-row-item"),n=t(".h5p-activity-container");n.hide(),t("#h5p-show-hide").text(t("#h5p-show-hide").attr("show-all-text")),t(".h5p-row-item").text(t(".h5p-row-item").attr("show-activity-text")),e.on("click",(function(){t(this).text()===t(this).attr("show-activity-text")?(n.hide(),t(this).closest("tr").next(this).show("slow"),t(this).text(t(this).attr("hide-activity-text")),window.dispatchEvent(new Event("resize"))):(t(this).closest("tr").next(this).hide(),t(this).text(t(this).attr("show-activity-text")))})),t("#h5p-show-hide").on("click",(function(){t(this).text()===t(this).attr("show-all-text")?(n.show(),t(this).text(t(this).attr("hide-all-text")),t(".h5p-row-item").text(t(".h5p-row-item").attr("hide-activity-text")),window.dispatchEvent(new Event("resize"))):(n.hide(),t(this).text(t(this).attr("show-all-text")),t(".h5p-row-item").text(t(".h5p-row-item").attr("show-activity-text")))}))}))},finalize:function(){}},e={init:function(){jQuery((function(t){t(document.body).on("click",".js-toggle-block",(function(e){var n=t(this);n.parents(".js-block").toggleClass("block-toggle--visible"),n.toggleClass("--visible")})),t(document.body).on("click",".toc__toggle #show",(function(e){var n=t(this);t('.toc [class*="--full"]').each((function(e){t(this).find("button").attr("aria-expanded","true"),t(this).find("ol").prop("hidden",!1)})),n.parents(".toc__toggle").attr("aria-expanded","true")})),t(document.body).on("click",".toc__toggle #hide",(function(e){var n=t(this);t('.toc [class*="--full"]').each((function(e){t(this).find("button").attr("aria-expanded","false"),t(this).find("ol").attr("hidden","true")})),n.parents(".toc__toggle").attr("aria-expanded","false")}))}))},finalize:function(){}},n={init:function(){jQuery((function(t){var e=t(".block-reading-meta__compare__toggle");e.on("click",(function(n){var o=t(".block-reading-meta__compare__activity"),a=t(".alert"),i=t(".block-reading-meta__compare__comparison"),r=t(".block-reading-meta__compare__stats"),c=t(".block-reading-meta__compare__current");if(a.addClass("visually-hidden"),"false"===t(n.currentTarget).attr("aria-expanded"))if(e.attr("aria-expanded",!0),o.prop("hidden",!1),i.hasClass("populated"))i.prop("hidden",!1),o.attr("hidden",!0);else{a.text(pressbooksBook.comparison_loading);var s=c.html(),d=c.attr("data-source-endpoint");fetch(d).then((function(e){if(200!==e.status)return a.addClass("alert--error").removeClass("visually-hidden").text(pressbooksBook.chapter_not_loaded),void o.attr("hidden",!0);e.json().then((function(e){var n=t("
"+e.content.raw+"
").html();t.post(pressbooksBook.ajaxurl,{action:"text_diff",security:pressbooksBook.text_diff_nonce,left:n,right:s},(function(e){if(!0===e.success){var n=JSON.parse(e.data);i.append(n),i.children("table");var c=t(".diff del").length,s=t(".diff ins").length;r.children("ins").children(".num").text(s),r.children("del ").children(".num").text(c),o.attr("hidden",!0),a.text(pressbooksBook.comparison_loaded),i.prop("hidden",!1)}}))}))})).catch((function(t){a.addClass("alert--error").removeClass("visually-hidden").text(pressbooksBook.chapter_not_loaded),o.attr("hidden",!0)}))}else e.attr("aria-expanded",!1),i.attr("hidden",!0),t(".diff").remove()})),t(document).ready((function(){var e;t(window).on("scroll",(function(){t(window).scrollTop()>250&&t(".nav-reading__up").animate({opacity:1},0),t(window).scrollTop()<250&&t(".nav-reading__up").animate({opacity:0},0)})),t(".nav-reading__up").on("click",(function(e){return e.preventDefault(),t(".nav-reading__up").blur().animate({opacity:0},0),t("html, body").animate({scrollTop:0},0),!1})),t(document).on("keydown",(function(e){if(!t("body").hasClass("no-navigation")){var n=!1;37===e.which?n=t(".nav-previous a, .js-nav-previous a").attr("href"):39===e.which&&(n=t(".nav-next a, .js-nav-next a").attr("href")),n&&!t("textarea, input").is(":focus")&&(window.location=n)}})),(e=t("iframe[src*='//player.vimeo.com'], iframe[src*='//www.youtube.com']")).each((function(){t(this).data("aspectRatio",this.height/this.width).removeAttr("height").removeAttr("width")})),t(window).on("resize",(function(){e.each((function(){var e=t(this),n=e.parent().parent().width();e.width(n).height(n*e.data("aspectRatio"))}))})).trigger("resize")}))}))},finalize:function(){}},o=function(t){return"".concat(t.charAt(0).toLowerCase()).concat(t.replace(/[\W_]/g,"|").split("|").map((function(t){return"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1))})).join("").slice(1))};function a(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"init",n=arguments.length>2?arguments[2]:void 0,o=""!==t&&this.routes[t]&&"function"==typeof this.routes[t][e];o&&this.routes[t][e](n)}},{key:"loadEvents",value:function(){var t=this;this.fire("common"),document.body.className.toLowerCase().replace(/-/g,"_").split(/\s+/).map(o).forEach((function(e){t.fire(e),t.fire(e,"finalize")})),this.fire("common","finalize")}}])&&a(e.prototype,n),i&&a(e,i),t}())({common:t,home:e,single:n});jQuery(document).ready((function(){return i.loadEvents()}))},340:()=>{},811:()=>{}},n={};function o(t){var a=n[t];if(void 0!==a)return a.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,o),i.exports}o.m=e,t=[],o.O=(e,n,a,i)=>{if(!n){var r=1/0;for(d=0;d=i)&&Object.keys(o.O).every((t=>o.O[t](n[s])))?n.splice(s--,1):(c=!1,i0&&t[d-1][2]>i;d--)t[d]=t[d-1];t[d]=[n,a,i]},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={370:0,765:0,97:0};o.O.j=e=>0===t[e];var e=(e,n)=>{var a,i,[r,c,s]=n,d=0;for(a in c)o.o(c,a)&&(o.m[a]=c[a]);if(s)var l=s(o);for(e&&e(n);do(875))),o.O(void 0,[765,97],(()=>o(340)));var a=o.O(void 0,[765,97],(()=>o(811)));a=o.O(a)})(); \ No newline at end of file diff --git a/dist/scripts/collapse-sections.js b/dist/scripts/collapse-sections.js index 009acfc1c..84bae92fe 100644 --- a/dist/scripts/collapse-sections.js +++ b/dist/scripts/collapse-sections.js @@ -1 +1 @@ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=2)}({2:function(t,e,n){t.exports=n("FGdR")},FGdR:function(t,e){document.addEventListener("DOMContentLoaded",(function(){var t=document.querySelectorAll("#content section ".concat("h1",":not(.entry-title)"));Array.prototype.forEach.call(t,(function(t){t.innerHTML='\n\t\t'),t.setAttribute("data-collapsed","true");var e=function(t){for(var e=[];t.nextElementSibling&&"H1"!==t.nextElementSibling.tagName&&!t.nextElementSibling.classList.contains("nav-reading--page")&&("DIV"!==t.nextElementSibling.tagName||"glossary"!==t.nextElementSibling.className);)e.push(t.nextElementSibling),t=t.nextElementSibling;return e.forEach((function(t){t.parentNode.removeChild(t)})),e}(t),n=document.createElement("div");n.hidden=!0,e.forEach((function(t){n.appendChild(t)})),t.parentNode.insertBefore(n,t.nextElementSibling);var r=t.querySelector("button");r.onclick=function(){var e="true"===r.getAttribute("aria-expanded")||!1;if(r.setAttribute("aria-expanded",!e),t.setAttribute("data-collapsed",e),n.hidden=e,window.dispatchEvent(new Event("resize")),!e&&!t.hasAttribute("data-unfurled")){var i=n.querySelectorAll("iframe");Array.prototype.forEach.call(i,(function(t){var e,n,r;(e=t.src,n=e.match(/^https?:\/\/([^/?#]+)(?:[/?#]|$)/i),r=n&&n[1],"string"==typeof r||r instanceof String?r:"").includes("phet.colorado.edu")&&(t.src=t.src)}))}t.setAttribute("data-unfurled",!0)}}))}))}}); \ No newline at end of file +document.addEventListener("DOMContentLoaded",(function(){var t=document.querySelectorAll("#content section ".concat("h1",":not(.entry-title)"));Array.prototype.forEach.call(t,(function(t){t.innerHTML='\n\t\t'),t.setAttribute("data-collapsed","true");var e=function(t){for(var e=[];t.nextElementSibling&&"H1"!==t.nextElementSibling.tagName&&!t.nextElementSibling.classList.contains("nav-reading--page")&&("DIV"!==t.nextElementSibling.tagName||"glossary"!==t.nextElementSibling.className);)e.push(t.nextElementSibling),t=t.nextElementSibling;return e.forEach((function(t){t.parentNode.removeChild(t)})),e}(t),n=document.createElement("div");n.hidden=!0,e.forEach((function(t){n.appendChild(t)})),t.parentNode.insertBefore(n,t.nextElementSibling);var a=t.querySelector("button");a.onclick=function(){var e="true"===a.getAttribute("aria-expanded")||!1;if(a.setAttribute("aria-expanded",!e),t.setAttribute("data-collapsed",e),n.hidden=e,window.dispatchEvent(new Event("resize")),!e&&!t.hasAttribute("data-unfurled")){var i=n.querySelectorAll("iframe");Array.prototype.forEach.call(i,(function(t){var e,n,a;(e=t.src,n=e.match(/^https?:\/\/([^/?#]+)(?:[/?#]|$)/i),a=n&&n[1],"string"==typeof a||a instanceof String?a:"").includes("phet.colorado.edu")&&(t.src=t.src)}))}t.setAttribute("data-unfurled",!0)}}))})); \ No newline at end of file diff --git a/dist/scripts/details-element-polyfill.js b/dist/scripts/details-element-polyfill.js index 5c7abc25f..5f1d1f156 100644 --- a/dist/scripts/details-element-polyfill.js +++ b/dist/scripts/details-element-polyfill.js @@ -1 +1 @@ -!function(){"use strict";var t,e,n,r,i=document.createElement("details"),a="undefined"!=typeof HTMLDetailsElement&&i instanceof HTMLDetailsElement,o="open"in i||a,u="ontoggle"in i,s='\ndetails, summary {\n display: block;\n}\ndetails:not([open]) > *:not(summary) {\n display: none;\n}\nsummary::before {\n content: "►";\n padding-right: 0.3rem;\n font-size: 0.6rem;\n cursor: default;\n}\n[open] > summary::before {\n content: "▼";\n}\n',c=[],d=c.forEach,l=c.slice;function f(t){(function(t,e){return(t.tagName==e?[t]:[]).concat("function"==typeof t.getElementsByTagName?l.call(t.getElementsByTagName(e)):[])})(t,"SUMMARY").forEach(function(t){var e=v(t,"DETAILS");t.setAttribute("aria-expanded",e.hasAttribute("open")),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("role")||t.setAttribute("role","button")})}function m(t){return!(t.defaultPrevented||t.ctrlKey||t.metaKey||t.shiftKey||t.target.isContentEditable)}function b(t){addEventListener("click",function(e){if(m(e)&&e.which<=1){var n=v(e.target,"SUMMARY");n&&n.parentNode&&"DETAILS"==n.parentNode.tagName&&t(n.parentNode)}},!1),addEventListener("keydown",function(e){if(m(e)&&(13==e.keyCode||32==e.keyCode)){var n=v(e.target,"SUMMARY");n&&n.parentNode&&"DETAILS"==n.parentNode.tagName&&(t(n.parentNode),e.preventDefault())}},!1)}function p(t){var e=document.createEvent("Event");e.initEvent("toggle",!1,!1),t.dispatchEvent(e)}function v(t,e){if("function"==typeof t.closest)return t.closest(e);for(;t;){if(t.tagName==e)return t;t=t.parentNode}}o||(document.head.insertAdjacentHTML("afterbegin",""),t=document.createElement("details").constructor.prototype,e=t.setAttribute,n=t.removeAttribute,r=Object.getOwnPropertyDescriptor(t,"open"),Object.defineProperties(t,{open:{get:function(){return"DETAILS"==this.tagName?this.hasAttribute("open"):r&&r.get?r.get.call(this):void 0},set:function(t){return"DETAILS"==this.tagName?t?this.setAttribute("open",""):this.removeAttribute("open"):r&&r.set?r.set.call(this,t):void 0}},setAttribute:{value:function(t,n){var r=this,i=function(){return e.call(r,t,n)};if("open"==t&&"DETAILS"==this.tagName){var a=this.hasAttribute("open"),o=i();if(!a){var u=this.querySelector("summary");u&&u.setAttribute("aria-expanded",!0),p(this)}return o}return i()}},removeAttribute:{value:function(t){var e=this,r=function(){return n.call(e,t)};if("open"==t&&"DETAILS"==this.tagName){var i=this.hasAttribute("open"),a=r();if(i){var o=this.querySelector("summary");o&&o.setAttribute("aria-expanded",!1),p(this)}return a}return r()}}}),b(function(t){t.hasAttribute("open")?t.removeAttribute("open"):t.setAttribute("open","")}),f(document),window.MutationObserver?new MutationObserver(function(t){d.call(t,function(t){d.call(t.addedNodes,f)})}).observe(document.documentElement,{subtree:!0,childList:!0}):document.addEventListener("DOMNodeInserted",function(t){f(t.target)})),o&&!u&&(window.MutationObserver?new MutationObserver(function(t){d.call(t,function(t){var e=t.target,n=t.attributeName;"DETAILS"==e.tagName&&"open"==n&&p(e)})}).observe(document.documentElement,{attributes:!0,subtree:!0}):b(function(t){var e=t.getAttribute("open");setTimeout(function(){var n=t.getAttribute("open");e!=n&&p(t)},1)}))}(); +!function(){"use strict";var t,e,n,r,i=document.createElement("details"),a="undefined"!=typeof HTMLDetailsElement&&i instanceof HTMLDetailsElement,o="open"in i||a,u="ontoggle"in i,s='\ndetails, summary {\n display: block;\n}\ndetails:not([open]) > *:not(summary) {\n display: none;\n}\nsummary::before {\n content: "►";\n padding-right: 0.3rem;\n font-size: 0.6rem;\n cursor: default;\n}\n[open] > summary::before {\n content: "▼";\n}\n',c=[],d=c.forEach,l=c.slice;function f(t){(function(t,e){return(t.tagName==e?[t]:[]).concat("function"==typeof t.getElementsByTagName?l.call(t.getElementsByTagName(e)):[])})(t,"SUMMARY").forEach((function(t){var e=v(t,"DETAILS");t.setAttribute("aria-expanded",e.hasAttribute("open")),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("role")||t.setAttribute("role","button")}))}function m(t){return!(t.defaultPrevented||t.ctrlKey||t.metaKey||t.shiftKey||t.target.isContentEditable)}function b(t){addEventListener("click",(function(e){if(m(e)&&e.which<=1){var n=v(e.target,"SUMMARY");n&&n.parentNode&&"DETAILS"==n.parentNode.tagName&&t(n.parentNode)}}),!1),addEventListener("keydown",(function(e){if(m(e)&&(13==e.keyCode||32==e.keyCode)){var n=v(e.target,"SUMMARY");n&&n.parentNode&&"DETAILS"==n.parentNode.tagName&&(t(n.parentNode),e.preventDefault())}}),!1)}function p(t){var e=document.createEvent("Event");e.initEvent("toggle",!1,!1),t.dispatchEvent(e)}function v(t,e){if("function"==typeof t.closest)return t.closest(e);for(;t;){if(t.tagName==e)return t;t=t.parentNode}}o||(document.head.insertAdjacentHTML("afterbegin",""),t=document.createElement("details").constructor.prototype,e=t.setAttribute,n=t.removeAttribute,r=Object.getOwnPropertyDescriptor(t,"open"),Object.defineProperties(t,{open:{get:function(){return"DETAILS"==this.tagName?this.hasAttribute("open"):r&&r.get?r.get.call(this):void 0},set:function(t){return"DETAILS"==this.tagName?t?this.setAttribute("open",""):this.removeAttribute("open"):r&&r.set?r.set.call(this,t):void 0}},setAttribute:{value:function(t,n){var r=this,i=function(){return e.call(r,t,n)};if("open"==t&&"DETAILS"==this.tagName){var a=this.hasAttribute("open"),o=i();if(!a){var u=this.querySelector("summary");u&&u.setAttribute("aria-expanded",!0),p(this)}return o}return i()}},removeAttribute:{value:function(t){var e=this,r=function(){return n.call(e,t)};if("open"==t&&"DETAILS"==this.tagName){var i=this.hasAttribute("open"),a=r();if(i){var o=this.querySelector("summary");o&&o.setAttribute("aria-expanded",!1),p(this)}return a}return r()}}}),b((function(t){t.hasAttribute("open")?t.removeAttribute("open"):t.setAttribute("open","")})),f(document),window.MutationObserver?new MutationObserver((function(t){d.call(t,(function(t){d.call(t.addedNodes,f)}))})).observe(document.documentElement,{subtree:!0,childList:!0}):document.addEventListener("DOMNodeInserted",(function(t){f(t.target)}))),o&&!u&&(window.MutationObserver?new MutationObserver((function(t){d.call(t,(function(t){var e=t.target,n=t.attributeName;"DETAILS"==e.tagName&&"open"==n&&p(e)}))})).observe(document.documentElement,{attributes:!0,subtree:!0}):b((function(t){var e=t.getAttribute("open");setTimeout((function(){var n=t.getAttribute("open");e!=n&&p(t)}),1)})))}(); diff --git a/dist/scripts/lightbox.js b/dist/scripts/lightbox.js index f838d1be4..dfcc7d8ab 100644 --- a/dist/scripts/lightbox.js +++ b/dist/scripts/lightbox.js @@ -1 +1 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=3)}({3:function(e,t,n){e.exports=n("Y79M")},Y79M:function(e,t){document.addEventListener("DOMContentLoaded",(function(){var e=document.querySelectorAll('#content a[href$=".gif"], #content a[href$=".jpg"], #content a[href$=".png"]');Array.prototype.forEach.call(e,(function(e){e.setAttribute("data-lity","true")}))}))}}); \ No newline at end of file +document.addEventListener("DOMContentLoaded",(function(){var t=document.querySelectorAll('#content a[href$=".gif"], #content a[href$=".jpg"], #content a[href$=".png"]');Array.prototype.forEach.call(t,(function(t){t.setAttribute("data-lity","true")}))})); \ No newline at end of file diff --git a/dist/scripts/lity.js b/dist/scripts/lity.js index 1f4a3ce9f..12cd3b8d4 100644 --- a/dist/scripts/lity.js +++ b/dist/scripts/lity.js @@ -1 +1 @@ -!function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,require("jquery")):e.lity=t(e,e.jQuery||e.Zepto)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=e.document,i=t(e),r=t.Deferred,o=t("html"),a=[],l="aria-hidden",s="lity-"+l,d='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',c={esc:!0,handler:null,handlers:{image:C,inline:function(e,n){var i,r,o;try{i=t(e)}catch(e){return!1}if(!i.length)return!1;return r=t(''),o=i.hasClass("lity-hide"),n.element().one("lity:remove",function(){r.before(i).remove(),o&&!i.closest(".lity-content").length&&i.addClass("lity-hide")}),i.removeClass("lity-hide").after(r)},youtube:function(e){var n=f.exec(e);if(!n)return!1;return k(x(e,w("https://www.youtube"+(n[2]||"")+".com/embed/"+n[4],t.extend({autoplay:1},b(n[5]||"")))))},vimeo:function(e){var n=y.exec(e);if(!n)return!1;return k(x(e,w("https://player.vimeo.com/video/"+n[3],t.extend({autoplay:1},b(n[4]||"")))))},googlemaps:function(e){var t=v.exec(e);if(!t)return!1;return k(x(e,w("https://www.google."+t[3]+"/maps?"+t[6],{output:t[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(e){var n=p.exec(e);if(!n)return!1;0!==e.indexOf("http")&&(e="https:"+e);return k(x(e,w("https://www.facebook.com/plugins/video.php?href="+e,t.extend({autoplay:1},b(n[4]||"")))))},iframe:k},template:''},u=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,f=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,y=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,v=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,p=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,m=function(){var e=n.createElement("div"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return t[i];return!1}();function h(e){var t=r();return m&&e.length?(e.one(m,t.resolve),setTimeout(t.resolve,500)):t.resolve(),t.promise()}function g(e,n,i){if(1===arguments.length)return t.extend({},e);if("string"==typeof n){if(void 0===i)return void 0===e[n]?null:e[n];e[n]=i}else t.extend(e,n);return this}function b(e){for(var t,n=decodeURI(e.split("#")[0]).split("&"),i={},r=0,o=n.length;r-1?"&":"?")+t.param(n)}function x(e,t){var n=e.indexOf("#");return-1===n?t:(n>0&&(e=e.substr(n)),t+e)}function C(e,n){var i=n.opener()&&n.opener().data("lity-desc")||"Image with no description",o=t(''+i+''),a=r(),l=function(){var e;a.reject((e="Failed loading image",t('').append(e)))};return o.on("load",function(){if(0===this.naturalWidth)return l();a.resolve(o)}).on("error",l),a.promise()}function k(e){return'