Skip to content

Commit 766c75a

Browse files
committed
Fixes to external JS CDN
1 parent 9ba991c commit 766c75a

File tree

3 files changed

+42
-57
lines changed

3 files changed

+42
-57
lines changed

atomic/component.php

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<?php $doc = JFactory::getDocument();
9898
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery.min.js']); ?>
9999
<?php else : ?>
100-
<?php echo $jquerycdn ?>
100+
<script src="https://<?php echo $jquerycdn ?>"></script>
101101
<?php endif; ?>
102102

103103
<jdoc:include type="head" />
@@ -110,10 +110,11 @@
110110
unset($doc->_scripts[JURI::root(true) . '/media/system/js/core.js']);
111111
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/bootstrap.min.js']);
112112
if (isset($this->_script['text/javascript'])) {
113-
$this->_script['text/javascript'] = preg_replace('%window\.addEvent\ (\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']);
114-
if (empty($this->_script['text/javascript']))
113+
$this->_script['text/javascript'] = preg_replace('/jQuery\(window\).on\(\'load\'\, function\(\) \{(.*);/is', '', $this->_script['text/javascript']);
114+
if (empty($this->_script['text/javascript'])) {
115115
unset($this->_script['text/javascript']);
116116
}
117+
}
117118
?>
118119
<?php endif; ?>
119120

@@ -130,7 +131,7 @@
130131
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery-migrate.min.js']);
131132
?>
132133
<?php elseif($jqmigrate = 1) : ?>
133-
<script defer src="https://code.jquery.com/jquery-migrate-3.1.0.min.js" crossorigin="anonymous"></script>
134+
<script defer src="https://code.jquery.com/jquery-migrate-3.3.1.min.js" crossorigin="anonymous"></script>
134135
<?php endif; ?>
135136

136137
<?php // Remove Joomla CSS file (Modal styles)
@@ -150,7 +151,7 @@
150151

151152
<?php // Load remote Bootstrap 4.5 CSS framework from CDN
152153
if(($bootstrapcdn == null) && ($bootstrapsource == 1)) : ?>
153-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
154+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
154155
<?php elseif(($bootstrapcdn == null) && ($bootstrapsource == 2)) : ?>
155156
<?php echo $bootstrapcdn ?>
156157
<?php else : ?>
@@ -171,7 +172,7 @@
171172
<?php elseif($fontawesome == 4) : ?>
172173
<script defer src="<?php echo $fontawesomecdn; ?>"></script>
173174
<?php endif; ?>
174-
175+
175176
<?php // Load Google Fonts ?>
176177
<?php if(($headerfont == 1) && ($bodyfont == 1) && ($headerfontname != null) && ($bodyfontname != null)) : ?>
177178
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=<?php echo $headerfontname; ?>|<?php echo $bodyfontname; ?>">
@@ -207,15 +208,6 @@
207208
</style>
208209
<?php endif; ?>
209210

210-
<?php // Add any custom dark mode CSS from the configuration.
211-
if($customcsscode != null) : ?>
212-
<style>
213-
@media(prefers-color-scheme:dark) {
214-
<?php echo $customdarkcsscode ?>
215-
}
216-
</style>
217-
<?php endif; ?>
218-
219211
<?php // Load template favicons, loaded by default
220212
if($loadfavicons == 1) : ?>
221213
<link rel="apple-touch-icon" sizes="180x180" href="/templates/<?php echo $this->template ?>/favicons/apple-touch-icon.png">
@@ -248,7 +240,7 @@
248240

249241
<?php // Add Google Analytics tag if configured.
250242
if($gacode != null) : ?>
251-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-504090-1"></script>
243+
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo $gacode; ?>"></script>
252244
<script>
253245
window.dataLayer = window.dataLayer || [];
254246
function gtag(){dataLayer.push(arguments);}
@@ -265,7 +257,7 @@ function gtag(){dataLayer.push(arguments);}
265257

266258
</head>
267259

268-
<?php /* Add the menu item alias to the body ID, class, or both */ ?>
260+
<?php // Add the menu item alias to the body ID, class, or both. // ?>
269261
<?php if($bodymenu == 1) : ?>
270262
<body class="<?php echo $active->alias; ?> component-only ">
271263
<?php elseif($bodymenu == 2) : ?>
@@ -276,13 +268,13 @@ function gtag(){dataLayer.push(arguments);}
276268
<body class="component-only">
277269
<?php endif; ?>
278270

279-
<?php // Add custom code after opening body tag
271+
<?php // Add custom code after opening body tag
280272
if($codeafterbody != null) : ?>
281273
<?php echo $codeafterbody;
282274
?>
283275
<?php endif; ?>
284276

285-
<?php // Choose either a fixed or fluid width container
277+
<?php // Choose either a fixed or fluid width container
286278
if($fluidcontainer == 1) : ?>
287279
<div class="container-fluid">
288280
<?php else : ?>
@@ -303,31 +295,31 @@ function gtag(){dataLayer.push(arguments);}
303295

304296
<?php // Use jQuery Migrate 3.0.1
305297
if($jqmigrate == 1) : ?>
306-
<script src="https://code.jquery.com/jquery-migrate-3.0.1.min.js" crossorigin="anonymous"></script>
298+
<script src="https://code.jquery.com/jquery-migrate-3.3.1.min.js" crossorigin="anonymous"></script>
307299
<?php endif; ?>
308300

309-
<?php // Load the local or remote Bootstrap 3 or 4 JavaScript dependency
310-
// If CDN empty and load BS 3 remotely
301+
<?php // Load the local or remote Bootstrap 3 or 4 JavaScript dependency
302+
// If CDN empty and load BS 3 remotely
311303
if(($bootstrapcdn == null) && ($bootstrapsource == 1)) : ?>
312-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
304+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
305+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
313306

314307
<?php // If CDN empty and load BS 4 remotely
315308
elseif(($bootstrapcdn == null) && ($bootstrapsource == 3)) : ?>
316309
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
317-
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
318-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
310+
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
311+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
319312

320313
<?php // If CDN empty and load BS 4 remotely, but full jQuery 3 is loaded
321314
elseif(($bootstrapcdn == null) && ($bootstrapsource == 3) && ($jqlibrary == 2)) : ?>
322-
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
323-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
315+
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
316+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
324317
<?php else : ?>
325318
<?php endif; ?>
326319

327320
<?php // Add custom code before closing body tag
328321
if($codebeforebody != null) : ?>
329-
<?php echo $codebeforebody;
330-
?>
322+
<?php echo $codebeforebody; ?>
331323
<?php endif; ?>
332324

333325
<?php // Use Instant.page

atomic/index.php

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<?php $doc = JFactory::getDocument();
9898
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery.min.js']); ?>
9999
<?php else : ?>
100-
<?php echo $jquerycdn ?>
100+
<script src="https://<?php echo $jquerycdn ?>"></script>
101101
<?php endif; ?>
102102

103103
<jdoc:include type="head" />
@@ -109,10 +109,8 @@
109109
unset($doc->_scripts[JURI::root(true) . '/media/modals/js/script.min.js']);
110110
unset($doc->_scripts[JURI::root(true) . '/media/system/js/core.js']);
111111
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/bootstrap.min.js']);
112-
113112
if (isset($this->_script['text/javascript'])) {
114113
$this->_script['text/javascript'] = preg_replace('/jQuery\(window\).on\(\'load\'\, function\(\) \{(.*);/is', '', $this->_script['text/javascript']);
115-
116114
if (empty($this->_script['text/javascript'])) {
117115
unset($this->_script['text/javascript']);
118116
}
@@ -133,7 +131,7 @@
133131
unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery-migrate.min.js']);
134132
?>
135133
<?php elseif($jqmigrate = 1) : ?>
136-
<script defer src="https://code.jquery.com/jquery-migrate-3.1.0.min.js" crossorigin="anonymous"></script>
134+
<script defer src="https://code.jquery.com/jquery-migrate-3.3.1.min.js" crossorigin="anonymous"></script>
137135
<?php endif; ?>
138136

139137
<?php // Remove Joomla CSS file (Modal styles)
@@ -153,7 +151,7 @@
153151

154152
<?php // Load remote Bootstrap 4.5 CSS framework from CDN
155153
if(($bootstrapcdn == null) && ($bootstrapsource == 1)) : ?>
156-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
154+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
157155
<?php elseif(($bootstrapcdn == null) && ($bootstrapsource == 2)) : ?>
158156
<?php echo $bootstrapcdn ?>
159157
<?php else : ?>
@@ -387,7 +385,6 @@ function gtag(){dataLayer.push(arguments);}
387385
<?php if($protopositions == 1) : ?><jdoc:include type="modules" name="position-2" style="none" /><?php endif; ?>
388386
</div>
389387
<?php endif; ?>
390-
391388
</div>
392389

393390
<?php if($footer == 1) : ?>
@@ -405,47 +402,43 @@ function gtag(){dataLayer.push(arguments);}
405402
</div>
406403
</footer>
407404
<?php endif; ?>
408-
409-
410-
<?php if ($this->countModules( 'alertbar' )) : ?>
411-
<?php if($alertbar == 1) : ?>
412-
<div id="alertbar"><jdoc:include type="modules" name="alertbar" style="none" /></div>
413-
<?php endif; ?>
414-
<?php endif; ?>
405+
406+
<?php if ($this->countModules( 'alertbar' )) : ?>
407+
<?php if($alertbar == 1) : ?>
408+
<div id="alertbar"><jdoc:include type="modules" name="alertbar" style="none" /></div>
409+
<?php endif; ?>
410+
<?php endif; ?>
415411

416-
<jdoc:include type="modules" name="debug" style="basic" />
417-
412+
<jdoc:include type="modules" name="debug" style="basic" />
418413
</div>
419414

420415
<?php // Use jQuery Migrate 3.0.1
421416
if($jqmigrate == 1) : ?>
422-
<script src="https://code.jquery.com/jquery-migrate-3.0.1.min.js" crossorigin="anonymous"></script>
417+
<script src="https://code.jquery.com/jquery-migrate-3.3.1.min.js" crossorigin="anonymous"></script>
423418
<?php endif; ?>
424419

425-
<?php // Load the local or remote Bootstrap 3 or 4 JavaScript dependency
426-
// If CDN empty and load BS 3 remotely
420+
<?php // Load the local or remote Bootstrap 3 or 4 JavaScript dependency
421+
// If CDN empty and load BS 3 remotely
427422
if(($bootstrapcdn == null) && ($bootstrapsource == 1)) : ?>
428-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
429-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
430-
423+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
424+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
431425

432426
<?php // If CDN empty and load BS 4 remotely
433427
elseif(($bootstrapcdn == null) && ($bootstrapsource == 3)) : ?>
434428
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
435-
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
436-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
429+
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
430+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
437431

438432
<?php // If CDN empty and load BS 4 remotely, but full jQuery 3 is loaded
439433
elseif(($bootstrapcdn == null) && ($bootstrapsource == 3) && ($jqlibrary == 2)) : ?>
440-
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
441-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
434+
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
435+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
442436
<?php else : ?>
443437
<?php endif; ?>
444438

445439
<?php // Add custom code before closing body tag
446440
if($codebeforebody != null) : ?>
447-
<?php echo $codebeforebody;
448-
?>
441+
<?php echo $codebeforebody; ?>
449442
<?php endif; ?>
450443

451444
<?php // Use Instant.page

atomic/language/en-GB/en-GB.tpl_atomic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ TPL_ATOMIC_JQUERY_LABEL="Load jQuery source"
6363
TPL_ATOMIC_JQUERY_DESC="Choose a version other than the default loaded by Joomla. If you you load Bootstrap, you should choose the version that supports the version you have enabled. Be very careful with this option."
6464

6565
TPL_ATOMIC_JQUERYCDN_LABEL="Custom jQuery CDN"
66-
TPL_ATOMIC_JQUERYCDN_DESC="Load a custom version of jQuery from the CDN. Paste in the code from code.jquery.com here. This will override your selection for jQuery source."
66+
TPL_ATOMIC_JQUERYCDN_DESC="Load a custom version of jQuery from the CDN. Paste in the URL only from code.jquery.com here without the HTTPS://. This will override your selection for jQuery source."
6767

6868
TPL_ATOMIC_JQUERY_DEFAULT="jQuery 1.12.4 Local (Joomla 3 Default)"
6969
TPL_ATOMIC_JQUERY_2="jQuery 2.2.4 Remote CDN"

0 commit comments

Comments
 (0)