mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
hide up2k mode-toggle in read-only folders
This commit is contained in:
parent
fc0c7ff374
commit
89d4a2b4c4
|
@ -1066,12 +1066,14 @@ function up2k_init(have_crypto) {
|
|||
|
||||
function set_fsearch(new_state) {
|
||||
var perms = document.body.getAttribute('perms');
|
||||
var read_only = false;
|
||||
|
||||
if (!ebi('fsearch')) {
|
||||
new_state = false;
|
||||
}
|
||||
else if (perms && perms.indexOf('write') === -1) {
|
||||
new_state = true;
|
||||
read_only = true;
|
||||
}
|
||||
|
||||
if (new_state !== undefined) {
|
||||
|
@ -1079,6 +1081,11 @@ function up2k_init(have_crypto) {
|
|||
bcfg_set('fsearch', fsearch);
|
||||
}
|
||||
|
||||
try {
|
||||
document.querySelector('label[for="fsearch"]').style.opacity = read_only ? '0' : '1';
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
try {
|
||||
var fun = fsearch ? 'add' : 'remove';
|
||||
ebi('op_up2k').classList[fun]('srch');
|
||||
|
|
Loading…
Reference in a new issue