this.buttonLeft = document.createElement('a');
this.buttonLeft.setAttribute('class', this.buttonClass + ' left');
this.buttonLeft.setAttribute('href', '#');
+ this.buttonLeft.setAttribute('role', 'button');
+ this.buttonLeft.setAttribute('aria-keyshortcuts', 'Ctrl+Shift+LeftArrow');
this.buttonRight = document.createElement('a');
this.buttonRight.setAttribute('class', this.buttonClass + ' right');
this.buttonRight.setAttribute('href', '#');
+ this.buttonRight.setAttribute('role', 'button');
+ this.buttonRight.setAttribute('aria-keyshortcuts', 'Ctrl+Shift+RightArrow');
if (this.audioSupport) {
this.init();
// Add tooltips
buttons.attr('data-tooltip', this.fluidbook.l10n.__('listen to the page'));
+ buttons.attr('aria-label', this.fluidbook.l10n.__('listen to the page'));
// Hide buttons by default - they will be shown if there is audio when setupPages() is run
buttons.hide();
}
bookmarks += "<a href=\"#\" class=\"bookmark " + side + "\" data-page=\"" + pageNr + "\"";
- bookmarks += ' data-keyshortcuts="' + shortcut + '"'
+ bookmarks += ' aria-keyshortcuts="' + shortcut + '" role="button"'
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 += " aria-label=\"" + this._txtAdd + "\"";
}
bookmarks += '>' + getSpriteIcon('bookmark-corner') + '</a>';
}
},
+ translateAttributes: function () {
+ var $this=this;
+ var attrs = ['data-tooltip', 'aria-label'];
+ var selectors = [];
+ $.each(attrs, function (k, attr) {
+ selectors.push('[' + attr + ']');
+ });
+
+ $(selectors.join(',')).each(function () {
+ var e = this;
+ $.each(attrs, function (k, attr) {
+ if ($(e).is('[' + attr + ']')) {
+ var attrValue=$(e).attr(attr);
+ if(attrValue.substr(0, 1) === '~'){
+ $(e).attr(attr, $this.fluidbook.l10n.__(attrValue.substring(1)));
+ }
+ }
+ })
+ });
+ },
+
load: function () {
this.dir = this.getLanguageDirection(this.getActiveLang());
this.ltr = (this.dir == 'ltr');
$this.fluidbook.initVideos();
$this.initInlineSlideshows();
$this.initAnimatedContentsLinks();
+ $this.fluidbook.l10n.translateAttributes();
}, 200);
callback();
}
var res = $(img);
+ $(res).attr('aria-hidden', true);
if (page !== null) {
$(res).attr('data-page', page);
$("#loadedcontents").append(res);
} else {
c = ' ' + c;
}
- return '<a href="#/closeview" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape" class="button back' + c + '">' + getSpriteIcon('interface-close') + '</a>';
+ return '<a href="#/closeview" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape" class="button back' + c + '">' + getSpriteIcon('interface-close') + '</a>';
}
,
openAudio: function (audio, callback) {
res += ' class="' + className + '"';
}
+ res+=' role="button"';
// Only the horizontal icon menu should have the tooltips
if (help !== undefined && help !== '') {
if (navType === 'horizontalNav') {
html += '<div class="searchResultsNavQuery"></div>';
html += '</div>'; // .searchResultsNavField
html += '<div class="searchResultsNavArrows">';
- html += '<div class="button searchResultsPrev" aria-label="' + this.fluidbook.l10n.__('previous result') + '" aria-keyshortcuts="Shift+F3"></div>';
+ html += '<div class="button searchResultsPrev" role="button" aria-label="' + this.fluidbook.l10n.__('previous result') + '" aria-keyshortcuts="Shift+F3"></div>';
html += '<div class="searchResultsNavCounter"></div>';
- html += '<div class="button searchResultsNext" aria-label="' + this.fluidbook.l10n.__('next result') + '" aria-keyshortcuts="F3"></div>';
+ html += '<div class="button searchResultsNext" role="button" aria-label="' + this.fluidbook.l10n.__('next result') + '" aria-keyshortcuts="F3"></div>';
html += '</div>'; // .searchResultsNavArrows
- html += '<div class="button searchResultsNavClose" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
+ html += '<div class="button searchResultsNavClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
html += getSpriteIcon('interface-close');
html += '</div>'; // .searchResultsNavClose
html += '</div>'; // #searchResultsNav
$this.eventTriggered(this);
});
- $("body").append('<div id="tooltip"></div>');
+ $("body").append('<div id="tooltip" aria-hidden="true"></div>');
},
updateMousePosition: function (e) {
}
menu += '</div></div>';
$groupWrapper.append('<div id="zoomPopupBackground"><div class="bg"></div></div>' + menu);
- $groupWrapper.append('<a href="#" class="zoomPopupClose" aria-label="'+$this.fluidbook.l10n.__('close')+'" aria-keyshortcuts="Escape">' + getSpriteIcon('interface-close') + '</a>');
+ $groupWrapper.append('<a href="#" role="button" class="zoomPopupClose" aria-label="'+$this.fluidbook.l10n.__('close')+'" aria-keyshortcuts="Escape">' + getSpriteIcon('interface-close') + '</a>');
}
var z = $('#zoomPopup_' + zoomID),