1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Fixes #813 - js error. Some gallery JS moved to footer and loaded only when required.

This commit is contained in:
Cameron
2015-02-04 23:16:27 -08:00
parent 4572cd7ceb
commit 2b83a64f16
5 changed files with 60 additions and 56 deletions

View File

@@ -17,9 +17,10 @@ if(USER_AREA)
{
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::js('gallery', 'jslib/jquery.cycle.all.js','jquery');
e107::css('gallery', 'gallery_style.css');
// Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890
@@ -49,51 +50,6 @@ e107::js('inline',$prettyPhoto,'jquery');
$gp = e107::getPlugPref('gallery');
e107::js('inline',"
$(document).ready(function()
{
$('#gallery-slideshow-content').cycle({
fx: '".varset($gp['slideshow_effect'],'scrollHorz')."',
next: '.gal-next',
prev: '.gal-prev',
speed: ".varset($gp['slideshow_duration'],1000).", // speed of the transition (any valid fx speed value)
timeout: ".varset($gp['slideshow_freq'],4000).",
slideExpr: '.slide',
pause: 1, // pause on hover - TODO pref
activePagerClass: '.gallery-slide-jumper-selected',//,
before: function(currSlideElement, nextSlideElement, options, forwardFlag)
{
var nx = $(nextSlideElement).attr('id').split('item-');
var th = $(currSlideElement).attr('id').split('item-');
$('#gallery-jumper-'+th[1]).removeClass('gallery-slide-jumper-selected');
$('#gallery-jumper-'+nx[1]).addClass('gallery-slide-jumper-selected');
}
});
$('.gallery-slide-jumper').click(function() {
var nid = $(this).attr('id');
var id = nid.split('-jumper-');
var go = parseInt(id[1]) - 1;
$('#gallery-slideshow-content').cycle(go);
return false;
});
$('#img.lb-close').on('live', function(e) {
$(this).attr('src','".e_PLUGIN."gallery/jslib/lightbox/images/close.png');
});
});
");
unset($gp);

View File

@@ -75,7 +75,7 @@ class gallery_shortcodes extends e_shortcode
$w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160;
$h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight(); // 130;
$class = ($this->slideMode == TRUE) ? 'gallery-slideshow-thumb img-responsive' : varset($parms['class'],'gallery-thumb img-responsive');
$class = ($this->slideMode == TRUE) ? 'gallery-slideshow-thumb img-responsive img-rounded' : varset($parms['class'],'gallery-thumb img-responsive');
// $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery';
$rel = ($this->slideMode == TRUE) ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]';
$att = 'aw='.$w.'&ah='.$h.'&x=1'; // 'aw=190&ah=150';
@@ -218,7 +218,6 @@ class gallery_shortcodes extends e_shortcode
$tp = e107::getParser();
$this->slideMode = TRUE;
$parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2];
$limit = (integer) vartrue($parms['limit'], 16);

View File

@@ -17,15 +17,15 @@ ul.gallery-cat > li > div > h3 { text-align: center }
/* SLIDESHOW */
#gallery-slideshow-wrapper { display:block; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; width: 660px; height: 146px; overflow: hidden; background: #000000; margin-left:auto;margin-right:auto }
#gallery-slideshow-wrapper { display:block; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; width: 664px; height: 146px; overflow: hidden; background: #000000; margin-left:auto;margin-right:auto }
#gallery-slideshow-content { width: 3500px; }
#gallery-slideshow-content .slide { float: left; width: 660px; padding:12px; height: 146px; }
#gallery-slideshow-content .slide { float: left; width: 679px; padding:12px; height: 146px; white-space:nowrap }
.gallery-slideshow-controls { clear:both; width: 660px; margin-left:auto; margin-right:auto; padding-bottom:10px; }
.gallery-slideshow-controls { clear:both; width: 664px; margin-left:auto; margin-right:auto; padding-top:5px; padding-bottom:10px; }
.gallery-slide-item { margin-right:8px; }
.gallery-slide-item { margin-right:8px; display: inline-block; }
.gallery-slideshow-thumb { -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; }

View File

@@ -9,8 +9,57 @@ if (!defined('e107_INIT')) { exit; }
e107::plugLan('gallery', 'front');
$gp = e107::getPlugPref('gallery');
e107::js('gallery', 'jslib/jquery.cycle.all.js','jquery');
e107::js('footer-inline',"
$(document).ready(function()
{
$('#gallery-slideshow-content').cycle({
fx: '".varset($gp['slideshow_effect'],'scrollHorz')."',
next: '.gal-next',
prev: '.gal-prev',
speed: ".varset($gp['slideshow_duration'],1000).", // speed of the transition (any valid fx speed value)
timeout: ".varset($gp['slideshow_freq'],4000).",
slideExpr: '.slide',
pause: 1, // pause on hover - TODO pref
activePagerClass: '.gallery-slide-jumper-selected',//,
before: function(currSlideElement, nextSlideElement, options, forwardFlag)
{
var nx = $(nextSlideElement).attr('id').split('item-');
var th = $(currSlideElement).attr('id').split('item-');
$('#gallery-jumper-'+th[1]).removeClass('gallery-slide-jumper-selected');
$('#gallery-jumper-'+nx[1]).addClass('gallery-slide-jumper-selected');
}
});
$('.gallery-slide-jumper').click(function() {
var nid = $(this).attr('id');
var id = nid.split('-jumper-');
var go = parseInt(id[1]) - 1;
$('#gallery-slideshow-content').cycle(go);
return false;
});
$('#img.lb-close').on('live', function(e) {
$(this).attr('src','".e_PLUGIN."gallery/jslib/lightbox/images/close.png');
});
});
");
$text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}");
e107::getRender()->tablerender("Gallery",$text,'gallery_slideshow');
unset($text);
unset($gp);
?>

View File

@@ -62,21 +62,21 @@ $GALLERY_TEMPLATE['cat_end'] =
$GALLERY_TEMPLATE['slideshow_wrapper'] = '
<div id="gallery-slideshow-wrapper">
<div id="gallery-slideshow-content">
<div id="gallery-slideshow-content" >
{GALLERY_SLIDES=4}
</div>
</div>
<div class="gallery-slideshow-controls">
<a href="#" class="gallery-control gal-next" style="float: right">Next &rsaquo;</a>
<a href="#" class="gallery-control gal-prev" >&lsaquo; Previous</a>
<a href="#" class="gallery-control gal-next btn btn-xs btn-default" style="float: right">Next {GLYPH=fa-chevron-right}</a>
<a href="#" class="gallery-control gal-prev btn btn-xs btn-default" >{GLYPH=fa-chevron-left} Previous</a>
<span class="gallery-slide-jumper-container">{GALLERY_JUMPER}</span>
</div>
';
$GALLERY_TEMPLATE['slideshow_slide_item'] = '<span class="gallery-slide-item">{GALLERY_THUMB=w=150&h=120}</span>';
$GALLERY_TEMPLATE['slideshow_slide_item'] = '<span class="gallery-slide-item">{GALLERY_THUMB: w=150&h=120}</span>';