diff --git a/exifprop.go b/exifprop.go index ba60af88..7a6cb475 100644 --- a/exifprop.go +++ b/exifprop.go @@ -43,14 +43,14 @@ type ExifProp struct { thumb MediaData } -func ratfloat32(t *tiff.Tag) float32 { +func RatFloat32(t *tiff.Tag) float32 { if numer, denom, _ := t.Rat2(0); denom != 0 { return float32(numer) / float32(denom) } return 0 } -func ratfloat64(t *tiff.Tag) float64 { +func RatFloat64(t *tiff.Tag) float64 { if numer, denom, _ := t.Rat2(0); denom != 0 { return float64(numer) / float64(denom) } @@ -92,31 +92,31 @@ func (ep *ExifProp) Setup(x *exif.Exif) { ep.ExposureProg, _ = t.Int(0) } if t, err = x.Get(exif.FNumber); err == nil { - ep.FNumber = ratfloat32(t) + ep.FNumber = RatFloat32(t) } if t, err = x.Get(exif.ISOSpeedRatings); err == nil { ep.ISOSpeed, _ = t.Int(0) } if t, err = x.Get(exif.ShutterSpeedValue); err == nil { - ep.ShutterSpeed = ratfloat32(t) + ep.ShutterSpeed = RatFloat32(t) } if t, err = x.Get(exif.ApertureValue); err == nil { - ep.Aperture = ratfloat32(t) + ep.Aperture = RatFloat32(t) } if t, err = x.Get(exif.ExposureBiasValue); err == nil { - ep.ExposureBias = ratfloat32(t) + ep.ExposureBias = RatFloat32(t) } if t, err = x.Get(exif.LightSource); err == nil { ep.LightSource, _ = t.Int(0) } if t, err = x.Get(exif.FocalLength); err == nil { - ep.Focal = ratfloat32(t) + ep.Focal = RatFloat32(t) } if t, err = x.Get(exif.FocalLengthIn35mmFilm); err == nil { ep.Focal35mm, _ = t.Int(0) } if t, err = x.Get(exif.DigitalZoomRatio); err == nil { - ep.DigitalZoom = ratfloat32(t) + ep.DigitalZoom = RatFloat32(t) } if t, err = x.Get(exif.ImageLength); err == nil { ep.Height, _ = t.Int(0) @@ -134,7 +134,7 @@ func (ep *ExifProp) Setup(x *exif.Exif) { ep.Latitude, ep.Longitude = lat, lon } if t, err = x.Get(exif.GPSAltitude); err == nil { - ep.Altitude = ratfloat32(t) + ep.Altitude = RatFloat32(t) if t, err = x.Get(exif.GPSAltitudeRef); err == nil { var ref, _ = t.Int(0) if ref == 1 { diff --git a/folder.go b/folder.go index 3a9c349d..70af72de 100644 --- a/folder.go +++ b/folder.go @@ -20,43 +20,38 @@ var puidsym = (func() (t [256]bool) { // UnfoldPath brings any share path to system file path. func UnfoldPath(shrpath string) (syspath string, err error) { + var pref, suff = shrpath, "." for i, c := range shrpath { if c == '/' || c == '\\' { - var puid Puid_t - if err = puid.Set(shrpath[:i]); err != nil { - return - } - if puid < PUIDreserved { - err = ErrNotSys - return - } - var suff = path.Clean(shrpath[i+1:]) + pref, suff = shrpath[:i], path.Clean(shrpath[i+1:]) if !fs.ValidPath(suff) { // prevent to modify original path err = ErrPathOut return } - var pref string - var ok bool - if pref, ok = syspathcache.Path(puid); !ok { - err = ErrNoPath - return - } - syspath = path.Join(pref, suff) - return + break } else if int(c) >= len(puidsym) || !puidsym[c] { syspath, err = shrpath, fs.ErrPermission return } } var puid Puid_t - if err = puid.Set(shrpath); err != nil { + if err = puid.Set(pref); err != nil { return } var ok bool - if syspath, ok = syspathcache.Path(puid); !ok { + if pref, ok = syspathcache.Path(puid); !ok { err = ErrNoPath return } + if suff != "." { + if puid < PUIDreserved { + err = ErrNotSys + return + } + syspath = path.Join(pref, suff) + } else { + syspath = pref + } return // root of share } diff --git a/frontend/devmode/cards.js b/frontend/devmode/cards.js index 7c3e93cd..3c39806f 100644 --- a/frontend/devmode/cards.js +++ b/frontend/devmode/cards.js @@ -14,28 +14,28 @@ const sortmodehint = { }; const listmodetag = { - lsicon: 'list-item-tag', - smicon: 'file-item-tag', - mdicon: 'file-item-tag', - lgicon: 'img-item-tag' + xs: 'list-item-tag', + sm: 'file-item-tag', + md: 'file-item-tag', + lg: 'img-item-tag' }; const listmoderow = { - lsicon: 'align-items-start', - smicon: 'align-items-start', - mdicon: 'align-items-start', - lgicon: 'align-items-center' + xs: 'align-items-start', + sm: 'align-items-start', + md: 'align-items-start', + lg: 'align-items-center' }; const listmodeicon = { - lsicon: 'format_align_justify', - smicon: 'view_comfy', - mdicon: 'view_module', - lgicon: 'widgets' + xs: 'format_align_justify', + sm: 'view_comfy', + md: 'view_module', + lg: 'widgets' }; const listmodehint = { - lsicon: "list", - smicon: "small icons", - mdicon: "middle icons", - lgicon: "large icons" + xs: "list", + sm: "small icons", + md: "middle icons", + lg: "large icons" }; const noderadius = 15; @@ -186,7 +186,7 @@ const VueCtgrCard = { props: ["flist"], data() { return { - listmode: "smicon", + listmode: 'sm', iid: makestrid(10) // instance ID }; }, @@ -225,16 +225,16 @@ const VueCtgrCard = { }, methods: { onlistmodels() { - this.listmode = 'lsicon'; + this.listmode = 'xs'; }, onlistmodesm() { - this.listmode = 'smicon'; + this.listmode = 'sm'; }, onlistmodemd() { - this.listmode = 'mdicon'; + this.listmode = 'md'; }, onlistmodelg() { - this.listmode = 'lgicon'; + this.listmode = 'lg'; }, onselect(file) { @@ -279,7 +279,7 @@ const VueDriveCard = { diskadd: null, sortorder: 1, - listmode: "smicon", + listmode: 'sm', iid: makestrid(10) // instance ID }; }, @@ -350,16 +350,16 @@ const VueDriveCard = { this.sortorder = -this.sortorder; }, onlistmodels() { - this.listmode = 'lsicon'; + this.listmode = 'xs'; }, onlistmodesm() { - this.listmode = 'smicon'; + this.listmode = 'sm'; }, onlistmodemd() { - this.listmode = 'mdicon'; + this.listmode = 'md'; }, onlistmodelg() { - this.listmode = 'lgicon'; + this.listmode = 'lg'; }, ondiskadd() { @@ -501,7 +501,7 @@ const VueDirCard = { data() { return { sortorder: 1, - listmode: "smicon", + listmode: 'sm', iid: makestrid(10) // instance ID }; }, @@ -555,16 +555,16 @@ const VueDirCard = { this.sortorder = -this.sortorder; }, onlistmodels() { - this.listmode = 'lsicon'; + this.listmode = 'xs'; }, onlistmodesm() { - this.listmode = 'smicon'; + this.listmode = 'sm'; }, onlistmodemd() { - this.listmode = 'mdicon'; + this.listmode = 'md'; }, onlistmodelg() { - this.listmode = 'lgicon'; + this.listmode = 'lg'; }, onselect(file) { @@ -606,7 +606,7 @@ const VueFileCard = { expanded: true, sortorder: 1, sortmode: 'byalpha', - listmode: 'smicon', + listmode: 'sm', thumbmode: true, fgshow: [ false, // other @@ -885,16 +885,16 @@ const VueFileCard = { this.sortmode = 'unsorted'; }, onlistmodels() { - this.listmode = 'lsicon'; + this.listmode = 'xs'; }, onlistmodesm() { - this.listmode = 'smicon'; + this.listmode = 'sm'; }, onlistmodemd() { - this.listmode = 'mdicon'; + this.listmode = 'md'; }, onlistmodelg() { - this.listmode = 'lgicon'; + this.listmode = 'lg'; }, onthumbmode() { this.thumbmode = thumbmode = !this.thumbmode; diff --git a/frontend/devmode/devmode.js b/frontend/devmode/devmode.js index e6e819bc..76da397a 100644 --- a/frontend/devmode/devmode.js +++ b/frontend/devmode/devmode.js @@ -3,7 +3,7 @@ // This file is included only for developer mode linkage const buildvers = "0.8.3"; -const builddate = "2022.10.25"; +const builddate = "2022.10.31"; console.info("version: %s, builton: %s", buildvers, builddate); console.info("starts in developer mode"); diff --git a/frontend/devmode/fileitem.js b/frontend/devmode/fileitem.js index 085f176e..c38ba3c3 100644 --- a/frontend/devmode/fileitem.js +++ b/frontend/devmode/fileitem.js @@ -285,9 +285,29 @@ const fileinfo = file => { return lst; }; +const iconpixsize = { + xs: 'icon-pix-xs imgscale', + sm: 'icon-pix-sm imgscale', + md: 'icon-pix-md imgscale', + lg: 'icon-pix-lg imgscale', +}; + +const iconsvgsize = { + xs: 'icon-svg-xs imgcontain', + sm: 'icon-svg-sm imgcontain', + md: 'icon-svg-md imgcontain', + lg: 'icon-svg-lg imgcontain', +}; + +const iconwdh = { + sm: 'smimgw', + md: 'mdimgw', + lg: 'lgimgw', +}; + const VueIcon = { template: '#icon-tpl', - props: ["file", "clsimg"], + props: ["file", "size"], data() { return { iconfmt: [], @@ -301,10 +321,11 @@ const VueIcon = { clsicon() { for (const fmt of this.iconfmt) { if (fmt.mime === 'image/svg+xml') { - return this.clsimg + ' imgcontain'; + return iconsvgsize[this.size]; + } else { + return iconpixsize[this.size]; } } - return this.clsimg + ' imgscale'; }, ismtmb() { return Number(this.file.mtmb) > 0 && this.tm; @@ -451,7 +472,7 @@ const VueIconMenu = { const VueListItem = { template: '#list-item-tpl', - props: ["file", "size"], + props: ["file"], data() { return { iconfmt: [], @@ -471,26 +492,24 @@ const VueListItem = { : iconmapping.private.label; } }, - clsimgwdh() { - switch (this.size) { - case "smicon": - return "smimgw"; - case "mdicon": - return "mdimgw"; - case "lgicon": - return "lgimgw"; - } + clsiconwdh() { + return iconwdh['xs']; }, - clsimage() { - switch (this.size) { - case "smicon": - return "smimgw smimgh"; - case "mdicon": - return "mdimgw mdimgh"; - case "lgicon": - return "lgimgw lgimgh"; + clsicon() { + for (const fmt of this.iconfmt) { + if (fmt.mime === 'image/svg+xml') { + return iconsvgsize['xs']; + } else { + return iconpixsize['xs']; + } } }, + clsiconsvg() { + return iconsvgsize['xs']; + }, + clsiconpix() { + return iconpixsize['xs']; + }, // manage items classes itemview() { @@ -548,26 +567,24 @@ const VueFileItem = { : iconmapping.private.label; } }, - clsimgwdh() { - switch (this.size) { - case "smicon": - return "smimgw"; - case "mdicon": - return "mdimgw"; - case "lgicon": - return "lgimgw"; - } + clsiconwdh() { + return iconwdh[this.size]; }, - clsimage() { - switch (this.size) { - case "smicon": - return "smimgw smimgh"; - case "mdicon": - return "mdimgw mdimgh"; - case "lgicon": - return "lgimgw lgimgh"; + clsicon() { + for (const fmt of this.iconfmt) { + if (fmt.mime === 'image/svg+xml') { + return iconsvgsize[this.size]; + } else { + return iconpixsize[this.size]; + } } }, + clsiconsvg() { + return iconsvgsize[this.size]; + }, + clsiconpix() { + return iconpixsize[this.size]; + }, // manage items classes itemview() { diff --git a/frontend/skin/blue/imgitem.css b/frontend/skin/blue/imgitem.css index 271afeb1..e414852d 100644 --- a/frontend/skin/blue/imgitem.css +++ b/frontend/skin/blue/imgitem.css @@ -19,11 +19,6 @@ box-shadow: 0px 0px 12px DodgerBlue; } - .imgitem .pict { - max-width: 256px; - max-height: 256px; - } - .imgitem .label { width: 100%; max-width: 96px; diff --git a/frontend/skin/blue/listitem.css b/frontend/skin/blue/listitem.css index a16d80d4..dad9bfb3 100644 --- a/frontend/skin/blue/listitem.css +++ b/frontend/skin/blue/listitem.css @@ -33,11 +33,6 @@ } } -.listitem .pict, .listitem .label, .listitem .bars { - width: 48px; - height: 48px; -} - .listitem .name, .listitem .attr { margin-left: 0.25rem; margin-right: 0.25rem; diff --git a/frontend/skin/coffee-beans/imgitem.css b/frontend/skin/coffee-beans/imgitem.css index 0262b812..088c429c 100644 --- a/frontend/skin/coffee-beans/imgitem.css +++ b/frontend/skin/coffee-beans/imgitem.css @@ -22,11 +22,6 @@ box-shadow: 0px 0px 12px Tomato; } - .imgitem .pict { - max-width: 256px; - max-height: 256px; - } - .imgitem .label { width: 100%; max-width: 96px; diff --git a/frontend/skin/coffee-beans/listitem.css b/frontend/skin/coffee-beans/listitem.css index 07f68043..2ba6196d 100644 --- a/frontend/skin/coffee-beans/listitem.css +++ b/frontend/skin/coffee-beans/listitem.css @@ -33,11 +33,6 @@ } } -.listitem .pict, .listitem .label, .listitem .bars { - width: 48px; - height: 48px; -} - .listitem .name, .listitem .attr { margin-left: 0.25rem; margin-right: 0.25rem; diff --git a/frontend/skin/cup-of-coffee/imgitem.css b/frontend/skin/cup-of-coffee/imgitem.css index 0262b812..088c429c 100644 --- a/frontend/skin/cup-of-coffee/imgitem.css +++ b/frontend/skin/cup-of-coffee/imgitem.css @@ -22,11 +22,6 @@ box-shadow: 0px 0px 12px Tomato; } - .imgitem .pict { - max-width: 256px; - max-height: 256px; - } - .imgitem .label { width: 100%; max-width: 96px; diff --git a/frontend/skin/cup-of-coffee/listitem.css b/frontend/skin/cup-of-coffee/listitem.css index 5d03c8b3..e34701e7 100644 --- a/frontend/skin/cup-of-coffee/listitem.css +++ b/frontend/skin/cup-of-coffee/listitem.css @@ -33,11 +33,6 @@ } } -.listitem .pict, .listitem .label, .listitem .bars { - width: 48px; - height: 48px; -} - .listitem:hover .name { color: LightGoldenRodYellow; } diff --git a/frontend/skin/dark/imgitem.css b/frontend/skin/dark/imgitem.css index bf5f1e1e..4b91f307 100644 --- a/frontend/skin/dark/imgitem.css +++ b/frontend/skin/dark/imgitem.css @@ -19,11 +19,6 @@ box-shadow: 0px 0px 12px DodgerBlue; } - .imgitem .pict { - max-width: 256px; - max-height: 256px; - } - .imgitem .label { width: 100%; max-width: 96px; diff --git a/frontend/skin/dark/listitem.css b/frontend/skin/dark/listitem.css index b1e00abd..f6534409 100644 --- a/frontend/skin/dark/listitem.css +++ b/frontend/skin/dark/listitem.css @@ -33,11 +33,6 @@ } } -.listitem .pict, .listitem .label, .listitem .bars { - width: 48px; - height: 48px; -} - .listitem .name, .listitem .attr { margin-left: 0.25rem; margin-right: 0.25rem; diff --git a/frontend/skin/daylight/imgitem.css b/frontend/skin/daylight/imgitem.css index 5cb0aff6..2059a7b1 100644 --- a/frontend/skin/daylight/imgitem.css +++ b/frontend/skin/daylight/imgitem.css @@ -22,11 +22,6 @@ box-shadow: 0px 0px 12px DarkKhaki; } - .imgitem .pict { - max-width: 256px; - max-height: 256px; - } - .imgitem .label { width: 100%; max-width: 96px; diff --git a/frontend/skin/daylight/listitem.css b/frontend/skin/daylight/listitem.css index 1d3fc7a9..2dcb6be0 100644 --- a/frontend/skin/daylight/listitem.css +++ b/frontend/skin/daylight/listitem.css @@ -33,11 +33,6 @@ } } -.listitem .pict, .listitem .label, .listitem .bars { - width: 48px; - height: 48px; -} - .listitem .name, .listitem .attr { margin-left: 0.25rem; margin-right: 0.25rem; diff --git a/frontend/skin/neon/card.css b/frontend/skin/neon/card.css index b02dc28a..05c5e3a4 100644 --- a/frontend/skin/neon/card.css +++ b/frontend/skin/neon/card.css @@ -103,6 +103,46 @@ object-fit: contain; } +.icon-pix-xs { + max-width: 48px; + max-height: 48px; +} + +.icon-svg-xs { + width: 48px; + height: 48px; +} + +.icon-pix-sm { + max-width: 96px; + max-height: 96px; +} + +.icon-svg-sm { + width: 96px; + height: 96px; +} + +.icon-pix-md { + max-width: 176px; + max-height: 176px; +} + +.icon-svg-md { + width: 176px; + height: 176px; +} + +.icon-pix-lg { + max-width: 256px; + max-height: 256px; +} + +.icon-svg-lg { + width: 256px; + height: 256px; +} + .smimgw { width: 96px; } diff --git a/frontend/skin/neon/imgitem.css b/frontend/skin/neon/imgitem.css index f39b53eb..c445339f 100644 --- a/frontend/skin/neon/imgitem.css +++ b/frontend/skin/neon/imgitem.css @@ -22,11 +22,6 @@ box-shadow: 0px 0px 12px Azure; } - .imgitem .pict { - max-width: 256px; - max-height: 256px; - } - .imgitem .label { width: 100%; max-width: 96px; diff --git a/frontend/skin/neon/listitem.css b/frontend/skin/neon/listitem.css index d1d8b167..bed2a4bb 100644 --- a/frontend/skin/neon/listitem.css +++ b/frontend/skin/neon/listitem.css @@ -33,11 +33,6 @@ } } -.listitem .pict, .listitem .label, .listitem .bars { - width: 48px; - height: 48px; -} - .listitem .name, .listitem .attr { margin-left: 0.25rem; margin-right: 0.25rem; diff --git a/frontend/skin/neon/slider.css b/frontend/skin/neon/slider.css index 0aef8948..f92f4889 100644 --- a/frontend/skin/neon/slider.css +++ b/frontend/skin/neon/slider.css @@ -66,23 +66,18 @@ /* Thumbnail slider section */ -.thumbslider { - height: 80px; +.thumbslider .thumb { + opacity: 0.75; + border: 0.25rem solid Silver; } - .thumbslider .thumb { - height: 100%; - opacity: 0.75; - border: 0.25rem solid Silver; + .thumbslider .thumb:hover { + opacity: 1; + border: 0.25rem solid Lavender; } - .thumbslider .thumb:hover { - opacity: 1; - border: 0.25rem solid Lavender; - } - - .thumbslider .thumb.active { - z-index: 1036; - opacity: 1; - border: 0.25rem solid Azure; - } + .thumbslider .thumb.active { + z-index: 1036; + opacity: 1; + border: 0.25rem solid Azure; + } diff --git a/frontend/skin/old-monitor/imgitem.css b/frontend/skin/old-monitor/imgitem.css index 7f0acc40..c2347f63 100644 --- a/frontend/skin/old-monitor/imgitem.css +++ b/frontend/skin/old-monitor/imgitem.css @@ -19,11 +19,6 @@ box-shadow: 0px 0px 12px White; } - .imgitem .pict { - max-width: 256px; - max-height: 256px; - } - .imgitem .label { width: 100%; max-width: 96px; diff --git a/frontend/skin/old-monitor/listitem.css b/frontend/skin/old-monitor/listitem.css index 544361ce..7d11ba0d 100644 --- a/frontend/skin/old-monitor/listitem.css +++ b/frontend/skin/old-monitor/listitem.css @@ -33,11 +33,6 @@ } } -.listitem .pict, .listitem .label, .listitem .bars { - width: 48px; - height: 48px; -} - .listitem .name, .listitem .attr { margin-left: 0.25rem; margin-right: 0.25rem; diff --git a/frontend/tmpl/fileitem.html b/frontend/tmpl/fileitem.html index 9c879235..ee2510ad 100644 --- a/frontend/tmpl/fileitem.html +++ b/frontend/tmpl/fileitem.html @@ -1,15 +1,19 @@