Skip to content

Commit 1aeb495

Browse files
authored
Merge pull request #45 from Laravel-Backpack/fix-regex-theme-selector
Fix regex theme selector
2 parents da7b575 + 6eec31b commit 1aeb495

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

resources/views/common_styles.blade.php

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
<meta charset="utf-8">
22
<title>File Manager</title>
33
{{-- elFinder CSS (REQUIRED) --}}
4+
@php
5+
$themeStylesheetVersion = '3.0.0';
6+
@endphp
47
@bassetArchive('https://github.com/Studio-42/elFinder/archive/refs/tags/2.1.61.tar.gz', 'elfinder-2.1.61')
58
@basset('elfinder-2.1.61/elFinder-2.1.61/css/elfinder.min.css')
6-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/css/theme.min.css')
7-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/images/loading.svg', false)
8-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/font/material.eot', false)
9-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/font/material.svg', false)
10-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/images/icons-big.svg', false)
11-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/images/icons-small.svg', false)
12-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/font/material.woff', false)
13-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/font/material.ttf', false)
14-
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/font/material.woff2', false)
9+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/css/theme.min.css')
10+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/images/loading.svg', false)
11+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.eot', false)
12+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.svg', false)
13+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/images/icons-big.svg', false)
14+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/images/icons-small.svg', false)
15+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.woff', false)
16+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.ttf', false)
17+
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.woff2', false)
1518

1619
@bassetBlock('elfinderThemeSwitcherScript.js')
1720
<script type="text/javascript">
1821
document.addEventListener('DOMContentLoaded', function() {
1922
function getElfinderStyleSheet(main = true) {
20-
const regex = main ? /RobiNN1\/elFinder-Material-Theme\/Material\/css\/theme\.min\.css/ : /RobiNN1\/elFinder-Material-Theme\/Material\/css\/theme-gray\.min\.css/;
23+
let themeStylesheetVersion = '{{$themeStylesheetVersion}}';
24+
const regex = new RegExp(main ? `RobiNN1\/elFinder-Material-Theme@${themeStylesheetVersion}\/Material\/css\/theme\.min\.css` : `RobiNN1\/elFinder-Material-Theme@${themeStylesheetVersion}\/Material\/css\/theme-gray\.min\.css`);
2125
const linkElements = document.querySelectorAll('link[rel="stylesheet"]');
2226
// Find the main elfinder stylesheet
2327
let selectedLinkElement;
@@ -31,7 +35,7 @@ function getElfinderStyleSheet(main = true) {
3135
}
3236
3337
function addElfinderLightStylesheet() {
34-
let themeLightAsset = `{{ Basset::basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/Material/css/theme-gray.min.css') }}`;
38+
let themeLightAsset = `{{ Basset::basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/css/theme-gray.min.css') }}`;
3539
const match = themeLightAsset.match(/<link\s+href="([^"]+)"/i);
3640
if (match && match.length > 1) {
3741
let mainStyleSheet = getElfinderStyleSheet();

0 commit comments

Comments
 (0)