Skip to content

Commit

Permalink
fix post issue
Browse files Browse the repository at this point in the history
  • Loading branch information
uncovery committed Mar 25, 2016
1 parent 55bfa3e commit 172a640
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions unc_display.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ function unc_display_image_html($file_path, $show_thumb, $file_data = false) {

$gal_text = '';
if ($UNC_GALLERY['image_view_method'] == 'photoswipe') {
$js_code = str_replace("-", "_", $D['date']);
$gal_text = "onClick=\"unc_g_photoswipe_$js_code({$F['index']}); return false;\"";
global $post;
$slug = $post->post_name;
$gal_text = "onClick=\"unc_g_photoswipe_$slug({$F['index']}); return false;\"";
} else if ($UNC_GALLERY['image_view_method'] == 'lightbox') {
$gal_text = "data-lightbox=\"gallery_{$F['file_name']}\"";
}
Expand All @@ -345,16 +346,15 @@ function unc_display_image_html($file_path, $show_thumb, $file_data = false) {
}

function unc_display_photoswipe_js($files) {
global $UNC_GALLERY;
$D = $UNC_GALLERY['display'];
$js_code = str_replace("-", "_", $D['date']);
global $post;
$slug = $post->post_name;
$out = '
<script type="text/javascript">
function unc_g_photoswipe_' . $js_code . '(index) {
function unc_g_photoswipe_' . $slug . '(index) {
var options = {
index: index
};
var uncg_items_' . $js_code . ' = [';
var uncg_items_' . $slug . ' = [';
foreach ($files as $F) {
$out .= "
{
Expand All @@ -367,7 +367,7 @@ function unc_g_photoswipe_' . $js_code . '(index) {
}
$out .= "];
var pswpElement = document.querySelectorAll('.pswp')[0];
var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, uncg_items_$js_code, options);
var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, uncg_items_$slug, options);
gallery.init();
}
</script>";
Expand Down

0 comments on commit 172a640

Please sign in to comment.