Skip to content

Commit

Permalink
Look and feel. .
Browse files Browse the repository at this point in the history
  • Loading branch information
djcp committed Apr 26, 2012
1 parent 2a4c4c4 commit b37ccad
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<span id="searchables"></span><span id="add_searchable"> + Add Term</span>
<input type="submit" id="submit" value="go!" /><br/>
<div id="terms"></div>
<div id="meta"></div>
<div class="meta_inf"></div>
</form>
</fieldset>
<div id="messages"></div>
Expand All @@ -30,5 +30,7 @@
<div id="target">
</div>

<div class="footer meta_inf"></div>

</body>
</html>
30 changes: 17 additions & 13 deletions javascripts/covered.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,28 @@ $.extend({
var node = $('<div />').attr({class: 'doc ' + d['dpla.contributor'], id: 'doc-' + d['dpla.id']});
var nodeContent = '';

if(typeof(d['dpla.isbn']) === 'object'){
var isbn = d['dpla.isbn'][0].split('%%')[0];
nodeContent += '<img src="http://covers.openlibrary.org/b/isbn/' + isbn + '-M.jpg" class="cover" />';
}else if(typeof(d['dpla.isbn'] == 'string')){
nodeContent += '<img src="http://covers.openlibrary.org/b/isbn/' + d['dpla.isbn'] + '-M.jpg" class="cover" />';
}

if(d['dpla.content_link']){
nodeContent += '<a target="_blank" href="' + d['dpla.content_link'] + '">';
}
nodeContent += '<span class="title">' + ( (d['dpla.title']) ? $.ellipsisSubstr(d['dpla.title']) : 'Untitled Work' ) + '</span>';
nodeContent += '<h3 class="title">' + ( (d['dpla.title']) ? $.ellipsisSubstr(d['dpla.title']) : 'Untitled Work' ).replace(/\\|\//g,'') + '</h3>';
if(d['dpla.content_link']){
nodeContent += '</a>';
}

nodeContent += $.insertOpenLibraryCover(d);
nodeContent += '<span class="date">' + ((typeof(d['dpla.date']) === 'object') ? d['dpla.date'][0] : d['dpla.date']) + '</span>';
nodeContent += '<br/><span class="data_source">' + d['dpla.contributor'] + '</span>';
facets[d['dpla.contributor']] = (facets[d['dpla.contributor']] == undefined) ? 1 : (facets[d['dpla.contributor']] + 1);
return node.append(nodeContent).data('d',d);
},


insertOpenLibraryCover: function(d){
var output = '';
var isbn = ((typeof(d['dpla.isbn']) === 'object') ? d['dpla.isbn'][0].split('%%')[0] : d['dpla.isbn']);
output += '<img src="http://covers.openlibrary.org/b/isbn/' + isbn + '-M.jpg" class="cover" />';
return output;
},

relatedEditions: function(doc,isbn){
$.getJSON('http://xisbn.worldcat.org/webservices/xid/isbn/' + isbn + '?method=getEditionsa&format=json&fl=*&callback=?')
.done(function(data){
Expand Down Expand Up @@ -156,6 +159,7 @@ $(document).ready(function(){
$('.searchable_term sup').live({
click: function(){
$(this).closest('.searchable_term').remove();
$('#submit').click();
}
});

Expand Down Expand Up @@ -203,7 +207,7 @@ $(document).ready(function(){
$('#target').html('');
$('#target').isotope('destroy');
$('#facets').html('');
$('#meta').html('');
$('.meta_inf').html('');
},
complete: function(){
$('#submit').val('go!');
Expand All @@ -228,13 +232,13 @@ $(document).ready(function(){
var limit = parseInt(json.limit);
var num_found = parseInt(json.num_found);

$('#meta').append((start + 1) + ' to ' + ((num_found < (start + limit)) ? num_found : (start + limit) )+ ' of ' + num_found + ' found');
$('.meta_inf').append((start + 1) + ' to ' + ((num_found < (start + limit)) ? num_found : (start + limit) )+ ' of ' + num_found + ' found');

if(start != 0){
$('#meta').prepend($('<span class="paginate" id="prev" />').attr('data_pagination_start',start - limit).html('&laquo; Previous'));
$('.meta_inf').prepend($('<span class="paginate" id="prev" />').attr('data_pagination_start',start - limit).html('&laquo; Previous'));
}
if((start + limit) < num_found){
$('#meta').append($('<span class="paginate" id="next" />').attr('data_pagination_start',start + limit).html('Next &raquo;'));
$('.meta_inf').append($('<span class="paginate" id="next" />').attr('data_pagination_start',start + limit).html('Next &raquo;'));
}

}
Expand Down
10 changes: 8 additions & 2 deletions stylesheets/covered.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ input, select{
color: blue;
}

#meta{
.meta_inf{
text-align: center;
margin-left: 1em;
}

.footer.meta_inf{
margin: 10px 0px 20px 0px;
padding-top: 10px;
border-top: 2px dotted #ccc;
}

.paginate{
color: red;
}
Expand Down Expand Up @@ -128,7 +134,6 @@ input, select{

.doc .data_source{
font-size: 10px;
margin-left: 1em;
}

.doc .cover{
Expand All @@ -137,5 +142,6 @@ input, select{
}

.doc .title{
margin-top: 0px;
font-weight: bold;
}

0 comments on commit b37ccad

Please sign in to comment.