update jquery & pixastic
This commit is contained in:
parent
3ba9d65bae
commit
669aff3e12
15 changed files with 2949 additions and 30 deletions
|
@ -9,10 +9,7 @@
|
|||
- loading and generally hackiness of pointer is buggy, fix.
|
||||
- check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com
|
||||
- full browser test - IE9 / FF3.6+ / Chrome / Safari / Opera
|
||||
- don't inlcude the closure compiler, expect it (or similar) to be installed instead
|
||||
|
||||
- fix Makefile (handlebars is not compiling properly..)
|
||||
- fonts for left / right navigation, remove all sprites / images completely
|
||||
|
||||
Nice 2 have:
|
||||
- lint
|
||||
|
@ -20,14 +17,13 @@
|
|||
- make page draggable with the cursor
|
||||
- enable menu items via config, allow for custom items
|
||||
- split out classes into seperate files
|
||||
- offline access
|
||||
- thumbnail browser
|
||||
- chrome frame / ExplorerCanvas / non canvas version?
|
||||
- really need to speed up enhancements, try to use webworkers
|
||||
- refactor so we are not using all these loose shared variables and other nastyness
|
||||
- use custom event emitters instead of hacky code
|
||||
- properly bind "this" so we don't have to keep using "self"
|
||||
- allow toolbar to be sticky
|
||||
- unit test / integrate with travis CI
|
||||
- use less instead of plain css
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -85,7 +81,8 @@ function ComicBook(id, srcs, opts) {
|
|||
previous: 80,
|
||||
toolbar: 84,
|
||||
toggleLayout: 76
|
||||
}
|
||||
},
|
||||
libPath: "/lib/"
|
||||
};
|
||||
|
||||
var options = merge(defaults, opts); // options array for internal use
|
||||
|
@ -181,7 +178,11 @@ function ComicBook(id, srcs, opts) {
|
|||
window.addEventListener("hashchange", checkHash, false);
|
||||
}
|
||||
|
||||
ComicBook.prototype.renderControls = function() {
|
||||
/**
|
||||
* Render Handlebars templates. Templates with data-trigger & data-action will
|
||||
* have the specified events bound.
|
||||
*/
|
||||
ComicBook.prototype.renderControls = function () {
|
||||
|
||||
var controls = {};
|
||||
|
||||
|
@ -190,6 +191,7 @@ function ComicBook(id, srcs, opts) {
|
|||
var $template = $(template().trim());
|
||||
controls[name] = $template;
|
||||
|
||||
// add event listeners to controls that specify callbacks
|
||||
$template.find('*').andSelf().filter("[data-action][data-trigger]").each(function () {
|
||||
|
||||
var $this = $(this);
|
||||
|
@ -515,6 +517,8 @@ function ComicBook(id, srcs, opts) {
|
|||
context.drawImage(page2, page_width + offsetW, offsetH, page_width, page_height);
|
||||
}
|
||||
|
||||
this.pixastic = new Pixastic(context, options.libPath + "vendor/pixastic/");
|
||||
|
||||
// apply any image enhancements previously defined
|
||||
$.each(options.enhance, function(action, options) {
|
||||
self.enhance[action](options);
|
||||
|
@ -613,7 +617,7 @@ function ComicBook(id, srcs, opts) {
|
|||
}
|
||||
|
||||
ComicBook.prototype.sharpen = function () {
|
||||
self.enhance.sharpen({ amount: $(this).val() });
|
||||
self.enhance.sharpen({ strength: $(this).val() });
|
||||
}
|
||||
|
||||
ComicBook.prototype.desaturate = function () {
|
||||
|
@ -654,6 +658,21 @@ function ComicBook(id, srcs, opts) {
|
|||
self.drawPage(null, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Pixastic progress callback
|
||||
* @param {float} progress
|
||||
*/
|
||||
progress: function (progress) {
|
||||
// console.info(Math.floor(progress * 100));
|
||||
},
|
||||
|
||||
/**
|
||||
* Pixastic on complete callback
|
||||
*/
|
||||
done: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Adjust brightness / contrast
|
||||
*
|
||||
|
@ -675,13 +694,10 @@ function ComicBook(id, srcs, opts) {
|
|||
options.enhance.brightness = opts;
|
||||
|
||||
// run the enhancement
|
||||
Pixastic.process(canvas, "brightness", {
|
||||
self.pixastic.brightness({
|
||||
brightness: opts.brightness,
|
||||
contrast: opts.contrast,
|
||||
legacy: true
|
||||
});
|
||||
|
||||
init();
|
||||
contrast: opts.contrast
|
||||
}).done(this.done, this.progress);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -689,8 +705,7 @@ function ComicBook(id, srcs, opts) {
|
|||
*/
|
||||
desaturate: function () {
|
||||
options.enhance.desaturate = {};
|
||||
Pixastic.process(canvas, "desaturate", { average : false });
|
||||
init();
|
||||
self.pixastic.desaturate().done(this.done, this.progress);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -705,7 +720,7 @@ function ComicBook(id, srcs, opts) {
|
|||
* Sharpen
|
||||
*
|
||||
* options:
|
||||
* amount: number (-1 to infinity)
|
||||
* strength: number (-1 to infinity)
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
@ -713,15 +728,13 @@ function ComicBook(id, srcs, opts) {
|
|||
|
||||
this.desharpen();
|
||||
|
||||
var opts = merge({ amount: 0 }, params);
|
||||
var opts = merge({ strength: 0 }, params);
|
||||
|
||||
options.enhance.sharpen = opts;
|
||||
|
||||
Pixastic.process(canvas, "sharpen", {
|
||||
amount: opts.amount
|
||||
});
|
||||
|
||||
init();
|
||||
self.pixastic.sharpen3x3({
|
||||
strength: opts.strength
|
||||
}).done(this.done, this.progress);
|
||||
},
|
||||
|
||||
desharpen: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue