Skip to content
This repository
  • 5 commits
  • 14 files changed
  • 0 comments
  • 1 contributor
8  css/sass/fixed_layout.scss
@@ -34,14 +34,18 @@
34 34
 		width: 50%;
35 35
 	}
36 36
 
37  
-	.fixed-page-wrap.odd { 
  37
+	.fixed-page-wrap.right_page { 
38 38
 		left: 50%;
39 39
 	}
40 40
 
41  
-	.fixed-page-wrap.even { 
  41
+	.fixed-page-wrap.left_page  { 
42 42
 		left: 0%;
43 43
 	}
44 44
 
  45
+	.fixed-page-wrap.center_page  { 
  46
+		z-index: 11;
  47
+	}
  48
+
45 49
 }
46 50
 
47 51
 body.apple-fixed-layout {
10  css/sass/readium_paginator.scss
@@ -83,19 +83,19 @@ html, body {
83 83
 		width: 50%;
84 84
 	}
85 85
 
86  
-	.page-wrap.odd {
  86
+	.page-wrap.right {
87 87
 		left: 50%;
88 88
 	}
89 89
 
90  
-	.page-wrap.even {
  90
+	.page-wrap.left {
91 91
 		left: 0;
92 92
 	}
93 93
 
94  
-	.odd, .even .page-margin {
  94
+	.right, .left .page-margin {
95 95
 		float: right;
96  
-	}
  96
+	} 
97 97
 
98  
-	.even, .odd .page-margin {
  98
+	.left, .right .page-margin {
99 99
 		float: left;
100 100
 	}
101 101
 
14  css/viewer_manifest.css
@@ -154,13 +154,13 @@ html, body {
154 154
 /* Style declarations for two up mode */
155 155
 .two-up .page-wrap {
156 156
   width: 50%; }
157  
-.two-up .page-wrap.odd {
  157
+.two-up .page-wrap.right {
158 158
   left: 50%; }
159  
-.two-up .page-wrap.even {
  159
+.two-up .page-wrap.left {
160 160
   left: 0; }
161  
-.two-up .odd, .two-up .even .page-margin {
  161
+.two-up .right, .two-up .left .page-margin {
162 162
   float: right; }
163  
-.two-up .even, .two-up .odd .page-margin {
  163
+.two-up .left, .two-up .right .page-margin {
164 164
   float: left; }
165 165
 .two-up .page-margin {
166 166
   width: 90%;
@@ -213,10 +213,12 @@ html, body {
213 213
 
214 214
 .two-up .fixed-page-wrap {
215 215
   width: 50%; }
216  
-.two-up .fixed-page-wrap.odd {
  216
+.two-up .fixed-page-wrap.right_page {
217 217
   left: 50%; }
218  
-.two-up .fixed-page-wrap.even {
  218
+.two-up .fixed-page-wrap.left_page {
219 219
   left: 0%; }
  220
+.two-up .fixed-page-wrap.center_page {
  221
+  z-index: 11; }
220 222
 
221 223
 body.apple-fixed-layout {
222 224
   height: 100%;
2  manifest.json
@@ -29,5 +29,5 @@
29 29
     }
30 30
   ],
31 31
    "options_page": "views/library.html#options",
32  
-   "version": "0.2.3"
  32
+   "version": "0.2.4"
33 33
 }
7  scripts/extractBook.js
@@ -45,6 +45,9 @@ Readium.Models.BookExtractorBase = Backbone.Model.extend({
45 45
 		var that = this;
46 46
 		var abs_path = this.base_dir_name + "/" + rel_path;
47 47
 
  48
+		// If we get passed an APPLE FIXED LAYOUT metadata we need to 
  49
+		// parse it before we write it out. Note, we do not parse this file
  50
+		// again when we open the book
48 51
 		if(rel_path.indexOf(this.DISPLAY_OPTIONS) >= 0) {
49 52
 			if(typeof content === "string") {
50 53
 				this.packageDoc.parseIbooksDisplayOptions(content);
@@ -52,7 +55,7 @@ Readium.Models.BookExtractorBase = Backbone.Model.extend({
52 55
 			else {
53 56
 				this.readEntryByShortName(this.DISPLAY_OPTIONS, function(data) {
54 57
 					that.packageDoc.parseIbooksDisplayOptions(data);
55  
-				})
  58
+				});
56 59
 			}
57 60
 		}
58 61
 
@@ -87,6 +90,8 @@ Readium.Models.BookExtractorBase = Backbone.Model.extend({
87 90
 		}
88 91
 	},
89 92
 
  93
+	// remove all the callback handlers attached to
  94
+	// events that might be registered on this
90 95
 	removeHandlers: function() {
91 96
 		this.off();
92 97
 	},
96  scripts/models/ebook.js
@@ -26,28 +26,31 @@ Readium.Models.Ebook = Backbone.Model.extend({
26 26
     	"full_screen": false,
27 27
     	"toolbar_visible": true,
28 28
     	"toc_visible": false,
  29
+    	"can_two_up": true,
29 30
   	},
30 31
 
31 32
 	toggleTwoUp: function() {
32  
-		var twoUp = this.get("two_up");
33  
-		var displayed = this.get("current_page");
34  
-		var newPages = [];
35  
-		if(twoUp) {
36  
-			if (displayed[0] === 0) {
37  
-				newPages[0] = 1;
38  
-			} else {
  33
+		if(this.get("can_two_up")) {
  34
+			var twoUp = this.get("two_up");
  35
+			var displayed = this.get("current_page");
  36
+			var newPages = [];
  37
+			if(twoUp) {
  38
+				if (displayed[0] === 0) {
  39
+					newPages[0] = 1;
  40
+				} else {
  41
+					newPages[0] = displayed[0];
  42
+				}
  43
+			}
  44
+			else if(displayed[0] % 2 === 0) {
39 45
 				newPages[0] = displayed[0];
  46
+				newPages[1] = displayed[0] + 1;
40 47
 			}
41  
-		}
42  
-		else if(displayed[0] % 2 === 0) {
43  
-			newPages[0] = displayed[0];
44  
-			newPages[1] = displayed[0] + 1;
45  
-		}
46  
-		else {
47  
-			newPages[0] = displayed[0] - 1;
48  
-			newPages[1] = displayed[0];
49  
-		}
50  
-		this.set({two_up: !twoUp, current_page: newPages});
  48
+			else {
  49
+				newPages[0] = displayed[0] - 1;
  50
+				newPages[1] = displayed[0];
  51
+			}
  52
+			this.set({two_up: !twoUp, current_page: newPages});
  53
+		}	
51 54
 	},
52 55
 
53 56
 	toggleFullScreen: function() {
@@ -146,7 +149,7 @@ Readium.Models.Ebook = Backbone.Model.extend({
146 149
 	adjustCurrentPage: function() {
147 150
 		var cp = this.get("current_page");
148 151
 		var num = this.get("num_pages");
149  
-		var two_up = this.get("two_up")
  152
+		var two_up = this.get("two_up");
150 153
 		if(cp[cp.length - 1] > num) {
151 154
 			this.goToLastPage();
152 155
 		}
@@ -220,6 +223,10 @@ Readium.Models.Ebook = Backbone.Model.extend({
220 223
 		}
221 224
 	},
222 225
 
  226
+	// when the spine position changes we need to update the
  227
+	// state of this, this involes setting attributes that reflect
  228
+	// the current section's url and content etc, and then we need
  229
+	// to persist the position in a cookie
223 230
 	spinePositionChangedHandler: function() {
224 231
 		var that = this;
225 232
 		var sect = this.packageDocument.currentSection();
@@ -235,34 +242,75 @@ Readium.Models.Ebook = Backbone.Model.extend({
235 242
 			})
236 243
 		});
237 244
 		
238  
-
239 245
 		// save the position
240 246
 		this.savePosition();
241 247
 	},
242 248
 
243  
-	buildSectionJSON: function(manifest_item) {
  249
+	// this method creates the JSON representation of a manifest item
  250
+	// that is used to render out a page view.
  251
+	buildSectionJSON: function(manifest_item, spine_index) {
244 252
 		if(!manifest_item) {
245 253
 			return null;
246 254
 		}
247  
-		var section = {};
  255
+		var section = Object.create(null);
248 256
 		section.width = this.get("meta_width") || 0;
249 257
 		section.height = this.get("meta_height") || 0;
250 258
 		section.uri = this.packageDocument.resolveUri(manifest_item.get('href'));
251  
-
  259
+		section.page_class = this.getPositionClass(manifest_item, spine_index);
252 260
 		return section;
253 261
 	},
254 262
 
  263
+	// when rendering fixed layout pages we need to determine whether the page
  264
+	// should be on the left or the right in two up mode, options are:
  265
+	// 	left_page: 		render on the left side
  266
+	//	right_page: 	render on the right side
  267
+	//	center_page: 	always center the page horizontally
  268
+	getPositionClass: function(manifest_item, spine_index) {
  269
+
  270
+		if(this.get("apple_fixed")) {
  271
+			// the logic for apple fixed layout is a little different:
  272
+			if(!this.get("open_to_spread")) {
  273
+				// page spread is disabled for this book
  274
+				return	"center_page"
  275
+			}
  276
+			else if(spine_index === 0) {
  277
+				// for ibooks, odd pages go on the right. This means
  278
+				// the first page (0th index) will always be on the right
  279
+				// without a left counterpart, so center it
  280
+				return "center_page";
  281
+			}
  282
+			else if (spine_index % 2 === 1 && 
  283
+				spine_index === this.packageDocument.get("spine").length ) {
  284
+
  285
+				// if the last spine item in the book would be on the left, then
  286
+				// it would have no left counterpart, so center it
  287
+				return "center_page";
  288
+			}
  289
+			else {
  290
+				// otherwise first page goes on the right, and then alternate
  291
+				// left - right - left - right etc
  292
+				return (spine_index % 2 === 0 ? "right_page" : "left_page");
  293
+			}
  294
+		}
  295
+		else {
  296
+			return (spine_index % 2 === 0 ? "right_page" : "left_page");
  297
+		}
  298
+	},
  299
+
255 300
 	getAllSections: function() {
256 301
 		var spine = this.packageDocument.getResolvedSpine();
257 302
 		var sections = [];
258 303
 		for(var i = 0; i < spine.length; i++) {
259  
-			sections.push(this.buildSectionJSON( spine[i] ));
  304
+			sections.push(this.buildSectionJSON( spine[i], i ));
260 305
 		}
261 306
 		return sections;
262 307
 	},
263 308
 
264 309
 	getCurrentSection: function(i) {
265  
-		return this.buildSectionJSON(this.packageDocument.currentSection(i));
  310
+		// i is an optional arg, if it was not passed in default to 0
  311
+		i = i || 0; 
  312
+		var spine_index = i + this.packageDocument.get("spine_position");
  313
+		return this.buildSectionJSON(this.packageDocument.currentSection(i), spine_index);
266 314
 	},
267 315
 
268 316
 
24  scripts/models/packageDocument.js
@@ -123,6 +123,10 @@ Readium.Models.PackageDocumentBase = Backbone.Model.extend({
123 123
 		}
124 124
 		return spine;
125 125
 	},
  126
+
  127
+	paginateBackwards: function(xmlDom) {
  128
+		return $('spine', xmlDom).attr('page-progression-direction') === "ltr";
  129
+	},
126 130
 	
127 131
 	parse: function(xmlDom) {
128 132
 		var json;
@@ -143,6 +147,9 @@ Readium.Models.PackageDocumentBase = Backbone.Model.extend({
143 147
 
144 148
 		json = Jath.parse( this.jath_template, xmlDom);
145 149
 
  150
+		// parse the page-progression-direction if it is present
  151
+		json.paginate_backwards = this.paginateBackwards(xmlDom);
  152
+
146 153
 		// try to find a cover image
147 154
 		cover = this.getCoverHref(xmlDom);
148 155
 		if(cover) {
@@ -186,13 +193,17 @@ Readium.Models.ValidatedPackageMetaData = Readium.Models.PackageDocumentBase.ext
186 193
 	},
187 194
 
188 195
 	defaults: {
189  
-		fixed_layout: false,
190  
-		open_to_spread: false,
191  
-		cover_href: '/images/library/missing-cover-image.png',
192  
-		created_at: new Date(),
193  
-		updated_at: new Date(),
  196
+		fixed_layout: false, // default to fixed layout or reflowable format
  197
+		apple_fixed: false, // is this file Apple's spec
  198
+		open_to_spread: false, // specific to Apple, should two up be allowed?
  199
+		cover_href: '/images/library/missing-cover-image.png', // default to no cover image
  200
+		created_at: new Date(), // right now
  201
+		updated_at: new Date(), // right now
  202
+		paginate_backwards: false,
194 203
 	},
195 204
 
  205
+	// Apple created its own fixed layout spec for ibooks.
  206
+	// this function parses the metadata used by this spec
196 207
 	parseIbooksDisplayOptions: function(content) {
197 208
 		var parseBool = function(string) {
198 209
 			return string.toLowerCase().trim() === 'true';	
@@ -203,7 +214,8 @@ Readium.Models.ValidatedPackageMetaData = Readium.Models.PackageDocumentBase.ext
203 214
 		var openToSpread = xmlDoc.getElementsByName("open-to-spread")[0];
204 215
 		this.set({
205 216
 			fixed_layout: ( fixedLayout && parseBool(fixedLayout.textContent) ),
206  
-			open_to_spread: ( openToSpread && parseBool(openToSpread.textContent) )
  217
+			open_to_spread: ( openToSpread && parseBool(openToSpread.textContent) ),
  218
+			apple_fixed: true
207 219
 		})
208 220
 	},
209 221
 
95  scripts/models/paginator.js
@@ -8,33 +8,8 @@ Readium.Models.Paginator = Backbone.Model.extend({
8 8
 		this.model = this.get("book");
9 9
 		
10 10
 		// keep track of which direction we are moving through the publication
11  
-		this.model.packageDocument.on("increased:spine_position", function() {
12  
-			this.renderToLastPage = false;
13  
-
14  
-			if(this.rendered_spine_positions.indexOf(this.model.get("spine_position"))  > -1) {
15  
-				var sp = this.rendered_spine_positions[this.rendered_spine_positions.length - 1] + 1;
16  
-				if(sp <  this.model.packageDocument.get("spine").length) {
17  
-					this.model.packageDocument.set("spine_position", sp );	
18  
-				}
19  
-			}
20  
-			else {
21  
-				this.model.spinePositionChangedHandler();		
22  
-			}
23  
-			
24  
-		}, this);
25  
-		this.model.packageDocument.on("decreased:spine_position", function() {
26  
-			this.renderToLastPage = true;
27  
-			if(this.rendered_spine_positions.indexOf(this.model.packageDocument.get("spine_position"))  > -1) {
28  
-				var sp = this.rendered_spine_positions[0] - 1;
29  
-				if(sp >= 0) {
30  
-					this.model.packageDocument.set("spine_position", sp);	
31  
-				}
32  
-			}
33  
-			else {
34  
-				this.model.spinePositionChangedHandler();	
35  
-			}
36  
-			
37  
-		}, this);
  11
+		this.model.packageDocument.on("increased:spine_position", this.increasedSpinePosHandler, this);
  12
+		this.model.packageDocument.on("decreased:spine_position", this.decreasedSpinePosHandler, this);
38 13
 
39 14
 		// whenever current content changes it means, the spine item has been changed
40 15
 		// and it is loaded up and ready to go
@@ -42,6 +17,36 @@ Readium.Models.Paginator = Backbone.Model.extend({
42 17
 
43 18
 	},
44 19
 
  20
+	increasedSpinePosHandler: function() {
  21
+		this.renderToLastPage = false;
  22
+
  23
+		if(this.rendered_spine_positions.indexOf(this.model.get("spine_position"))  > -1) {
  24
+			var sp = this.rendered_spine_positions[this.rendered_spine_positions.length - 1] + 1;
  25
+			if(sp <  this.model.packageDocument.get("spine").length) {
  26
+				this.model.packageDocument.set("spine_position", sp );	
  27
+			}
  28
+		}
  29
+		else {
  30
+			this.model.spinePositionChangedHandler();		
  31
+		}
  32
+		
  33
+	},
  34
+
  35
+	decreasedSpinePosHandler: function() {
  36
+		this.renderToLastPage = true;
  37
+		if(this.rendered_spine_positions.indexOf(this.model.packageDocument.get("spine_position"))  > -1) {
  38
+			var sp = this.rendered_spine_positions[0] - 1;
  39
+			if(sp >= 0) {
  40
+				this.model.packageDocument.set("spine_position", sp);	
  41
+			}
  42
+		}
  43
+		else {
  44
+			this.model.spinePositionChangedHandler();	
  45
+		}
  46
+		
  47
+	},
  48
+
  49
+
45 50
 	// determine what the current spine item is and render it out
46 51
 	renderSpineItem: function(renderToLast) {
47 52
 		var book = this.model;
@@ -50,24 +55,36 @@ Readium.Models.Paginator = Backbone.Model.extend({
50 55
 			// the current spine position is already rended
51 56
 			return;
52 57
 		}
53  
-		// we are going to clear everything out so start from scratch
  58
+		// we are going to clear everything out and start from scratch
54 59
 		this.rendered_spine_positions = [];
55 60
 
  61
+		// clean up the old view if there is one
  62
+		if(this.v) {
  63
+			this.v.destruct();
  64
+		}
  65
+
56 66
 
57 67
 		var spineItem = book.packageDocument.currentSpineItem();
58 68
 		if(this.shouldRenderAsFixed(spineItem)) {
  69
+			this.should_two_up = book.get("two_up");
  70
+			book.set("two_up", false);
59 71
 			this.rendered_spine_positions.push(spine_position);
60 72
 			this.v = new Readium.Views.FixedPaginationView({model: book});
61 73
 
62 74
 			// add any consecutive fixed layout sections
63 75
 			this.v.render();
64 76
 
65  
-			var i = 1; // we have added one so far
  77
+			var pageNum = 1; // we have added one so far
  78
+			var offset = this.findPrerenderStart();
66 79
 
67  
-			while( this.shouldPreRender(book.packageDocument.currentSpineItem(i)) ) {
68  
-				this.v.addPage(book.getCurrentSection(i), i);
69  
-				this.rendered_spine_positions.push(spine_position + i);
70  
-				i += 1;
  80
+			while( this.shouldPreRender(book.packageDocument.currentSpineItem(offset)) ) {
  81
+				this.v.addPage(book.getCurrentSection(offset), pageNum );
  82
+				this.rendered_spine_positions.push(spine_position + offset);
  83
+				pageNum += 1;
  84
+				offset += 1;
  85
+				if(offset === 0) {
  86
+					book.set("current_page", [pageNum]);
  87
+				}
71 88
 			}
72 89
 		}
73 90
 		else {
@@ -75,6 +92,9 @@ Readium.Models.Paginator = Backbone.Model.extend({
75 92
 				this.v = new Readium.Views.ScrollingPaginationView({model: book});
76 93
 			}
77 94
 			else {
  95
+				if(this.should_two_up) {
  96
+					book.set("two_up", true);
  97
+				}
78 98
 				this.v = new Readium.Views.ReflowablePaginationView({model: book});
79 99
 			}
80 100
 			this.v.render(this.renderToLastPage);
@@ -82,6 +102,15 @@ Readium.Models.Paginator = Backbone.Model.extend({
82 102
 		}
83 103
 	},
84 104
 
  105
+	findPrerenderStart: function() {
  106
+		var i = 0;
  107
+		var pd = this.model.packageDocument;
  108
+		while ( this.shouldPreRender(pd.currentSpineItem(i-1)) ) {
  109
+			i -= 1;
  110
+		}
  111
+		return i;
  112
+	},
  113
+
85 114
 	shouldRenderAsFixed: function(spineItem) {
86 115
 		if(typeof spineItem.properties.fixed_flow !== "undefined") {
87 116
 			return spineItem.properties.fixed_flow;
2  scripts/views/nav_widget_view.js
@@ -4,6 +4,7 @@ Readium.Views.NavWidgetView = Backbone.View.extend({
4 4
 
5 5
 	initialize: function() {
6 6
 		this.model.on("change:two_up", this.render, this);
  7
+		this.model.on("change:can_two_up", this.render, this);
7 8
 		this.model.on("change:full_screen", this.render, this);
8 9
 		setTimeout(function() {
9 10
 			$('#settings').addClass('hover-fade')
@@ -17,6 +18,7 @@ Readium.Views.NavWidgetView = Backbone.View.extend({
17 18
 		this.$('#from-fs-icon').toggle( ebook.get("full_screen") );
18 19
 		this.$('#two-up-icon').toggle( !ebook.get("two_up") );
19 20
 		this.$('#one-up-icon').toggle( ebook.get("two_up") );
  21
+	//	this.$('#two-up-button').toggle( ebook.get("can_two_up") );   <= todo restyle
20 22
 	},
21 23
 
22 24
 	events: {
36  scripts/views/pagination_strategies/fixed_pagination_view.js
@@ -11,6 +11,19 @@ Readium.Views.FixedPaginationView = Readium.Views.PaginationViewBase.extend({
11 11
 		this.model.on("change:two_up", this.setUpMode, this);
12 12
 	},
13 13
 
  14
+	// sometimes these views hang around in memory before
  15
+	// the GC's get them. we need to remove all of the handlers
  16
+	// that were registered on the model
  17
+	destruct: function() {
  18
+		console.log("Fixed paginator destructor called");
  19
+
  20
+		// call the super constructor
  21
+		Readium.Views.PaginationViewBase.prototype.destruct.call(this);
  22
+
  23
+		// remove any listeners registered on the model
  24
+		this.model.off("change:two_up", this.setUpMode);
  25
+	},
  26
+
14 27
 	render: function() {
15 28
 
16 29
 		$('body').addClass('apple-fixed-layout');
@@ -24,11 +37,11 @@ Readium.Views.FixedPaginationView = Readium.Views.PaginationViewBase.extend({
24 37
 		this.$('#container').html("");
25 38
 
26 39
 		// add the current section
27  
-		this.addPage( this.model.getCurrentSection(), 1 );
28  
-		currentPage = this.model.set("current_page", [1]);
  40
+		//this.addPage( this.model.getCurrentSection(), 1 );
  41
+		//currentPage = this.model.set("current_page", [1]);
29 42
 		setTimeout(function() {
30 43
 			$('#page-wrap').zoomAndScale(); //<= this was a little buggy last I checked but it is a super cool feature
31  
-		}, 10)
  44
+		}, 1)
32 45
 		return this.renderPages();
33 46
 	},
34 47
 
@@ -46,26 +59,11 @@ Readium.Views.FixedPaginationView = Readium.Views.PaginationViewBase.extend({
46 59
 			// not sure why, on("load", this.applyBindings, this) was not working
47 60
 			that.applyBindings( $(e.srcElement).contents() );
48 61
 		});
49  
-		this.changePage();
  62
+		//this.changePage();
50 63
 		
51 64
 	},
52 65
 
53  
-	setUpMode: function() {
54  
-		// call super
55  
-		Readium.Views.PaginationViewBase.prototype.setUpMode.call(this);
56  
-		var two_up = this.model.get("two_up");
57  
-		var height = this.model.get("meta_height");
58  
-		var width = this.model.get("meta_width");
59  
-		if(two_up) {
60  
-			var content = this.empty_template({page_num: 0, height: height, width: width});
61  
-			//this.$('#container').prepend(content);
62  
-		} else {
63  
-			$('#page-0').remove();
64  
-		}
65  
-	},
66  
-
67 66
 	renderPages: function() {
68  
-		
69 67
 		// lost myself in the complexity here but this seems right
70 68
 		this.changePage();
71 69
 		return this;
17  scripts/views/pagination_strategies/pagination_view_base.js
@@ -14,6 +14,18 @@ Readium.Views.PaginationViewBase = Backbone.View.extend({
14 14
 		this.bindingTemplate = _.template( $('#binding-template').html() );
15 15
 	},
16 16
 
  17
+	// sometimes these views hang around in memory before
  18
+	// the GC's get them. we need to remove all of the handlers
  19
+	// that were registered on the model
  20
+	destruct: function() {
  21
+		console.log("Pagination base destructor called");
  22
+
  23
+		// remove any listeners registered on the model
  24
+		this.model.off("change:current_page", this.changePage);
  25
+		this.model.off("change:font_size", this.setFontSize);
  26
+		this.resetEl();
  27
+	},
  28
+
17 29
 	// handle  clicks of anchor tags by navigating to
18 30
 	// the proper location in the epub spine, or opening
19 31
 	// a new window for external links
@@ -163,7 +175,7 @@ Readium.Views.PaginationViewBase = Backbone.View.extend({
163 175
 	changePage: function() {
164 176
 		var that = this;
165 177
 		var currentPage = this.model.get("current_page");
166  
-		var two_up = this.model.get("two_up")
  178
+		var two_up = this.model.get("two_up");
167 179
 		this.$(".page-wrap").each(function(index) {
168 180
 			if(!two_up) { 
169 181
 				index += 1;
@@ -201,6 +213,9 @@ Readium.Views.PaginationViewBase = Backbone.View.extend({
201 213
     resetEl: function() {
202 214
     	$('body').removeClass("apple-fixed-layout");
203 215
     	$("#readium-book-view-el").attr("style", "");
  216
+		this.$el.toggleClass("two-up", false);
  217
+		this.$('#spine-divider').toggle(false);
  218
+
204 219
     	this.replaceContent("");
205 220
     	$('#page-wrap').css({
206 221
     		"position": "relative",
15  scripts/views/pagination_strategies/reflowable_pagination_view.js
@@ -14,6 +14,21 @@ Readium.Views.ReflowablePaginationView = Readium.Views.PaginationViewBase.extend
14 14
 
15 15
 	},
16 16
 
  17
+	// sometimes these views hang around in memory before
  18
+	// the GC's get them. we need to remove all of the handlers
  19
+	// that were registered on the model
  20
+	destruct: function() {
  21
+		console.log("Reflowing paginator destructor called");
  22
+
  23
+		// call the super constructor
  24
+		Readium.Views.PaginationViewBase.prototype.destruct.call(this);
  25
+
  26
+		// remove any listeners registered on the model
  27
+		this.model.off("repagination_event", this.renderPages);
  28
+		//this.model.off("change:current_content", this.render);
  29
+		this.model.off("change:two_up", this.renderPages);
  30
+	},
  31
+
17 32
 	render: function(goToLastPage) {
18 33
 		this.resetEl();
19 34
 		var htmlText = this.model.get("current_content");
10  scripts/views/pagination_strategies/scrolling_pagination_view.js
@@ -6,6 +6,16 @@ Readium.Views.ScrollingPaginationView = Readium.Views.PaginationViewBase.extend(
6 6
 		this.page_template = _.template( $('#scrolling-page-template').html() );
7 7
 	},
8 8
 
  9
+	// sometimes these views hang around in memory before
  10
+	// the GC's get them. we need to remove all of the handlers
  11
+	// that were registered on the model
  12
+	destruct: function() {
  13
+		console.log("Scrolling paginator destructor called");
  14
+
  15
+		// call the super destructor
  16
+		Readium.Views.PaginationViewBase.prototype.destruct.call(this);
  17
+	},
  18
+
9 19
 	render: function() {
10 20
 		var that = this;
11 21
 		var uri = this.model.get("current_section_url");
4  views/viewer.html
@@ -148,7 +148,7 @@ <h3 id="version-info">Version 0.2.4 Release Date 5.7.12</h3>
148 148
 
149 149
 		<!-- templates -->
150 150
 		<script type="text/template" id='reflowing-page-template'>
151  
-			<div id="page-<%= page_num %>" class="page-wrap <%= (page_num % 2 === 0) ? "even" : "odd" %>">
  151
+			<div id="page-<%= page_num %>" class="page-wrap <%= (page_num % 2 === 0) ? "left" : "right" %>">
152 152
 				<div class="page-margin">
153 153
 					<% if(!empty) { %>
154 154
 					<div class="page"></div>
@@ -158,7 +158,7 @@ <h3 id="version-info">Version 0.2.4 Release Date 5.7.12</h3>
158 158
 		</script>
159 159
 
160 160
 		<script type="text/template" id='fixed-page-template'>
161  
-			<div id="page-<%= page_num %>" class="fixed-page-wrap <%= (page_num % 2 === 0) ? "even" : "odd" %>">
  161
+			<div id="page-<%= page_num %>" class="fixed-page-wrap <%= page_class %>">
162 162
 				<div class="fixed-page-margin">
163 163
 
164 164
 					<iframe scrolling="no" 

No commit comments for this range

Something went wrong with that request. Please try again.