Improve share modal customization to make it work with async functions

pull/1/head
yflory 7 years ago
parent fd4ed3ce3b
commit 3d3f58b3fc

@ -375,8 +375,8 @@ define([
} }
if (val.embed) { $(link).find('#cp-share-embed').attr('checked', true); } if (val.embed) { $(link).find('#cp-share-embed').attr('checked', true); }
if (val.present) { $(link).find('#cp-share-present').attr('checked', true); } if (val.present) { $(link).find('#cp-share-present').attr('checked', true); }
UI.openCustomModal(UI.dialog.tabs(tabs));
}); });
return tabs;
}; };
UIElements.createFileShareModal = function (config) { UIElements.createFileShareModal = function (config) {
var origin = config.origin; var origin = config.origin;
@ -451,7 +451,7 @@ define([
pathname: pathname pathname: pathname
}); });
} }
UI.openCustomModal(UI.dialog.tabs(tabs)); return tabs;
}; };
UIElements.createButton = function (common, type, rightside, data, callback) { UIElements.createButton = function (common, type, rightside, data, callback) {

@ -444,13 +444,14 @@ define([
'class': 'fa fa-share-alt cp-toolbar-share-button', 'class': 'fa fa-share-alt cp-toolbar-share-button',
title: Messages.shareButton title: Messages.shareButton
}); });
$shareBlock.click(function () { var modal = UIElements.createShareModal({
UIElements.createShareModal({
origin: origin, origin: origin,
pathname: pathname, pathname: pathname,
hashes: hashes, hashes: hashes,
common: Common common: Common
}); });
$shareBlock.click(function () {
UI.openCustomModal(UI.dialog.tabs(modal));
}); });
toolbar.$leftside.append($shareBlock); toolbar.$leftside.append($shareBlock);
@ -472,13 +473,14 @@ define([
'class': 'fa fa-share-alt cp-toolbar-share-button', 'class': 'fa fa-share-alt cp-toolbar-share-button',
title: Messages.shareButton title: Messages.shareButton
}); });
$shareBlock.click(function () { var modal = UIElements.createFileShareModal({
UIElements.createFileShareModal({
origin: origin, origin: origin,
pathname: pathname, pathname: pathname,
hashes: hashes, hashes: hashes,
common: Common common: Common
}); });
$shareBlock.click(function () {
UI.openCustomModal(UI.dialog.tabs(modal));
}); });
toolbar.$leftside.append($shareBlock); toolbar.$leftside.append($shareBlock);

Loading…
Cancel
Save