16 november 2023

Enhance the Plain skin via include files

 

Introduction

In version 2 of the Plain skin, most of the modifications discussed in my previous note have been added, except the points 4 and 5

In version 2 of the Plain skin Laza did implement on my request include files, which makes it possible to insert extra code in the skin, so there is no need to change the original skin code.

In this note I will show how you can enhance the Plain skin with new features, starting with making the lightbox background color equal to the index page background color.



Include files in Plain version 2.7

page-header.inc:

With an include file user-head.inc in the project directory, you can insert extra code just before the </head> tag. You could use that to add extra css-files of add css-code via <style> blocks. Code added via this file will be used in the root-album and in the folder albums.


user-style.css:

I used include file user-stylele.css to add extra css-code at the end of the common.css file. Code added via this file will also be used in the root-album and in the folder albums.

To see the code I used, download this file and all other files made in this note here. The extra code in the user-style.css file adds the following features:

  • It makes the text and background color of the lightbox equal to the text and background color of the thumbnails page.

  • The caption text color is also made equal to the text color of the thumbnails page.

  • The caption background color is also made equal to the background color of the thumbnails page, but it is made more transparent (Opaque of 60%). It is of course more flexible to change the Page background color control on the design tab in a color control which allows also the define the transparency or even better to add a new color control with transparency for a caption, but this time I did not want to change the UI.

  • copied the css-code used in my PhotoSwipe skin to make the the audio clip control smaller and more transparent.

  • Finally I added css-code for the extra buttons discussed below.

To see the result of these changes open this sample album.


user-code.js:

With file user-code.js you can add extra javascript code to be used in the root album and in the folder albums. I use that for maps made with my MakeMap program. To make it possible to open the lightbox directory from a route map for the corresponding image number, via an URL like this: ''https://andrewolff.jalbum.net/Sample_Project_Plain_inc/index.html?M18”, which opens the light-box for the 19th image in the album.

This is also used in this albumYou can find the used code in the zip-file and in this note.


user-options.inc:

The contents in this file is used to add and/or change options of the lightbox. You can find these options in the PhotoSwipe gallerydocumentation.


Code added via this file will be used in the root-album and in the folder albums.

In this sample album it is used to set the bgOpacity to 1, otherwise you see part of the thumbnails page and clicking in the image will start or stop the slideshow.

user-top.inc:

You can use this include file to insert extra html-code after the title of the index page. You have to save such a file in each image directory where you like to show the extra code.

user-top-all.inc:

You can use this include file to insert extra html-code after the title of the index page. You have to save such a file in the root image directory if you like to show the extra code in the root output directory and all other output folders.

In this https://andrewolff.jalbum.net/Sample_Project_Plain_inc/ it is used to add a theme image,

user-code.inc:

You can use this include file to insert extra html-code after the  description of the index page. You have to save such a file in each image directory where you like to show the extra code.

user-code-all.inc:

You can use this include file to insert extra html-code after the description of the index page. You have to save such a file in the root image directory if you like to show the extra codein the root output directory and all other output folders.

In this https://andrewolff.jalbum.net/Sample_Project_Plain_inc/ it is used to add buttons to open the route maps and to download the corresponding gpx-file as described in this note.

The buttons are only added if the corresponding file 'track.gpx', 'GoogleMap.html' or 'OSM_Map.html' is found in the album output directory..

user-footer.inc:

You can use this include file to insert extra html-code at the end of the index page. Code added via this file will be used in the root-album and in the folder albums.

I used this in the sample album to insert a copyright statement under the thumbnails. But because the statement is automatically inserted in all folder albums, you see in the sample album that 3 folder albums show the wrong copyright statement.


Desired changes

Use user-footer.inc for footer code for the current folder and use user-footer-all.inc for footer code for the root folder and all other folders,

Demo albums

All described include files can be downloaded here and you see the effect of the unmodified Plain skin in this sample album, in this Audio-clip demo album.








































07 november 2023

New skin versions

My jAlbum skins have been updated:

FancyBox version 4.5.1.

PhotoSwipe version 5.7.2

LightGallery version 1.5.1

Slide Show 4 version 5.4.1


Survey of the changes:

  • If a description is given in a folder tile, a possible link is removed, because a link in a link will not work.

  • The description in a tile uses now also the 'Thumbnails text font-size', see this example album.

  • The Map.htt template file is changed so that the close button is better visible, see this example.

  • If a route map is shown with the OSM_Map.html web page made with my program MakeMap and the lightbox has been opened via a click in the thumbnail, you can now use the lightbox close button to return to the map, see this example. The latest version of MakeMap makes it also possible to disable opening the lightbox.

  • PhotoSwipe library version 5.4.2 is now used in res\photoswipe folder of the PhotoSwipe skin.

  • Style Blue has been added to the Slide Show 4 skin.


05 november 2023

New version 2.3 of my program MakeMap

 

Next items have been added or changed in version 2.3:

  • The close buttons on both map pages are now made with embedded buttons.
  • The download kml-file button has been removed from the Google Earth web page.

  • All skins do use now the same template file, the skin res directory is no longer used.

  • The MakeMap program can now also be used for the Plain skin, more info on this note.

  • If the new check-box 'Enable links' has been cleared, no Light-box with the corresponding slide page will be opened if you click on a waypoint in the map and next in the thumbnail.

You see the new check-box 'Enable links' at the top of the page:



If you clear check-box 'Enable links', no Light-box with the corresponding slide page will be opened if you click on a waypoint in the map and next on the thumbnail like this;:


See here for an example album which do not open the lightbox if you click in on the thumbnail.


You should clear this check-box if a lightbox of the skin can not be opened directly via an URL like this: ''https://andrewolff.jalbum.net/Sample_Project_Plain_inc/index.html?M18”, which opens the light-box for the 19th image in the album. It is recommended to clear this check-mark if you use an unmodified version of the Plain skin, unless you add the next user js-code via an include file 'user-code.js' to enable this:

document.addEventListener("DOMContentLoaded", function()  {
    if ((window.location.search.length) > 0) {
        var str = window.location.search.substring(1);
        if (str.substring(0, 1) == "M") {
            str = str.substring(1);
        }
        if ((str.substring(0, 1) != "f") && (str.substring(0, 1) != "_")) {
            openLightbox(parseInt(str));
}
    }
});

function openLightbox(slideNr) {
    if (slideNr < 0) slideNr = 0;
    const x = document.querySelectorAll(".main .card.image > .thumb,.card.video > .thumb");
    if (x) x[slideNr].click();
}

For an example, open this album.

More information in the Help-file and on the jAlbum forum.

19 oktober 2023

How to enhance the Plain skin


Summary


In this jAlbum forum thread I showed how the Plain skin could show the location in a Leaflet OpenStreet map and in this thread I showed how the PhotoSwipe lightbox could be replaced by the LightGallery lightbox which is also used in my LightGallery skin.
Because my big friend Jeff Tucker blocked my access to the forum and removed all version information and jaskin files, I did publish new versions in the Plain-LG demo album and now I continued the reporting about the exercise here in this blog.
These modifications were done with a Plain skin version which used a  BeanShell GUI, but the current version 1.0.4 uses a compiled GUI, which requires the NetBeans program for changes.

So I investigated now how version 1.0.4 could be modified.
The result is a Plain_M version 1.0.4B which contains the following enhancements:
  1. The Thumbnails caption selection box has been copied to the Lightbox tab and can now be used to select a caption below the image in the lightbox.
  2. Thumbnails caption bug in Plain 1.0.4 repaired.
  3. If the API-key field is empty, a Leaflet OpenStreet map will be used to display the location.
  4. In the HEAD section code can be added via a file  page-header_0.inc in the image directory.
  5. The lightbox background color is equal to the index page background color.

This example album shows the result and allows you to download the the jaskin file used to make this album.

This album uses the following settings in the modified lightbox tab:




The caption box in the Thumbnails tab is empty.

The implementation 


First you copy the the Plain map from the standard jAlbum skin directory C:\Program Files\jAlbum\skins to a Plain-M folder in the directory used for skins made by volunteers C:\Users\Andre\AppData\Roaming\JAlbum\skins

Next you install NetBeans and JAVA tools as described in the thread Compiling a skin's user interfaceCreate a new project Plain-M as described in the thread.
Copy file Gui.java from directory C:\Program Files\jAlbum\skins\Plain\src\plain to the NetBeans src directory, in my case D:\Andre\Documents\NetBeansProjects\Plain-M\src.

For this version I copied in Netbeans the code of the caption selection boxes from the Thumbnails panel to the Lightbox panel and renamed the copied controls, for instance I renamed the thumbnailItems control into slideItems control.

I added also a label hintOSMLabel and added the corresponding text in the Plain-M text.properties file:

ui.hintOSM=To use an OpenStreet map, leave the next field empty

Translate this string to other languages via menu Tools / Translator / Update ALL skin translations (auto translate).

After compiling the changed  Gui.java file, you will find the corresponding Plain-M.jar file in folder D:\Andre\Documents\NetBeansProjects\Plain-M\dist. Move file Plain-M.jar to the skin directory C:\Users\Andre\AppData\Roaming\JAlbum\skins\Plain-M\lib and overwrite the existing file.

To see the modified Gui.java file, download the Plain-M.jaskin file and open after the installation folder C:\Users\Andre\AppData\Roaming\JAlbum\skins\Plain-M\src\plain.

Next edit in jAlbum the template files. All my changes are indicated as comments with the letters AW in the skin directory C:\Users\Andre\AppData\Roaming\JAlbum\skins\Plain-M.
Note that these template files uses a js-shell, so you should use javascript code in these files. I use sometimes ChatGPT to convert JAVA code to javascript code.

For the OpenStreet maps implementation I changed files init.js, index.htt and photoswipe-init.js.

The slide captions are added as described in the PhotoSwipe documentation
To keep it simple, the slide captions are saved in the alt attributes.
I added a simplified version to file  photoswipe-init.js:

// <AW
   lightbox.on('uiRegister', function() {
    lightbox.pswp.ui.registerElement({
        name: 'custom-caption',
        order: 9,
        isButton: false,
        appendTo: 'root',
        html: 'Caption text',
        onInit: (el, pswp) => {
            lightbox.pswp.on('change', () => {
                const currSlideElement = lightbox.pswp.currSlide.data.element;
                let captionHTML = '';
                if (currSlideElement) {
                        // get caption from alt attribute
                        captionHTML = currSlideElement.querySelector('img').getAttribute('alt');
                }
                if (captionHTML.length > 0) {
     el.style.display = 'block';
     el.innerHTML = captionHTML;
   }
   else  el.style.display = 'none';
            });
        }
    });
});
// AW>

The required CSS code is added to file common.css:

/***< AW ****************************************  Customized lightbox  captios */
 .pswp__bg {
    background-color: ${pageBgColor};
  }

.pswp__custom-caption {
  position: absolute;
  color: ${textColor};
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background-color: ${pageBgColor}; 
  padding: 4px 18px;
  border-radius: 4px;
  bottom: 16px;
}
 .pswp__custom-caption a {
    color: ${textColor};
}
/*******************************************  AW> */

To save the slide captions in the alt attribute I had to change file index.htt, but also file util.js in C:\Users\Andre\AppData\Roaming\JAlbum\skins\Plain-M\lib
In that file I used a quick and dirty solution by copying function getCaption which uses control thumbnailItems to a new function getSlideCaption which uses the new control slideItems. I changed also  function getThumbnailElement which processes the alt attribute.

This is a very simple solution to add captions. My PhotoSwipe skin uses the dynamic caption plugin  which offers much more features: captions which do not overlap the image, captions in the sidebar and you can change the caption colors, see some examples in this example album.


Modification of version 2.4

In version 2 of the Plain skin, most of the modifications discussed above have been added, except the points 4 and 5.

To make the lightbox background color equal to the index page background color you can use in version 2.4 include files.

This has been decribed in my note Enhance the Plain skin via include files.

.

















26 september 2023

How to use a video or slide-show instead of a theme image with jAlbum

 

How to use a video or slide-show instead of a theme image with jAlbum



With the latest version 5.7.1 of my PhotoSwipe skin, the latest version 4.5.0 of my FancyBox skin and with the latest version 1.5.0 of my LightGallery skin it is possible to replace the theme image by a video or slide-show if you make a jAlbum web-album.

In both cases, you have first to remove the theme image:

  1. Open the Explorer, click with the right mouse button in the Theme image in the lower right corner and select Remove.

  2. Open the skin Index page / Theme image tab and clear field 'Theme image'.

  3. Finally clear check-box 'If this field is blank or …'

Next open the Index page / Footer tab and check the new check-mark 'After the theme image'.

The other requred actions depends on the type of Theme image replacement.

Use a video instead of a theme image

Enter the next code in the html code text-box Index page / Footer tab:

<div class="iframe-container iframe-container-Video">   

<iframe class="frame" src="https://www.youtube.com/embed/YN5avcf43OE?autoplay=1&mute=1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

</div>


Next enter this CSS code in the CSS code text-box on the Custom code tab:

.iframe-container { position: relative; height: 0; }

.iframe-container-Video { padding-bottom:40% }

.iframe-container iframe { border: none; position: absolute; top:0; left: 0; width: 100%; height: 100%; }


Play with the padding-bottom % to get the desired display.

The youtube src string depends on the video you like to show.

To get this string, click on the 'Share' button below your selected video and next on the 'Embed video' button.

Finally make and upload the album,

For an example of an album with a video instead of a theme image, open my Drenthe album.

Use a slide-show instead of a theme image

First you should make the slide-show you like to use as a replacement of the theme image. You can use all my 3 skins to do that, but I recommend to use my LightGallery skin, because that skins has a large selection of slide-show transitions.

Select for the slide-show images with a large width / height ratio and use a large width x height images bounds:


If you like, you can make the ratio the same for all images with a fixed shape filter:

filter1

class=FixedShapeFilter all prescale

Enter this string in the Advanced / User Variables tab:

Control the cropping, click with the right mouse button in the image and select 'Set crop focus...' and select option 'thumbnails bounds' (for for me unknown reasons, there is no 'image bounds' option).


On the skin 'General settings tab select check-marks 'Skip thumbnails pages' and 'Disable Viewer settngs' and select a 100% transparent color for the 'Page background color'.

On the skin Slide page / Layout page', clear the next check-marks: 'Prevent that the description overlaps the image' and clear all check-marks in the 'Show as description in the caption bar or side panel'.

On the skin Slide page / Options, select the slide show parameters and set / clear the next check-marks:

Next make the slide-show as you see in this example.

Now open the project file of the album where you like to use the slide-show instead of the theme image.

Enter the next code in the html code text-box Index page / Footer tab:

<div class="iframe-container iframe-container-slideShow">

    <iframe scrolling="no" src="https://www.andrewolff.nl/FotoSerie/AlgarveSlideShow_LG/"></iframe>

</div>

Enter here the URL of the slide-show you made above,

Next enter this CSS code in the CSS code text-box on the Custom code tab:

.iframe-container { position: relative; height: 0; }

.iframe-container-slideShow { padding-bottom:25% }

.iframe-container iframe { border: none; position: absolute; top:0; left: 0; width: 100%; height: 100%; }

Play with the padding-bottom % to get the desired display.

Finally make and upload the album and you see something like my Algarve album.





22 september 2023

My biggest 3 jAlbum problems

 

My biggest 3 jAlbum problems



I am using the jAlbum software already 15 years for publishing the photos and routes of my walkings on my website.

It is an excellent program to do that, but in all those years I encountered a number of problems, which I did report in the jAlbum forum in the Features requests thread, but most of these requests were not implemented, because Jeff Tucker did not agree. In fact he did remove some of my requests and blocked my access to the forum. Therefore I will report the 3 most important problems which could have saved me a lot of times in this blog.

Jalbum uses absolute links instead of relative links.

I use at home a desktop computer to process my photos, but in my holidays I use a laptop computer to do that. To prevent that I have to copy files to my desktop and/or laptop after/before each trip I use a 2TB Samsung T7 SSD as external disk, which I connect via a fast USB-C port to my Laptop or Desktop.

If I connect the disk to my Desktop. It gets drive letter K: and the jAlbum Genral settings window shows:


The original RAW format photos are imported in K:\Users\Andre\Afbeeldingen\LightRoom_photos\ and after processing exported to K:\Users\Andre\Afbeeldingen\jALBUM\

With these settings I can make and upload an album op my desktop without problems, see my published album.


However if I connect the SSD to the laptop, it gets drive letter I: and the image directory field shows:

I:\Users\Andre\Afbeeldingen\jALBUM\Oostvaarderplassen\FancyBox

while the output directory still shows:

K:\Users\Andre\Documents\Mijn websites\andrewolff.nl\FotoSerie\Wandelingen\Oostvaarderplassen


Now jAlbum can't find the original images and the album can't be made. I can repair the images links, but if I do that, the album can no longer be made on my desktop.

It is no problem for LightRoom, without changing anything I can export my images to the \Users\Andre\Afbeeldingen\jALBUM\ directory, both on the Desktop and on the Laptop, because LightRoom uses relative links instead of absolute links.

My original Feature request for this problem has been deleted, see here.

I did request to use relative links, so that General setting window would show:


If the output directory is on another disk, you should see a drive letter in the Output directory field.


Problems with the Cache

If you change a simple thing like an icon or a color in an existing album and you preview the result in an external browser like Google Chrome, many times you do not see the new icon or color, but you still see the old icon and/or color.

Sometimes it took me a long time before I discovere the source of this problem:

It is caused by the Browser Cache, which still contains images of the old album. So to see all your changes correctly in the Preview, you have to empty the Cache before each preview.

Currently, if I see that the preview is incorrect, I copy the album path,  select the Incognito mode and drop the album path in the address field. In that case I always see the icon or color changes I made with the new settings.

So I did request to add a field in jAlbum to use a special browser or command switch for the preview.

ThisFeature request has not (yet?) been deleted. The owner and developer of jAlbum, David Ekholm, did find it initially a good idea, but later Jeff Tucker did not like this request, so it has not been implemented.

Prevent that the output folder contains an index.htm and an index.html file

I have seen many times that after the upload of an album, you see another display as showed locally in the preview. Many times it took me hours to discover the source of this problem:

In the Advance tab was Page extension '.htm' used, but the output folder did contain an old 'index.html' file. The 'index.html' file apparently gets a priority over an 'index.htm' file, so that is why you see a different album.

So I did this simple Feature request:

Delete automatically an 'index.html' file if the album contains an 'index.htm' file and delete automatically an 'index.htm' file if the album contains an 'index.html' file.

But again this simple request has not been implemented.

I have no longer access to the forum, so you will no longer see my new feature requests or Bug reports on the forum.



29 augustus 2023

Faster coding with the help of OpenAI ChatGPT

 

In the previous versions of my LightGallery, my FancyBox and my PhotoSwipe jAlbum skin, the menu did disappear if you scorll-up a thumbnails page.

I wanted to fix the menu a the top of the page if you scroll-up.

It is really amazing how fast you can do that with the help of the new AI ChatGPT  tool.

To see it open my ChatGPT conversation.

See the result in my France album.

I used ChatGPT too in my Plain-LG exercise to convert Groovy JAVA code to javascript code for use in the js-shell used by Laza.

That goes without problems as long as you know that you should replace the *Let* and *Const* statements in the ChatGPT code.

Here are two other examples for converting code:

Convert JAVA to JS.

Convert jQuery code into plain vanille javascript code

I posed next question to ChatGPT:

"Does there exists a browser for my windows 10 64 bits system where the cache is not used?".

This was the answer:

Here are a few browsers that offer options to control caching:

Epic Privacy Browser: This browser is designed with privacy in mind and offers a built-in option to disable caching. It's based on Chromium and is available for Windows 10.

Brave Browser: Another privacy-focused browser based on Chromium. While it doesn't provide an explicit option to disable caching, it has a Private Browsing mode that reduces data retention, and it blocks trackers by default.

Firefox: Although Firefox doesn't provide a straightforward way to disable caching completely, you can customize the caching behavior using about:config settings. Search for "browser.cache" in the configuration settings and adjust the values to control caching behavior.

Tor Browser: If privacy is your primary concern, the Tor Browser is an excellent option. It's based on Firefox but routes your traffic through the Tor network, offering a high level of anonymity. It limits caching and takes other measures to enhance privacy.

Comodo Dragon: This browser is based on Chromium and offers various privacy and security features. While it might not have an explicit caching toggle, it does provide options to clear browsing data automatically upon exit.Browser

I installed the *Epic Privacy Browser* and it seems to work fine to preview an album after a Make, but for daily use this browser is for me not suited: No Search possibility, no remembered passwords etc.