Guest User

Untitled

a guest
Oct 19th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.08 KB | None | 0 0
  1. //gallery popup
  2. //detect jetpack carousel and disable the theme popup
  3. if ( 'undefined' === typeof jetpackCarouselStrings ) {
  4.  
  5. // 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
  6. jQuery( 'figure.gallery-item' ).each(function() {
  7. var caption_text = jQuery( this ).children( 'figcaption' ).html();
  8. jQuery( this ).find( 'a' ).data( 'caption', caption_text );
  9. });
  10.  
  11.  
  12. //jquery tiled gallery
  13. jQuery( '.tiled-gallery' ).magnificPopup({
  14. type: 'image',
  15. delegate: "a",
  16. gallery: {
  17. enabled: true,
  18. tPrev: tdUtil.getBackendVar( 'td_magnific_popup_translation_tPrev' ), // Alt text on left arrow
  19. tNext: tdUtil.getBackendVar( 'td_magnific_popup_translation_tNext' ), // Alt text on right arrow
  20. tCounter: tdUtil.getBackendVar( 'td_magnific_popup_translation_tCounter' ) // Markup for "1 of 7" counter
  21. },
  22. ajax: {
  23. tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_ajax_tError' )
  24. },
  25. image: {
  26. tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_image_tError' ),
  27. titleSrc: function( item ) {//console.log(item.el);
  28. var td_current_caption = jQuery( item.el ).parent().find( '.tiled-gallery-caption' ).text();
  29. var pinItURL = "http://pinterest.com/pin/create/button/";
  30. pinItURL += '?url=' + 'http://mmoda.net' + window.location.pathname;
  31. pinItURL += '&media=' + item.el.attr('href');
  32. pinItURL += '&description='+td_current_caption;
  33. if ( 'undefined' !== typeof td_current_caption ) {
  34. 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>';
  35. } else {
  36. 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>';
  37. }
  38. }
  39. },
  40. zoom: {
  41. enabled: true,
  42. duration: 300,
  43. opener: function( element ) {
  44. return element.find( 'img' );
  45. }
  46. },
  47. callbacks: {
  48. open: function() {
  49. this.wrap.on('click.pinhandler', '.pin-it', function(e) {
  50. 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);
  51. return false;
  52. });
  53. },
  54. change: function( item ) {
  55. tdModalImageLastEl = item.el;
  56. tdUtil.scrollIntoView( item.el );
  57. },
  58. beforeClose: function() {
  59. tdUtil.scrollIntoView( tdModalImageLastEl );
  60. this.wrap.off('click.pinhandler');
  61. }
  62. }
  63. });
  64.  
  65.  
  66.  
  67. jQuery( '.gallery' ).magnificPopup({
  68. type: 'image',
  69. delegate: '.gallery-icon > a',
  70. gallery: {
  71. enabled: true,
  72. tPrev: tdUtil.getBackendVar( 'td_magnific_popup_translation_tPrev' ), // Alt text on left arrow
  73. tNext: tdUtil.getBackendVar( 'td_magnific_popup_translation_tNext' ), // Alt text on right arrow
  74. tCounter: tdUtil.getBackendVar( 'td_magnific_popup_translation_tCounter' ) // Markup for "1 of 7" counter
  75. },
  76. ajax: {
  77. tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_ajax_tError' )
  78. },
  79. image: {
  80. tError: tdUtil.getBackendVar( 'td_magnific_popup_translation_image_tError' ),
  81. titleSrc: function( item ) {//console.log(item.el);
  82. var td_current_caption = jQuery( item.el ).parent().find( '.tiled-gallery-caption' ).text();
  83. var pinItURL = "http://pinterest.com/pin/create/button/";
  84. pinItURL += '?url=' + 'http://mmoda.net' + window.location.pathname;
  85. pinItURL += '&media=' + item.el.attr('href');
  86. pinItURL += '&description='+td_current_caption;
  87. if ( 'undefined' !== typeof td_current_caption ) {
  88. 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>';
  89. } else {
  90. 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>';
  91. }
  92. }
  93. },
  94. zoom: {
  95. enabled: true,
  96. duration: 300,
  97. opener: function( element ) {
  98. return element.find( 'img' );
  99. }
  100. },
  101. callbacks: {
  102. open: function() {
  103. this.wrap.on('click.pinhandler', '.pin-it', function(e) {
  104. 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);
  105. return false;
  106. });
  107. },
  108. change: function( item ) {
  109. tdModalImageLastEl = item.el;
  110. tdUtil.scrollIntoView( item.el );
  111. },
  112. beforeClose: function() {
  113. tdUtil.scrollIntoView( tdModalImageLastEl );
  114. this.wrap.off('click.pinhandler');
  115. }
  116. }
  117. });
  118. }
  119. } //end modal
Advertisement
Add Comment
Please, Sign In to add comment