Commit fafb0256 authored by Gaus Surahman's avatar Gaus Surahman Committed by Gaus Surahman
Browse files

Issue #3256023 by gausarts: Update to PhotoSwipe 5.1.7

parent 45d8e8fd
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
js/blazy.photoswipe.min.js
js/blazy.photoswipe5.min.js
js/*.min.js
js/blazy.photoswipe.js
*.yml
+7 −1
Original line number Diff line number Diff line
@@ -2,13 +2,19 @@
  // This file extends .eslintrc at drupal root.
  // Located at /modules/contrib/blazy_photoswipe, run:
  // eslint . -o ../../eslint/blazy_photoswipe.html -f html
  "extends": "../../../core/.eslintrc.legacy.json",
  "extends": "../../../core/.eslintrc.json",
  "globals": {
    "Blazy": true,
    "dBlazy": true,
    "PhotoSwipeLightbox": true,
    "PhotoSwipe": true,
    "PhotoSwipeUI_Default": true
  },
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "ecmaVersion": 2020,
    "requireConfigFile": false
  },
  "rules": {
    "consistent-this": [0, "me"],
    "max-params": 0,
+4 −0
Original line number Diff line number Diff line

Blazy PhotoSwipe 8.x-1.0-dev, 2021-12-26
----------------------------------------
- Issue #3256023 by gausarts: Update to PhotoSwipe 5.1.7

Blazy PhotoSwipe 8.x-1.0-dev, 2021-12-17
----------------------------------------
- Added Drupal ^10.
+8 −8
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@
# <a name="introduction"></a>INTRODUCTION
Provides a simple Blazy PhotoSwipe integration.

This branch should work with Blazy or PhotoSwipe 1.x and 2.x branches.
Yet 2.x is recommended.
This branch should work with Blazy or PhotoSwipe 1.x, 2.x, 3.x branches.
Yet 2+ is recommended. Be sure to read the project for more updated info.

***
***
@@ -71,6 +71,7 @@ Enable Blazy PhotoSwipe module under **Blazy** package:
1. Download the library:
   + `https://github.com/dimsemenov/photoswipe/tree/v5-beta`
   + `https://github.com/dimsemenov/photoswipe/tree/v5`(likely future releases)
   + Only tested with v5.1.7 as of this writing. Bigger or smaller might break.
2. Requires Blazy 2.3+, or the latest DEV as of this writing.
3. Visit `/admin/config/media/blazy`.
4. Select **PhotoSwipe 5** under **Extra settings**.
@@ -79,16 +80,15 @@ Enable Blazy PhotoSwipe module under **Blazy** package:
6. Clear cache.

## Limitations/ Tips:
1. Default `/libraries` location is required for now till future improvement.
2. Picture is not supported for pan-zooming, regular Responsive image is.
3. For some reasons, it must be connected to internet. It appears the library
1. Picture is not supported for pan-zooming, regular Responsive image is.
2. For some reasons, it must be connected to internet. It appears the library
   disables it when being [offline](https://github.com/dimsemenov/PhotoSwipe/blob/v5-beta/dist/photoswipe-lightbox.esm.js#L533). No big deal, just a headup.
4. To customize options, implement `hook_blazy_photoswipe_js_options_alter` like
3. To customize options, implement `hook_blazy_photoswipe_js_options_alter` like
   PhotoSwipe 4.
5. Be sure to provide **Thumbnail style** at blazy-related formatters for
4. Be sure to provide **Thumbnail style** at blazy-related formatters for
   initial image placeholder with the same aspect ratio as the full resolution
   **Lightbox image style**.
6. Modern browsers only, no IEs. Check out your visitors before usages. See
5. Modern browsers only, no IEs. Check out your visitors before usages. See
   https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#browser_compatibility

***
+4 −1
Original line number Diff line number Diff line
@@ -27,11 +27,14 @@ function blazy_photoswipe_blazy_attach_alter(array &$load, $attach = []) {
    $config = blazy()->configLoad();
    $five = !empty($config['extras']['photoswipe']) && $config['extras']['photoswipe'] == 5;
    $load['library'][] = $five ? 'blazy_photoswipe/load5' : 'blazy_photoswipe/load';
    $path = base_path() . blazy_libraries_get_path('photoswipe');

    // Allow other modules to alter / extend the options to pass to photoswipe.
    $options = blazy()->configLoad('options', 'photoswipe.settings');
    $options['version'] = $five ? 5 : 4;
    blazy()->getModuleHandler()->alter('blazy_photoswipe_js_options', $options);
    $load['drupalSettings']['photoswipe']['options'] = $options;
    $load['drupalSettings']['photoswipe']['path'] = $path;

    if (!$five) {
      $template = ['#theme' => 'photoswipe_container'];
@@ -81,7 +84,7 @@ function blazy_photoswipe_form_blazy_settings_form_alter(array &$form, $form_sta
    '#options'       => [5 => t('PhotoSwipe 5')],
    '#empty_option'  => t('- None -'),
    '#default_value' => isset($settings['extras']['photoswipe']) ? $settings['extras']['photoswipe'] : '',
    '#description'   => t('Warning! WIP, might break. Switch to PhotoSwipe 5. Default is PhotoSwipe 4. Check out /admin/help/blazy_photoswipe for howtos. Clear cache. See #3214672'),
    '#description'   => t('Warning! WIP, might break. Switch to PhotoSwipe 5. Default is PhotoSwipe 4. Check out /admin/help/blazy_photoswipe for howtos. Clear cache. See #3214672, #3256023'),
  ];
}

Loading