diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-24 11:42:27 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-24 11:42:27 -0500 |
commit | 10b33dbd20d33b7497f500c11ad343399fc338a9 (patch) | |
tree | 1ce7dafce5a98a6c87dc1197b3be0ff9e2256ff8 /ext/bg/js | |
parent | cf18e3b42e0fa171b9ec9af4c534a962d347e155 (diff) |
Optimize toggle on the context popup window
Remove bootstrap-toggle dependency
Diffstat (limited to 'ext/bg/js')
-rw-r--r-- | ext/bg/js/context.js | 19 |
1 files changed, 12 insertions, 7 deletions
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); }); })); |