blob: c2f3d18583f8205c36e51cafe5430206c647fe8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* global App, Plugins, xhr */
Plugins.Profile_Chooser = {
onChange: function(sender) {
if (confirm("Activate selected profile? Window will reload.")) {
xhr.post("backend.php", {op: "pref-prefs", method: "activateprofile", id: sender.attr('value')}, () => {
window.location.reload();
});
} else {
// there has to be a better way to revert select to a previous value in onchange...
xhr.json("backend.php", App.getPhArgs("profile_chooser", "getprofile"), (reply) => {
if (reply && typeof reply.profile != 'undefined')
sender.attr('value', reply.profile, false);
});
}
}
};
|