Created
December 16, 2009 19:37
-
-
Save documentcloud/258105 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////////////////// | |
// The public DocumentViewer API. Available for other scripts to access: | |
///////////////////////////////////////////////////////////////////////////// | |
// Return the total number of pages in the document. | |
DV.controller.numberOfPages = function() { | |
return this.models.document.totalPages; | |
}; | |
// Change the documents' sections, re-rendering the navigation. "sections" | |
// should be an array of sections in the canonical format: | |
// {title: "Chapter 1", pages: "1-12"} | |
DV.controller.setSections = function(sections) { | |
DV.Schema.data.sections = sections; | |
this.models.chapters.loadChapters(); | |
this.helpers.renderNavigation(); | |
}; | |
// Get a list of every section in the document. | |
DV.controller.getSections = function() { | |
return _.clone(DV.Schema.data.sections || []); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment