From e35ffd910a18c60f4664732f9ede1ce777442de2 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Thu, 1 Aug 2024 08:42:12 +0200 Subject: [PATCH] update photoswipe to v5.4.4 --- src/sigal/themes/photoswipe/static/app.js | 214 - .../static/default-skin/default-skin.css | 485 -- .../static/default-skin/default-skin.css.map | 10 - .../static/default-skin/default-skin.png | Bin 794 -> 0 bytes .../static/default-skin/default-skin.svg | 36 - .../static/default-skin/preloader.gif | Bin 866 -> 0 bytes .../themes/photoswipe/static/echo/blank.gif | Bin 42 -> 0 bytes .../themes/photoswipe/static/echo/echo.js | 135 - .../themes/photoswipe/static/echo/echo.min.js | 2 - .../static/photoswipe-lightbox.esm.js | 1960 +++++ .../static/photoswipe-lightbox.esm.js.map | 1 + .../static/photoswipe-lightbox.esm.min.js | 5 + .../static/photoswipe-ui-default.js | 871 -- .../static/photoswipe-ui-default.min.js | 1 - .../static/photoswipe-video-plugin.esm.js | 257 + .../static/photoswipe-video-plugin.esm.min.js | 1 + .../themes/photoswipe/static/photoswipe.css | 525 +- .../photoswipe/static/photoswipe.css.map | 10 - .../photoswipe/static/photoswipe.esm.js | 7081 +++++++++++++++++ .../photoswipe/static/photoswipe.esm.js.map | 1 + .../photoswipe/static/photoswipe.esm.min.js | 5 + .../themes/photoswipe/static/photoswipe.js | 3592 --------- .../photoswipe/static/photoswipe.min.js | 1 - .../themes/photoswipe/templates/album.html | 91 +- tests/sample/sigal.conf.py | 4 +- 25 files changed, 9724 insertions(+), 5564 deletions(-) delete mode 100644 src/sigal/themes/photoswipe/static/app.js delete mode 100644 src/sigal/themes/photoswipe/static/default-skin/default-skin.css delete mode 100644 src/sigal/themes/photoswipe/static/default-skin/default-skin.css.map delete mode 100644 src/sigal/themes/photoswipe/static/default-skin/default-skin.png delete mode 100644 src/sigal/themes/photoswipe/static/default-skin/default-skin.svg delete mode 100644 src/sigal/themes/photoswipe/static/default-skin/preloader.gif delete mode 100644 src/sigal/themes/photoswipe/static/echo/blank.gif delete mode 100644 src/sigal/themes/photoswipe/static/echo/echo.js delete mode 100644 src/sigal/themes/photoswipe/static/echo/echo.min.js create mode 100644 src/sigal/themes/photoswipe/static/photoswipe-lightbox.esm.js create mode 100644 src/sigal/themes/photoswipe/static/photoswipe-lightbox.esm.js.map create mode 100644 src/sigal/themes/photoswipe/static/photoswipe-lightbox.esm.min.js delete mode 100644 src/sigal/themes/photoswipe/static/photoswipe-ui-default.js delete mode 100644 src/sigal/themes/photoswipe/static/photoswipe-ui-default.min.js create mode 100644 src/sigal/themes/photoswipe/static/photoswipe-video-plugin.esm.js create mode 100644 src/sigal/themes/photoswipe/static/photoswipe-video-plugin.esm.min.js delete mode 100644 src/sigal/themes/photoswipe/static/photoswipe.css.map create mode 100644 src/sigal/themes/photoswipe/static/photoswipe.esm.js create mode 100644 src/sigal/themes/photoswipe/static/photoswipe.esm.js.map create mode 100644 src/sigal/themes/photoswipe/static/photoswipe.esm.min.js delete mode 100644 src/sigal/themes/photoswipe/static/photoswipe.js delete mode 100644 src/sigal/themes/photoswipe/static/photoswipe.min.js diff --git a/src/sigal/themes/photoswipe/static/app.js b/src/sigal/themes/photoswipe/static/app.js deleted file mode 100644 index de825ae..0000000 --- a/src/sigal/themes/photoswipe/static/app.js +++ /dev/null @@ -1,214 +0,0 @@ -echo.init({ - offset: 100, - throttle: 250, - unload: false -}); - -var initPhotoSwipeFromDOM = function(gallerySelector) { - - // parse slide data (url, title, size ...) from DOM elements - // (children of gallerySelector) - var parseThumbnailElements = function(el) { - var thumbElements = el.childNodes, - numNodes = thumbElements.length, - items = [], - figureEl, - linkEl, - size, - item; - - for(var i = 0; i < numNodes; i++) { - - figureEl = thumbElements[i]; //
element - - // include only element nodes - if(figureEl.nodeType !== 1) { - continue; - } - - linkEl = figureEl.children[0]; // element - - // create slide object - if (linkEl.getAttribute('data-type') == 'video') { - item = { - html: linkEl.getAttribute('data-video') - }; - } else { - size = linkEl.getAttribute('data-size').split('x'); - item = { - src: linkEl.getAttribute('href'), - w: parseInt(size[0], 10), - h: parseInt(size[1], 10) - }; - } - - if(figureEl.children.length > 1) { - //
content - item.title = figureEl.children[1].innerHTML; - } - - if(linkEl.children.length > 0) { - // thumbnail element, retrieving thumbnail url - item.msrc = linkEl.children[0].getAttribute('data-echo'); - } - - item.el = figureEl; // save link to element for getThumbBoundsFn - items.push(item); - } - - return items; - }; - - // find nearest parent element - var closest = function closest(el, fn) { - return el && ( fn(el) ? el : closest(el.parentNode, fn) ); - }; - - // triggers when user clicks on thumbnail - var onThumbnailsClick = function(e) { - e = e || window.event; - e.preventDefault ? e.preventDefault() : e.returnValue = false; - - var eTarget = e.target || e.srcElement; - - // find root element of slide - var clickedListItem = closest(eTarget, function(el) { - return (el.tagName && el.tagName.toUpperCase() === 'FIGURE'); - }); - - if(!clickedListItem) { - return; - } - - // find index of clicked item by looping through all child nodes - // alternatively, you may define index via data- attribute - var clickedGallery = clickedListItem.parentNode, - childNodes = clickedListItem.parentNode.childNodes, - numChildNodes = childNodes.length, - nodeIndex = 0, - index; - - for (var i = 0; i < numChildNodes; i++) { - if(childNodes[i].nodeType !== 1) { - continue; - } - - if(childNodes[i] === clickedListItem) { - index = nodeIndex; - break; - } - nodeIndex++; - } - - - - if(index >= 0) { - // open PhotoSwipe if valid index found - openPhotoSwipe( index, clickedGallery ); - } - return false; - }; - - // parse picture index and gallery index from URL (#&pid=1&gid=2) - var photoswipeParseHash = function() { - var hash = window.location.hash.substring(1), - params = {}; - - if(hash.length < 5) { - return params; - } - - var vars = hash.split('&'); - for (var i = 0; i < vars.length; i++) { - if(!vars[i]) { - continue; - } - var pair = vars[i].split('='); - if(pair.length < 2) { - continue; - } - params[pair[0]] = pair[1]; - } - - if(params.gid) { - params.gid = parseInt(params.gid, 10); - } - - return params; - }; - - var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) { - var pswpElement = document.querySelectorAll('.pswp')[0], - gallery, - options, - items; - - items = parseThumbnailElements(galleryElement); - - // define options (if needed) - options = { - - // define gallery index (for URL) - galleryUID: galleryElement.getAttribute('data-pswp-uid'), - - getThumbBoundsFn: function(index) { - // See Options -> getThumbBoundsFn section of documentation for more info - var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail - pageYScroll = window.pageYOffset || document.documentElement.scrollTop, - rect = thumbnail.getBoundingClientRect(); - - return {x:rect.left, y:rect.top + pageYScroll, w:rect.width}; - } - - }; - - // PhotoSwipe opened from URL - if(fromURL) { - if(options.galleryPIDs) { - // parse real index when custom PIDs are used - // http://photoswipe.com/documentation/faq.html#custom-pid-in-url - for(var j = 0; j < items.length; j++) { - if(items[j].pid == index) { - options.index = j; - break; - } - } - } else { - // in URL indexes start from 1 - options.index = parseInt(index, 10) - 1; - } - } else { - options.index = parseInt(index, 10); - } - - // exit if index not found - if( isNaN(options.index) ) { - return; - } - - if(disableAnimation) { - options.showAnimationDuration = 0; - } - - // Pass data to PhotoSwipe and initialize it - gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options); - gallery.init(); - }; - - // loop through all gallery elements and bind events - var galleryElements = document.querySelectorAll( gallerySelector ); - - for(var i = 0, l = galleryElements.length; i < l; i++) { - galleryElements[i].setAttribute('data-pswp-uid', i+1); - galleryElements[i].onclick = onThumbnailsClick; - } - - // Parse URL and open gallery if it contains #&pid=3&gid=1 - var hashData = photoswipeParseHash(); - if(hashData.pid && hashData.gid) { - openPhotoSwipe( hashData.pid , galleryElements[ hashData.gid - 1 ], true, true ); - } -}; - -// execute above function -initPhotoSwipeFromDOM('.gallery'); diff --git a/src/sigal/themes/photoswipe/static/default-skin/default-skin.css b/src/sigal/themes/photoswipe/static/default-skin/default-skin.css deleted file mode 100644 index bc42eba..0000000 --- a/src/sigal/themes/photoswipe/static/default-skin/default-skin.css +++ /dev/null @@ -1,485 +0,0 @@ -/*! 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 - - */ -/* - - - - - - -
-
-
-
-
-
-
- - - - - -
-
-
- - - - - {% endblock %} diff --git a/tests/sample/sigal.conf.py b/tests/sample/sigal.conf.py index bf31721..c7cd6f1 100644 --- a/tests/sample/sigal.conf.py +++ b/tests/sample/sigal.conf.py @@ -35,13 +35,13 @@ watermark = "watermark.png" watermark_position = (10, 10) watermark_opacity = 0.3 -theme = "colorbox" +theme = "photoswipe" thumb_size = (200, 150) rss_feed = {"feed_url": "http://127.0.0.1:8000/feed.rss", "nb_items": 10} atom_feed = {"feed_url": "http://127.0.0.1:8000/feed.atom", "nb_items": 10} -# theme = 'photoswipe' +# theme = 'colorbox' # theme = 'galleria' # thumb_size = (280, 210) # galleria_theme = 'folio'