Add support for displaying author information from Goodreads

Requires the "goodread" module (added to optional-requirements.txt) and an API key

Retrieves Goodreads author information and displays their photo and "about" text
This commit is contained in:
Jonathan Rehm
2017-07-08 16:05:20 -07:00
parent 31e0025099
commit fe68c8a7f8
8 changed files with 145 additions and 7 deletions

View File

@ -2,6 +2,20 @@ var displaytext;
var updateTimerID;
var updateText;
// Generic control/related handler to show/hide fields based on a checkbox' value
// e.g.
// <input type="checkbox" data-control="stuff-to-show">
// <div data-related="stuff-to-show">...</div>
$(document).on("change", "input[type=\"checkbox\"][data-control]", function () {
var $this = $(this);
var name = $this.data("control");
var showOrHide = $this.prop("checked");
$("[data-related=\""+name+"\"]").each(function () {
$(this).toggle(showOrHide);
});
});
$(function() {
function restartTimer() {
@ -121,6 +135,8 @@ $(function() {
});
});
$("input[data-control]").trigger("change");
$(window).resize(function(event) {
$(".discover .row").isotope("reLayout");
});