Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

fix image description and add image title #36

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions admin/theme-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ function of_options(){
"std" => "1",
"type" => "checkbox");

$of_options[] = array( "name" => __("Show image title", 'dsframework'),
"desc" => __("Show the media title on top-left of gallery area."),
"id" => "show_image_title",
"std" => "1",
"type" => "checkbox");

$of_options[] = array( "name" => __("Show image description", 'dsframework'),
"desc" => __("Show the media description on top-left of gallery area."),
"id" => "show_image_desc",
"std" => "1",
"type" => "checkbox");



}
Expand Down
6 changes: 3 additions & 3 deletions content-ds-gallery.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@
$img_scale = '';
}

$desc = get_post( $attachment_id_item )->post_content;

$desc = get_ds_option('show_image_desc')==1 ? get_post( $attachment_id_item )->post_content : null;
$title = get_ds_option('show_image_title')==1 ? get_post( $attachment_id_item )->post_title : null;


if(!$alt_attr)
$alt_attr = $image_urls[$j];

$album_data .= "\t\t<li class=\"two-dim-item\"{$video_data}{$img_scale} data-img-desc=\"{$desc}\" data-img-width=\"{$image_widths[$j]}\" data-img-height=\"{$image_heights[$j]}\">";
$album_data .= "\t\t<li class=\"two-dim-item\"{$video_data}{$img_scale} data-img-title=\"{$title}\" data-img-desc=\"{$desc}\" data-img-width=\"{$image_widths[$j]}\" data-img-height=\"{$image_heights[$j]}\">";
$album_data .= "<a href=\"{$image_urls[$j]}\">{$alt_attr}</a>";

$album_data .= "</li>\n";
Expand Down
2 changes: 1 addition & 1 deletion css-less/two-dim-slider.less
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
height: auto;
padding: 1.0em;
}
h3.album-title {
h3.img-title {
margin-top: 0;
}
.img-content {
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.slider-pack.1.1.min.js

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions js/jquery.slider-pack.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2015,8 +2015,8 @@
path = currItem.find('a').attr('href'),
bWidth = currItem.attr('data-img-width'),
bHeight = currItem.attr('data-img-height'),
title = currItem.attr('data-img-title'),
desc = currItem.attr('data-img-desc');


if(currImg.length <= 0) {
hasImage = false;
Expand All @@ -2029,7 +2029,7 @@

if(currImgDesc.length <= 0) {
hasDesc = false;
currImgDesc = $('<div id="img-desc" class="img-desc-block text-block"><div class="info-container"><div class="img-content">'+desc+'</div></div></div>');
currImgDesc = $('<div id="img-desc" class="img-desc-block text-block"><div class="info-container"><h3 class="img-title"></h3><div class="img-content"></div></div></div>');
} else {
hasDesc = true;
}
Expand All @@ -2041,12 +2041,6 @@
'img-scale': currItem.data('img-scale')
});







if(currBlockPath === path) {
if(!currBlock.hasClass('loading')) {
if(self.loadQueue.length > 1) {
Expand All @@ -2067,16 +2061,17 @@
.bind('load.tds', self._onLoadingComplete({type:'loaded', loadDataItem:currQueueItem, block:currBlock, img:currImg }))
.bind('error.tds', self._onLoadingComplete({type:'error', loadDataItem:currQueueItem, block:currBlock, img:currImg })).attr({'src': path, 'alt':currItem.find('a').text()});


if (!hasDesc) {
currImgDesc.appendTo(currBlock.find('.block-inside'));
}

if (desc.length > 0) {
if (desc.length > 0 || title.length > 0) {
currImgDesc.find('.img-title').text(title);
currImgDesc.find('.img-content').text(desc);
currImgDesc.show();
}else{
currImgDesc.hide();
}

if (!hasDesc) {
currImgDesc.appendTo(currBlock.find('.block-inside'));
}
if (!hasImage) {
currImg.appendTo(currBlock.find('.block-inside'));
}
Expand Down