Fixed attachments slideshow

This commit is contained in:
RainLoop Team 2015-04-28 17:50:18 +04:00
parent df3a8182c3
commit 2d1d71b147
2 changed files with 10 additions and 5 deletions

View file

@ -582,9 +582,10 @@
if (this.pswpDom) if (this.pswpDom)
{ {
oDom oDom
.on('click', '.attachmentImagePreview[data-index]', function (oEvent) { .on('click', '.attachmentImagePreview.visible', function (oEvent) {
var var
iIndex = 0,
oPs = null, oPs = null,
oEl = oEvent.currentTarget || null, oEl = oEvent.currentTarget || null,
aItems = [] aItems = []
@ -601,14 +602,18 @@
// } // }
; ;
oDom.find('.attachmentImagePreview[data-index]').each(function (index, oSubElement) { oDom.find('.attachmentImagePreview.visible').each(function (index, oSubElement) {
var var
$oItem = $(oSubElement) $oItem = $(oSubElement)
; ;
if (oEl === oSubElement)
{
iIndex = index;
}
aItems.push({ aItems.push({
// 'el': $oItem,
'w': 600, 'h': 400, 'w': 600, 'h': 400,
'src': $oItem.attr('href'), 'src': $oItem.attr('href'),
'title': $oItem.attr('title') || '' 'title': $oItem.attr('title') || ''
@ -620,7 +625,7 @@
Globals.useKeyboardShortcuts(false); Globals.useKeyboardShortcuts(false);
oPs = new PhotoSwipe(self.pswpDom, PhotoSwipeUI_Default, aItems, { oPs = new PhotoSwipe(self.pswpDom, PhotoSwipeUI_Default, aItems, {
'index': Utils.pInt($(oEl).data('index')), 'index': iIndex,
'bgOpacity': 0.85, 'bgOpacity': 0.85,
'loadingIndicatorDelay': 500, 'loadingIndicatorDelay': 500,
'errorMsg': '<div class="pswp__error-msg">' + sErrorMessage + '</div>', 'errorMsg': '<div class="pswp__error-msg">' + sErrorMessage + '</div>',

View file

@ -332,7 +332,7 @@
</div> </div>
</div> </div>
<div class="showPreview"> <div class="showPreview">
<a data-bind="css: {'attachmentImagePreview': isImage()}, attr: { 'title': fileName, 'href': linkPreviewMain(), 'data-index': $index }" target="_blank"> <a data-bind="css: {'attachmentImagePreview': isImage(), 'visible': !isLinked}, attr: { 'title': fileName, 'href': linkPreviewMain() }" target="_blank">
<div class="iconMain"> <div class="iconMain">
<i class="attachmentIcon attachmentMainIcon" data-bind="css: iconClass()"></i> <i class="attachmentIcon attachmentMainIcon" data-bind="css: iconClass()"></i>
<i class="attachmentIconText attachmentMainIconText" data-bind="text: iconText()"></i> <i class="attachmentIconText attachmentMainIconText" data-bind="text: iconText()"></i>