Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //gallery popup
- //detect jetpack carousel and disable the theme popup
- if ( 'undefined' === typeof jetpackCarouselStrings ) {
- // copy gallery caption from figcaption to data-caption attribute of the link to the full image, in this way the modal can read the caption
- jQuery( 'figure.gallery-item' ).each(function() {
- var caption_text = jQuery( this ).children( 'figcaption' ).html();
- jQuery( this ).find( 'a' ).data( 'caption', caption_text );
- });
- //jquery tiled gallery
- jQuery( '.tiled-gallery' ).magnificPopup({
- type: 'image',
- delegate: "a",
- gallery: {
- enabled: true,
- tPrev: tdUtil.getBackendVar( 'td_magnific_popup_translation_tPrev' ), // Alt text on left arrow
- tNext: tdUtil.getBackendVar( 'td_magnific_popup_translation_tNext' ), // Alt text on right arrow
- tCounter: tdUtil.getBackendVar( 'td_magnific_popup_translation_tCounter' ) // Markup for "1 of 7" counter
- },
- ajax: {
- tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_ajax_tError' )
- },
- image: {
- tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_image_tError' ),
- titleSrc: function( item ) {//console.log(item.el);
- var td_current_caption = jQuery( item.el ).parent().find( '.tiled-gallery-caption' ).text();
- var pinItURL = "http://pinterest.com/pin/create/button/";
- pinItURL += '?url=' + 'http://mmoda.net' + window.location.pathname;
- pinItURL += '&media=' + item.el.attr('href');
- pinItURL += '&description='+td_current_caption;
- if ( 'undefined' !== typeof td_current_caption ) {
- return '<a href="'+pinItURL+'" target="_blank"><img src="http://assets.pinterest.com/images/pidgets/pin_it_button.png" /></a><br>' + td_current_caption + '<br><a href="'+item.src+'" target="_blank">Gerçek Boyut / Full Size</a>';
- } else {
- return '<a href="'+pinItURL+'" target="_blank"><img src="http://assets.pinterest.com/images/pidgets/pin_it_button.png" /></a><br>' + td_current_caption + '<br><a href="'+item.src+'" target="_blank">Gerçek Boyut / Full Size</a>';
- }
- }
- },
- zoom: {
- enabled: true,
- duration: 300,
- opener: function( element ) {
- return element.find( 'img' );
- }
- },
- callbacks: {
- open: function() {
- this.wrap.on('click.pinhandler', '.pin-it', function(e) {
- window.open(e.currentTarget.href, "intent", "scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left=" + (window.screen ? Math.round(screen.width / 2 - 275) : 50) + ",top=" + 100);
- return false;
- });
- },
- change: function( item ) {
- tdModalImageLastEl = item.el;
- tdUtil.scrollIntoView( item.el );
- },
- beforeClose: function() {
- tdUtil.scrollIntoView( tdModalImageLastEl );
- this.wrap.off('click.pinhandler');
- }
- }
- });
- jQuery( '.gallery' ).magnificPopup({
- type: 'image',
- delegate: '.gallery-icon > a',
- gallery: {
- enabled: true,
- tPrev: tdUtil.getBackendVar( 'td_magnific_popup_translation_tPrev' ), // Alt text on left arrow
- tNext: tdUtil.getBackendVar( 'td_magnific_popup_translation_tNext' ), // Alt text on right arrow
- tCounter: tdUtil.getBackendVar( 'td_magnific_popup_translation_tCounter' ) // Markup for "1 of 7" counter
- },
- ajax: {
- tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_ajax_tError' )
- },
- image: {
- tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_image_tError' ),
- titleSrc: function( item ) {//console.log(item.el);
- var td_current_caption = jQuery( item.el ).parent().find( '.tiled-gallery-caption' ).text();
- var pinItURL = "http://pinterest.com/pin/create/button/";
- pinItURL += '?url=' + 'http://mmoda.net' + window.location.pathname;
- pinItURL += '&media=' + item.el.attr('href');
- pinItURL += '&description='+td_current_caption;
- if ( 'undefined' !== typeof td_current_caption ) {
- return '<a href="'+pinItURL+'" target="_blank"><img src="http://assets.pinterest.com/images/pidgets/pin_it_button.png" /></a><br>' + td_current_caption + '<br><a href="'+item.src+'" target="_blank">Gerçek Boyut / Full Size</a>';
- } else {
- return '<a href="'+pinItURL+'" target="_blank"><img src="http://assets.pinterest.com/images/pidgets/pin_it_button.png" /></a><br>' + td_current_caption + '<br><a href="'+item.src+'" target="_blank">Gerçek Boyut / Full Size</a>';
- }
- }
- },
- zoom: {
- enabled: true,
- duration: 300,
- opener: function( element ) {
- return element.find( 'img' );
- }
- },
- callbacks: {
- open: function() {
- this.wrap.on('click.pinhandler', '.pin-it', function(e) {
- window.open(e.currentTarget.href, "intent", "scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left=" + (window.screen ? Math.round(screen.width / 2 - 275) : 50) + ",top=" + 100);
- return false;
- });
- },
- change: function( item ) {
- tdModalImageLastEl = item.el;
- tdUtil.scrollIntoView( item.el );
- },
- beforeClose: function() {
- tdUtil.scrollIntoView( tdModalImageLastEl );
- this.wrap.off('click.pinhandler');
- }
- }
- });
- }
- } //end modal
Advertisement
Add Comment
Please, Sign In to add comment