fix scrolling on modals spawned by settings modal, fix getUsers cache

closing the settings modal to immediately open another caused the
'modal-open' class on the body to get deleted, which meant scrolling
stopped working inside them. Also fix mistake added to jfapi in last commit.
pull/20/head v0.1.8
Harvey Tindall 4 years ago
parent 410c35c844
commit 802f957d22
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -136,6 +136,10 @@
.settingIcon {
margin-left: 0.2rem;
}
body.modal-open {
overflow: hidden;
}
</style>
<title>Admin</title>
</head>
@ -404,10 +408,23 @@
<script>
{{ if .bs5 }}
function createModal(id, find = false) {
let modal;
if (find) {
return bootstrap.Modal.getInstance(document.getElementById(id));
modal = bootstrap.Modal.getInstance(document.getElementById(id));
} else {
modal = new bootstrap.Modal(document.getElementById(id));
}
return new bootstrap.Modal(document.getElementById(id));
document.getElementById(id).addEventListener('shown.bs.modal', function () {
document.body.classList.add("modal-open");
});
return {
modal: modal,
show: function() {
let temp = this.modal.show();
return temp
},
hide: function() { return this.modal.hide(); }
};
}
{{ else }}
let send_to_addess_enabled = document.getElementById('send_to_address_enabled');
@ -419,9 +436,13 @@
multiUseEnabled.classList.remove('form-check-input');
}
function createModal(id, find = false) {
$('#' + id).on('shown.bs.modal', function () {
document.body.classList.add("modal-open");
});
return {
show: function() {
return $('#' + id).modal('show');
let temp = $('#' + id).modal('show');
return temp
},
hide: function() {
return $('#' + id).modal('hide');

@ -224,7 +224,6 @@ func (jf *Jellyfin) getUsers(public bool) ([]map[string]interface{}, int, error)
if public {
url := fmt.Sprintf("%s/users/public", jf.server)
data, status, err = jf._get(url, nil)
} else {
url := fmt.Sprintf("%s/users", jf.server)
data, status, err = jf._get(url, jf.loginParams)
@ -237,7 +236,7 @@ func (jf *Jellyfin) getUsers(public bool) ([]map[string]interface{}, int, error)
jf.cacheExpiry = time.Now().Add(time.Minute * time.Duration(jf.cacheLength))
return result, status, nil
}
return jf.userCache, status, nil
return jf.userCache, 200, nil
}
func (jf *Jellyfin) userByName(username string, public bool) (map[string]interface{}, int, error) {

Loading…
Cancel
Save