GALERIE: Mista
PRÁSK: Natáčení klipu zpěvačky Misty
GALERIE: Mista vydala nový singl
'); if (showPrev && showPrevGal) { prevGalleryLink.on('touchend click touchcancel', function(e) { e.preventDefault(); window.location = $(this).attr('href'); }); // base.$el.find('[data-bind="link-prev"]').after( prevGalleryLink.hide() ); prevGalleryLink.show(); } } if (base.currentImage +1 < base.images.length ) { // on all but last picture log("on all but last picture", base.currentImage, base.images.length); // base.$el.find('[data-bind="related-galleries"]').remove(); // hide prev gallery icon prevGalleryLink.hide(); // hide related gallery link relatedGalleryLink.hide(); // show prev gallery link on first image if (base.currentImage == 0) { // console.log('show prev gal'); base.$el.find('[data-bind="link-prev"]').fadeOut('fast').attr('href','#'); if (showPrev && showPrevGal) { prevGalleryLink.show(); } } base.$el.find('[data-bind="link-next"]').attr('href', base.options.linkHrefTemplate.replace('[imageId]', base.images[ (base.currentImage -1) ] ) ).fadeIn('fast'); base.$el.find('[data-bind="preview-image-link"]').attr('href',base.options.linkHrefTemplate.replace('[imageId]', base.images[ (base.currentImage -1) ] )); } else { // on last picture // hide prev gallery icon prevGalleryLink.hide(); // disable next link base.$el.find('[data-bind="link-next"]').fadeOut('fast').attr('href','#'); // image link /* .on('touch touchend click', function(e) { }); */ // show related gallery link // console.log('SHOW RELATED LINK'); var href = relatedGalleryLink.attr('href'); base.$el.find('[data-bind="preview-image-link"]') .off() .attr('href', href); if (href && href !== '#') { base.$el.find('.preview-image-link img').click(function(e) { e.stopPropagation(); e.preventDefault(); base.$el.addClass('loading'); setTimeout(function() { window.location = href; }, 10); }); relatedGalleryLink.show(); } // show link to related galleries on last image // TODO ikona pro přechod na related // base.$el.find('[data-bind="preview-image-link"]').attr('href',"https://prask.nova.cz/clanek/galerie/galerie-mista.html?from=648036&gallery=648036&backId=648021"); // var relatedLink = $('
'); // realted gallery link for touch devices relatedGalleryLink.on('touchend click touchcancel', function(e) { e.preventDefault(); window.location = $(this).attr('href'); }); // base.$el.find('[data-bind="link-next"]').after(relatedLink); // relatedLink.show('fast'); /* // console.log('base el', base.$el.html()); base.$el.find('.image').swipe({ swipeRight: function(event, direction, distance, duration, fingerCount) { console.log('Swipe right'); if (base.$el.find(".rel-galleries").length < 1) { base.$el.find('[data-bind="related-galleries"]:visible').click(); } } }); */ } // update text data data.title && base.$el.find('[data-bind="title"]').text(data.title); data.title && base.$el.find('[data-bind="rating"]').attr("data-rating", data.rating).attr("data-rating-id", data.id).trigger("checkVoted"); base.$el.find('[data-bind="current-image-number"]').text(base.currentImage+1); (data.description != undefined) && base.$el.find('[data-bind="description"]').text(data.description); var $source = base.$el.find('[data-bind="source"]'); if( data.source && (data.source.name || data.source.source_name)){ var $newSource = ''; if(data.source.name) $newSource = $newSource + data.source.name; if(data.source.name && data.source.source_name) $newSource = $newSource + ', '; if(data.source.source_name) $newSource = $newSource + data.source.source_name; data.source.url && ($newSource = '' + $newSource + ''); $source.find('[data-bind="source-data"]').html($newSource); $source.show('fast'); } else { $source.hide('fast'); } //if (_gaq) _gaq.push(['_trackPageview', window.location.href]); base.$el.removeClass('loading'); //console.log('remove loading'); base.options.onUpdate(base); }; /* Destroy plugin * removes handlers, classes, data */ base.destroy = function(){ base.$el .off('click.' + base.prefix) .removeClass( base.prefix ) .removeData( base.prefix ) .find('.active').removeClass('active') ; base.options.onDestroy(base); }; base.init = function(){ base.options = $.extend({},$.ajaxGallery2.defaultOptions, options); base.images = base.options.images; if( base.images.length < 1 || !base.options.ajaxUrl ){ // do not proceed without images array or ajaxUrl base.options.onDestroy(base); return false; } base.$el.addClass(base.prefix); // reset current image to first image if not provided base.currentImage = Math.max( base.images.indexOf( base.options.currentImage ), 0 ); // handle next, prev base.$el.on( 'click.' + base.prefix, '[data-bind="link-prev"]:not([href="#"])', function(e){ e.stopPropagation(); base.loadImage( base.getIndex(-1), e); base.options.onPrevious(base, e); return false; } ); base.$el.on( 'click.' + base.prefix, '[data-bind="link-next"]:not([href="#"])', function(e){ e.stopPropagation(); base.loadImage( base.getIndex(1), e); base.options.onNext(base, e); return false; } ); base.$el.on( 'click.' + base.prefix, '[data-bind="preview-image-link"]:not([href="#"])', function(e){ e.stopPropagation(); base.loadImage( base.getIndex(1), e); base.options.onNext(base, e); return false; } ); // handle thumbnail click base.$el.on( 'click.' + base.prefix, '[data-image-link]', function(e){ e.stopPropagation(); var image = parseInt( $(this).attr('data-image-link') ); $('#rel-back').click(); if ( !isNaN(image) && image >= 0 && image < base.images.length ){ base.loadImage(image, e); base.options.onThumbnail(base, e); return false; } return true; } ); //base.$el.on( 'click.' + base.prefix, '[data-bind="related-galleries"]', function(e){ base.loadRelatedGalleries(e); return false; }); // update navigation on init var showPrev = '1'; var showPrevGal = ''; var relatedGalleryLink = base.$el.find('.related-gallery'); var href = relatedGalleryLink.attr('href'); base.$el.find('.related-gallery, .prev-gallery').hide(); if (base.currentImage + 1 == base.images.length) { // console.log('Gallery: init on last image'); base.$el.find('.link-next').hide(); if (href && href !== '#') { base.$el.find('.related-gallery').show(); base.$el.find('.preview-image-link img').click(function(e) { e.stopPropagation(); e.preventDefault(); base.$el.addClass('loading'); setTimeout(function() { window.location = href; }, 10); }); } // console.log('ADD RELATED', base.currentImage, base.images.length, relatedLink, base.$el.find('[data-bind="link-next"]')); // base.$el.find('[data-bind="link-next"]').after( relatedLink ); // base.$el.find('[data-bind="link-next"]').hide(); } else if (base.currentImage == 0) { // console.log('Gallery: init on first image', showPrev, showPrevGal); base.$el.find('.link-prev').hide();	// window.testel = base.$el.find('.prev-gallery'); if (showPrev && showPrevGal) { setTimeout(function() { base.$el.find('.prev-gallery').show(); }, 200); } } // setup cache base.cache = []; // init preloading base.options.onInit(base); }; base.init(); }; $.ajaxGallery2.defaultOptions = { images: [], ajaxType: 'GET', ajaxData: {}, ajaxDataType: 'json', cache: true, linkHrefTemplate: "/[imageId]/", onInit: function(base){}, // after inicialization is complete onChange: function(base){}, // on image change onNext: function(base, e){}, // on next image request onPrevious: function(base, e){}, // on previous image request onThumbnail: function(base, e){}, // on image request from thumbnail onLoading: function(base, e){}, // on image request sent onUpdate: function(base){}, // on gallery contents updated onLoad: function(base){}, // on response received onLoadFail: function(base){}, // on image request failed onLoadSuccess: function(base){}, // on image request succeded onLoadFromCache: function(base){}, // on request loaded from cache onDestroy: function(base){} // on plugin destroyed }; $.fn.ajaxGallery2 = function(options){ return this.each(function(){ (new $.ajaxGallery2(this, options)); }); }; // === GALLERY PLUGIN // MINI SLIDER === $.miniSlider = function(el, options){ var base = this; base.$el = $(el); base.el = el; base.$el.data("miniSlider", base); base.prefix = "miniSlider"; /* Get item index relatively from current item @dir -1: previous, 1: next */ base.getIndex = function(dir) { return (base.currentItem + base.$items.length*10 + dir) % base.$items.length; }; /* Shift moves slider to next/previous set of elements */ base.shift = function(dir){ var offset = Math.min( Math.max( base.$collection.position().left - (base.wrapperWidth*dir), base.wrapperWidth - base.contentWidth ), 0 ); log('shift', "offset", offset, "base.$collection.position().left", "dir", dir, base.$collection.position().left, "base.wrapperWidth", base.wrapperWidth, "(base.wrapperWidth*dir)", (base.wrapperWidth*dir), "base.wrapperWidth - base.contentWidth", base.wrapperWidth - base.contentWidth ); base.$collection.stop().animate({ left: offset }, 1000, base.update ); base.options.onShift(base); }; /* Shift to reveals target item in center of the slider */ base.shiftTo = function(target){ var $targetItem = $(base.$items[target]); if( $targetItem.length < 1 ){ return false; } var itemPos = $targetItem.position().left; var itemWidth = $targetItem.outerWidth(); var offset = 0 - ( itemPos - base.wrapperWidth/2 + itemWidth/2); offset = Math.min( Math.max( offset, base.wrapperWidth - base.contentWidth ), 0 ); log('shiftTo', "itemPos", itemPos, "$targetItem", $targetItem, "target", target, "offset", offset); //var offset = Math.min( Math.max( base.$collection.position().left - (base.wrapperWidth*dir), base.wrapperWidth - base.contentWidth ), 0 ); //log('shift', "offset", offset, "base.$collection.position().left", "dir", dir, base.$collection.position().left, "base.wrapperWidth", base.wrapperWidth, "(base.wrapperWidth*dir)", (base.wrapperWidth*dir), "base.wrapperWidth - base.contentWidth", base.wrapperWidth - base.contentWidth ); base.$collection.stop().animate({ left: offset }, 1000, base.update ); base.options.onShift(base); }; /* Update Updates slider, check next/prev buttons */ base.update = function(data){ base.loadItems(); //log('updating', "base.$wrapper", base.$wrapper); base.wrapperWidth = base.$wrapper.width(); if( base.contentWidth <= base.wrapperWidth + base.options.marginForError ){ //log('content too short, reset offset', "base.contentWidth", base.contentWidth, "base.wrapperWidth", base.wrapperWidth, "base.options.marginForError", base.options.marginForError); base.$next.add(base.$previous).fadeOut('fast'); base.$collection.stop().animate({ left: 0 }, 1000 ); } else { var offset = Math.min( Math.max( base.$collection.position().left, base.wrapperWidth - base.contentWidth ), 0 ); //log('long content, current offset', base.$collection.position().left, 'new offset', offset); if( offset < 0 ){ base.$previous.fadeIn('fast'); } else { base.$previous.fadeOut('fast'); } if( base.wrapperWidth - offset <= base.contentWidth - base.options.marginForError ){ base.$next.fadeIn('fast'); } else { base.$next.fadeOut('fast'); } base.$collection.stop().animate({ left: offset }, 1000 ); } base.options.onUpdate(base); }; /* Load items * loads item information */ base.loadItems = function(){ if ( base.options.items && ( $(base.options.items).length > 0 ) ){ base.$items = $(base.options.items); } else if( ( $items = base.$el.find('ul').first().children() ) && $items.length > 0 ) { base.$items = $items; } else { log.warn(base.prefix, 'no items to process'); return false; } base.current = Math.max( Math.min( base.current, base.$items.length-1 ), 0 ); base.contentWidth = base.options.marginForError; base.$items.each(function() { base.contentWidth += $(this).outerWidth(); }); base.$collection = base.$items.first().parent().css('position','relative'); base.$collection.width( base.contentWidth ); base.$wrapper = base.$collection.parent(); return true; } /* Destroy plugin * removes handlers, classes, data */ base.destroy = function(){ base.$el .off('click.' + base.prefix) .removeClass( base.prefix ) .removeData( base.prefix ) .find('.active').removeClass('active') ; base.options.onDestroy(base); } base.init = function(){ base.options = $.extend({},$.miniSlider.defaultOptions, options); if( !base.loadItems ){ return false }; // if there are no items, cancel inicialization base.$el.addClass(base.prefix); base.current = Math.max( base.options.current, 0 ); // handle next, prev if (base.options.previous) { base.$previous = $(base.options.previous); base.$el.on( 'click.' + base.prefix, base.options.previous, function(e){ base.shift( -1, e); base.options.onPrevious(base, e); return false; } ); } if (base.options.next) { base.$next = $(base.options.next); base.$el.on( 'click.' + base.prefix, base.options.next, function(e){ base.shift( 1, e); base.options.onNext(base, e); return false; } ); } base.update(); base.options.onInit(base); }; base.init(); }; $.miniSlider.defaultOptions = { items: $([]), current: 0, marginForError: 4, onInit: function(base){}, // after inicialization is complete onNext: function(base, e){}, // on next items onPrevious: function(base, e){}, // on previous items onShift: function(base, e){}, // on slider shift onUpdate: function(base, e){}, // on plugin update onDestroy: function(base){} // on plugin destroyed }; $.fn.miniSlider = function(options){ return this.each(function(){ (new $.miniSlider(this, options)); }); }; // === MINI SLIDER PLUGIN $(function() { // DOM READY === $("#gallery-container").on("click","#rel-back", function() { $('#rel-galleries').fadeOut('slow', function() { $(this).remove(); }) }); var $miniSlider = $("#gallery-container .img_slider"); $miniSlider.miniSlider({ previous: '.btn_prev_slider', next: '.btn_next_slider', onInit: function(base){ log('onInit', base); $miniSlider.swipe({ swipeLeft:function(event, direction, distance, duration, fingerCount) { $miniSlider.find('.btn_next_slider:visible').click(); }, swipeRight:function(event, direction, distance, duration, fingerCount) { $miniSlider.find('.btn_prev_slider:visible').click(); } }); }, // after inicialization is complete onNext: function(base, e){ log('onNext', base, e)}, // on next image request onPrevious: function(base, e){ log('onPrevious', base, e)}, // on previous image request onShift: function(base, e){ log('onShift', base, e); }, // on slider shift onUpdate: function(base, e){ log('onUpdate', base, e); }, // on plugin update onDestroy: function(base){ log('onDestroy', base); } // on plugin destroyed }); $("#gallery-container").ajaxGallery2({ images: ['2142635','2142634','2142633','2142632','2142631','2142630','2142628'], ajaxUrl: '/ajax/box/boxid/ajaxGetImage/?_boxId=14399', ajaxUrlRelated: '/ajax/box/boxid/ajaxGetRelatedGalleries/?_boxId=14399', ajaxData: { galleryId : '648036' }, currentImage: '2142635', linkHrefTemplate: '/clanek/galerie/galerie-mista-vydala-novy-singl.html/?imageId=%5BimageId%5D', onInit: function(base){ // after inicialization is complete log('onInit', base); //$('[data-bind=link-full-image]').colorbox({maxWidth:'95%', maxHeight:'95%'}); $('[data-bind=link-full-image]').click(function() { return false }); //console.log('CHECK BASE', base); var thebase = base; $(document).on('keyup.'+base.prefix, function(event, base){ // Next/Prev on arrow keys // Disable arrow keys when colorbox is open event.preventDefault(); if ($("#cboxOverlay").is(":visible")) { return; } var dir = event.which == 37 ? "prev" : (event.which == 39 ? "next" : null); if ( event.which == 37 ) { var prevbtn = thebase.$el.find('.btn_prev:visible'); // console.log('go prev', thebase.$el.find('.btn_prev:visible')); if (prevbtn.hasClass('prev-gallery')) { window.location = prevbtn.attr('href'); } else { prevbtn.last().click(); } } else if ( event.which == 39 ) { var nextbtn = thebase.$el.find('.btn_next:visible'); // console.log('go next', thebase.$el.find('.btn_next:visible')); if (nextbtn.hasClass('related-gallery')) { window.location = nextbtn.attr('href'); } else { nextbtn.last().click(); } } }); var gallery = $("#gallery-container"); gallery.find('.image').swipe({ swipeLeft:function(event, direction, distance, duration, fingerCount) { var rel = gallery.find('.related-gallery:visible'); //console.log('swipe left', rel); if (rel.length > 0) { // console.log('redirect to related gallery', rel[0]); window.location = jQuery(rel[0]).attr('href'); } else { gallery.find('[data-bind="link-next"]:visible').click(); } }, swipeRight:function(event, direction, distance, duration, fingerCount) { var prev = gallery.find('.prev-gallery:visible'); // console.log('swipe right', prev); if (prev.length > 0) { // console.log('redirect to related gallery', prev[0]); window.location = jQuery(prev[0]).attr('href'); } else { gallery.find('[data-bind="link-prev"]:visible').click(); } } }); gallery.find('[data-bind="link-next"]').on('touchend touchcancel', function(e){ e.preventDefault(); gallery.find('[data-bind="link-next"]').click(); }); gallery.find('[data-bind="link-prev"]').on('touchend touchcancel', function(e){ e.preventDefault(); gallery.find('[data-bind="link-prev"]').click(); }); gallery.find('.prev-gallery').on('touchend touchcancel', function(e) { //console.log('LEVA'); //gallery.prepend('