From 10b33dbd20d33b7497f500c11ad343399fc338a9 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 24 Nov 2019 11:42:27 -0500 Subject: Optimize toggle on the context popup window Remove bootstrap-toggle dependency --- ext/bg/context.html | 65 +++++++++++++++++++++++++++++++++++++++++++++++++--- ext/bg/js/context.js | 19 +++++++++------ ext/bg/legal.html | 1 - 3 files changed, 74 insertions(+), 11 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/context.html b/ext/bg/context.html index 7e08dddd..52645022 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -11,7 +11,6 @@ -
- +
@@ -119,7 +179,6 @@
- diff --git a/ext/bg/js/context.js b/ext/bg/js/context.js index 3fb27f0d..5bd6ada4 100644 --- a/ext/bg/js/context.js +++ b/ext/bg/js/context.js @@ -64,13 +64,18 @@ $(document).ready(utilAsync(() => { url: window.location.href }; apiOptionsGet(optionsContext).then(options => { - const toggle = $('#enable-search'); - toggle.prop('checked', options.general.enable).change(); - toggle.bootstrapToggle(); - toggle.change(() => apiCommandExec('toggle')); + const toggle = document.querySelector('#enable-search'); + toggle.checked = options.general.enable; + toggle.addEventListener('change', () => apiCommandExec('toggle'), false); - const toggle2 = $('#enable-search2'); - toggle2.prop('checked', options.general.enable).change(); - toggle2.change(() => apiCommandExec('toggle')); + const toggle2 = document.querySelector('#enable-search2'); + toggle2.checked = options.general.enable; + toggle2.addEventListener('change', () => apiCommandExec('toggle'), false); + + setTimeout(() => { + for (const n of document.querySelectorAll('.toggle-group')) { + n.classList.add('toggle-group-animated'); + } + }, 10); }); })); diff --git a/ext/bg/legal.html b/ext/bg/legal.html index 377d25ba..3047ab3e 100644 --- a/ext/bg/legal.html +++ b/ext/bg/legal.html @@ -41,7 +41,6 @@ and are used in conformance with the Group's Bootstrap v3.3.7 -
  • Bootstrap Toggle v2.2.0
  • Handlebars v4.0.6
  • jQuery v3.2.1
  • JSZip v3.1.3
  • -- cgit v1.2.3