this.fluidbook.tooltip.hideTooltip();
var mview = $('#view .mview:last');
+ $("#view").attr('aria-hidden', 'false');
+ $("#main").attr('aria-hidden', 'true');
+
if (!Modernizr.ftouch) {
$(mview).find('.content:not(.noscroll)').perfectScrollbar();
} else {
resize();
}, 420);
},
+
+ viewWrap: function (content, menu, attributes, cls) {
+ if (attributes === undefined) {
+ attributes = '';
+ }
+ if (cls === undefined) {
+ cls = '';
+ }
+ var res = '<div class="mview ' + cls + '" data-menu="' + menu + '" role="dialog" aria-labelledby="mview-dialog-title"' + attributes + '>' + content + '</div>';
+ $("#view").append(res);
+ },
+
+ getCaption:function(caption, close, cls) {
+ if (cls === undefined) {
+ cls = '';
+ }
+ if (close === undefined) {
+ close = true;
+ }
+ if (caption === undefined) {
+ caption = '';
+ }
+
+ var res = '<div class="caption ' + cls + '">';
+ if (close) {
+ res += this.closeButton();
+ }
+ if (caption !== '') {
+ res += '<h2 id="mview-dialog-title">' + caption + '</h2>';
+ }
+ res += '</div>';
+ return res;
+ },
+
openMultimedia: function (multimedia, callback) {
var a = $('a[href="#/multimedia/' + multimedia + '"]');
var markup = decodeURIComponent($(a).attr('data-multimedia'));
- var view = '<div class="caption">' + this.closeButton() + '</div>';
+ var view = this.getCaption();
var links = '';
var animateLinks = false;
var uid = $(a).closest('[data-id]').data('id');
view += '</div></div></div>';
var read = multimedia.indexOf('r_') == 0 ? ' data-readmode="1"' : '';
- $("#view").append('<div class="mview" dir="ltr" data-menu="multimedia"' + read + '>' + view + '</div>');
+ read += ' dir="ltr"';
+ this.viewWrap(view, multimedia, read)
if (animateLinks) {
this.fluidbook.links.doAnimateLinks($("#view"), 500);
a = this.fluidbook.links.getLinkByHref(href);
}
var markup = decodeURIComponent($(a).attr('data-iframe'));
- var view = '<div class="caption">' + this.closeButton() + '</div>';
+ var view = this.getCaption();
view += '<div class="content noscroll"><div class="iframeHolder">';
view += markup;
view += '</div></div>';
maxWidth = ' data-max-width="' + $(a).data('max-width') + '"';
}
- $("#view").append('<div class="mview" dir="ltr" data-menu="iframe"' + maxWidth + '>' + view + '</div>');
+ this.viewWrap(view, 'iframe', maxWidth + ' dir="ltr"');
if (callback != undefined) {
callback();
}
openVideo: function (video, callback) {
var a = $('a[href="#/video/' + video + '"]');
var markup = decodeURIComponent($(a).attr('data-video'));
- var view = '<div class="caption">' + this.closeButton() + '</div>';
+ var view = this.getCaption();
view += '<div class="content">';
view += markup;
view += '</div>';
- $("#view").append('<div class="mview" data-menu="video">' + view + '</div>');
+ this.viewWrap(view, 'video');
+
this.fluidbook.stats.track(11);
this.fluidbook.initVideos();
var $this = this;
openSlideshow: function (slideshow, callback) {
var a = $('a[href="#/slideshow/' + slideshow + '"]');
var markup = decodeURIComponent($(a).attr('data-slideshow'));
- var view = '<div class="caption">' + this.closeButton() + '</div>';
+ var view = this.getCaption();
view += '<div class="content">';
view += markup;
view += '</div>';
- $("#view").append('<div class="mview" data-menu="slideshow">' + view + '</div>');
+ this.viewWrap(view, 'slideshow');
// TODO: check which type should be passed to fluidbook.stats.track() ???
// this.fluidbook.stats.track(11);
openAudio: function (audio, callback) {
var a = $('a[href="#/audio/' + audio + '"]');
var markup = decodeURIComponent($(a).attr('data-audio'));
- var view = '<div class="caption">' + this.closeButton() + '</div>';
+ var view = this.getCaption();
view += '<div class="content">';
view += markup;
view += '</div>';
- $("#view").append('<div class="mview" data-menu="audio">' + view + '</div>');
+ this.viewWrap(view, 'audio');
this.fluidbook.stats.track(11);
var $this = this;
var times = [250, 500, 750, 1000, 1250];
,
openWebVideo: function (service, video, callback) {
- var view = '<div class="caption">' + this.closeButton() + '</div>';
+ var view = this.getCaption();
view += '<div class="content">';
if (service == 'youtube') {
view += '<iframe class="webvideo" type="text/html" src="./video/brightcove.html?pid=' + this.fluidbook.settings.brightcovePlayerId + '&pk=' + encodeURIComponent(this.fluidbook.settings.brightcovePlayerSecret) + '&vid=' + video + '" width="100%" frameborder="0"></iframe>'
}
view += '</div>';
- $("#view").append('<div class="mview" data-menu="webvideo">' + view + '</div>');
+ this.viewWrap(view, 'webvideo');
this.fluidbook.stats.track(11);
if (callback != undefined) {
callback();
}
,
openLocales: function (p1, p2, callback) {
- var view = '<div class="caption">' + this.closeButton() + '<h2>Select language</h2></div>';
+ var view = this.getCaption('Select language');
view += '<div class="content">';
view += '<ul class="chapters localesList">';
var $this = this;
});
view += '</ul>';
view += '</div>';
- $("#view").append('<div class="mview" data-menu="locales">' + view + '</div>');
+ this.viewWrap(view, 'locales');
if (callback != undefined) {
callback();
}
// __("you don't have any bookmark. to add a bookmark, please click on the icon in the page corner")
//var message = this.fluidbook.l10n.translate("you don't have any bookmark. to add a bookmark, please click on the icon in the page corner")
var message = __("you don't have any bookmark. to add a bookmark, please click on the icon in the page corner");
- var view = '<div><div class="caption">' + this.fluidbook.menu.closeButton() + '<h2></h2>';
+ var view = '<div>' + this.getCaption();
view += '</div>';
view += '<div class="content">';
view += '<p>' + message + '</p>';
view += '';
view += '</div>';
view += '</div>';
- $("#view").append('<div class="mview" data-menu="bookmarks-help">' + view + '</div>');
-
+ this.viewWrap(view, 'bookmarks-help');
if (callback != undefined) {
callback();
}
var view = this.fluidbook.bookmarks.getView(title, downloadLabel);
- $("#view").append('<div class="mview" data-menu="bookmarks">' + view + '</div>');
+ this.viewWrap(view, 'bookmarks');
+
if (callback != undefined) {
callback();
}
if (this.fluidbook.settings.chaptersCaptionDisplay === false) {
c += ' h0';
}
- var view = '<div class="caption' + c + '">' + this.closeButton();
- if (this.fluidbook.settings.chaptersCaptionDisplay !== false) {
- view += '<h2>' + v.title + '</h2>';
- }
-
- view += '</div>';
+ var view = this.getCaption(this.fluidbook.settings.chaptersCaptionDisplay ? v.title : '', true, c);
view += '<div class="content">';
view += v.view;
view += '</div>';
color = ' c_' + v.color;
}
- $("#view").append('<div id="' + menuId + '" class="mview' + color + '" data-menu="chapters">' + view + '</div>');
+ this.viewWrap(view, 'chapters', 'id="' + menuId + '"', color);
+
this.fluidbook.chapters.removeItemsAfterMaxPage();
if (callback != undefined) {
callback();
this.fluidbook.stats.track(14);
},
openExternalChapters: function (callback) {
- var view = '<div class="caption">' + this.closeButton() + '</div>';
+ var view = this.getCaption();
view += '<div class="content"><div class="multimediaHolder"><div class="multimediaScale">';
view += '<iframe data-width="' + this.fluidbook.settings.externalChaptersSize.width + '" data-height="' + this.fluidbook.settings.externalChaptersSize.height + '" width="' + this.fluidbook.settings.externalChaptersSize.width + '" height="' + this.fluidbook.settings.externalChaptersSize.height + '" src="data/chapters/index.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>';
view += '</div></div></div>';
var read = ' data-readmode="1"';
- $("#view").append('<div class="mview" dir="ltr" data-menu="externalchapters"' + read + '>' + view + '</div>');
+ this.viewWrap(view, 'externalchapters', read + ' dir="ltr"');
if (callback != undefined) {
callback();
}
this.index.openIndex(title, group, closeAll, callback);
},
openArchives: function (title, callback) {
- var archives = '<div class="caption">' + this.closeButton() + '<h2>' + title + '</h2></div>';
+ var archives = this.getCaption(title);
archives += '<div class="image" id="archivesview"><img src="data/images/' + this.fluidbook.settings.externalArchives + '" /><div class="links">' + this.fluidbook.settings.links.archives + '</div></div>';
- $("#view").append('<div class="mview archives" data-menu="archives">' + archives + '</div>');
+ this.viewWrap(archives, 'archives', '', 'archives');
if (callback != undefined) {
callback();
}
style = styleMatches[1].replace(/\s/g, '');
}
text = text.replace(/\<style\>([^\<]*)<\/style>/g, '');
- var t = '<div class="caption">' + this.closeButton() + '<h2></h2></div>';
+ var t = this.getCaption();
t += '<div class="content"><div class="text" style="' + style + '">' + text + '</div></div>';
- $("#view").append('<div class="mview" data-menu="text">' + t + '</div>');
+ this.viewWrap(t, 'text');
if (callback != undefined) {
callback();
}
},
openPrint: function (callback) {
- var printDialogue = '<div class="caption">' + this.closeButton() + '<h2>' + __('print') + '</h2></div>';
+ var printDialogue = this.getCaption(__('print'));
printDialogue += this.fluidbook.printing.getView();
- $("#view").append('<div class="mview" data-menu="print">' + printDialogue + '</div>');
+ this.viewWrap(printDialogue, 'print');
// Auto select first option (the options are dynamic so we can't do it until now)
$('.print-dialogue .print-option:first-of-type input[type="radio"]').prop('checked', true);
},
openDownload: function (callback) {
- var downloadDialogue = '<div class="caption">' + this.closeButton() + '<h2>' + __('download') + '</h2></div>';
-
+ var downloadDialogue = this.getCaption(__('download'));
downloadDialogue += this.fluidbook.printing.getView('download'); // Reuse print dialogue since they're almost the same
- $("#view").append('<div class="mview" data-menu="download">' + downloadDialogue + '</div>');
+ this.viewWrap(downloadDialogue, 'download');
// Auto select first option (the options are dynamic so we can't do it until now)
// Todo: maybe make this different for downloads? Auto select full brochure option?
}
if (all) {
- $("#main").show();
+ $("#view").attr('aria-hidden', 'true');
+ $("#main").attr('aria-hidden', 'false').show();
$('body').removeClass('view');
}
resize();