1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-13 17:09:46 +01: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 ======= -->";
$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)
{

View File

@ -1305,7 +1305,7 @@ class e_jsmanager
{
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 '</style>';
echo "\n";

View File

@ -15,7 +15,15 @@ if (!defined('e107_INIT')) { exit; }
if(USER_AREA)
{
// 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');
/*
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
@ -23,12 +31,7 @@ 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');
@ -37,7 +40,7 @@ $(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 */
theme: 'pp_default',
overlay_gallery: false,
deeplinking: false
}
@ -45,7 +48,7 @@ $(document).ready(function(){
});
JS;
e107::js('inline',$prettyPhoto,'jquery');
e107::js('footer-inline',$prettyPhoto,'jquery');
@ -53,6 +56,7 @@ e107::js('inline',$prettyPhoto,'jquery');
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);
class gallery
@ -58,7 +88,7 @@ class gallery
$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']);
}

View File

@ -11,6 +11,41 @@ e107::plugLan('gallery', 'front');
$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('footer-inline',"