From 2982ad1c3edc19259442a2ef58c7b5a74f802e9b Mon Sep 17 00:00:00 2001 From: Ayanaa Rahman Date: Tue, 10 Oct 2023 18:58:45 -0400 Subject: [PATCH] Remove extra theme-switcher.js file --- pontoon/base/static/js/theme-switcher.js | 41 ------------------------ 1 file changed, 41 deletions(-) delete mode 100644 pontoon/base/static/js/theme-switcher.js diff --git a/pontoon/base/static/js/theme-switcher.js b/pontoon/base/static/js/theme-switcher.js deleted file mode 100644 index 05bbcdbe29..0000000000 --- a/pontoon/base/static/js/theme-switcher.js +++ /dev/null @@ -1,41 +0,0 @@ -$(function () { - $('.appearance .toggle-button button').click(function (e) { - e.preventDefault(); - - var self = $(this); - - // If the clicked button is already active, do nothing - if (self.is('.active')) { - return; - } - - var theme = self.attr('class').split(' ')[0]; // gets the theme (dark, light, system) based on the button's class - - $.ajax({ - url: '/api/v1/user/theme/' + $('#server').data('username') + '/', - type: 'POST', - data: { - csrfmiddlewaretoken: $('body').data('csrf'), - theme: theme, - }, - success: function () { - $('.appearance .toggle-button button').removeClass('active'); - - self.addClass('active'); - - $('body') - .removeClass('dark-theme light-theme system-theme') - .addClass(`${theme}-theme`); - - Pontoon.endLoader(`Theme changed to ${theme}.`); - }, - error: function (request) { - if (request.responseText === 'error') { - Pontoon.endLoader('Oops, something went wrong.', 'error'); - } else { - Pontoon.endLoader(request.responseText, 'error'); - } - }, - }); - }); -});