Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpm committed Nov 21, 2024
1 parent 25b5c97 commit aec00c6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
14 changes: 5 additions & 9 deletions resources/views/common_scripts.blade.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{{-- jQuery (REQUIRED) --}}
@if (!isset ($jquery) || (isset($jquery) && $jquery == true))
@basset('https://unpkg.com/jquery@3.6.1/dist/jquery.min.js')
@basset('bp-jquery')
@endif

{{-- jQuery UI and Smoothness theme --}}
@bassetArchive('https://github.com/jquery/jquery-ui/archive/refs/tags/1.13.2.tar.gz', 'jquery-ui-1.13.2')
@basset('jquery-ui-1.13.2/jquery-ui-1.13.2/dist/themes/smoothness/jquery-ui.min.css')
@basset('jquery-ui-1.13.2/jquery-ui-1.13.2/dist/jquery-ui.min.js')
{{-- jQuery UI --}}
@basset('bp-jquery-ui')

{{-- elFinder JS (REQUIRED) --}}
@bassetArchive('https://github.com/Studio-42/elFinder/archive/refs/tags/2.1.64.tar.gz', 'elfinder-2.1.64')
@basset('elfinder-2.1.64/elFinder-2.1.64/js/elfinder.min.js')
@basset('bp-elfinder-js')

{{-- elFinder translation (OPTIONAL) --}}
@if($locale)
@basset('https://cdnjs.cloudflare.com/ajax/libs/elfinder/2.1.64/js/i18n/elfinder.'.$locale.'.min.js')
@basset('bp-elfinder-i18n-'.$locale)
@endif

{{-- elFinder sounds --}}
Expand Down
29 changes: 12 additions & 17 deletions resources/views/common_styles.blade.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<meta charset="utf-8">
<title>File Manager</title>
{{-- elFinder CSS (REQUIRED) --}}
@php
$themeStylesheetVersion = '3.0.0';
@endphp
@bassetArchive('https://github.com/Studio-42/elFinder/archive/refs/tags/2.1.64.tar.gz', 'elfinder-2.1.64')
@basset('elfinder-2.1.64/elFinder-2.1.64/css/elfinder.min.css')
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/css/theme.min.css')
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/images/loading.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.eot', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/images/icons-big.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/images/icons-small.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.woff', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.ttf', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.woff2', false)
@basset('bp-elfinder-css')
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/css/theme.min.css')
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/images/loading.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/font/material.eot', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/font/material.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/images/icons-big.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/images/icons-small.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/font/material.woff', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/font/material.ttf', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/[email protected]/Material/font/material.woff2', false)

@bassetBlock('elfinderThemeSwitcherScript.js')
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
function getElfinderStyleSheet(main = true) {
let themeStylesheetVersion = '{{$themeStylesheetVersion}}';
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`);
const regex = new RegExp(main ? `RobiNN1\/[email protected]\/Material\/css\/theme\.min\.css` : `RobiNN1\/[email protected]\/Material\/css\/theme-gray\.min\.css`);
const linkElements = document.querySelectorAll('link[rel="stylesheet"]');
// Find the main elfinder stylesheet
let selectedLinkElement;
Expand All @@ -35,7 +30,7 @@ function getElfinderStyleSheet(main = true) {
}
function addElfinderLightStylesheet() {
let themeLightAsset = `{{ Basset::basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/css/theme-gray.min.css') }}`;
let themeLightAsset = `{{ Basset::basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/css/theme-gray.min.css') }}`;
const match = themeLightAsset.match(/<link\s+href="([^"]+)"/i);
if (match && match.length > 1) {
let mainStyleSheet = getElfinderStyleSheet();
Expand Down
18 changes: 18 additions & 0 deletions src/FileManagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ public function boot()
if ($this->app->runningInConsole()) {
$this->bootForConsole();
}

if(!backpack_pro()) {
Basset::map('bp-jquery-ui-js', 'https://raw.githubusercontent.com/jquery/jquery-ui/refs/tags/1.13.2/dist/jquery-ui.min.js', ['integrity' => 'sha384-4D3G3GikQs6hLlLZGdz5wLFzuqE9v4yVGAcOH86y23JqBDPzj9viv0EqyfIa6YUL', 'crossorigin' => 'anonymous']);
}

Basset::map('bp-elfinder-js', 'https://raw.githubusercontent.com/Studio-42/elFinder/refs/tags/2.1.64/js/elfinder.min.js', ['integrity' => 'sha384-Ow1wKIUQLS9bOa23gn7yT91nyowDhk2zK1lO7G5Hnxlh3bvTPNH7c5uODf7/jIec', 'crossorigin' => 'anonymous']);
Basset::map('bp-elfinder-css', 'https://raw.githubusercontent.com/Studio-42/elFinder/refs/tags/2.1.64/css/elfinder.min.css', ['integrity' => 'sha384-O+x3Lv203m3W8SILSSf8xt2ryvN+CEx3s9tpGloi3D6UQ+1BkbXPuSxEj7uhKKCs', 'crossorigin' => 'anonymous']);
Basset::map('bp-elfinder-icons-big', 'https://raw.githubusercontent.com/Studio-42/elFinder/refs/tags/2.1.64/img/icons-big.svg', ['integrity' => 'sha384-BWeb84E4ly6GgjPMWRpJNB+I8XpW+xqF9kezQR6PNqXP0pmjHi8iqlGZs0JRgHlu', 'crossorigin' => 'anonymous']);
Basset::map('bp-elfinder-logo', 'https://raw.githubusercontent.com/Studio-42/elFinder/refs/tags/2.1.64/img/logo.png', ['integrity' => 'sha384-mAtths5Wl6rU0MrgaCz2bJRTIG8LhA1pLZ4ZX+Qo9fQRjlKFxb5eLWUO3pZ7Aioq', 'crossorigin' => 'anonymous']);

$crudLanguages = array_keys(config('backpack.crud.languages', []));

foreach ($crudLanguages as $language) {
if ($language === 'en') {
continue;
}
Basset::map('bp-elfinder-i18n-'.$language, 'https://raw.githubusercontent.com/Studio-42/elFinder/refs/tags/2.1.64/js/i18n/elfinder.'.$language.'.js');
}
}

public function register()
Expand Down

0 comments on commit aec00c6

Please sign in to comment.