Skip to content

Commit

Permalink
Test page for the three flippers.
Browse files Browse the repository at this point in the history
Also an option you can pass to override the detected flipper.
  • Loading branch information
joseph committed Mar 2, 2010
1 parent 8ddd079 commit 2622e65
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/flippers/legacy.js
Expand Up @@ -49,8 +49,8 @@ Carlyle.Flippers.Legacy = function (reader, setPageFn) {
p.page.scrollerDiv.style.right = "0";
p.page.scrollerDiv.style.overflow = "auto";
p.page.contentDiv.style.position = "relative";
p.page.contentDiv.style.width = "auto";
p.page.contentDiv.style.minWidth = "auto";
p.page.contentDiv.style.width = "100%";
p.page.contentDiv.style.minWidth = "0%";

if (!p.divs.legacyMessage) {
p.divs.legacyMessage = document.createElement('div');
Expand Down Expand Up @@ -96,9 +96,9 @@ Carlyle.Flippers.Legacy = function (reader, setPageFn) {

Carlyle.Styles.Flippers.Legacy = {
message: {
"border": "1px solid #999",
"border": "1px solid #987",
"background": "#FFC",
"color": "#999",
"color": "#666",
"font-family": "sans-serif",
"font-size": "90%",
"margin-right": "3px",
Expand Down
14 changes: 9 additions & 5 deletions src/reader.js
@@ -1,7 +1,7 @@
/* READER */

Carlyle.Reader = function (node, bookData) {
if (Carlyle == this) { return new Carlyle.Reader(node, bookData); }
Carlyle.Reader = function (node, bookData, options) {
if (Carlyle == this) { return new Carlyle.Reader(node, bookData, options); }

// Constants.
var k = {
Expand Down Expand Up @@ -66,11 +66,13 @@ Carlyle.Reader = function (node, bookData) {

// Sets up the container and internal elements.
//
function initialize(node, bookData) {
function initialize(node, bookData, options) {
p.divs.box = typeof(node) == "string" ?
document.getElementById(node) :
node;

options = options || {}

dispatchEvent("carlyle:initializing");

var bk;
Expand All @@ -92,7 +94,9 @@ Carlyle.Reader = function (node, bookData) {
p.divs.container = document.createElement('div');
p.divs.box.appendChild(p.divs.container);

p.flipper = new Carlyle.Flippers.Legacy(API, setPage); // FIXME: detect?
var flipperClass = options.flipper || Carlyle.Flippers.Slider;
// FIXME: detect legacy flipper?
p.flipper = new flipperClass(API, setPage);

for (var i = 0; i < p.flipper.pageCount; ++i) {
var page = p.divs.pages[i] = document.createElement('div');
Expand Down Expand Up @@ -547,7 +551,7 @@ Carlyle.Reader = function (node, bookData) {
API.showControl = showControl;
API.addEventListener = addEventListener;

initialize(node, bookData);
initialize(node, bookData, options);

return API;
}

0 comments on commit 2622e65

Please sign in to comment.