|
9 | 9 | // Documentation for client options: |
10 | 10 | // https://github.com/Studio-42/elFinder/wiki/Client-configuration-options |
11 | 11 | $().ready(function() { |
| 12 | + var theme = 'default'; |
| 13 | +
|
12 | 14 | $('#elfinder').elfinder({ |
13 | 15 | // set your elFinder options here |
14 | 16 | @if($locale) |
|
18 | 20 | _token: '{{ csrf_token() }}' |
19 | 21 | }, |
20 | 22 | url : '{{ route("elfinder.connector") }}', // connector URL |
21 | | - soundPath: '{{ Basset::getUrl(base_path("vendor/studio-42/elfinder/sounds")) }}' |
| 23 | + soundPath: '{{ Basset::getUrl(base_path("vendor/studio-42/elfinder/sounds")) }}', |
| 24 | + themes: { |
| 25 | + default : 'https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-gray.json', |
| 26 | + dark : 'https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-default.json', |
| 27 | + }, |
| 28 | + theme: theme |
| 29 | + }, |
| 30 | + function(fm, extraObj) { |
| 31 | + fm.bind('open', function() { |
| 32 | + setElFinderColorMode(); |
| 33 | + }); |
22 | 34 | }); |
| 35 | +
|
| 36 | + function isElfinderInDarkMode() { |
| 37 | + return typeof window.parent.colorMode !== 'undefined' && window.parent.colorMode.result === 'dark'; |
| 38 | + } |
| 39 | +
|
| 40 | + function setElFinderColorMode() { |
| 41 | + theme = isElfinderInDarkMode() ? 'dark' : 'default'; |
| 42 | +
|
| 43 | + let instance = $('#elfinder').elfinder('instance'); |
| 44 | + instance.changeTheme(theme).storage('theme', theme); |
| 45 | + } |
| 46 | +
|
| 47 | + if(typeof window.parent.colorMode !== 'undefined') { |
| 48 | + window.parent.colorMode.onChange(function() { |
| 49 | + setElFinderColorMode(); |
| 50 | + }); |
| 51 | + } |
23 | 52 | }); |
24 | 53 | </script> |
25 | 54 | @endsection |
|
0 commit comments