From 97888c11c4f121a31698b6845698ed0ad1a2aec8 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 16 Nov 2021 18:36:28 +0100 Subject: [PATCH] wait #4884 @1 --- js/libs/fluidbook/fluidbook.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index d8f68267..4456511e 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -1034,6 +1034,8 @@ Fluidbook.prototype = { url = url.replace('$uuid', this.stats.vid); + var attrs = ""; + if (target == undefined) { target = '_self'; } @@ -1041,6 +1043,15 @@ Fluidbook.prototype = { options = ''; } + if (target === '_download') { + var e = url.split('/'); + var last = e.pop(); + e = last.split('?'); + var name = e.shift(); + this.clickFakeLink(''); + return false; + } + // fix #3407 if (target === '_popupiframe' && Modernizr.ios && url.search(/\.pdf$/) >= 0) { target = '_blank'; @@ -1092,14 +1103,8 @@ Fluidbook.prototype = { if (options == undefined && replace == undefined) { if (this.support.IE == 0) { w = win.open(url, mtarget); - console.log(w); } else { - $("#wopen").remove(); - $('body').append(''); - $("#wopen").get(0).click(); - setTimeout(function () { - $("#wopen").remove(); - }, 200); + this.clickFakeLink(''); } } else { w = win.open(url, mtarget, options, replace); @@ -1116,6 +1121,17 @@ Fluidbook.prototype = { return w; }, + clickFakeLink: function (html) { + var a = $(html); + $(a).attr('id', 'wopen'); + $("#wopen").remove(); + $('body').append(a); + $("#wopen").get(0).click(); + setTimeout(function () { + $("#wopen").remove(); + }, 200); + }, + openInPopupIframe: function (url, callback) { this.menu.openView('freeiframe', url, '', function () { if (callback !== undefined) { -- 2.39.5