Widget:Google Books: Difference between revisions
No edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
</noinclude> | </noinclude> | ||
<includeonly> | <includeonly> | ||
< | <!-- Simple container that will be filled by the Google Books API --> | ||
<div id="viewerCanvas<!--{$id|escape:'html'}-->" style="width:<!--{$width|escape:'html'|default:'600'}-->px; height:<!--{$height|escape:'html'|default:'500'}-->px; margin:1em 0;"></div> | |||
< | <!-- Load the Google Books API --> | ||
<script type="text/javascript" src="https://books.google.com/books/api.js"></script> | |||
<!-- Initialize the viewer --> | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
/* <![CDATA[ */ | /* <![CDATA[ */ | ||
(function() { | google.books.load(); | ||
var | |||
function initialize() { | |||
var viewer = new google.books.DefaultViewer(document.getElementById('viewerCanvas<!--{$id|escape:'html'}-->')); | |||
viewer.load('ISBN:<!--{$id|escape:'html'}-->'); | |||
} | |||
google.books.setOnLoadCallback(initialize); | |||
/* ]]> */ | /* ]]> */ | ||
</script> | </script> | ||
</includeonly> | </includeonly> |
Revision as of 15:22, 10 March 2025
This widget allows you to embed Google Books on your wiki page. Originally created by Arv and adapted by FrancisFranck.
Using this widget
To use this widget, add the following code to your wiki page:
{{#widget:Google_Books |id=BOOK_ID |width=600 |height=500 }}
Parameters:
- id - The Google Books ID (required)
- width - Width of the embedded viewer in pixels (optional, default: 600)
- height - Height of the embedded viewer in pixels (optional, default: 500)
Copy to your site
To use this widget on your site, install MediaWiki Widgets extension and copy the complete source code of this page to your wiki as page Widget:Google Books.