| 1 |
function Photonic_Lightbox_PrettyPhoto() { |
| 2 |
Photonic_Lightbox.call(this); |
| 3 |
} |
| 4 |
Photonic_Lightbox_PrettyPhoto.prototype = Object.create(Photonic_Lightbox.prototype); |
| 5 |
|
| 6 |
Photonic_Lightbox_PrettyPhoto.prototype.swipe = function() { |
| 7 |
$('.pp_hoverContainer').remove(); |
| 8 |
$("#pp_full_res") |
| 9 |
.on('swipeleft', function() { $.prettyPhoto.changePage('next'); }) |
| 10 |
.on('swiperight', function() { $.prettyPhoto.changePage('previous'); }); |
| 11 |
}; |
| 12 |
|
| 13 |
Photonic_Lightbox_PrettyPhoto.prototype.soloImages = function() { |
| 14 |
$('a[href]').filter(function() { |
| 15 |
return /(\.jpg|\.jpeg|\.bmp|\.gif|\.png)/i.test( $(this).attr('href')); |
| 16 |
}).filter(function() { |
| 17 |
var res = new RegExp('photonic-prettyPhoto').test($(this).attr('rel')); |
| 18 |
return !res; |
| 19 |
}).attr("rel", 'photonic-prettyPhoto'); |
| 20 |
}; |
| 21 |
|
| 22 |
Photonic_Lightbox_PrettyPhoto.prototype.changeVideoURL = function(element, regular, embed) { |
| 23 |
$(element).attr('href', regular); |
| 24 |
}; |
| 25 |
|
| 26 |
Photonic_Lightbox_PrettyPhoto.prototype.initialize = function(e) { |
| 27 |
// this.handleSolos(); // Can't do this here since initialize is not called directly |
| 28 |
var self = this; |
| 29 |
|
| 30 |
$("a[rel^='photonic-prettyPhoto']").prettyPhoto({ |
| 31 |
theme: Photonic_JS.pphoto_theme, |
| 32 |
autoplay_slideshow: Photonic_JS.slideshow_mode, |
| 33 |
slideshow: Photonic_JS.slideshow_interval, |
| 34 |
show_title: false, |
| 35 |
social_tools: '', |
| 36 |
deeplinking: false, |
| 37 |
changepicturecallback: function() { |
| 38 |
var img = $('#fullResImage'); |
| 39 |
if (e !== undefined && e['deep'] === undefined) { |
| 40 |
var clicked_thumb = $(e.target).parent(); |
| 41 |
var clicked_div = $(clicked_thumb).parent(); |
| 42 |
var current_stream = $(clicked_div).parent(); |
| 43 |
|
| 44 |
var active_node = $(current_stream).find('a[href="' + $(img).attr('src') + '"]'); |
| 45 |
|
| 46 |
if (active_node.length === 0) { |
| 47 |
$.each($('div.title-display-regular, div.title-display-below, div.title-display-tooltip, div.title-display-hover-slideup-show, div.title-display-slideup-stick, '+ |
| 48 |
'ul.title-display-regular, ul.title-display-below, ul.title-display-tooltip, ul.title-display-hover-slideup-show, ul.title-display-slideup-stick'), function(key, value) { |
| 49 |
active_node = $(this).find('a[href="' + $(img).attr('src') + '"]'); |
| 50 |
if (active_node.length !== 0) { |
| 51 |
return false; |
| 52 |
} |
| 53 |
}); |
| 54 |
} |
| 55 |
|
| 56 |
self.setHash(active_node); |
| 57 |
} |
| 58 |
else if (e['deep'] !== undefined) { |
| 59 |
var idx = e['images'].indexOf($(img).attr('src')); |
| 60 |
if (idx > -1) { |
| 61 |
self.setHash(e['deep'][idx]); |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
var shareable = { |
| 66 |
'url': location.href, |
| 67 |
'title': $('.pp_description').text(), |
| 68 |
'image': img.attr('src') |
| 69 |
}; |
| 70 |
self.addSocial('#pp_full_res', shareable); |
| 71 |
|
| 72 |
self.swipe(); |
| 73 |
}, |
| 74 |
callback: function() { |
| 75 |
self.unsetHash(); |
| 76 |
} |
| 77 |
}); |
| 78 |
}; |
| 79 |
|
| 80 |
Photonic_Lightbox_PrettyPhoto.prototype.initializeForExisting = function() { |
| 81 |
var self = this; |
| 82 |
|
| 83 |
$(document).on('click', "a[rel^='photonic-prettyPhoto']", function(e) { |
| 84 |
e.preventDefault(); |
| 85 |
self.initialize(e); |
| 86 |
this.click(); |
| 87 |
}); |
| 88 |
|
| 89 |
$("a[rel^='photonic-prettyPhoto-video'],a[rel^='photonic-prettyPhoto-html5-video']").prettyPhoto({ |
| 90 |
theme: Photonic_JS.pphoto_theme, |
| 91 |
autoplay_slideshow: Photonic_JS.slideshow_mode, |
| 92 |
slideshow: Photonic_JS.slideshow_interval, |
| 93 |
show_title: false, |
| 94 |
social_tools: '', |
| 95 |
deeplinking: false |
| 96 |
}); |
| 97 |
}; |
| 98 |
|
| 99 |
photonicLightbox = new Photonic_Lightbox_PrettyPhoto(); |
| 100 |
photonicLightbox.handleSolos(); |
| 101 |
photonicLightbox.initializeForExisting(); |
| 102 |
|