This repository has been archived on 2024-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
epubreader/js/settings.js
sysadminstory 13d4946e19 Cleanup old files and update comments
Change the settings url to be mor consistant with the others urls of the
app.

Better feedback if the saving of settings did work or not.

Use the Framework to get the settings value, instead of using the $_POST
array.
2022-01-22 01:55:57 +01:00

22 lines
921 B
JavaScript

window.addEventListener('DOMContentLoaded', function () {
// save settings
var readerSettings = {
save : function() {
var data = {
EpubEnable: document.getElementById('EpubEnable').checked ? 'true' : 'false',
PdfEnable: document.getElementById('PdfEnable').checked ? 'true' : 'false',
CbxEnable: document.getElementById('CbxEnable').checked ? 'true' : 'false'
};
OC.msg.startSaving('#reader-personal .msg');
$.post(OC.generateUrl('apps/epubreader/settings/set'), data, readerSettings.afterSave);
},
afterSave : function(data){
OC.msg.finishedSaving('#reader-personal .msg', data);
}
};
$('#EpubEnable').on("change", readerSettings.save);
$('#PdfEnable').on("change", readerSettings.save);
$('#CbxEnable').on("change", readerSettings.save);
});