Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

A little bit of cleanup. Including removing the Vert dimension.

  • Loading branch information...
commit 1b5c86f255335420363cdc8379951e85275a7e04 1 parent 83cf064
@joseph authored
Showing with 21 additions and 136 deletions.
  1. +4 −1 src/compat/browser.js
  2. +2 −0  src/compat/css.js
  3. +3 −0  src/compat/env.js
  4. +9 −0 src/compat/stubs.js
  5. +0 −3  src/controls/contents.js
  6. +0 −4 src/controls/magnifier.js
  7. +0 −3  src/controls/placesaver.js
  8. +0 −3  src/controls/scrubber.js
  9. +0 −3  src/controls/spinner.js
  10. +0 −2  src/controls/stencil.js
  11. +0 −1  src/core/book.js
  12. +1 −1  src/core/events.js
  13. +1 −8 src/core/monocle.js
  14. +0 −3  src/core/reader.js
  15. +1 −0  src/core/styles.js
  16. +0 −87 src/dimensions/vert.js
  17. +0 −3  src/flippers/slider.js
  18. +0 −1  test/bookdata/index.html
  19. +0 −1  test/componentry/index.html
  20. +0 −1  test/controls/index.html
  21. +0 −2  test/dogfood/index.html
  22. +0 −1  test/dogfood/simplest.html
  23. +0 −1  test/events/index.html
  24. +0 −1  test/flippers/index.html
  25. +0 −1  test/locus-search/index.html
  26. +0 −1  test/panels/index.html
  27. +0 −1  test/rich_content/index.html
  28. +0 −1  test/showcase/01-velveteen/index.html
  29. +0 −1  test/stencil/index.html
  30. +0 −1  test/stylesheet/index.html
View
5 src/compat/browser.js
@@ -1,4 +1,4 @@
-Monocle.Browser = {}
+Monocle.Browser = {};
// Compare the user-agent string to a string or regex pattern.
//
@@ -20,6 +20,8 @@ Monocle.Browser.is = {
}
+// Set the browser engine string.
+//
if (Monocle.Browser.is.IE) {
Monocle.Browser.engine = "IE";
} else if (Monocle.Browser.is.Opera) {
@@ -29,6 +31,7 @@ if (Monocle.Browser.is.IE) {
} else if (Monocle.Browser.is.Gecko) {
Monocle.Browser.engine = "Gecko";
} else {
+ console.warn("Unknown engine; assuming W3C compliant.");
Monocle.Browser.engine = "W3C";
}
View
2  src/compat/css.js
@@ -1,3 +1,5 @@
+// A class for manipulating CSS properties in a browser-engine-aware way.
+//
Monocle.CSS = function () {
var API = { constructor: Monocle.CSS }
View
3  src/compat/env.js
@@ -1,3 +1,6 @@
+// A class that tests the browser environment for required capabilities and
+// known bugs (for which we have workarounds).
+//
Monocle.Env = function () {
var API = { constructor: Monocle.Env }
View
9 src/compat/stubs.js
@@ -27,3 +27,12 @@ window.console.compatDir = function (obj) {
window.console.log(stringify(obj));
}
+
+
+// A convenient alias for setTimeout that assumes 0 if no timeout is specified.
+//
+Monocle.defer = function (fn, time) {
+ if (fn && typeof fn == "function") {
+ return setTimeout(fn, time || 0);
+ }
+}
View
3  src/controls/contents.js
@@ -1,7 +1,4 @@
Monocle.Controls.Contents = function (reader) {
- if (Monocle.Controls == this) {
- return new Monocle.Controls.Contents(reader);
- }
var API = { constructor: Monocle.Controls.Contents }
var k = API.constants = API.constructor;
View
4 src/controls/magnifier.js
@@ -1,9 +1,5 @@
Monocle.Controls.Magnifier = function (reader) {
- if (Monocle.Controls == this) {
- return new Monocle.Controls.Magnifier(reader);
- }
- // Public methods and properties.
var API = { constructor: Monocle.Controls.Magnifier }
var k = API.constants = API.constructor;
var p = API.properties = {
View
3  src/controls/placesaver.js
@@ -1,7 +1,4 @@
Monocle.Controls.PlaceSaver = function (bookId) {
- if (Monocle.Controls == this) {
- return new Monocle.Controls.PlaceSaver(bookId);
- }
var API = { constructor: Monocle.Controls.PlaceSaver }
var k = API.constants = API.constructor;
View
3  src/controls/scrubber.js
@@ -1,7 +1,4 @@
Monocle.Controls.Scrubber = function (reader) {
- if (Monocle.Controls == this) {
- return new Monocle.Controls.Scrubber(reader);
- }
var API = { constructor: Monocle.Controls.Scrubber }
var k = API.constants = API.constructor;
View
3  src/controls/spinner.js
@@ -1,7 +1,4 @@
Monocle.Controls.Spinner = function (reader) {
- if (Monocle.Controls == this) {
- return new Monocle.Controls.Spinner(reader);
- }
var API = { constructor: Monocle.Controls.Spinner }
var k = API.constants = API.constructor;
View
2  src/controls/stencil.js
@@ -1,7 +1,5 @@
Monocle.Controls.Stencil = function (reader) {
- if (Monocle.Controls == this) { return new this.Stencil(reader); }
-
var API = { constructor: Monocle.Controls.Stencil }
var k = API.constants = API.constructor;
var p = API.properties = {
View
1  src/core/book.js
@@ -10,7 +10,6 @@
*
*/
Monocle.Book = function (dataSource) {
- if (Monocle == this) { return new Monocle.Book(dataSource); }
var API = { constructor: Monocle.Book }
var k = API.constants = API.constructor;
View
2  src/core/events.js
@@ -1,4 +1,4 @@
-Monocle.Events = {}
+Monocle.Events = {};
// Fire a custom event on a given target element. The attached data object will
View
9 src/core/monocle.js
@@ -10,14 +10,7 @@ Monocle = {
};
-Monocle.defer = function (fn, time) {
- if (fn && typeof fn == "function") {
- return setTimeout(fn, time || 0);
- }
-}
-
-
-Monocle.Dimensions = {}
+Monocle.Dimensions = {};
Monocle.Controls = {};
Monocle.Flippers = {};
Monocle.Panels = {};
View
3  src/core/reader.js
@@ -31,9 +31,6 @@
// systemId: the id for root elements of components, defaults to "RS:monocle"
//
Monocle.Reader = function (node, bookData, options, onLoadCallback) {
- if (Monocle == this) {
- return new Monocle.Reader(node, bookData, options, onLoadCallback);
- }
var API = { constructor: Monocle.Reader }
var k = API.constants = API.constructor;
View
1  src/core/styles.js
@@ -95,6 +95,7 @@ Monocle.Styles = {
//
Monocle.Styles.container = {
"position": "absolute",
+ "overflow": "hidden",
"top": "0",
"left": "0",
"bottom": "0",
View
87 src/dimensions/vert.js
@@ -1,87 +0,0 @@
-// This was once used by the legacy flipper, before the legacy flipper was
-// removed. It could serve as the basis for a scrolling flipper or something.
-//
-Monocle.Dimensions.Vert = function (pageDiv) {
-
- var API = { constructor: Monocle.Dimensions.Vert }
- var k = API.constants = API.constructor;
- var p = API.properties = {
- page: pageDiv,
- reader: pageDiv.m.reader
- }
-
-
- function initialize() {
- p.reader.listen('monocle:componentchange', componentChanged);
- }
-
-
- function update(callback) {
- p.bodyHeight = getBodyHeight();
- p.pageHeight = getPageHeight();
- p.length = Math.ceil(p.bodyHeight / p.pageHeight);
- callback(p.length);
- }
-
-
- function getBodyHeight() {
- return p.page.m.activeFrame.contentDocument.body.scrollHeight;
- }
-
-
- function getPageHeight() {
- return p.page.m.activeFrame.offsetHeight - k.GUTTER;
- }
-
-
- function percentageThroughOfNode(target) {
- if (!target) {
- return 0;
- }
- var doc = p.page.m.activeFrame.contentDocument;
- var offset = 0;
- if (target.getBoundingClientRect) {
- offset = target.getBoundingClientRect().top;
- offset -= doc.body.getBoundingClientRect().top;
- } else {
- var oldScrollTop = doc.body.scrollTop;
- target.scrollIntoView();
- offset = doc.body.scrollTop;
- doc.body.scrollLeft = 0;
- doc.body.scrollTop = oldScrollTop;
- }
-
- //console.log(id + ": " + offset + " of " + p.bodyHeight);
- var percent = offset / p.bodyHeight;
- return percent;
- }
-
-
- function componentChanged(evt) {
- if (evt.m['page'] != p.page) { return; }
- var sheaf = p.page.m.sheafDiv;
- var cmpt = p.page.m.activeFrame;
- sheaf.dom.setStyles(k.SHEAF_STYLES);
- cmpt.dom.setStyles(k.COMPONENT_STYLES);
- var doc = evt.m['document'];
- doc.documentElement.style.overflow = 'hidden';
- doc.body.style.marginRight = '10px !important';
- cmpt.contentWindow.scrollTo(0,0);
- }
-
-
- function locusToOffset(locus) {
- return p.pageHeight * (locus.page - 1);
- }
-
-
- API.update = update;
- API.percentageThroughOfNode = percentageThroughOfNode;
- API.locusToOffset = locusToOffset;
-
- initialize();
-
- return API;
-}
-
-Monocle.Dimensions.Vert.GUTTER = 10;
View
3  src/flippers/slider.js
@@ -1,7 +1,4 @@
Monocle.Flippers.Slider = function (reader) {
- if (Monocle.Flippers == this) {
- return new Monocle.Flippers.Slider(reader);
- }
var API = { constructor: Monocle.Flippers.Slider }
var k = API.constants = API.constructor;
View
1  test/bookdata/index.html
@@ -21,7 +21,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
#part1, #part2 {
display: none;
View
1  test/componentry/index.html
@@ -18,7 +18,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
#hiddenFrames {
View
1  test/controls/index.html
@@ -19,7 +19,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
#part1, #part2 {
display: none;
View
2  test/dogfood/index.html
@@ -13,9 +13,7 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
margin: 2em 0;
- float: left;
}
#theCode {
clear: both;
View
1  test/dogfood/simplest.html
@@ -18,7 +18,6 @@
width: 300px;
height: 400px;
border: 1px solid #000;
- overflow: hidden;
}
</style>
View
1  test/events/index.html
@@ -13,7 +13,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
#out {
font: 9pt Consolas, Inconsolata, Menlo, Andale Mono, Monaco, monospace;
View
1  test/flippers/index.html
@@ -18,7 +18,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
#part1, #part2 {
display: none;
View
1  test/locus-search/index.html
@@ -13,7 +13,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
</style>
View
1  test/panels/index.html
@@ -18,7 +18,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
#part1, #part2 {
display: none;
View
1  test/rich_content/index.html
@@ -17,7 +17,6 @@
height: 420px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
</style>
View
1  test/showcase/01-velveteen/index.html
@@ -17,7 +17,6 @@
height: 420px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
</style>
View
1  test/stencil/index.html
@@ -23,7 +23,6 @@
height: 400px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
</style>
View
1  test/stylesheet/index.html
@@ -17,7 +17,6 @@
height: 420px;
border: 1px solid #000;
background-color: #CCC;
- overflow: hidden;
}
</style>
Please sign in to comment.
Something went wrong with that request. Please try again.