From 306c6cbf1beaeff8ec8a2010249dadc98beb629d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 7 Apr 2022 16:42:49 +0200 Subject: [PATCH] wait #5219 @1.5 --- js/libs/fluidbook/fluidbook.input.js | 17 ++++++----------- js/libs/fluidbook/fluidbook.links.js | 23 +++++++++++++++++------ js/libs/fluidbook/fluidbook.menu.js | 14 +++++++++++--- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.input.js b/js/libs/fluidbook/fluidbook.input.js index f8381b66..08b0c9fe 100644 --- a/js/libs/fluidbook/fluidbook.input.js +++ b/js/libs/fluidbook/fluidbook.input.js @@ -42,7 +42,7 @@ FluidbookInput.prototype = { this.setMouseClasses(); } - if (Modernizr.ios || Modernizr.android) { + if (Modernizr.ios || Modernizr.android || this.fluidbook.settings.phonegap === 'ios' || this.fluidbook.settings.phonegap === 'android') { this.usingTouch = this.hasTouch = this.forceTouch = true; this.usingMouse = this.hasMouse = this.forceMouse = false; this.usingKeyboard = this.hasKeyboard = this.forceKeyboard = false; @@ -68,8 +68,7 @@ FluidbookInput.prototype = { isUsingMouse: function () { return this.usingMouse; - }, - isUsingKeyboard: function () { + }, isUsingKeyboard: function () { return this.usingKeyboard; }, @@ -79,15 +78,13 @@ FluidbookInput.prototype = { this.usingKeyboard = this.usingMouse = false; this.setTouchClasses(); } - }, - useMouse: function () { + }, useMouse: function () { if (!this.usingMouse) { this.hasMouse = this.usingMouse = true; this.usingKeyboard = this.usingTouch = false; this.setMouseClasses(); } - }, - useKeyboard: function () { + }, useKeyboard: function () { if (!this.usingKeyboard) { this.hasKeyboard = this.usingKeyboard = true; this.usingMouse = this.usingTouch = false; @@ -103,16 +100,14 @@ FluidbookInput.prototype = { .addClass('using-touch') .addClass('no-using-keyboard'); - }, - setMouseClasses: function () { + }, setMouseClasses: function () { $('html').addClass('using-mouse') .addClass('no-using-touch') .addClass('no-using-keyboard') .removeClass('no-using-mouse') .removeClass('using-touch') .removeClass('using-keyboard'); - }, - setKeyboardClasses: function () { + }, setKeyboardClasses: function () { $('html').addClass('using-keyboard') .addClass('no-using-touch') .addClass('no-using-mouse') diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index 17c6b483..45ad51be 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -32,22 +32,33 @@ FluidbookLinks.prototype = { if (this.fluidbook.settings.phonegap === 'ios') { $(document).on('touchstart touchend click', 'a.clickonly', function (e) { - e.preventDefault(); - e.stopPropagation(); - e.stopImmediatePropagation(); + var cancel = function (e) { + e.preventDefault(); + e.stopPropagation(); + e.stopImmediatePropagation(); + }; if (e.type === 'touchstart') { $(this).data('touchstart', Date.now()); + cancel(e); } else if (e.type === 'touchend') { var start = $(this).data('touchstart'); if (start === null) { - return; + cancel(e); + return false; } var diff = Date.now() - start; if (diff > 300) { - return; + cancel(e); + return false; + } + var href = $(this).attr('href'); + if (href !== undefined && href !== null && href !== '' && href !== '#') { + cancel(e); + window.location = href; + return false; } - window.location = $(this).attr('href'); + return true; } }); } diff --git a/js/libs/fluidbook/fluidbook.menu.js b/js/libs/fluidbook/fluidbook.menu.js index ca0b0d7e..f0b3f405 100644 --- a/js/libs/fluidbook/fluidbook.menu.js +++ b/js/libs/fluidbook/fluidbook.menu.js @@ -32,7 +32,9 @@ FluidbookMenu.prototype = { viewMode: function () { return $("#view .mview").length > 0; - }, openView: function (view, param1, param2, callback) { + }, + + openView: function (view, param1, param2, callback) { var $this = this; setTimeout(function () { @@ -57,7 +59,9 @@ FluidbookMenu.prototype = { } else { this.__openView(view, param1, param2, callback); } - }, __openView: function (view, param1, param2, callback) { + }, + + __openView: function (view, param1, param2, callback) { try { if (typeof param1 === 'string') { @@ -116,11 +120,15 @@ FluidbookMenu.prototype = { } else { this['open' + camelView](param1, param2, cb); } + + this.fluidbook.nav.closeMenu(); }, openNotes: function (p1, p2, cb) { this.fluidbook.notes.openMenu(cb); }, openSearch: function (q, cb) { this.fluidbook.nav.openSearch(q, cb); - }, openingView: function (callback, view) { + }, + + openingView: function (callback, view) { var $this = this; this.fluidbook.resize.resizeView(); this.fluidbook.tooltip.hideTooltip(); -- 2.39.5