aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Resources/static/themes/_global/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/Resources/static/themes/_global/index.js')
-rw-r--r--app/Resources/static/themes/_global/index.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js
index ae598e56..88365270 100644
--- a/app/Resources/static/themes/_global/index.js
+++ b/app/Resources/static/themes/_global/index.js
@@ -4,6 +4,9 @@ import $ from 'jquery';
4/* Annotations */ 4/* Annotations */
5import annotator from 'annotator'; 5import annotator from 'annotator';
6 6
7import ClipboardJS from 'clipboard';
8import 'mathjax/es5/tex-svg';
9
7/* Fonts */ 10/* Fonts */
8import 'material-design-icons-iconfont/dist/material-design-icons.css'; 11import 'material-design-icons-iconfont/dist/material-design-icons.css';
9import 'lato-font/css/lato-font.css'; 12import 'lato-font/css/lato-font.css';
@@ -70,4 +73,47 @@ $(document).ready(() => {
70 retrievePercent(x.entryId, true); 73 retrievePercent(x.entryId, true);
71 }); 74 });
72 } 75 }
76
77 document.querySelectorAll('[data-handler=tag-rename]').forEach((item) => {
78 const current = item;
79 current.wallabag_edit_mode = false;
80 current.onclick = (event) => {
81 const target = event.currentTarget;
82
83 if (target.wallabag_edit_mode === false) {
84 $(target.parentNode.querySelector('[data-handle=tag-link]')).addClass('hidden');
85 $(target.parentNode.querySelector('[data-handle=tag-rename-form]')).removeClass('hidden');
86 target.parentNode.querySelector('[data-handle=tag-rename-form] input').focus();
87 target.querySelector('.material-icons').innerHTML = 'done';
88
89 target.wallabag_edit_mode = true;
90 } else {
91 target.parentNode.querySelector('[data-handle=tag-rename-form]').submit();
92 }
93 };
94 });
95
96 // mimic radio button because emailTwoFactor is a boolean
97 $('#update_user_googleTwoFactor').on('change', () => {
98 $('#update_user_emailTwoFactor').prop('checked', false);
99 });
100
101 $('#update_user_emailTwoFactor').on('change', () => {
102 $('#update_user_googleTwoFactor').prop('checked', false);
103 });
104
105 // same mimic for super admin
106 $('#user_googleTwoFactor').on('change', () => {
107 $('#user_emailTwoFactor').prop('checked', false);
108 });
109
110 $('#user_emailTwoFactor').on('change', () => {
111 $('#user_googleTwoFactor').prop('checked', false);
112 });
113
114 // handle copy to clipboard for developer stuff
115 const clipboard = new ClipboardJS('.btn');
116 clipboard.on('success', (e) => {
117 e.clearSelection();
118 });
73}); 119});