for (var i in this.bookmarks) {
this.addBookmark(this.bookmarks[i], true);
}
+
+ this.fluidbook.keyboard.initBookmarksShortcuts();
+ },
+
+ toggleSide: function (side) {
+ var b = $('a.bookmark.' + side);
+ if (b.length === 0) {
+ b = $('a.bookmark');
+ }
+ $(b).click();
},
+
sortGroup: function (a, b) {
var p_a = this.getPagesOfGroup(a)[0];
var p_b = this.getPagesOfGroup(b)[0];
if (permanentIcon) {
side += ' permanent';
}
+ var shortcut = "Control+Alt+D";
+ if (side === 'left') {
+ shortcut = "Control+Shift+D";
+ }
bookmarks += "<a href=\"#\" class=\"bookmark " + side + "\" data-page=\"" + pageNr + "\"";
+ bookmarks += ' data-keyshortcuts="' + shortcut + '"'
if (this.isBookmarked(pageNr)) {
bookmarks += " data-enabled=\"enabled\"";
bookmarks += " data-tooltip=\"" + this._txtRemove + "\"";
+ bookmarks += " aria-label=\"" + this._txtRemove + "\"";
} else {
bookmarks += " data-tooltip=\"" + this._txtAdd + "\"";
+ bookmarks += " aria-label\"" + this._txtAdd + "\"";
}
bookmarks += '>' + getSpriteIcon('bookmark-corner') + '</a>';
$(document).on('click', '.icon-help', function (e) {
$this.show();
- if (fluidbook.nav.menuIsOpen) {
- fluidbook.nav.menuAPI.close();
+ if ($this.fluidbook.nav.menuIsOpen) {
+ $this.fluidbook.nav.menuAPI.close();
}
e.preventDefault();
});
var res = '';
if ($('html').hasClass('ltr')) {
res += '<div id="next-arrows">';
- res += this.fluidbook.nav.getLink('interface-next', '#', 'next', '', labels.next, 'arrow-top', true, '', 'Right');
+ res += this.fluidbook.nav.getLink('interface-next', '#', 'next', '', labels.next, 'arrow-top', true, '', 'ArrowRight');
res += this.fluidbook.nav.getLink('interface-last', '#', 'last', '', labels.last, 'arrow-bottom', true ,'','End');
res += '</div>';
res += '<div id="prev-arrows">';
- res += this.fluidbook.nav.getLink('interface-prev', '#', 'previous', '', labels.previous, 'arrow-top', true, '', 'Left');
+ res += this.fluidbook.nav.getLink('interface-prev', '#', 'previous', '', labels.previous, 'arrow-top', true, '', 'ArrowLeft');
res += this.fluidbook.nav.getLink('interface-first', '#', 'first', '', labels.first, 'arrow-bottom', true, '', 'Home');
res += '</div>';
} else {
res += '<div id="next-arrows">';
- res += this.fluidbook.nav.getLink('interface-next', '#', 'previous', '', labels.previous, 'arrow-top', true, '', 'Right');
+ res += this.fluidbook.nav.getLink('interface-next', '#', 'previous', '', labels.previous, 'arrow-top', true, '', 'ArrowRight');
res += this.fluidbook.nav.getLink('interface-last', '#', 'first', '', labels.first, 'arrow-bottom', true, 'Home');
res += '</div>';
res += '<div id="prev-arrows">';
- res += this.fluidbook.nav.getLink('interface-prev', '#', 'next', '', labels.next, 'arrow-top', true, 'Left');
+ res += this.fluidbook.nav.getLink('interface-prev', '#', 'next', '', labels.next, 'arrow-top', true, 'ArrowLeft');
res += this.fluidbook.nav.getLink('interface-first', '#', 'last', '', labels.last, 'arrow-bottom', true, 'End');
res += '</div>';
}
this.contentlock = new FluidbookContentLock(this);
this.menu = new FluidbookMenu(this);
this.support = new FluidbookSupport(this);
+ this.l10n = new FluidbookL10N(this, $_GET['lang']);
this.search = new FluidbookSearch(this);
this.mobilefirst = new FluidbookMobileFirst(this);
this.zoom = new FluidbookZoom(this);
this.touch = new FluidbookTouch(this);
}
this.background = new FluidbookBackground(this);
- this.l10n = new FluidbookL10N(this, $_GET['lang']);
this.video = new FluidbookVideo(this);
this.bookmarks = new FluidbookBookmarks(this);
this.tooltip = new FluidbookTooltip(this);
FluidbookKeyboard.prototype = {
initKeyboardShortcuts: function () {
var $this = this;
- key('escape', function () {
- $this.fluidbook.help.hide();
- $this.fluidbook.menu.closeView(function () {
+ key.filter = function (event) {
+ var e = $(event.target || event.srcElement);
+ return !(e.is('input:not(#q),select,textarea'));
+ }
+ this.keyShortcut('escape', function () {
+ if ($this.fluidbook.help.isVisible()) {
+ $this.fluidbook.help.hide();
+ }
+ if ($this.fluidbook.menu.viewMode()) {
+ $this.fluidbook.menu.closeView(function () {
+
+ }, true, true);
+ }
+ $this.fluidbook.search.closeSearch();
+ if ($this.fluidbook.nav.menuIsOpen) {
+ $this.fluidbook.nav.closeMenu();
+ }
+ if (screenfull.isFullscreen) {
+ screenfull.exit();
+ }
+ });
+ if (this.fluidbook.settings.fullscreen) {
+ this.keyShortcut('f11', function () {
+ screenfull.toggle();
+ });
+ }
+
+ if (!this.fluidbook.settings.print) {
+ this.keyShortcut('ctrl+p', function () {
+ });
+ }
+ },
- }, true, true);
+ initBookmarksShortcuts: function () {
+ var $this = this;
+ this.keyShortcut('ctrl+alt+d', function () {
+ $this.fluidbook.bookmarks.toggleSide('right');
+ });
+ this.keyShortcut('ctrl+shift+d', function () {
+ $this.fluidbook.bookmarks.toggleSide('left');
+ });
+ },
+
+ initSearchShortcuts: function () {
+ var $this = this;
+ key('f3', function () {
+ if ($this.fluidbook.search.isResultNavOpened()) {
+ $this.fluidbook.search.nextResultsPage();
+ } else {
+ $this.fluidbook.nav.openSearch();
+ }
+ return false;
+ });
+
+ key('shift+f3', function () {
+ if ($this.fluidbook.search.isResultNavOpened()) {
+ $this.fluidbook.search.previousResultsPage();
+ }
+ return false;
});
},
return;
}
key(this.checkShortcuts(shortcuts), function () {
- console.log('triggered ' + shortcuts)
func();
- if(shortcuts==='f11'){
- return true;
- }
return false;
});
},
var $this = this;
shortcuts = shortcuts.split(' ');
var res = [];
- var map = {control: 'ctrl'};
+ var map = {control: 'ctrl', arrowleft: 'left', arrowright: 'right', arrowup: 'up', arrowdown: 'down'};
$.each(shortcuts, function (k, shortcut) {
if (shortcut === '') {
return;
} else {
c = ' ' + c;
}
- return '<a href="#/closeview" class="button back' + c + '">' + getSpriteIcon('interface-close') + '</a>';
+ return '<a href="#/closeview" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape" class="button back' + c + '">' + getSpriteIcon('interface-close') + '</a>';
}
,
openAudio: function (audio, callback) {
// Make sure that the link gets a unique ID when it is used in both menus
- var elementID = (navType === undefined || navType===null || navType==='') ? id : navType + '_' + id;
+ var elementID = (navType === undefined || navType === null || navType === '') ? id : navType + '_' + id;
res += ' id="' + elementID + '"';
} else if (icon === 'bookmark' && this.fluidbook.settings.bookmark) {
link = this.addLink(navType, 'nav-bookmarks', '#/bookmark', 'bookmarks', 'bookmarks', 'bookmarks', 'Control+B');
} else if (icon === 'pdf' && this.fluidbook.settings.pdf) {
- link = this.addLink(navType, 'nav-download', '#', 'download', 'download', 'download', 'Control+Alt+D');
+ link = this.addLink(navType, 'nav-download', '#', 'download', 'download', 'download', 'Control+S');
} else if (icon === 'print' && this.fluidbook.settings.print) {
link = this.addLink(navType, 'nav-print', '#', 'print', 'print', 'print', 'Control+P');
} else if (icon === 'basket' && this.fluidbook.cart !== undefined && this.fluidbook.cart.enabled) {
} else if (icon === 'fullscreen' && this.fluidbook.support.fullscreen && !this.fluidbook.settings.phonegap) {
link = this.addLink(navType, 'nav-' + icon, '#', icon, 'full screen', 'switch between fullscreen and normal', 'F11');
-
} else if (icon === 'sound' && this.fluidbook.sound.enabled) {
link = this.addLink(navType, 'nav-sound-on', '#', 'sound-on', 'switch off the sound', 'switch on / switch off the sound', 'F10');
link2 = this.addLink(navType, 'nav-sound-off', '#', 'sound-off', 'switch on the sound', 'switch on / switch off the sound', 'Alt+A');
if (screenfull.isFullscreen) {
$('.icon-fullscreen').addClass('active');
} else {
+ window.focus();
$('.icon-fullscreen').removeClass('active');
}
resize();
setTimeout(function () {
resize();
}, 1000);
+ window.focus();
});
},
}
});
- return '<a href="#" id="' + buttonID + '">' + getSpriteIcon('interface-close') + '</a>';
+ return '<a href="#" id="' + buttonID + '" aria-label="' + $this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">' + getSpriteIcon('interface-close') + '</a>';
},
getSearch: function () {
// The results nav bar provides navigation between results without needing the menu to be open
// When it is active, the rest of the interface is hidden
initResultsNav: function () {
+
+ this.fluidbook.keyboard.initSearchShortcuts();
+
var $this = this;
// Previously we used buttons in the HTML for clickable elements
html += '<div class="searchResultsNavQuery"></div>';
html += '</div>'; // .searchResultsNavField
html += '<div class="searchResultsNavArrows">';
- html += '<div class="button searchResultsPrev"></div>';
+ html += '<div class="button searchResultsPrev" aria-label="' + this.fluidbook.l10n.__('previous result') + '" aria-keyshortcuts="Shift+F3"></div>';
html += '<div class="searchResultsNavCounter"></div>';
- html += '<div class="button searchResultsNext"></div>';
+ html += '<div class="button searchResultsNext" aria-label="' + this.fluidbook.l10n.__('next result') + '" aria-keyshortcuts="F3"></div>';
html += '</div>'; // .searchResultsNavArrows
- html += '<div class="button searchResultsNavClose">';
+ html += '<div class="button searchResultsNavClose" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
html += getSpriteIcon('interface-close');
html += '</div>'; // .searchResultsNavClose
html += '</div>'; // #searchResultsNav
$this.closeResultsNav();
}
})
-
-
},
resultsNavActive: function () {
return $('body').hasClass(this.resultsActiveClass);
},
+
updateResultsNav: function (resultPage) {
// If we are in landscape view, there are 2 pages visible,
this.resultsNav.removeClass('hidden');
$('body').addClass(this.resultsActiveClass);
},
+
+ isResultNavOpened: function () {
+ return $('body').hasClass(this.resultsActiveClass);
+ },
+
closeResultsNav: function (keepSearch) {
keepSearch = keepSearch !== 'undefined' ? keepSearch : false;
}
menu += '</div></div>';
$groupWrapper.append('<div id="zoomPopupBackground"><div class="bg"></div></div>' + menu);
- $groupWrapper.append('<a href="#" class="zoomPopupClose">' + getSpriteIcon('interface-close') + '</a>');
+ $groupWrapper.append('<a href="#" class="zoomPopupClose" aria-label="'+$this.fluidbook.l10n.__('close')+'" aria-keyshortcuts="Escape">' + getSpriteIcon('interface-close') + '</a>');
}
var z = $('#zoomPopup_' + zoomID),