From 66d868454b373e64eca78120ce47ca896c6be0ea Mon Sep 17 00:00:00 2001 From: kor Date: Wed, 31 Oct 2018 14:26:21 +1300 Subject: [PATCH] Refactor image type entry css, fix (remove) image-type-link underline. --- docs/asset/style.css | 16 +++++++++++----- docs/logic/view.js | 20 +++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/docs/asset/style.css b/docs/asset/style.css index 82eefd5..36bfef8 100644 --- a/docs/asset/style.css +++ b/docs/asset/style.css @@ -230,7 +230,9 @@ body { } /*IMAGE*/ -.griditem-image .griditem-containerupper { +.griditem-containerupper-image { + padding: var(--size-grid-gutter) var(--size-grid-gutter) 0 var(--size-grid-gutter); + display: inline-block; position: absolute; height: 100%; width: 100%; @@ -238,14 +240,17 @@ body { z-index: 200; top: 0; } -.griditem-image .griditem-containerlower { - padding-bottom: var(--size-grid-gutter); +.griditem-containerlower-image { + padding: var(--size-grid-gutter); position: absolute; width: 100%; bottom: 0; z-index: 200; left: 0; } +.griditem-containerlower-image:empty { + display: none; +} .griditem-image { background: transparent; padding-bottom: 0; @@ -371,6 +376,7 @@ body { vertical-align: top; text-align: center; float: right; + text-decoration: none; } .griditem-typeicon { opacity: var(--alpha-idleicon); @@ -451,10 +457,10 @@ body { } /* IMAGE */ -.griditem-image .griditem-containerlower { +.griditem-containerlower-image { display: none; } -.griditem-image:hover .griditem-containerlower { +.griditem-image:hover .griditem-containerlower-image { display: initial; } .griditem-taglink { diff --git a/docs/logic/view.js b/docs/logic/view.js index 3a07851..5c51138 100644 --- a/docs/logic/view.js +++ b/docs/logic/view.js @@ -88,7 +88,8 @@ function View() } let onclickImage = ``; - if (SETTINGS.SHOWIMAG && this.isType(value.TYPE, 'image')) + let entryIsImageType = (SETTINGS.SHOWIMAG && this.isType(value.TYPE, 'image')); + if (entryIsImageType) { itemClass += " griditem-image"; onclickImage = `onclick="main.view.handleImageClick(event, this, '${value.FILE}');" @@ -118,7 +119,12 @@ function View() // UPPER CONTENT START if (SETTINGS.SHOWUPPER) { - entry += `
`; + let upperClass = 'griditem-containerupper'; + if (entryIsImageType) + { + upperClass = 'griditem-containerupper-image'; + } + entry += `
`; // TITLE if (SETTINGS.SHOWTITLE) @@ -165,7 +171,12 @@ function View() // LOWER CONTENT START if (SETTINGS.SHOWLOWER) { - entry += `
`; + let lowerClass = 'griditem-containerlower'; + if (entryIsImageType) + { + lowerClass = 'griditem-containerlower-image'; + } + entry += `
`; // AUTHOR if (SETTINGS.SHOWAUTH && this.isDefined(value.AUTH)) @@ -260,8 +271,7 @@ function View() } // IMAGE - for image-type-entry - if (SETTINGS.SHOWIMAG - && this.isType(value.TYPE, 'image') + if (entryIsImageType && this.isDefined(value.FILE) && this.isImage(value.FILE)) {