From d8a533274fa6354072a2acb66bd1574ecaec2c02 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 18 Mar 2010 00:19:32 +0100 Subject: [PATCH] Updated 'more' anchor for attachments to do an XHR GET --- js/util.js | 110 +++++++++++--------- lib/attachmentlist.php | 2 - plugins/OStatus/classes/Ostatus_profile.php | 2 +- theme/base/css/display.css | 9 +- theme/default/css/display.css | 3 +- theme/identica/css/display.css | 3 +- 6 files changed, 74 insertions(+), 55 deletions(-) diff --git a/js/util.js b/js/util.js index f82ca992c6..79fd40deba 100644 --- a/js/util.js +++ b/js/util.js @@ -399,58 +399,70 @@ var SN = { // StatusNet return; } - $.fn.jOverlay.options = { - method : 'GET', - data : '', - url : '', - color : '#000', - opacity : '0.6', - zIndex : 9999, - center : false, - imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif', - bgClickToClose : true, - success : function() { - $('#jOverlayContent').append(''); - $('#jOverlayContent button').click($.closeOverlay); - }, - timeout : 0, - autoHide : true, - css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'} - }; - - notice.find('a.attachment').click(function() { - var attachId = ($(this).attr('id').substring('attachment'.length + 1)); - if (attachId) { - $().jOverlay({url: $('address .url')[0].href+'attachment/' + attachId + '/ajax'}); - return false; - } - }); + var attachment_more = notice.find('.attachment.more'); + if (attachment_more.length > 0) { + attachment_more.click(function() { + $.get($(this).attr('href')+'/ajax', null, function(data) { + notice.find('.entry-title .entry-content').html($(data).find('#attachment_view .entry-content').html()); + }); - if ($('#shownotice').length == 0) { - var t; - notice.find('a.thumbnail').hover( - function() { - var anchor = $(this); - $('a.thumbnail').children('img').hide(); - anchor.closest(".entry-title").addClass('ov'); - - if (anchor.children('img').length === 0) { - t = setTimeout(function() { - $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { - anchor.append(data); - }); - }, 500); - } - else { - anchor.children('img').show(); - } + return false; + }); + } + else { + $.fn.jOverlay.options = { + method : 'GET', + data : '', + url : '', + color : '#000', + opacity : '0.6', + zIndex : 9999, + center : false, + imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif', + bgClickToClose : true, + success : function() { + $('#jOverlayContent').append(''); + $('#jOverlayContent button').click($.closeOverlay); }, - function() { - clearTimeout(t); - $('a.thumbnail').children('img').hide(); - $(this).closest('.entry-title').removeClass('ov'); + timeout : 0, + autoHide : true, + css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'} + }; + + notice.find('a.attachment').click(function() { + var attachId = ($(this).attr('id').substring('attachment'.length + 1)); + if (attachId) { + $().jOverlay({url: $('address .url')[0].href+'attachment/' + attachId + '/ajax'}); + return false; } - ); + }); + + if ($('#shownotice').length == 0) { + var t; + notice.find('a.thumbnail').hover( + function() { + var anchor = $(this); + $('a.thumbnail').children('img').hide(); + anchor.closest(".entry-title").addClass('ov'); + + if (anchor.children('img').length === 0) { + t = setTimeout(function() { + $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { + anchor.append(data); + }); + }, 500); + } + else { + anchor.children('img').show(); + } + }, + function() { + clearTimeout(t); + $('a.thumbnail').children('img').hide(); + $(this).closest('.entry-title').removeClass('ov'); + } + ); + } } }, diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 22ae8ba07a..13dafd13e4 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -368,9 +368,7 @@ class Attachment extends AttachmentListItem { $body = $this->scrubHtmlFile($attachment); if ($body) { - $this->out->elementStart('div', array('class' => 'inline-attachment')); $this->out->raw($body); - $this->out->elementEnd('div'); } } diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index a59184b892..7ea8ff633b 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -559,7 +559,7 @@ class Ostatus_profile extends Memcached_DataObject htmlspecialchars($attachUrl) . '" class="attachment more">' . // TRANS: expansion link for too-long remote messages - htmlspecialchars(_m('(more)')) . + htmlspecialchars(_m('more')) . ''; } } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index a2e4cdf2af..9044021f5f 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1284,9 +1284,16 @@ height:16px; position:relative; padding-left:16px; } -#attachments .attachment { +#attachments .attachment, +.notice .attachment.more { padding-left:0; } +.notice .attachment.more:before { +content:'( '; +} +.notice .attachment.more:after { +content:' )'; +} .notice .attachment img { position:absolute; top:18px; diff --git a/theme/default/css/display.css b/theme/default/css/display.css index d92a53965b..c08a03061d 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -410,7 +410,8 @@ background-position: 0 -1714px; .notice .attachment { background-position:0 -394px; } -#attachments .attachment { +#attachments .attachment, +.notice .attachment.more { background:none; } .notice-options .notice_reply { diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 59cb3c38a0..62a9e25d81 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -409,7 +409,8 @@ background-position: 0 -1714px; .notice .attachment { background-position:0 -394px; } -#attachments .attachment { +#attachments .attachment, +.notice .attachment.more { background:none; } .notice-options .notice_reply { -- 2.39.2