From fd66fb3afca90bf0690edab709ff37a1c7cbb4f6 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 19 Dec 2018 16:49:14 +0100 Subject: [PATCH] wip #2449 @0.5 --- js/libs/fluidbook/fluidbook.menu.js | 45 +++++++++++++++++------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.menu.js b/js/libs/fluidbook/fluidbook.menu.js index a503b909..61570a20 100644 --- a/js/libs/fluidbook/fluidbook.menu.js +++ b/js/libs/fluidbook/fluidbook.menu.js @@ -60,11 +60,20 @@ FluidbookMenu.prototype = { }, __openView: function (view, param1, param2, callback) { - if (typeof param1 === 'string') { - param1 = decodeURIComponent(param1); + try { + if (typeof param1 === 'string') { + param1 = decodeURIComponent(param1); + } + }catch (e) { + } - if (typeof param2 === 'string') { - param2 = decodeURIComponent(param2); + + try { + if (typeof param2 === 'string') { + param2 = decodeURIComponent(param2); + } + }catch (e) { + } var $this = this; @@ -72,34 +81,34 @@ FluidbookMenu.prototype = { var cb = function () { $this.openingView(callback, view); }; - if (view == 'index') { + if (view === 'index') { this.openIndex(this.fluidbook.l10n.__('overview'), undefined, true, cb); - } else if (view == 'video') { + } else if (view === 'video') { this.openVideo(param1, cb); - } else if (view == 'audio') { + } else if (view === 'audio') { this.openAudio(param1, cb); - } else if (view == 'webvideo') { + } else if (view === 'webvideo') { this.openWebVideo(param1, param2, cb); - } else if (view == 'multimedia') { + } else if (view === 'multimedia') { this.openMultimedia(param1, cb); - } else if (view == 'chapters') { - if (param1 == undefined || param1 == 'undefined' || param1 == null || param1 == '') { + } else if (view === 'chapters') { + if (param1 === undefined || param1 === 'undefined' || param1 === null || param1 === '') { param1 = 'null'; } this.openChapters(param1, cb); - } else if (view == 'archives') { + } else if (view === 'archives') { this.openArchives($("#nav #archives").data('tooltip'), cb); - } else if (view == 'text') { + } else if (view === 'text') { this.openText(param1, cb); - } else if (view == 'slideshow') { + } else if (view === 'slideshow') { this.openSlideshow(param1, cb); - } else if (view == 'iframe') { + } else if (view === 'iframe') { this.openIframe(param1, cb); - } else if (view == 'search') { + } else if (view === 'search') { this.openSearch(param1, cb); - } else if (view == 'print') { + } else if (view === 'print') { this.openPrint(cb); - } else if (view == 'download') { + } else if (view === 'download') { this.openDownload(cb); } else { this['open' + camelView](param1, param2, cb); -- 2.39.5