1:- module(books, [book_viewer//1]).

Generic interface for online book viewer/review widgets

*/

    6:- use_module(library(http/html_write)).    7:- use_module(library(http/html_head)).    8
    9:- meta_predicate book_viewer(1, ?, ?).   10:- style_check(-atom).
 book_viewer(+Generator:callable)// is det
To be done
- comment this

*/

   17book_viewer(Generator) -->
   18	{
   19	   (   call(Generator, id(ID)) ; ID = bookViewerCanvas ),
   20	   call(Generator, book_id(Book))
   21	},
   22	html([
   23	    \html_requires('https://www.google.com/jsapi'),
   24	    \html_post(head,
   25		       [script([type='text/javascript'], [
   26'      google.load("books", "0");
   27
   28      function initialize() {
   29        var ~wviewer = new google.books.DefaultViewer(document.getElementById(\'~w\'));'
   30	   -[ID,ID],
   31'        ~wviewer.load(\'~w\');
   32      }
   33
   34      google.setOnLoadCallback(initialize);'-[ID, Book]
   35							 ])]),
   36	    div([id=ID], [&(nbsp)])
   37	     ])