No images in this repository’s iceberg at this time
Download raw (1.9 KB)
$(document).ready(function(){ img_pattern = /jpg|gif|png$/g //olid_pattern = /^\/books\/([A-Z0-9]*)/g olid_pattern = /(OL[A-Z0-9]*M)/g body_id = $("body").attr("id").toUpperCase(); $("dd").each(function(){ val = $(this).text(); if(val.match(img_pattern)){ $(this).html("<img src='" + val + "' />"); } //olid_match = olid_pattern.exec(val); //if(olid_match){ //$("#infobox").before("<section id='cover' class='box'><img src='http://covers.openlibrary.org/b/olid/" + olid_match[1] + "-L.jpg' /></section>"); //} }); olid_match = olid_pattern.exec(body_id); if(olid_match){ $("#infobox").before("<section id='cover' class=''><img src='http://covers.openlibrary.org/b/olid/" + body_id + "-L.jpg' /></section>").ready(function(){ // Hide image if smaller than 10px (meaning there's no cover) img_width = $("#cover img")[0].naturalWidth; console.log(img_width); if(img_width < 10){ $("#cover").hide(); } }); } // TABLE OF CONTENT $("#toc").tocify({ "context": "#content section", "selectors": "h1", "extendPage": false, "highlightOnScroll": true, }); $("body#ol200810a h1#node").html("Anna Kavan"); }); $(window).load(function(){ // DISPLAY DEFAULT COVER IF NO COVER $("#content img").each(function(){ img = $($(this)[0]); w = $(this)[0].naturalWidth; if (w < 10) { //img.css("outline", "10px solid red"); img.parent().addClass("default-cover"); img.parent().append(img.attr("title").replace(" (", "<span class='year'>(").replace(")", ")</span>")); img.hide(); } }); // MASONRY FOR BOOKS var msnry = new Masonry( "#book-list", { itemSelector: 'li', }); });