$(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(""); } //olid_match = olid_pattern.exec(val); //if(olid_match){ //$("#infobox").before("
"); //} }); olid_match = olid_pattern.exec(body_id); if(olid_match){ $("#infobox").before("
").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(" (", "(").replace(")", ")")); img.hide(); } }); // MASONRY FOR BOOKS var msnry = new Masonry( "#book-list", { itemSelector: 'li', }); });