mirror of
https://github.com/9001/copyparty.git
synced 2026-06-20 13:12:26 -06:00
changed filename to color logic
This commit is contained in:
parent
d20e49e311
commit
5b96ecaecc
|
|
@ -6463,8 +6463,8 @@ var thegrid = (function () {
|
||||||
'<div class="imgcontainer">' +
|
'<div class="imgcontainer">' +
|
||||||
'<input type="checkbox" class="gselchk"></input>' +
|
'<input type="checkbox" class="gselchk"></input>' +
|
||||||
'<svg class="thumb" width="100%" height="100%" version="1.1"><use href="#' +
|
'<svg class="thumb" width="100%" height="100%" version="1.1"><use href="#' +
|
||||||
(isdir ? 'folder' : 'file') + '-icon" color="#' +
|
(isdir ? 'folder' : 'file') + '-icon" color="' +
|
||||||
(ext == 'unk' || ext.startsWith('/') ? '0000' : intToRGB(hashCode(ext))) + '"/></svg>' +
|
(ext == 'unk' || ext.startsWith('/') ? '#0000' : intToHSL(hashCode(ext))) + '"/></svg>' +
|
||||||
(isdir || ext == 'unk' || ext.startsWith('/') ? '' :
|
(isdir || ext == 'unk' || ext.startsWith('/') ? '' :
|
||||||
'<span class="th_ext" style="font-size: ' + (r.sz / 5) +'em; font-size:calc(var(--grid-sz) / 5 * ' +
|
'<span class="th_ext" style="font-size: ' + (r.sz / 5) +'em; font-size:calc(var(--grid-sz) / 5 * ' +
|
||||||
(ext.length > 3 ? 1 / (3 + ext.length * .4) * 3 : 1) + ')">' + ext + '</span>') +
|
(ext.length > 3 ? 1 / (3 + ext.length * .4) * 3 : 1) + ')">' + ext + '</span>') +
|
||||||
|
|
@ -6512,16 +6512,12 @@ var thegrid = (function () {
|
||||||
function hashCode (str) {
|
function hashCode (str) {
|
||||||
var hash = 0;
|
var hash = 0;
|
||||||
for(var i = 0; i < str.length; i++){
|
for(var i = 0; i < str.length; i++){
|
||||||
hash = str.charCodeAt(i) + 2026 * ((hash << 5) - hash);
|
hash = str.charCodeAt(i) + 130 * ((hash << 5) - hash);
|
||||||
}
|
}
|
||||||
return hash
|
return hash
|
||||||
}
|
}
|
||||||
function intToRGB(i){
|
function intToHSL(i){
|
||||||
var c = (i & 0x00FFFFFF)
|
return 'hsl(' + i % 360 + 'deg 100% 50%)'
|
||||||
.toString(16)
|
|
||||||
.toUpperCase();
|
|
||||||
|
|
||||||
return "00000".substring(0, 6 - c.length) + c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r.bagit = function (isrc) {
|
r.bagit = function (isrc) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue