1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-01-08 08:12:53 +01:00

use more constants

This commit is contained in:
nobody 2024-06-08 08:33:33 +02:00
parent fa54b84ee6
commit ea91bc8cf8
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
2 changed files with 10 additions and 5 deletions

View File

@ -432,6 +432,11 @@ const MathJax3Files = {
};
const ReqAnalyzer = {
'BUNDLE_MATHJAX': 'MathJax (Bundle)',
'BUNDLE_TINYMCE': 'TinyMCE (Bundle)',
'BUNDLE_DATATABLES': 'DataTables (Bundle)',
'BUNDLE_SCROLLMAGIC': 'ScrollMagic (Bundle)',
'BUNDLE_FONT_AWESOME': 'Font Awesome (Fonts) (Bundle)',
'BUNDLE_PURE_CSS': 'Pure CSS (Bundle)',
};

View File

@ -251,15 +251,15 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
requestAnalyzer._getPathOfBundle = function (initiator, channelHost, channelPath, targetPath, bundle) {
let filename = channelPath.split('/').pop();
if (bundle === 'MathJax (Bundle)' && filename !== 'MathJax.js') {
if (bundle === ReqAnalyzer.BUNDLE_MATHJAX && filename !== 'MathJax.js') {
filename = requestAnalyzer._handleMathJax(channelPath, channelHost, initiator);
} else if (bundle === 'TinyMCE (Bundle)' && filename !== 'tinymce.min.js') {
} else if (bundle === ReqAnalyzer.BUNDLE_TINYMCE && filename !== 'tinymce.min.js') {
filename = requestAnalyzer._handleTinyMCE(channelPath, channelHost, initiator);
} else if (bundle === 'DataTables (Bundle)') {
} else if (bundle === ReqAnalyzer.BUNDLE_DATATABLES) {
filename = requestAnalyzer._handleUncompressedFiles(filename);
} else if (bundle === 'ScrollMagic (Bundle)' && !filename.endsWith('.min.js')) {
} else if (bundle === ReqAnalyzer.BUNDLE_SCROLLMAGIC && !filename.endsWith('.min.js')) {
filename = requestAnalyzer._handleUncompressedFiles(filename);
} else if (bundle === 'Font Awesome (Fonts) (Bundle)') {
} else if (bundle === ReqAnalyzer.BUNDLE_FONT_AWESOME) {
filename = requestAnalyzer._handleFontawesomeFiles(targetPath, filename);
} else if (bundle === ReqAnalyzer.BUNDLE_PURE_CSS) {
filename = (filename === 'pure-min.css' ? 'pure.min.css' : filename);