Update browser.js

This commit is contained in:
ed 2026-04-10 18:33:04 +00:00 committed by GitHub
parent 515eec899a
commit 8770cc2911
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -155,7 +155,6 @@ if (1)
"wt_m3ua": "add to m3u playlist (click <code>📻copy</code> later)", "wt_m3ua": "add to m3u playlist (click <code>📻copy</code> later)",
"wt_m3uc": "copy m3u playlist to clipboard", "wt_m3uc": "copy m3u playlist to clipboard",
"wt_grid": "toggle grid / list view$NHotkey: G", "wt_grid": "toggle grid / list view$NHotkey: G",
"wt_gridauto": "toggle auto-grid mode",
"wt_prev": "previous track$NHotkey: J", "wt_prev": "previous track$NHotkey: J",
"wt_play": "play / pause$NHotkey: P", "wt_play": "play / pause$NHotkey: P",
"wt_next": "next track$NHotkey: L", "wt_next": "next track$NHotkey: L",
@ -229,10 +228,9 @@ if (1)
"cl_hpick": "tap on column headers to hide in the table below", "cl_hpick": "tap on column headers to hide in the table below",
"cl_hcancel": "column hiding aborted", "cl_hcancel": "column hiding aborted",
"cl_rcm": "right-click menu", "cl_rcm": "right-click menu",
"cl_gridauto": "autogrid", "cl_gauto": "autogrid",
"ct_grid": '田 the grid', "ct_grid": '田 the grid',
"ct_gridauto": 'autogrid',
"ct_ttips": '◔ ◡ ◔"> tooltips', "ct_ttips": '◔ ◡ ◔"> tooltips',
"ct_thumb": 'in grid-view, toggle icons or thumbnails$NHotkey: T">🖼️ thumbs', "ct_thumb": 'in grid-view, toggle icons or thumbnails$NHotkey: T">🖼️ thumbs',
"ct_csel": 'use CTRL and SHIFT for file selection in grid-view">sel', "ct_csel": 'use CTRL and SHIFT for file selection in grid-view">sel',
@ -285,8 +283,8 @@ if (1)
"tt_dynt": "autogrow as tree expands", "tt_dynt": "autogrow as tree expands",
"tt_wrap": "word wrap", "tt_wrap": "word wrap",
"tt_hover": "reveal overflowing lines on hover$N( breaks scrolling unless mouse $N&nbsp; cursor is in the left gutter )", "tt_hover": "reveal overflowing lines on hover$N( breaks scrolling unless mouse $N&nbsp; cursor is in the left gutter )",
"tt_gathresh": "percentage of files required to trigger autogrid", "tt_gauto": "display as grid or list depending on folder contents",
"tt_gaext": "comma-separated file extensions to consider for autogrid", "tt_gathr": "use grid if this percentage of files are pics/vids",
"ml_pmode": "at end of folder...", "ml_pmode": "at end of folder...",
"ml_btns": "cmds", "ml_btns": "cmds",
@ -941,11 +939,10 @@ ebi('op_cfg').innerHTML = (
' </div>\n' + ' </div>\n' +
'</div>\n' + '</div>\n' +
'<div>\n' + '<div>\n' +
' <h3>' + L.cl_gridauto + '</h3>\n' + ' <h3>' + L.cl_gauto + '</h3>\n' +
' <div>\n' + ' <div>\n' +
' <a id="gridauto" class="tgl btn" href="#" tt="' + L.wt_gridauto + '">' + L.ct_gridauto + '</a>\n' + ' <a id="gauto" class="tgl btn" href="#" tt="' + L.tt_gauto + '">' + L.enable + '</a>\n' +
' <input type="text" id="ga_thresh" value="" ' + NOAC + ' style="width:1.5em" tt="' + L.tt_gathresh + '" />' + ' <input type="text" id="ga_thresh" value="" ' + NOAC + ' style="width:1.5em" tt="' + L.tt_gathr + '" />' +
' <input type="text" id="ga_ext" value="" ' + NOAC + ' style="width:5em" tt="' + L.tt_gaext + '" />' +
' </div>\n' + ' </div>\n' +
'</div>\n' + '</div>\n' +
'<div>\n' + '<div>\n' +
@ -5570,6 +5567,16 @@ var thegrid = (function () {
r.setvis(); r.setvis();
}; };
r.autogrid = function (res) {
var ni = 0;
var nf = res.files.length;
for (var a = 0; a < nf; a++)
if (img_re.test('.' + res.files[a].ext))
ni++;
if (nf)
thegrid.en = 100 * ni / nf >= r.gathr;
};
function setln(v) { function setln(v) {
if (v) { if (v) {
r.ln += v; r.ln += v;
@ -5957,10 +5964,17 @@ var thegrid = (function () {
pbar.onresize(); pbar.onresize();
vbar.onresize(); vbar.onresize();
}); });
bcfg_bind(r, 'gaen', 'gridauto', false, function(v) { bcfg_bind(r, 'gaen', 'gauto', false, function(v) {
if (!jread("griden", false) && thegrid.en) if (r.en && sread("griden") != 1) {
thegrid.en = false; r.en = false;
r.setvis(true);
}
}); });
ebi('ga_thresh').value = r.gathr = icfg_get('ga_thresh', 70);
ebi('ga_thresh').oninput = function (e) {
var n = parseInt(this.value);
swrite('ga_thresh', r.gathr = (isNum(n) ? n : 0) || 70);
};
ebi('wtgrid').onclick = ebi('griden').onclick; ebi('wtgrid').onclick = ebi('griden').onclick;
return r; return r;
@ -6893,16 +6907,6 @@ var treectl = (function () {
var n = parseInt(this.value); var n = parseInt(this.value);
swrite('bd_lim', r.lim = (isNum(n) ? n : 0) || 1000); swrite('bd_lim', r.lim = (isNum(n) ? n : 0) || 1000);
}; };
ebi('ga_thresh').value = r.gathresh = icfg_get('ga_thresh', 70);
ebi('ga_thresh').oninput = function (e) {
var n = parseInt(this.value);
swrite('ga_thresh', r.gathresh = (isNum(n) ? n : 0) || 70);
};
ebi('ga_ext').value = r.gaext = scfg_get('ga_ext', 'jpg,jpeg,png,gif,webp,webm,mp4');
ebi('ga_ext').oninput = function (e) {
var v = this.value;
swrite('ga_ext', r.gaext = v);
};
r.nvis = r.lim; r.nvis = r.lim;
ldks = jread('dks', []); ldks = jread('dks', []);
@ -7683,8 +7687,8 @@ var treectl = (function () {
} }
} }
if (jread('gridauto', false) && !jread('griden', false)) if (thegrid.gaen && sread('griden') != 1)
autogrid(res); thegrid.autogrid(res);
if (url) setTimeout(asdf, 1); else asdf(); if (url) setTimeout(asdf, 1); else asdf();
} }
@ -7850,26 +7854,6 @@ var treectl = (function () {
onresize(); onresize();
} }
function autogrid(res) {
var icount = 0;
var fcount = res.files.length;
var iext = new Set((sread('ga_ext') || "jpg,jpeg,png,gif,webp,webm,mp4").split(','));
for (var a = 0; a < fcount; a++) {
var fext = res.files[a].ext ? res.files[a].ext.toLowerCase() : '';
if (fext && iext.has(fext))
icount++;
}
var iratio = fcount > 0 ? (icount / fcount) * 100 : 0;
var threshold = sread('ga_thresh') || 70;
if (iratio >= threshold)
thegrid.en = true;
else
thegrid.en = false;
}
ebi('entree').onclick = r.entree; ebi('entree').onclick = r.entree;
ebi('detree').onclick = r.detree; ebi('detree').onclick = r.detree;
ebi('visdir').onclick = tree_scrollto; ebi('visdir').onclick = tree_scrollto;