removed crappy exception class
This commit is contained in:
parent
aaafbbc12c
commit
752bf3b02f
1 changed files with 12 additions and 18 deletions
|
@ -4,7 +4,6 @@
|
|||
TODOs:
|
||||
|
||||
Fo sho:
|
||||
- fix last page loading bug
|
||||
- improve prev/next buttons, only show them when they can possibly work (not at beginning/end)
|
||||
- check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com
|
||||
- write bin scripts to minify & join all js
|
||||
|
@ -54,16 +53,12 @@ function merge(a, b) {
|
|||
* @param {Object} object
|
||||
* @returns {ComicBookException}
|
||||
*/
|
||||
function ComicBookException(type, object) {
|
||||
|
||||
this.type = type;
|
||||
this.object = object;
|
||||
|
||||
this.INVALID_PAGE = "invalid page";
|
||||
this.INVALID_PAGE_TYPE = "invalid page type";
|
||||
this.UNDEFINED_CONTROL = "undefined control";
|
||||
this.INVALID_ZOOM_MODE = "invalid zoom mode";
|
||||
this.INVALID_NAVIGATION_EVENT = "invalid navigation event";
|
||||
var ComicBookException = {
|
||||
INVALID_PAGE: "invalid page",
|
||||
INVALID_PAGE_TYPE: "invalid page type",
|
||||
UNDEFINED_CONTROL: "undefined control",
|
||||
INVALID_ZOOM_MODE: "invalid zoom mode",
|
||||
INVALID_NAVIGATION_EVENT: "invalid navigation event"
|
||||
};
|
||||
|
||||
function ComicBook(id, srcs, opts) {
|
||||
|
@ -348,7 +343,7 @@ function ComicBook(id, srcs, opts) {
|
|||
ComicBook.prototype.getControl = function(control) {
|
||||
|
||||
if (typeof this.control[control] === "undefined") {
|
||||
throw new ComicBookException(ComicBookException.UNDEFINED_CONTROL, control);
|
||||
throw ComicBookException.UNDEFINED_CONTROL+' '+control;
|
||||
}
|
||||
|
||||
return this.control[control];
|
||||
|
@ -394,7 +389,7 @@ function ComicBook(id, srcs, opts) {
|
|||
ComicBook.prototype.getPage = function(i) {
|
||||
|
||||
if (i < 0 || i > srcs.length) {
|
||||
throw new ComicBookException(ComicBookException.INVALID_PAGE, i);
|
||||
throw ComicBookException.INVALID_PAGE+' '+i;
|
||||
}
|
||||
|
||||
if (typeof pages[i] === "object") {
|
||||
|
@ -525,8 +520,9 @@ function ComicBook(id, srcs, opts) {
|
|||
if (options.displayMode === "double" && pointer < srcs.length-1) {
|
||||
page2 = ComicBook.prototype.getPage(pointer + 1);
|
||||
}
|
||||
|
||||
if (typeof page !== "object") {
|
||||
throw new ComicBookException(ComicBookException.INVALID_PAGE_TYPE, typeof page);
|
||||
throw ComicBookException.INVALID_PAGE_TYPE+' '+typeof page;
|
||||
}
|
||||
|
||||
var width = page.width;
|
||||
|
@ -572,7 +568,7 @@ function ComicBook(id, srcs, opts) {
|
|||
break;
|
||||
|
||||
default:
|
||||
throw new ComicBookException(ComicBookException.INVALID_ZOOM_MODE, options.zoomMode);
|
||||
throw ComicBookException.INVALID_ZOOM_MODE+' '+options.zoomMode;
|
||||
}
|
||||
|
||||
var canvas_width = page.width * zoom_scale;
|
||||
|
@ -802,9 +798,7 @@ function ComicBook(id, srcs, opts) {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
throw new ComicBookException(
|
||||
ComicBookException.INVALID_NAVIGATION_EVENT, e.type
|
||||
);
|
||||
throw ComicBookException.INVALID_NAVIGATION_EVENT+' '+e.type;
|
||||
}
|
||||
|
||||
if (side) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue