async function fetchAndDisplayBooks() {
try {
let books = [{"title":"A Perfect Spy","shorttitle":"A Perfect Spy","authorstring":"John le Carré","description":"From the New York Times bestselling author of A Legacy of Spies. John le Carré’s new novel, Agent Running in the Field, is coming October 2019.\n\nOver the course of his seemingly irreproachable life, Magnus Pym has been all things to all people: a devoted family man, a trusted colleague, a loyal friend—and the perfect spy. But in the wake of his estranged father’s death, Magnus vanishes, and the British Secret Service is up in arms. Is it grief, or is the reason for his disappearance more sinister? And who is the mysterious man with the sad moustache who also seems to be looking for Magnus?\n\nIn A Perfect Spy, John le Carré has crafted one of his crowning masterpieces, interweaving a moving and unusual coming-of-age story with a morally tangled chronicle of modern espionage.","descriptionHtml":"From the New York Times bestselling author of A Legacy of Spies. John le Carré’s new novel, Agent Running in the Field, is coming October 2019.
Over the course of his seemingly irreproachable life, Magnus Pym has been all things to all people: a devoted family man, a trusted colleague, a loyal friend—and the perfect spy. But in the wake of his estranged father’s death, Magnus vanishes, and the British Secret Service is up in arms. Is it grief, or is the reason for his disappearance more sinister? And who is the mysterious man with the sad moustache who also seems to be looking for Magnus?
In A Perfect Spy, John le Carré has crafted one of his crowning masterpieces, interweaving a moving and unusual coming-of-age story with a morally tangled chronicle of modern espionage.","isbn":"9780143119760","amazonurl":"http://www.amazon.com/A-Perfect-Spy-Novel/dp/0143119761?linkCode=ll1&tag=codexmap-20&linkId=8d37aaf25f3947e1637a2ada957a9c8f&ref_=as_li_ss_tl","HawaiiProject":"https://www.thehawaiiproject.com/book/A-Perfect-Spy--by--John-le-Carré--30245","tbr":"https://tbrapp.co/book/30245","AppleBooks":"https://books.apple.com/us/book/a-perfect-spy/id433556413?itscg=30200&at=1000l3dBv&ct=30245","BarnesNoble":"https://www.barnesandnoble.com/s/9780143119760","Bookshop":"https://bookshop.org/a/19558/9780143119760","coverarturl":"https://images-na.ssl-images-amazon.com/images/I/41diHZ9KCYL.jpg","bookid":"30245","publicationdate":"2002-12-31 00:00:00"},{"title":"The Hunters","shorttitle":"The Hunters","authorstring":"James Salter","description":"Captain Cleve Connell has already made a name for himself among pilots when he arrives in Korea during the war there to fly the newly operational F-86 fighters against the Soviet MIGs. His goal, like that of every fighter pilot, is to chalk up enough kills to become an ace.\n\nBut things do not turn out as expected. Mission after mission proves fruitless, and Connell finds his ability and his stomach for combat questioned by his fellow airmen: the brash wing commander, Imil; Captain Robey, an ace whose record is suspect; and finally, Lieutenant Pell, a cocky young pilot with an uncanny amount of skill and luck.\n\nDisappointment and fear gradually erode Connell's faith in himself, and his dream of making ace seems to slip out of reach. Then suddenly, one dramatic mission above the Yalu River reveals the depth of his courage and honor.\n\nOriginally published in 1956, The Hunters was James Salter's first novel. Based on his own experiences as a fighter pilot in the Korean War, it is a classic of wartime fiction. Now revised by the author and back in print on the sixty-fifth anniversary of the Air Force, the story of Cleve Connell's war flies straight into the heart of men's rivalries and fears.","descriptionHtml":"
Captain Cleve Connell has already made a name for himself among pilots when he arrives in Korea during the war there to fly the newly operational F-86 fighters against the Soviet MIGs. His goal, like that of every fighter pilot, is to chalk up enough kills to become an ace.
But things do not turn out as expected. Mission after mission proves fruitless, and Connell finds his ability and his stomach for combat questioned by his fellow airmen: the brash wing commander, Imil; Captain Robey, an ace whose record is suspect; and finally, Lieutenant Pell, a cocky young pilot with an uncanny amount of skill and luck.
Disappointment and fear gradually erode Connell's faith in himself, and his dream of making ace seems to slip out of reach. Then suddenly, one dramatic mission above the Yalu River reveals the depth of his courage and honor.
Originally published in 1956, The Hunters was James Salter's first novel. Based on his own experiences as a fighter pilot in the Korean War, it is a classic of wartime fiction. Now revised by the author and back in print on the sixty-fifth anniversary of the Air Force, the story of Cleve Connell's war flies straight into the heart of men's rivalries and fears.
","isbn":"9781619020542","amazonurl":"http://www.amazon.com/The-Hunters-James-Salter/dp/1619020548?linkCode=ll1&tag=codexmap-20&linkId=8d37aaf25f3947e1637a2ada957a9c8f&ref_=as_li_ss_tl","HawaiiProject":"https://www.thehawaiiproject.com/book/The-Hunters--by--James-Salter--26126","tbr":"https://tbrapp.co/book/26126","AppleBooks":"https://books.apple.com/us/book/the-hunters/id1547265073?itscg=30200&at=1000l3dBv&ct=26126","BarnesNoble":"https://www.barnesandnoble.com/s/9781619020542","Bookshop":"https://bookshop.org/a/19558/9781619020542","coverarturl":"https://images-na.ssl-images-amazon.com/images/I/418-nYKhC%2BL.jpg","bookid":"26126","publicationdate":"1956-01-01 01:01:01"},{"title":"The Wine-Dark Sea (Vol. Book 16) (Aubrey/Maturin Novels)","shorttitle":"The Wine-Dark Sea","authorstring":"Patrick O'Brian","description":"The sixteenth volume in the Aubrey/Maturin series, and Patrick O'Brian's first bestseller in the United States. At the outset of this adventure filled with disaster and delight, Jack Aubrey and Stephen Maturin pursue an American privateer through the Great South Sea. The strange color of the ocean reminds Stephen of Homer's famous description, and portends an underwater volcanic eruption that will create a new island overnight and leave an indelible impression on the reader's imagination.\n\nTheir ship, the Surprise, is now also a privateer, the better to escape diplomatic complications from Stephen's mission, which is to ignite the revolutionary tinder of South America. Jack will survive a desperate open boat journey and come face to face with his illegitimate black son; Stephen, caught up in the aftermath of his failed coup, will flee for his life into the high, frozen wastes of the Andes; and Patrick O'Brian's brilliantly detailed narrative will reunite them at last in a breathtaking chase through stormy seas and icebergs south of Cape Horn, where the hunters suddenly become the hunted.","descriptionHtml":"The sixteenth volume in the Aubrey/Maturin series, and Patrick O'Brian's first bestseller in the United States.
At the outset of this adventure filled with disaster and delight, Jack Aubrey and Stephen Maturin pursue an American privateer through the Great South Sea. The strange color of the ocean reminds Stephen of Homer's famous description, and portends an underwater volcanic eruption that will create a new island overnight and leave an indelible impression on the reader's imagination.
Their ship, the Surprise, is now also a privateer, the better to escape diplomatic complications from Stephen's mission, which is to ignite the revolutionary tinder of South America. Jack will survive a desperate open boat journey and come face to face with his illegitimate black son; Stephen, caught up in the aftermath of his failed coup, will flee for his life into the high, frozen wastes of the Andes; and Patrick O'Brian's brilliantly detailed narrative will reunite them at last in a breathtaking chase through stormy seas and icebergs south of Cape Horn, where the hunters suddenly become the hunted.
","isbn":"9780393312447","amazonurl":"http://www.amazon.com/Wine-Dark-Vol-Aubrey-Maturin-Novels/dp/0393312445?linkCode=ll1&tag=codexmap-20&linkId=8d37aaf25f3947e1637a2ada957a9c8f&ref_=as_li_ss_tl","HawaiiProject":"https://www.thehawaiiproject.com/book/The-Wine-Dark-Sea--by--Patrick-OBrian--47057","tbr":"https://tbrapp.co/book/47057","AppleBooks":"https://books.apple.com/us/book/the-wine-dark-sea/id482675292?itscg=30200&at=1000l3dBv&ct=47057","BarnesNoble":"https://www.barnesandnoble.com/s/9780393312447","Bookshop":"https://bookshop.org/a/19558/9780393312447","coverarturl":"https://images-na.ssl-images-amazon.com/images/I/51---Sn6yIL.jpg","bookid":"47057","publicationdate":"1994-10-17 00:00:00"}];
// Create a container for the book list
const bookList = document.createElement('div');
bookList.className = 'book-list';
// Add some basic styling
const style = document.createElement('style');
style.textContent = `
body {
--cover-width: 70px;
--cover-height: calc(var(--cover-width) * 1.55);
--cover-radius: 8px;
--cover-bordercolor: rgba(255, 255, 255, 0.5);
--widget-background: black;
--widget-textcolor: white;
}
.book-list {
display: flex;
flex-direction: column;
gap: 10px;
padding: 4px;
max-widthX: 250px;
background: var(--widget-background);
}
.book-card {
display: flex;
flex-direction: row;
align-items: center;
overflow: hidden;
}
@media (max-width:1080px) {
.book-card {
flex-direction: column;
}
}
.book-cover-container {
flexX: 0 0 var(--cover-width);
width: var(--cover-width);
height: var(--cover-height);
border-radius: var(--cover-radius);
background: var(--cover-bordercolor);
displayX: flex;
padding: 2px;
}
.book-cover-link {
display: block;
height: 100%
}
.book-cover {
display: block;
widthX: var(--cover-width);
heightX: var(--cover-height);
border-radius: var(--cover-radius);
object-fit: cover;
height: 100%;
width: 100%;
marginX: 1px;
box-shadow: 0 0 1px 0px white inset, 0 0 1px 0px white;
}
.book-info {
flex: 1;
padding: 8px;
display: flex;
flex-direction: column;
justify-content: center;
background: var(--widget-background);
color: var(--widget-textcolor);
}
.book-title {
margin: 0 0 0px 0 !important;
font-size: 1rem;
font-weight: bold;
color: var(--widget-textcolor);
}
.book-author {
color: var(--widget-textcolor);
margin-bottom: 0px !important;
font-size: 0.75rem;
}
`;
document.head.appendChild(style);
// Create and append book cards
books.forEach(book => {
const bookCard = document.createElement('div');
bookCard.className = 'book-card';
// h2: margin-top: 0px;
bookCard.innerHTML = `
${book.shorttitle}
by ${book.authorstring}
`;
bookList.appendChild(bookCard);
});
// Add the book list to the document
const booksContainer = document.getElementById('fdb2eae44c496f82eb8c4d968057560d');
if (booksContainer) {
booksContainer.appendChild(bookList);
} else {
console.error('Element with id "books" not found');
}
//
var poweredDiv = document.createElement("div");
poweredDiv.setAttribute('style', 'padding-top: 4px; display: flex; justify-content: center; align-items: center;' );
var poweredImage = document.createElement("img");
var poweredLink = document.createElement("a");
var poweredImgLink = document.createElement("a");
poweredDiv.className ='LT_powered';
poweredImage.className ="favicon";
poweredImage.setAttribute('src', "https://bookshipapp.com/assets/icon/favicon.ico");
poweredImage.setAttribute('width', '16px');
poweredImage.setAttribute('height', '16px');
poweredImage.setAttribute('alt', 'Powered by Bookship');
poweredLink.setAttribute('href', 'https://www.bookshipapp.com')
poweredLink.setAttribute('target', '_top');
poweredLink.setAttribute('style', 'display: flex;');
poweredLink.innerHTML='Powered by Bookship';
poweredImgLink.setAttribute('href', 'https://www.bookshipapp.com')
poweredImgLink.setAttribute('target', '_top');
poweredImgLink.setAttribute('style', 'display: flex;padding-right: 4px;');
poweredImgLink.appendChild(poweredImage);
poweredDiv.appendChild(poweredImgLink);
poweredDiv.appendChild(poweredLink);
booksContainer.appendChild(poweredDiv);
} catch (error) {
console.error('Error fetching or displaying books:', error);
const errorMessage = document.createElement('div');
errorMessage.style.color = 'red';
errorMessage.style.padding = '20px';
errorMessage.textContent = 'Sorry, there was an error loading the books.';
document.body.appendChild(errorMessage);
}
}
fetchAndDisplayBooks();
// Call the function when the document is loaded
// document.addEventListener('DOMContentLoaded', fetchAndDisplayBooks);