Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbaf964

Browse files
committed
Improved the JS code
1 parent2f77a0c commitbbaf964

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/settings.html.twig‎

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
visibility:visible;
2828
}
2929
.modal-wrap.modal-container {
30-
box-shadow:0002pxvar(--page-background);
30+
box-shadow:5px5px10px0pxrgba(0,0,0,0.5);
3131
color:var(--base-6);
3232
margin:1em;
3333
max-width:94%;
@@ -120,6 +120,7 @@
120120
</div>
121121

122122
<script>
123+
(function() {
123124
let configOptions=document.querySelectorAll('.config-option');
124125
let oppositeValues= {'light':'dark','dark':'light','normal':'full','full':'normal' };
125126
[...configOptions].forEach(option=> {
@@ -134,34 +135,26 @@
134135
});
135136
});
136137
137-
letopenModal=document.getElementById('open-settings');
138-
letmodal=document.getElementById('profiler-settings');
138+
letopenModalButton=document.getElementById('open-settings');
139+
letmodalWindow=document.getElementById('profiler-settings');
139140
let closeModalButton=document.getElementsByClassName('close-modal')[0];
140141
let modalWrapper=document.getElementsByClassName('modal-wrap')[0]
141142
142-
openModal.addEventListener('click',function(event) {
143-
if ('theme-light'==localStorage.getItem('symfony/profiler/theme')) {
144-
document.getElementById('settings-theme-light').checked='checked';
145-
}else {
146-
document.getElementById('settings-theme-dark').checked='checked';
147-
}
148-
149-
if ('width-normal'==localStorage.getItem('symfony/profiler/width')) {
150-
document.getElementById('settings-width-normal').checked='checked';
151-
}else {
152-
document.getElementById('settings-width-full').checked='checked';
153-
}
143+
openModalButton.addEventListener('click',function(event) {
144+
document.getElementById('settings-'+localStorage.getItem('symfony/profiler/theme')).checked='checked';
145+
document.getElementById('settings-'+localStorage.getItem('symfony/profiler/width')).checked='checked';
154146
155-
modal.classList.toggle('visible');
147+
modalWindow.classList.toggle('visible');
156148
event.preventDefault();
157149
});
158150
159151
closeModalButton.addEventListener('click',function() {
160-
modal.classList.remove('visible');
152+
modalWindow.classList.remove('visible');
161153
});
162154
modalWrapper.addEventListener('click',function(event) {
163155
if (event.target==event.currentTarget) {
164-
modal.classList.remove('visible');
156+
modalWindow.classList.remove('visible');
165157
}
166158
});
159+
})();
167160
</script>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp