Skip to content

Commit

Permalink
Moved default CSS into its own file.
Browse files Browse the repository at this point in the history
  • Loading branch information
morbus committed Nov 28, 2010
1 parent 78caf8d commit 3bbf0b4
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 64 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ BUGS AND TODOS
* @bug We don't currently do any validation/sanitation of incoming data.
* @bug Revise docs to refer to command line arguments.
* @bug If a range is in the form of 7-5, we'll kabloeey.
* @bug May/Summer types of issue numbers are unsupported.
* @todo Create an index.html that contains the form purdiness.
* @todo Write up the theme documentation.
* @todo COMIC_VINE_API_KEY and Apache tweak for setup (or var at top?)
Expand All @@ -14,11 +15,12 @@ BUGS AND TODOS
* @todo Offer option to collapse all singles into a single heading.
* @todo Rendering all themes all the time costs a lot less than downloading.
* @todo Make another theme - Excel-like?
* @todo Create a misc/ directly for 'default' CSS (and future jQ, etc.).
* @todo Check notices for any remaining tweaks.
* @todo The script is going to be very slow for large collections. Cache issue data?


VERSION 1.0, 2010-11-30
VERSION 1.1, 2010-12-06
-----------------------

VERSION 1.0, 2010-11-29
-----------------------
* Initial public release.
26 changes: 8 additions & 18 deletions comic-vineyard.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

progress("<p>Comic Vineyard is now rendering your comic book collection. Be patient, bub.</p>\n\n");
$theme_fields = 'issue_number,publish_year,publish_month,publish_day,image,site_detail_url';
$issues_cache = cache_load('issues_cache.db');
$issue_numbers = cache_load('issue_numbers.db');


/* ************************************************************************** */
Expand Down Expand Up @@ -101,15 +101,15 @@
// the current Comic Vine API doesn't return the issue number in the
// volume issues field list so we have to scan each one to find it.
// we cache the values in a local file for faster reruns.
if (!isset($issues_cache[$volume_issue->id])) {
if (!isset($issue_numbers[$volume_issue->id])) {
$issue_details = http_request("http://api.comicvine.com/issue/" . $volume_issue->id . "/?api_key=$api_key&field_list=issue_number&format=json", "json");
$issues_cache[$volume_issue->id] = (int) $issue_details->results->issue_number; // just a simple lookup hash to convert ids to numbers. yawn.
$issue_numbers[$volume_issue->id] = (int) $issue_details->results->issue_number; // just a simple lookup hash to convert ids to numbers. yawn.
progress('<span class="heartbeat">.</span> '); // heartbeat for long-lived volumes with lots of issues.
$new_cache_items = TRUE;
}

// if this issue is in our collection, fetch all.
$issue_number = $issues_cache[$volume_issue->id];
$issue_number = $issue_numbers[$volume_issue->id];
if (isset($collection[$volume_id]['issue numbers'][$issue_number])) {
progress('<span class="heartbeat">.</span> '); // heartbeat for long-lived collections with lots of issues.
$issue_details = http_request("http://api.comicvine.com/issue/" . $volume_issue->id . "/?api_key=$api_key&field_list=$theme_fields&format=json", "json");
Expand All @@ -123,7 +123,7 @@
} progress('</ul>');

if (isset($new_cache_items)) {
cache_save($issues_cache, 'issues_cache.db');
cache_save($issue_numbers, 'issue_numbers.db');
}


Expand Down Expand Up @@ -229,6 +229,7 @@ function cache_load($path) {
* A relative or absolute path to save the data to.
*/
function cache_save($data, $path) {
$lines = NULL; // I SHALL SPIT YOU.
foreach ($data as $key => $value) {
$lines .= "$key,$value\n";
}
Expand All @@ -254,26 +255,15 @@ function progress_surroundings($type) {
$header .= '<head>';
$header .= '<meta charset="utf-8" />';
$header .= '<title>My Comic Vineyard</title>';
$header .= '<style type="text/css">';
$header .= 'body { background: #ccc; font: 14px sans-serif; margin: 0; }';
$header .= '#header { background: #458C40; height: 99px; }';
$header .= '#header #logo { float: left; }';
$header .= '#header-statistics { background: #000; height: 70px; }';
$header .= '#header-explanation { color: #fff; font-size: 11px; font-weight: bold; margin: 9px; }';
$header .= '#header-explanation a { color: #fff; }';
$header .= '#progress { background: #fff; border-radius: 5px; clear: both; margin: auto; padding: 10px; width: 960px; }';
$header .= '#progress a { color: #093; font-weight: bold; text-decoration: none; }';
$header .= '.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }';
$header .= '* html .clearfix { height: 1%; } *:first-child + html .clearfix { min-height: 1%; }';
$header .= '</style>';
$header .= '<link rel="stylesheet" href="misc/default.css" type="text/css" />';
$header .= '</head>';
$header .= '<body>';
$header .= '<div id="header">';
$header .= '<a href="http://www.comicvine.com/"><img id="logo" src="http://media.comicvine.com/media/vine/img/white/layout/logo.png" /></a>';
$header .= '<div id="header-statistics">&nbsp;<!-- nothing to see here yet. maybe one day it\'ll include a list of statistics? -->&nbsp;</div>';
$header .= '<div id="header-explanation"><a href="http://www.disobey.com/d/code/comic_vineyard/">Comic Vineyard</a> allows you to track your comic book collection using <a href="http://www.comicvine.com/">Comic Vine</a>. <div style="float: right;">Comic Vineyard was created by <a href="http://www.comicvine.com/myvine/morbus/">Morbus Iff</a>.</div></div>';
$header .= '</div>';
$header .= '<div id="progress" class="clearfix">';
$header .= '<div id="wrapper" class="clearfix progress">';

$footer = '</div>';
$footer .= '</body>';
Expand Down
60 changes: 60 additions & 0 deletions issues_cache.db → issue_numbers.db
Original file line number Diff line number Diff line change
Expand Up @@ -4097,3 +4097,63 @@
105900,600
105764,27
105763,1
152663,3
152662,2
145942,4
122831,1
214785,0
142054,4
142053,3
142052,2
142051,1
106723,2
106717,1
128119,0
106727,3
106726,2
106718,1
105793,15
105789,28
105788,27
105787,26
105786,25
105785,24
105784,23
105783,22
105782,21
105781,20
105780,19
105779,18
105778,14
105777,17
105776,16
105775,13
105774,12
105773,11
105770,10
105769,9
105768,7
105767,8
105766,6
77725,5
77724,4
77723,3
77722,2
77721,1
238692,1
181456,2
181455,1
111528,4
111527,3
111526,2
111459,1
111525,4
111524,3
111523,2
111458,1
129454,3
129452,2
129392,1
118941,2
118940,1
118871,0
25 changes: 3 additions & 22 deletions renders/morbus-20545-default.html

Large diffs are not rendered by default.

23 changes: 2 additions & 21 deletions themes/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,7 @@
<head>
<meta charset="utf-8" />
<title>My Comic Vineyard</title>
<style type="text/css">
body { background: #ccc; font: 12px sans-serif; margin: 0; }
#header { background: #458C40; height: 99px; }
#header #logo { float: left; }
#header-statistics { background: #000; height: 70px; }
#header-explanation { color: #fff; font-size: 11px; font-weight: bold; margin: 9px; }
#header-explanation a { color: #fff; }
.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
* html .clearfix { height: 1%; } *:first-child + html .clearfix { min-height: 1%; }

#collection { background: #fff; border-radius: 5px; clear: both; margin: auto; padding: 10px; width: 90%; }
.volume { margin-bottom: 20px; }
.volume-header { margin-bottom: 10px; }
.volume-header h2 { background: #e5ede5; border-top-left-radius: 5px; border-top-right-radius: 5px; margin: 0; padding: 10px; }
.volume-data { background: #f3f3f3; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-top: 0; padding: 5px 10px; }
.issue { float: left; font-weight: bold; margin: 2px; text-align: center; }
.issue img { border: 1px solid #e5ede5; padding: 2px; }
.issue a { color: #093; text-decoration: none; }
.issue-publication { color: #666; font-size: 11px; font-weight: normal; }
</style>
<link rel="stylesheet" href="../misc/default.css" type="text/css" />
</head>
<body>

Expand All @@ -32,7 +13,7 @@
<div id="header-explanation"><a href="http://www.disobey.com/d/code/comic_vineyard/">Comic Vineyard</a> allows you to track your comic book collection using <a href="http://www.comicvine.com/">Comic Vine</a>. <div style="float: right;">Comic Vineyard was created by <a href="http://www.comicvine.com/myvine/morbus/">Morbus Iff</a>.</div></div>
</div>

<div id="collection" class="clearfix">
<div id="wrapper" class="clearfix collection">

<?php
foreach ($data as $volume_id => $volume) {
Expand Down

0 comments on commit 3bbf0b4

Please sign in to comment.