/** * @Name Theme Joomla Power Slide Pro Module * @URL http://powerslide.themejoomla.com * @version $Id: tj.gallery.set.js 13 skashi $ * @package Joomla (1.5.x) * @subpackage Power Slide Pro Module * @copyright Copyright (C) 2008-2020 Theme Joomla. All rights reserved. E & OE * @Script tj_gallery.set.js, GNU General Public License * @credit script by Jonathan Schemoul - JonDesign's SmoothGallery v2.0. (http://smoothgallery.jondesign.net) */ var gallerySet = gallery.extend({ initialize: function(element, options) { this.setOptions({ manualSetData: [], gallerySelector: "div.galleryElement", galleryTitleSelector: "h2", textGallerySelector: 'Galleries', textShowGallerySelector: 'View other Galleries', textGalleryInfo: '{0} pictures', startWithSelector: true, galleryColumns: 2, loadFirstTime: true, /* Changing default options */ textShowCarousel: '{0}/{1} Pictures', carouselPreloader: false }, options); this.gallerySet = this.options.manualSetData; this.addEvent('onPopulated', this.createGallerySelectorTab.bind(this)); this.addEvent('onPopulated', this.createGallerySelector.bind(this)); this.startWithSelectorFn = this.toggleGallerySelector.pass(true, this); if (this.options.startWithSelector) this.addEvent('onGallerySelectorCreated', this.startWithSelectorFn); this.parent(element, this.options); }, populateData: function() { options = this.options; var data = $A(this.gallerySet); this.populateFrom.getElements(options.gallerySelector).each(function (galEl) { currentGalArrayPlace = 0; galleryDict = { title: galEl.getElement(options.galleryTitleSelector).innerHTML, elements: [] } galleryDict.elements.extend(this.populateGallery(galEl, 0)); data.extend([galleryDict]); if (this.options.destroyAfterPopulate) galEl.remove(); }, this); this.gallerySet = data; this.galleryData = data[0].elements; this.currentGallery = 0; this.fireEvent('onPopulated'); }, changeGallery: function(number) { if (number!=this.currentGallery) { this.changeData(this.gallerySet[number].elements); this.maxIter = this.gallerySet[number].elements.length; this.currentGallery = number; //this.gallerySelectorBtn.setHTML(this.gallerySet[number].title); //removed GHack this.fireEvent('onGalleryChanged'); } this.toggleGallerySelector(false); }, createGallerySelectorTab: function() { this.gallerySelectorBtn = new Element('a').addClass('gallerySelectorBtn').setProperties({ title: this.options.textShowGallerySelector }).setHTML(this.options.textShowGallerySelector).addEvent( 'click', function(){ this.toggleGallerySelector(true); }.bind(this) ).injectInside(this.galleryElement); this.addEvent('onShowCarousel', function(){this.gallerySelectorBtn.setStyle('zIndex', 10)}.bind(this)); this.addEvent('onCarouselHidden', function(){this.gallerySelectorBtn.setStyle('zIndex', 15)}.bind(this)); }, createGallerySelector: function() { this.gallerySelector = new Fx.Styles( new Element('div').addClass( 'gallerySelector' ).injectInside( this.galleryElement ).setStyles({ 'display': 'none', 'opacity': '0' }) ); this.gallerySelectorTitle = new Element('h2').setHTML( this.options.textGallerySelector ).injectInside(this.gallerySelector.element); var gallerySelectorHeight = this.galleryElement.offsetHeight - 50 - 10 - 2; this.gallerySelectorWrapper = new Fx.Style( new Element('div').addClass( 'gallerySelectorWrapper' ).setStyle( 'height', gallerySelectorHeight + "px" ).injectInside(this.gallerySelector.element) ); this.gallerySelectorInner = new Element('div').addClass('gallerySelectorInner').injectInside(this.gallerySelectorWrapper.element); this.gallerySelectorWrapper.scroller = new Scroller(this.gallerySelectorWrapper.element, { area: 100, velocity: 0.3 }).start(); this.createGalleryButtons(); this.fireEvent('onGallerySelectorCreated'); }, createGalleryButtons: function () { var galleryButtonWidth = ((this.galleryElement.offsetWidth - 30) / this.options.galleryColumns) - 14; this.gallerySet.each(function(galleryItem, index){ var button = new Element('div').addClass('galleryButton').injectInside( this.gallerySelectorInner ).addEvents({ 'mouseover': function(myself){ myself.button.addClass('hover'); }.pass(galleryItem, this), 'mouseout': function(myself){ myself.button.removeClass('hover'); }.pass(galleryItem, this), 'click': function(myself, number){ this.prepareTimer(); this.options.loadFirstTime = false; this.doSlideShow(1); this.changeGallery.pass(number,this)(); }.pass([galleryItem, index], this) }).setStyle('width', galleryButtonWidth); galleryItem.button = button; var thumbnail = ""; if (this.options.showCarousel) { found = false; thumbnail = null; for( i=0;i