1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Load Gallery Plugin Javascript and CSS only when needed.

This commit is contained in:
Cameron
2015-05-23 13:09:44 -07:00
parent 88c343a793
commit cfcce0ed03
5 changed files with 80 additions and 11 deletions

View File

@@ -302,7 +302,7 @@ if (is_array($pref['e_footer_list']))
// //
echo "\n\n<!-- ======= [JSManager] FOOTER: Remaining CSS ======= -->"; echo "\n\n<!-- ======= [JSManager] FOOTER: Remaining CSS ======= -->";
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('other','core','plugin','theme','inline'); $CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('other','core','plugin','theme'); // INLINE CSS in Body not supported by HTML5. .
foreach($CSSORDER as $val) foreach($CSSORDER as $val)
{ {

View File

@@ -1305,7 +1305,7 @@ class e_jsmanager
{ {
echo "<!-- [CSSManager] ".$label." -->\n"; echo "<!-- [CSSManager] ".$label." -->\n";
} }
echo '<style type="text/css">'; echo '<style rel="stylesheet" type="text/css" property="stylesheet">';
echo implode("\n\n", $content_array); echo implode("\n\n", $content_array);
echo '</style>'; echo '</style>';
echo "\n"; echo "\n";

View File

@@ -15,14 +15,6 @@ if (!defined('e107_INIT')) { exit; }
if(USER_AREA) if(USER_AREA)
{ {
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::css('gallery', 'gallery_style.css');
// Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890 // Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890
e107::css('inline', " e107::css('inline', "
/* Gallery CSS */ /* Gallery CSS */
@@ -31,13 +23,24 @@ margin-left:0;
}",'jquery'); }",'jquery');
/*
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::css('gallery', 'gallery_style.css');
$prettyPhoto = <<<JS $prettyPhoto = <<<JS
$(document).ready(function(){ $(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto( $("a[data-gal^='prettyPhoto']").prettyPhoto(
{ {
hook: 'data-gal', hook: 'data-gal',
theme: 'pp_default', /* pp_default , light_rounded , dark_rounded , light_square , dark_square ,facebook */ theme: 'pp_default',
overlay_gallery: false, overlay_gallery: false,
deeplinking: false deeplinking: false
} }
@@ -45,7 +48,7 @@ $(document).ready(function(){
}); });
JS; JS;
e107::js('inline',$prettyPhoto,'jquery'); e107::js('footer-inline',$prettyPhoto,'jquery');
@@ -53,6 +56,7 @@ e107::js('inline',$prettyPhoto,'jquery');
unset($gp); unset($gp);
*/
} }
?> ?>

View File

@@ -30,6 +30,36 @@ if (!e107::isInstalled('gallery'))
} }
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::css('gallery', 'gallery_style.css');
// Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890
e107::css('inline', "
/* Gallery CSS */
.thumbnails .span2:nth-child(6n+1) {
margin-left:0;
}",'jquery');
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default', /* pp_default , light_rounded , dark_rounded , light_square , dark_square ,facebook */
overlay_gallery: false,
deeplinking: false
}
);
});
JS;
e107::js('inline',$prettyPhoto,'jquery');
require_once(HEADERF); require_once(HEADERF);
class gallery class gallery
@@ -58,7 +88,7 @@ class gallery
$text = ""; $text = "";
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat. if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootstrap3 to bootstrap2 compat.
{ {
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']); $template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
} }

View File

@@ -11,6 +11,41 @@ e107::plugLan('gallery', 'front');
$gp = e107::getPlugPref('gallery'); $gp = e107::getPlugPref('gallery');
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::css('gallery', 'gallery_style.css');
// Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890
e107::css('inline', "
.thumbnails .span2:nth-child(6n+1) {
margin-left:0;
}",'jquery');
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default',
overlay_gallery: false,
deeplinking: false
}
);
});
JS;
e107::js('footer-inline',$prettyPhoto,'jquery');
e107::js('gallery', 'jslib/jquery.cycle.all.js','jquery'); e107::js('gallery', 'jslib/jquery.cycle.all.js','jquery');
e107::js('footer-inline'," e107::js('footer-inline',"