Photonic Version 2.60 – Hello ES6!

I released version 2.60 of Photonic earlier today. This is a major release that completes the modernization of the underlying framework of the plugin.

Without much ado, here are the key highlights of this release:

  1. Switch to Modern JavaScript
    Undoubtedly one of the biggest undertakings in Photonic’s history, this update delivers a rewrite of the underlying framework to unshackle itself from jQuery. I had mentioned this about 6 months back, but cutting the cord took a lot of time because I got extremely busy with my day job and another activity in the interceding months. Anyway, the rewrite is done – it took me a lot of development effort and a lot of testing, particularly because of the plethora of lightboxes, layouts and platforms supported by Photonic.

    If I have not messed it up, the update should really not change anything on the front-end for you. What happens under the hood is that the core Photonic code no longer loads jQuery if it can avoid it. Additionally the code has been modernized to the JavaScript ES6 standards (ES = ECMAScript). This makes it a lot easier to read and one can work in a very modular manner. There are two versions of the JS code that get bundled – one is ignored by modern browsers (i.e. anything apart from IE), and other is ignored by older browsers. Not using jQuery also makes the code much faster.

    There is a catch though – while Photonic’s code does not use jQuery, most of the lightboxes bundled with Photonic do. That forces the plugin to load jQuery. That brings me to my next point.

  2. 3 New Pure JS Lightboxes
    The only pure JS lightboxes in Photonic so far were LightGallery.js and PhotoSwipe. That number has gone up 150% this time. You have BaguetteBox, BigPicture, and “Gie” Lightbox, or GLightbox, which operate without jQuery. You can refer to the Lightboxes documentation for what each lightbox supports.

    BaguetteBox is the new default because of its small footprint – it seemed like the closest approximation for SwipeBox, but it cannot handle YouTube or Vimeo videos.

    However, even after introducing new lightboxes , there is still the problem about the jQuery LightSlider script that I was using for the slider. That brings me to my next point.

  3. A Pure JS Slider
    This caused me some consternation, as I wasn’t very thrilled with my choices. I started out with Glide, explored Siema, almost settled on Glider before finally landing on Splide. I would have dearly loved to use Glider because of its small footprint, but it didn’t support slideshow thumbnails, which was a dealbreaker.
  4. Strip Included
    One jQuery lightbox that Photonic has supported since long but was unable to bundle due to licensing restrictions was Strip. Strip is now released under CC-BY 4.0, which makes it OK to bundle it in GPL software. So Strip has moved from the “non-bundled” section of Photonic to the list of bundled scripts.
  5. More New Features
    1. There is now a new option for showing shared Google Albums. While you could earlier show individual shared albums by passing the album id in the regular shortcode, the ability to easily obtain the shared album’s id was not there. I have now added this as an option to the Wizard. This corresponds to view='shared-photos' in the shortcode for Google Photos.
    2. A long time back I had logged a ticket with the Gutenberg team to handle conditional shortcode transformation to blocks. While this was resolved a year back, I normally wait for two releases before deprecating functionality. With WP 5.6 finally being released, I was able to uncomment my code and eliminate a lengthy workaround that converts Photonic shortcodes to Photonic blocks. No such workaround is required any more, and you should be able to seamlessly convert the shortcodes to blocks.
    3. I added a couple of options under Photonic → Settings ↠ Generic Options → Generic Settings, which prevent the shortcode from executing in excerpts in the Latest Posts page and in archives. This greatly speeds up the performance for such pages.
  6. Bug Fixes
    1. WP 5.6 bumped up the version of jQuery, which caused some old lightbox scripts to start failing. I have addressed this issue.
    2. Running WP from the command line using wp-cli was throwing up error messages in the log. This has been addressed.
    3. I fixed an issue where a small JS script was getting loaded in the front-end if Elementor was active.

The modernization drive began in late 2018 with the release of version 2.00, which featured the Gallery Wizard. It continued into late 2019 and early 2020 with the delivery of 2.40, which overhauled the PHP foundations. This was the last major step remaining, and I am very relieved to have got it out of the way. The next few iterations will focus on adding some more lightboxes, removal of jQuery dependency from the back-end, and potentially a new platform.

And maybe I will be able to focus a bit on Kon-Tiki!