}
GnuBook.prototype.initToolbar = function(mode, ui) {
- var modeButtons = '';
-
- // $$$ workaround for not displaying short books in 2up
- if (this.canSwitchToMode(this.constMode1up) && this.canSwitchToMode(this.constMode2up)) {
- modeButtons = " <button class='GBicon rollover one_page_mode' onclick='gb.switchMode(1); return false;'/>"
- + " <button class='GBicon rollover two_page_mode' onclick='gb.switchMode(2); return false;'/>";
- }
$("#GnuBook").append("<div id='GBtoolbar'><span style='float:left;'>"
+ "<a class='GBicon logo rollover' href='" + this.logoURL + "'> </a>"
+ " <button class='GBicon rollover zoom_out' onclick='gb.zoom1up(-1); return false;'/>"
+ "<button class='GBicon rollover zoom_in' onclick='gb.zoom1up(1); return false;'/>"
+ " <span class='label'>Zoom: <span id='GBzoom'>25</span>%</span>"
- + modeButtons
+ + " <button class='GBicon rollover one_page_mode' onclick='gb.switchMode(1); return false;'/>"
+ + " <button class='GBicon rollover two_page_mode' onclick='gb.switchMode(2); return false;'/>"
+ " <a class='GBblack title' href='"+this.bookUrl+"' target='_blank'>"+this.shortTitle(50)+"</a>"
+ "</span></div>");
for (var icon in titles) {
jToolbar.find(icon).attr('title', titles[icon]);
}
+
+ // Hide mode buttons and autoplay if 2up is not available
+ // $$$ if we end up with more than two modes we should show the applicable buttons
+ if ( !this.canSwitchToMode(this.constMode2up) ) {
+ jToolbar.find('.one_page_mode, .two_page_mode, .play, .pause').hide();
+ }
// Switch to requested mode -- binds other click handlers
this.switchToolbarMode(mode);
return "<iframe src='" + this.getEmbedURL() + "' width='480px' height='430px'></iframe>";
}
+// canSwitchToMode
+//________
+// Returns true if we can switch to the requested mode
GnuBook.prototype.canSwitchToMode = function(mode) {
if (mode == this.constMode2up) {
// check there are enough pages to display