Plugin Directory

Changeset 1156874


Ignore:
Timestamp:
05/09/2015 01:35:04 PM (11 years ago)
Author:
eroux
Message:

Display a message if Google can't find a book for the ISBN supplied

Location:
currently-reading/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • currently-reading/trunk/CurrentlyReading.php

    r1156538 r1156874  
    55    Description: Display a Currently Reading widget using the Google Books API
    66    Author: Eugéne Roux
    7     Version: 4.0
     7    Version: 4.0.1
    88    Author URI: http://damn.org.za/
    99 */
     
    4242            $isbnjson = json_decode( file_get_contents( "https://www.googleapis.com/books/v1/volumes?q=isbn:" . $myisbn ), true );
    4343
     44            echo $before_widget;
     45
     46            if ( $title )
     47                echo $before_title . $title . $after_title; // This way we get to choose a "No Title" scenario...
     48
    4449            if ( $isbnjson[ "totalItems" ] > 0 ) {
    4550
    46                 echo $before_widget;
    47 
    48                 if ( $title )
    49                     echo $before_title . $title . $after_title; // This way we get to choose a "No Title" scenario...
    50 
    51 
    5251                print("\n\t<!-- ISBN: " . $myisbn . " / Title: " . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'title' ] . " -->\n");
    5352
    5453                print( "\t\t<div" );
    55                 if ( $internalcss ) {
    56                     print( " style='margin: 1em; padding: 2ex;'" );
    57                 }
     54
     55                if ( $internalcss )
     56                    print( " style='padding: 1em 1em 0;'" );        // print( " style='margin: 1em; padding: 2ex;'" );
     57
    5858                print( " class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "'>\n");
    5959
    6060                $googlelink = $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'canonicalVolumeLink' ];
    61                 print("\n\t<!-- Google Link: " . $googlelink . " -->\n");
     61                print("\n\t<!-- Google Canonical Volume Link: " . $googlelink . " -->\n");
    6262
    6363                print( "\t\t\t<a href='" . str_replace( "google.com", $localdomain, $googlelink ) . "'>");
    6464                print( "<img class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "-img' " );
     65
    6566                if ( $boxshadow ) {
    6667                    print( "style='-moz-box-shadow: #CCC 5px 5px 5px; -webkit-box-shadow: #CCC 5px 5px 5px; " );
    6768                    print( "-khtml-box-shadow: #CCC 5px 5px 5px; box-shadow: #CCC 5px 5px 5px;' " );
    6869                }
     70
    6971                print( "src='"   . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'imageLinks' ][ 'thumbnail' ]   . "' " );
    7072                print( "alt='"   . $isbnjson[ 'items' ][0][ 'volumeInfo' ][ 'title' ]                       . "' ");
     
    7274                print( "\t\t</div>\n");
    7375
    74                 echo $after_widget;
     76            } else {
     77
     78                print( "\n\t<!-- ISBN: " . $myisbn . " / No Google Books Entry Found -->\n");
     79                print( "\n\t<div class='currentlyreading' id='currenlyreading-ISBN" . $myisbn . "'" );
     80                if ( $internalcss )
     81                    print( " style='padding: 1em 1em 0 1em;'" );
     82                print( ">No Google Books Entry Found for ISBN: <em>" . $myisbn . "</em></div>\n");
    7583            }
     84
     85            echo $after_widget;
    7686        }
    7787    }
  • currently-reading/trunk/readme.txt

    r1156538 r1156874  
    6363== Screenshots ==
    6464
    65 1. The Configuration of a "Currently Reading" section, with the "UL" marker suppressed.
     651. The Configuration of a "Currently Reading" section, with Padding enabled.
    66662. Multiple Widgets, the first marking them as "Finished Reading".
    67673. The previous configuration as rendered by Safari.
    68684. The difference between Padding and Box-Shadow Enabled and Disabled.
     695. Widget Configuration location in the Dashboard's sidebar.
    6970
    7071== Changelog ==
     72
     73= 4.0.1 =
     74
     75* Display a message (No Google Books Entry Found for ISBN) when Google has no entry for the book in question
     76* Reduce the width of margins so that the book entries fit better into the sidebar
     77* Added a screenshot of the Widget Configuration location in the Sidebar (mostly since I keep forgetting where it is)
    7178
    7279= 4.0 =
Note: See TracChangeset for help on using the changeset viewer.