Widget:Google Books: Difference between revisions
Created page with "<noinclude>__NOTOC__ This widget allows you to embed '''[https://developers.google.com/books Google Books]''' on your wiki page. Originally created by [https://www.mediawikiwidgets.org/User:Arv Arv] and adapted by [https://www.mediawikiwidgets.org/User:FrancisFranck FrancisFranck]. Further updated to meet current MediaWiki security requirements. == Using this widget == To use this widget, add the following code to your wiki page: <pre> {{#widget:Google_Books |id=BOOK_..." |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
This widget allows you to embed '''[https://developers.google.com/books Google Books]''' on your wiki page. | This widget allows you to embed '''[https://developers.google.com/books Google Books]''' on your wiki page. | ||
Originally created by [https://www.mediawikiwidgets.org/User:Arv Arv] and adapted by [https://www.mediawikiwidgets.org/User:FrancisFranck FrancisFranck]. | Originally created by [https://www.mediawikiwidgets.org/User:Arv Arv] and adapted by [https://www.mediawikiwidgets.org/User:FrancisFranck FrancisFranck]. | ||
== Using this widget == | == Using this widget == | ||
Line 24: | Line 23: | ||
</noinclude> | </noinclude> | ||
<includeonly> | <includeonly> | ||
<div | <!-- Main container div with explicit sizing --> | ||
<div style="width:<!--{$width|escape:'html'|default:'600'}-->px; height:<!--{$height|escape:'html'|default:'500'}-->px; margin:1em 0;"> | |||
<!-- The ID must match what's used in the script --> | |||
<div id="viewerCanvas<!--{$id|escape:'html'}-->" style="width:100%; height:100%;"></div> | |||
</div> | |||
<!-- Load the Google Books API --> | |||
<script type="text/javascript" src="https://www.google.com/books/jsapi.js"></script> | |||
<!-- Initialize the viewer --> | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
/* <![CDATA[ */ | |||
function initializeGoogleBooksViewer() { | |||
var viewer = new google.books.DefaultViewer( | |||
document.getElementById('viewerCanvas<!--{$id|escape:'html'}-->') | |||
); | |||
viewer.load('<!--{$id|escape:'html'}-->'); | |||
} | |||
if (typeof google !== 'undefined' && google.books) { | |||
google.books.load(); | |||
google.books.setOnLoadCallback(initializeGoogleBooksViewer); | |||
} | |||
/* ]]> */ | |||
} | |||
</script> | </script> | ||
</includeonly> | </includeonly> |
Latest revision as of 15:34, 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.