Album

 view release on metacpan or  search on metacpan

script/album  view on Meta::CPAN

		    print STDERR ("mkdir $fdir\n");
		    mkdir(d_css(""));
		}
	    }
	    print STDERR ("Creating stylesheets: ") if $verbose > 1 && !$did++;
	    print STDERR ("$req ") if $verbose > 1;
	    open (my $fh, '>', $css) || die("$css: $!\n");
	    print { $fh } $data;
	    close($fh);
	}
	$data =~ s/^([ \t]+)/detab($1)/gem;
	$data;
    };

    my $css_for_common = heredoc(<<"    EOD", 0);

    body {
	$css_fontfam;
	font-size:  80%;
	text: $BLACK;
    }

    a:link {
	color: $BLACK; text-decoration: none;
    }
    a:visited {
	color: $BLACK; text-decoration: none;
    }
    a:active {
	color: $RED; text-decoration: none;
    }

    img.image {
	border: 2px solid $BLACK;
    }

    img.button {
	border: 0;
	vertical-align: top;
    }

    table.vb {
	border: 0;
	border-spacing: 0 0;
    }
    table.vb td {
	padding: 0 0 0 0;
    }
    table.hb {
	border: 0;
	border-spacing: 0 0;
    }
    table.hb td {
	padding: 0 0 0 0;
    }
    EOD

    my $css_for_ipage = heredoc(<<"    EOD", 0);
    $css_for_common
    body {
	background: $DGREY;
    }
    td {
	font-size:  80%;
    }
    p.hdl, p.hdr {
	font-size: 140%; font-weight: bold;
	margin-top: 0; margin-bottom: 0;
    }
    p.ftl, p.ftr {
	font-size:  80%;
	margin-top: 0; margin-bottom: 0;
    }
    td.topleft {
	text-align: left;
	vertical-align: top;
    }
    td.topright {
	text-align: right;
	vertical-align: top;
    }
    td.image {
	text-align: center;
	vertical-align: top;
    }
    td.botleft {
	text-align: left;
	vertical-align: top;
    }
    td.botright {
	text-align: right;
	vertical-align: top;
    }
    td.vbuttons {
	vertical-align: top;
    }
    EOD

    $css_for{index} = $load->("index", heredoc(<<"    EOD", 4));
    /* ALBUM-CSS-VERSION: ${css_major}.${css_minor} */
    $css_for_ipage
    a.info {
	position: relative; z-index: 24; background-color: $LGREY;
	color: $BLACK; text-decoration:none;
    }
    a.info:hover {
	z-index: 25; background-color: $LGREY;
    }
    a.info:hover span {
	display: block;
	position: absolute; top: 2em; left: 2em; width: 25em;
	border: 0px; background-color: $MGREY; color: $BLACK;
	text-align: center;
    }
    a.info span {
	display: none;
    }
    table.outer {
	background: $MGREY;
	border-collapse: separate;
	border-width: 2px;           /* border=2 */
	border-style: solid;
	border-color: $GR232 $GR114 $GR114 $GR232;
	border-spacing: 3px;        /* cellspacing = 3 */
    }
    table.outer tr {
	background: $LGREY;
    }
    table.outer td {
	border-width: 1px;
	border-style: solid;
	border-color: $GR124 $GR245 $GR245 $GR124;
    }
    table.inner {
	/* need a width otherwise we cannot center it */
	width: ${helper}px;
	border: outset 0px;
    }
    table.inner td {
	border: inset 0px;
        padding: 0 0 0 0;
    }
    p.hdr {
	font-size: 140%; font-weight: bold;
	margin-top: 0; margin-bottom: 0;
    }
    p.hdr a:link {
	color: $BLACK; text-decoration: underline;
    }
    p.hdr a:visited {
	color: $BLACK; text-decoration: underline;
    }
    p.hdr a:hover {
	color: $RED; text-decoration: underline;
    }
    td.vimage {
	vertical-align: top;
    }
    td.oimg {
	text-align: center;
	vertical-align: bottom;
    }
    td.iimg {
	text-align: center;
    }
    td.itxt {
	text-align: center;
    }
    img.thumb {
	border: 0;
    }
    EOD

    my $css_for_image = heredoc(<<"    EOD", 4);
    /* ALBUM-CSS-VERSION: ${css_major}.${css_minor} */
    $css_for_ipage
    a.info {
	position: relative; z-index: 24; background-color: $DGREY;
	color:$BLACK; text-decoration:none;
    }
    a.info:hover {
	z-index: 25; background-color: $DGREY;
    }
    a.info span {
	display: none;
    }
    a.info:hover span {
	display: block;
	position: absolute; top:2em; left: 2em; width: 15em;
	border: 0px; background-color: $MGREY; color: $BLACK;
	text-align: center;
    }
    EOD

    $css_for{large}   = $load->("large",   $css_for_image);
    $css_for{medium}  = $load->("medium",  $css_for_image);

    $css_for{journal} = $load->("journal", heredoc(<<"    EOD", 4));
    /* ALBUM-CSS-VERSION: ${css_major}.${css_minor} */
    $css_for_common
    body {
	font-size: 100%;
	background: $WHITE;
    }
    td {
	font-size:  100%;
    }
    p.hdl {
	font-size: 140%; font-weight: bold;
	margin-left: 0.1in; margin-top: 0.1in; margin-bottom: 0.1in;
    }

    table.outer {
	width: 600px;
	border-spacing: 10px;
    }
    tr.grey {
	background: $DGREY;
    }
    table.outer td.twocol {
	vertical-align: top;
	text-align: left;
    }
    table.outer td.jl {
	vertical-align: top;
	text-align: left;
    }
    table.outer td.jr {
	width: ${thumb}px;
	vertical-align: top;
        text-align: center;
        background: $LGREY;
    }
    table.outer td.buttons {
	vertical-align: middle;
	text-align: right;
	padding-right: 0.1in;
    }
    EOD

    $css_for{main} = $load->("main", heredoc(<<"    EOD", 4));
    /* ALBUM-CSS-VERSION: ${css_major}.${css_minor} */
    body {
        $css_fontfam;
        font-size:  80%;
        background: $LGREY;
        background-image: url("icons/bg.jpg");
        background-repeat: no-repeat;
        background-position: 10% 60%;
    }
    p.ftr {
        padding-left: 10%;
        padding-top: 40%;
        font-size:  80%;
        text-align: left;
        color: $DDGREY;
    }
    p.indextitle {
        padding-left: 10%;
        font-size: 500%;
        font-weight: bold;
        color: $WHITE;
    }
    p.indextitle a {
        text-decoration: none;
        color: $WHITE;
    }
    EOD
}

sub css_for {
    my ($type) = shift(@_);
    defined(my $css = $css_for{$type}) or die("PROGRAM ERROR: css_for($type)");
    return qq{<link rel="stylesheet" href="}.d_up(d_css($type.".css")).qq{">}
      unless $css;
    qq{<style type=\"text/css\">\n} . $css . qq{</style>};
}

################ Helpers for Image/Index/Journal pages ################

sub jscript {
    my (%nav) = @_;
    my $next = $nav{next};
    my $prev = $nav{prev};
    my $up   = $nav{up};
    my $down = $nav{down};
    my $idx  = $nav{idx};
    my $jnl  = $nav{jnl};
    my $js = heredoc(<<"    EOD", 4);
    <script type='text/javascript'>
    function handleKey(e) {
      var key;
      if ( e == null ) { // IE
	key = event.keyCode
      }
      else { // Mozilla
	if ( e.altKey || e.ctrlKey ) {
	  return true
	}
	key = e.which
      }
      switch(key) {
    EOD

    $js .= "    case   8: window.location = '$prev'; break // Backspace\n" if $prev;
    $js .= "    case  32: window.location = '$next'; break // Space\n"     if $next;
    $js .= "    case  13: window.location = '$down'; break // Enter\n"     if $down;
    $js .= "    case  43: window.location = '$down'; break // '+'\n"       if $down;
    $js .= "    case 117: window.location = '$up'; break // 'u'\n"         if $up;



( run in 0.719 second using v1.01-cache-2.11-cpan-0b5f733616e )