dindinet / pwi

Automatically exported from code.google.com/p/pwi
0 stars 0 forks source link

Short caption in thumbnails and long in slimbox #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have a need for huge captions.. sometimes long paragraph. However this 
is useless in album thumbnail mode. I notice that the caption and picture 
title were substantially the same. This modification crops the caption in 
thumbnail mode.

Solution in jquery.pwi.js:

add this to fn.pwi.defaults

    showCaptionLength: 0,
What is the expected output? What do you see instead?

Modify function photo like so:

function photo(photo){
  //$lc is new long caption variable    
  var $html, $dt, $d, $lc, $img_base = photo.content.src,
  $id_base = photo.gphoto$id.$t,
  $c = (photo.summary ? photo.summary.$t : "");
  $lc = $c;
  if(settings.showCaptionLength > 0 && $c.length > 
settings.showCaptionLength) {
    $c = $c.substr(0, settings.showCaptionLength);
    $c = $c + '...'+settings.showCaptionLength;
  }

And then change the line starting html.append to this:

$html.append("<a href='" + $img_base + "?imgmax=" + settings.photoSize 
+ "' rel='lb-" + settings.username + "' title='" + $d +'<br>'+$lc 
+ "'><img src='" + $img_base + "?imgmax=" + settings.thumbSize + "&crop=" 
+ settings.thumbCrop + "'/></a>");

You will notice that I added a <br> which although not appropriate in a 
title, looks nice

Here's hoping this is a good idea.

PS Why does this script use $letter variable names? It is disconcerting!

Original issue reported on code.google.com by tazmaybe...@gmail.com on 21 Dec 2009 at 1:02

GoogleCodeExporter commented 9 years ago
Hi,

Nice fix. I might just include it in the source in a next version.
Why I used letters? I guess it's just laziness...it keeps the lines of codes 
short so 
they are readable in my screen from start to end :-)
But I must agree that it's not very friendly to those who like to change the 
code.
This project started as a personal project for private use and I decided later 
on to 
make it public. Maybe a rewrite for ease of use would be appropriate at some 
point.
If you are offering to help ;-)

Original comment by jdiderik on 24 Feb 2010 at 8:58

GoogleCodeExporter commented 9 years ago
added showCaptionLength as a setting, default to 9999 (which would probably 
show all captions.. unless they are reeaaaalllllyyyy long

Original comment by jdiderik on 12 Aug 2010 at 2:35