toggle toolbar with a keyboard shortcut
This commit is contained in:
parent
3c14fa09fc
commit
5a5546aed6
2 changed files with 22 additions and 16 deletions
|
@ -77,7 +77,8 @@ function ComicBook(id, srcs, opts) {
|
|||
next: 78,
|
||||
previous: 80,
|
||||
control: {
|
||||
color: 69
|
||||
color: 69,
|
||||
toolbar: 84
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -177,7 +178,7 @@ function ComicBook(id, srcs, opts) {
|
|||
* TODO: save current values
|
||||
*/
|
||||
ComicBook.prototype.control = {
|
||||
|
||||
|
||||
toolbar: $(document.createElement("div"))
|
||||
.attr("id", "cb-toolbar")
|
||||
.addClass("cb-control")
|
||||
|
@ -324,12 +325,16 @@ function ComicBook(id, srcs, opts) {
|
|||
this.getControl(control).hide();
|
||||
};
|
||||
|
||||
ComicBook.prototype.toggle = function(e) {
|
||||
e.toggle();
|
||||
};
|
||||
|
||||
ComicBook.prototype.toggleControl = function(control) {
|
||||
if (this.getControl(control).is(":visible")) {
|
||||
this.hideControl(control);
|
||||
} else {
|
||||
this.showControl(control);
|
||||
}
|
||||
ComicBook.prototype.toggle(this.getControl(control));
|
||||
};
|
||||
|
||||
ComicBook.prototype.toggleToolbar = function() {
|
||||
ComicBook.prototype.toggle($("#cb-toolbar"));
|
||||
};
|
||||
|
||||
ComicBook.prototype.toggleLayout = function() {
|
||||
|
@ -343,7 +348,7 @@ function ComicBook(id, srcs, opts) {
|
|||
$("#cb-toolbar .cb-layout").addClass(options.displayMode);
|
||||
ComicBook.prototype.draw();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the image for a given page.
|
||||
*
|
||||
|
@ -400,7 +405,7 @@ function ComicBook(id, srcs, opts) {
|
|||
function preload(i) {
|
||||
|
||||
var page = new Image();
|
||||
|
||||
|
||||
$("#cb-status").text("loading page " + (i + 1) + " of " + no_pages);
|
||||
|
||||
page.src = srcs[i];
|
||||
|
@ -707,8 +712,14 @@ function ComicBook(id, srcs, opts) {
|
|||
break;
|
||||
case "keydown":
|
||||
|
||||
// navigation
|
||||
if (e.keyCode === options.keyboard.previous) { side = "left"; }
|
||||
if (e.keyCode === options.keyboard.next) { side = "right"; }
|
||||
|
||||
// display controls
|
||||
if (e.keyCode === options.keyboard.control.toolbar) {
|
||||
ComicBook.prototype.toggleToolbar();
|
||||
}
|
||||
if (e.keyCode === options.keyboard.control.color) {
|
||||
ComicBook.prototype.toggleControl("color");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue