diff --git a/scripts/3rd-party/backend.js b/scripts/3rd-party/backend.js index 99985a32..da45ced8 100644 --- a/scripts/3rd-party/backend.js +++ b/scripts/3rd-party/backend.js @@ -316,7 +316,7 @@ const SmartAlbumID = Object.freeze({ * @property {string} landing_page_enable - actually a boolean * @property {string} lang * @property {string[]} lang_available - * @property {string} layout - actually a number: `0`, `1` or `2` + * @property {string} layout - `square`, `justified` or `unjustified` * @property {string} [location] * @property {string} location_decoding - actually a boolean * @property {string} location_show - actually a boolean diff --git a/scripts/main/build.js b/scripts/main/build.js index 91a7caed..e5363977 100644 --- a/scripts/main/build.js +++ b/scripts/main/build.js @@ -287,7 +287,7 @@ build.photo = function (data, disabled = false) { lychee.locale["PHOTO_THUMBNAIL"] }' data-overlay='false' draggable='false' data-tabindex='${tabindex.get_next_tab_index()}'>`; } - } else if (lychee.layout === 0) { + } else if (lychee.layout === "square") { if (data.size_variants.thumb2x !== null) { thumb2x = data.size_variants.thumb2x.url; } diff --git a/scripts/main/lychee.js b/scripts/main/lychee.js index 45da9385..204b388e 100644 --- a/scripts/main/lychee.js +++ b/scripts/main/lychee.js @@ -32,13 +32,13 @@ const lychee = { /** * Values: * - * - `0`: Use default, "square" layout. - * - `1`: Use Flickr-like "justified" layout. - * - `2`: Use Google-like "unjustified" layout + * - `square`: Use default, "square" layout. + * - `justified`: Use Flickr-like "justified" layout. + * - `unjustified`: Use Google-like "unjustified" layout * - * @type {number} + * @type {string} */ - layout: 1, + layout: "justified", /** * Display search in public mode. * @type {boolean} @@ -546,8 +546,7 @@ lychee.parsePublicInitializationData = function (data) { lychee.album_decoration = data.config.album_decoration || "layers"; lychee.album_decoration_orientation = data.config.album_decoration_orientation || "row"; lychee.checkForUpdates = data.config.check_for_updates; - lychee.layout = Number.parseInt(data.config.layout, 10); - if (Number.isNaN(lychee.layout)) lychee.layout = 1; + lychee.layout = data.config.layout || "justified"; lychee.landing_page_enable = data.config.landing_page_enable; lychee.public_search = data.config.public_search; lychee.image_overlay_type = data.config.image_overlay_type || "exif"; diff --git a/scripts/main/search.js b/scripts/main/search.js index 1c452bae..30898fbd 100644 --- a/scripts/main/search.js +++ b/scripts/main/search.js @@ -90,9 +90,9 @@ search.find = function (term) { if (albumsData !== "") albums_divider += " (" + (search.json.tag_albums.length + search.json.albums.length) + ")"; if (photosData !== "") { photos_divider += " (" + search.json.photos.length + ")"; - if (lychee.layout === 1) { + if (lychee.layout === "justified") { photosData = '
' + photosData + "
"; - } else if (lychee.layout === 2) { + } else if (lychee.layout === "unjustified") { photosData = '
' + photosData + "
"; } } diff --git a/scripts/main/view.js b/scripts/main/view.js index 4a7f347d..83a78fa9 100644 --- a/scripts/main/view.js +++ b/scripts/main/view.js @@ -256,7 +256,7 @@ view.album = { } if (photosData !== "") { - if (lychee.layout === 1) { + if (lychee.layout === "justified") { // The CSS class 'laying-out' prevents the DIV from being // rendered. // The CSS class will eventually be removed by the @@ -269,7 +269,7 @@ view.album = { // the correct width of the container. // TODO: Re-add the CSS class `laying-out` here after https://github.com/LycheeOrg/Lychee-front/pull/335 has been merged. photosData = '
' + photosData + "
"; - } else if (lychee.layout === 2) { + } else if (lychee.layout === "unjustified") { photosData = '
' + photosData + "
"; } } @@ -380,7 +380,7 @@ view.album = { srcset = ""; // This mimicks the structure of build.photo - if (lychee.layout === 0) { + if (lychee.layout === "square") { src = data.size_variants.thumb.url; if (data.size_variants.thumb2x !== null) { srcset = `${data.size_variants.thumb2x.url} 2x`; @@ -516,7 +516,7 @@ view.album = { */ const photos = album.json.photos; - if (lychee.layout === 1) { + if (lychee.layout === "justified") { /** @type {jQuery} */ const jqJustifiedLayout = $(".justified-layout"); let containerWidth = parseFloat(jqJustifiedLayout.width()); @@ -606,7 +606,7 @@ view.album = { }); // Show updated layout jqJustifiedLayout.removeClass("laying-out"); - } else if (lychee.layout === 2) { + } else if (lychee.layout === "unjustified") { /** @type {jQuery} */ const jqUnjustifiedLayout = $(".unjustified-layout"); let containerWidth = parseFloat(jqUnjustifiedLayout.width()); @@ -1383,9 +1383,9 @@ view.settings = {

${lychee.locale["LAYOUT_TYPE"]}