Announcement

  •  » Requests
  •  » Automatically go from the Album list to a sub album if only 1 exists?

#1 2023-10-11 19:41:59

abda53
Member
2023-10-11
16

Automatically go from the Album list to a sub album if only 1 exists?

On the homepage which shows all of the albums, if I click on an album and there is only 1 subalbum, is there a better way to make it automatically go to the subalbum automatically?

I am currently doing this via jQuery, but was curious if there's a good way to do it through code? I'm assuming it's not that hard but I wasn't feeling like going through the source code lol This method does work but there is an obvious redirect after the page loads, which isn't super ideal.

Code:

jQuery( document ).ready(function() {
  if( jQuery('#theCategoryPage .thumbnailCategories .album').length ==1){
    window.location.replace( jQuery('#theCategoryPage .thumbnailCategories .album a').attr('href') );
  }
});

Offline

 
  •  » Requests
  •  » Automatically go from the Album list to a sub album if only 1 exists?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact