From: Michael Ang Date: Mon, 15 Nov 2010 18:32:09 +0000 (+0000) Subject: Merge commit 'rajbot/newui' into newui X-Git-Url: http://git.rot13.org/?p=bookreader.git;a=commitdiff_plain;h=e3724e8584a743a04dbbac647cada7695e4cb84a;hp=-c Merge commit 'rajbot/newui' into newui --- e3724e8584a743a04dbbac647cada7695e4cb84a diff --combined BookReader/BookReader.js index 8d1e432,9315999..0d1cfa1 --- a/BookReader/BookReader.js +++ b/BookReader/BookReader.js @@@ -3724,43 -3724,20 +3724,43 @@@ BookReader.prototype.initToolbar = func jToolbar.find('.one_page_mode').hide(); } - // $$$ Don't hardcode ids - jToolbar.find('.share').colorbox({inline: true, opacity: "0.5", href: "#shareThis"}); - jToolbar.find('.info').colorbox({inline: true, opacity: "0.5", href: "#aboutThis"}); - - $("body").append( - [ - '
', - this.makeShareDiv(), - this.makeAboutDiv(), - '
' - ].join('\n') - ); - + // $$$ Don't hardcode ids + var self = this; + jToolbar.find('.share').colorbox({inline: true, opacity: "0.5", href: "#BRshare", onLoad: function() { self.ttsStop(); } }); + jToolbar.find('.info').colorbox({inline: true, opacity: "0.5", href: "#BRinfo", onLoad: function() { self.ttsStop(); } }); + $("body").append(['
', + '
', + '
', + 'Share', + 'Close', + '
', + '
', + '
', + '
About this book', + 'Close', + '
', + '
', + '
', + '
', + '
', + '
', + '

', + '
', + + '
', + '
', + '
', + '', + '
'].join('\n')); + + $('#BRinfo .BRfloatTitle a').attr( {'href': this.bookUrl} ).text(this.bookTitle).addClass('title').appendTo + + // These functions can be overridden + this.buildInfoDiv($('#BRinfo')); + this.buildShareDiv($('#BRshare')); // Switch to requested mode -- binds other click handlers //this.switchToolbarMode(mode); @@@ -4794,7 -4771,7 +4794,7 @@@ BookReader.prototype.ttsStartCB = funct // showProgressPopup //______________________________________________________________________________ BookReader.prototype.showProgressPopup = function(msg) { - if (soundManager.debugMode) console.log('showProgressPopup index='+this.ttsIndex+' pos='+this.ttsPosition); + //if (soundManager.debugMode) console.log('showProgressPopup index='+this.ttsIndex+' pos='+this.ttsPosition); if (this.popup) return; this.popup = document.createElement("div"); @@@ -5115,72 -5092,97 +5115,72 @@@ BookReader.prototype.ttsStartPolling = },500); } -BookReader.prototype.makeShareDiv = function() +BookReader.prototype.buildShareDiv = function(jShareDiv) { var pageView = document.location + ''; var bookView = (pageView + '').replace(/#.*/,''); - var embedLink = this.getEmbedURL({ 'mode': this.constMode1up } ); + var self = this; - var html = [ - '
', - '
', - 'Share', - 'Close', - '
', - '

Copy and paste one of these options to share this book elsewhere.

', - '
', - '
', - '', - '', + var jForm = $([ + '

Copy and paste one of these options to share this book elsewhere.

', + '', + '
', + '', + '', + '
', + '
', + '', + '', + '
', + '
', + '', + '
', + '', + '', + '', '
', - '
', - '', - '', - '
', - '
', - '', - '
', - '', - '', - '', - '
', - '', - '

NOTE: We\'ve tested EMBED on blogspot.com blogs as well as self-hosted Wordpress blogs. This feature will NOT work on wordpress.com blogs.

', - '
', - '
', - '', - '
', - '', - '
' - ].join('\n'); + '', + '

NOTE: We\'ve tested EMBED on blogspot.com blogs as well as self-hosted Wordpress blogs. This feature will NOT work on wordpress.com blogs.

', + '', + '
', + '', + '
', + ''].join('\n')); + + jForm.appendTo(jShareDiv); + + jForm.find('input').bind('change', function() { + var form = $(this).parents('form:first'); + var params = {}; + params.mode = $(form.find('input[name=pages]:checked')).val(); + if (form.find('input[name=thispage]').attr('checked')) { + params.page = self.getPageNum(self.currentIndex()); + } + + console.log(params); + var embedLink = self.getEmbedURL( params ); + form.find('.BRframeEmbed').val(''); + }) + jForm.find('input[name=thispage]').trigger('change'); + jForm.find('input, textarea').bind('focus', function() { + this.select(); + }); - return html; + jForm.appendTo(jShareDiv); + jForm = ''; // closure + } -BookReader.prototype.makeAboutDiv = function() +// Should be overridden +BookReader.prototype._buildInfoDiv = function(jInfoDiv) { - var html = [ - '
', - '
About this book', - 'Close', - '
', - '
' - ]; - - // Use 3rd-party provided function if available - if (this.getInfoDiv) { - html.push(this.getInfoDiv()); - } else { - html = html.concat([ - '', - ]); - } - - html = html.concat([ - '
', // BRfloatBody - '
' - ]); - - if (this.getInfoFooter) { - html.push(this.getInfoFooter()); - } else { - html.push( - 'About the BookReader' - ); - } - - html = html.concat([ - '
', // BRfloatfoot - '
' // BRfloat - ]); - - return html.join('\n'); }