This commit is contained in:
James Cole
2025-10-25 14:09:44 +02:00
parent 60b3692ac9
commit f5806ea6de
12 changed files with 131 additions and 46 deletions

View File

@@ -17,13 +17,42 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/** global: token, helpPageTitle */
/** global: token, helpPageTitle, anonymous */
$(function () {
"use strict";
$('#help').click(showHelp);
$('#anonymous').click(changeAnonymity)
});
function submitAnonymity(value) {
$.ajax({
url: 'api/v1/preferences/anonymous',
data: JSON.stringify({data: value}),
type: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'),
},
});
}
function changeAnonymity(e) {
if (anonymous) {
console.log('Will DISABLE.');
submitAnonymity(false);
alert(anonymous_warning_off_txt);
window.location.reload(true);
}
if (!anonymous) {
console.log('Will ENABLE.');
submitAnonymity(true);
alert(anonymous_warning_on_txt);
window.location.reload(true);
}
return false;
}
function showHelp(e) {
"use strict";
var target = $(e.target);