From fb2da27115b8003b1a491e7dfb2c767e211651e3 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Fri, 9 Aug 2019 14:06:37 +0200 Subject: [PATCH 1/2] Add download file from contextmenu in code and slide apps --- www/common/common-ui-elements.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f4551c4ef..f66b4a3fe 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2854,10 +2854,14 @@ define([ 'aria-labelledBy': 'dropdownMenu', 'style': 'display:block;position:static;margin-bottom:5px;' }, [ - h('li', h('a.dropdown-item', { + h('li', h('a.cp-app-drive-context-saveindrive.dropdown-item', { 'tabindex': '-1', 'data-icon': "fa-cloud-upload", - }, Messages.pad_mediatagImport)) + }, Messages.pad_mediatagImport)), + h('li', h('a.cp-app-drive-context-download.dropdown-item', { + 'tabindex': '-1', + 'data-icon': "fa-download", + }, Messages.download_mt_button)), ]) ]); $(menu).find("li a.dropdown-item").each(function (i, el) { @@ -2879,7 +2883,13 @@ define([ e.stopPropagation(); m.hide(); var $mt = $menu.data('mediatag'); - common.importMediaTag($mt); + if ($(this).hasClass("cp-app-drive-context-saveindrive")) { + common.importMediaTag($mt); + } + else if ($(this).hasClass("cp-app-drive-context-download")) { + var media = $mt[0]._mediaObject; + window.saveAs(media._blob.content, media.name); + } }); return m; From c3c918cce7e3bf5c171ab7cb8791a435dd38dd32 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Mon, 12 Aug 2019 10:55:03 +0200 Subject: [PATCH 2/2] Fix classname of contextmenu options --- www/common/common-ui-elements.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index f66b4a3fe..cc1e46d7b 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2854,11 +2854,11 @@ define([ 'aria-labelledBy': 'dropdownMenu', 'style': 'display:block;position:static;margin-bottom:5px;' }, [ - h('li', h('a.cp-app-drive-context-saveindrive.dropdown-item', { + h('li', h('a.cp-app-code-context-saveindrive.dropdown-item', { 'tabindex': '-1', 'data-icon': "fa-cloud-upload", }, Messages.pad_mediatagImport)), - h('li', h('a.cp-app-drive-context-download.dropdown-item', { + h('li', h('a.cp-app-code-context-download.dropdown-item', { 'tabindex': '-1', 'data-icon': "fa-download", }, Messages.download_mt_button)), @@ -2883,10 +2883,10 @@ define([ e.stopPropagation(); m.hide(); var $mt = $menu.data('mediatag'); - if ($(this).hasClass("cp-app-drive-context-saveindrive")) { + if ($(this).hasClass("cp-app-code-context-saveindrive")) { common.importMediaTag($mt); } - else if ($(this).hasClass("cp-app-drive-context-download")) { + else if ($(this).hasClass("cp-app-code-context-download")) { var media = $mt[0]._mediaObject; window.saveAs(media._blob.content, media.name); }