1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-14 02:24:08 +02:00

Use Library Manager to load libraries. Use JS behaviors. Add "Order images by" pref.

This commit is contained in:
Lóna Lore
2016-03-29 11:22:25 +02:00
parent 3198440697
commit 6b9838ae99
11 changed files with 467 additions and 322 deletions

View File

@@ -5,96 +5,32 @@
*
* Gallery Template
*/
if (!defined('e107_INIT')) { exit; }
if(!defined('e107_INIT'))
{
exit;
}
e107::plugLan('gallery', 'front');
$gp = e107::getPlugPref('gallery');
e107::library('load', 'jquery.cycle');
e107::library('load', 'jquery.prettyPhoto');
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'css/gallery.css');
e107::js('gallery', 'js/gallery.js');
e107::js('gallery', 'js/gallery.cycle.js');
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',"
$(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');
});
});
");
$settings = array(
'fx' => varset($gp['slideshow_effect'], 'scrollHorz'),
'speed' => varset($gp['slideshow_duration'], 1000),
'timeout' => varset($gp['slideshow_freq'], 4000),
);
e107::js('settings', array('gallery' => $settings));
$text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}");
e107::getRender()->tablerender("Gallery",$text,'gallery_slideshow');
e107::getRender()->tablerender("Gallery", $text, 'gallery_slideshow');
unset($text);
unset($gp);
?>