diff --git a/www/common/common-interface.js b/www/common/common-interface.js
index 735d3fb37..4fa409604 100644
--- a/www/common/common-interface.js
+++ b/www/common/common-interface.js
@@ -462,6 +462,35 @@ define([
return frame;
};
+ UI.createModal = function (cfg) {
+ var $body = cfg.$body || $('body');
+ var $blockContainer = $body.find('#'+cfg.id);
+ if (!$blockContainer.length) {
+ $blockContainer = $(h('div.cp-modal-container#'+cfg.id, {
+ tabindex: 1
+ }));
+ }
+ var hide = function () {
+ if (cfg.onClose) { return void cfg.onClose(); }
+ $blockContainer.hide();
+ };
+ $blockContainer.html('').appendTo($body);
+ var $block = $(h('div.cp-modal')).appendTo($blockContainer);
+ $(h('span.cp-modal-close.fa.fa-times', {
+ title: Messages.filePicker_close
+ })).click(hide).appendTo($block);
+ $body.click(hide);
+ $block.click(function (e) {
+ e.stopPropagation();
+ });
+ $body.keydown(function (e) {
+ if (e.which === 27) {
+ hide();
+ }
+ });
+ return $blockContainer;
+ };
+
UI.alert = function (msg, cb, opt) {
var force = false;
if (typeof(opt) === 'object') {
diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js
index 4d487f779..6377e2fb8 100644
--- a/www/common/common-ui-elements.js
+++ b/www/common/common-ui-elements.js
@@ -2538,37 +2538,6 @@ define([
return $block;
};
- UIElements.createModal = function (cfg) {
- var $body = cfg.$body || $('body');
- var $blockContainer = $body.find('#'+cfg.id);
- if (!$blockContainer.length) {
- $blockContainer = $('
', {
- 'class': 'cp-modal-container',
- tabindex: 1,
- 'id': cfg.id
- });
- }
- var hide = function () {
- if (cfg.onClose) { return void cfg.onClose(); }
- $blockContainer.hide();
- };
- $blockContainer.html('').appendTo($body);
- var $block = $('
', {'class': 'cp-modal'}).appendTo($blockContainer);
- $('', {
- 'class': 'cp-modal-close fa fa-times',
- 'title': Messages.filePicker_close
- }).click(hide).appendTo($block);
- $body.click(hide);
- $block.click(function (e) {
- e.stopPropagation();
- });
- $body.keydown(function (e) {
- if (e.which === 27) {
- hide();
- }
- });
- return $blockContainer;
- };
UIElements.createNewPadModal = function (common) {
// if in drive, show new pad modal instead
@@ -2576,7 +2545,7 @@ define([
return void $(".cp-app-drive-element-row.cp-app-drive-new-ghost").click();
}
- var $modal = UIElements.createModal({
+ var $modal = UI.createModal({
id: 'cp-app-toolbar-creation-dialog',
$body: $('body')
});
diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js
index 81f7a6e54..787caa6b4 100644
--- a/www/common/drive-ui.js
+++ b/www/common/drive-ui.js
@@ -2892,7 +2892,7 @@ define([
$element.append($('', {'class': 'cp-app-drive-element-name'})
.text(Messages.fm_newFile));
$element.click(function () {
- var $modal = UIElements.createModal({
+ var $modal = UI.createModal({
id: 'cp-app-drive-new-ghost-dialog',
$body: $('body')
});
diff --git a/www/filepicker/inner.js b/www/filepicker/inner.js
index aba1ed77b..2eb9b4120 100644
--- a/www/filepicker/inner.js
+++ b/www/filepicker/inner.js
@@ -81,7 +81,7 @@ define([
var createFileDialog = function () {
var types = filters.types || [];
// Create modal
- var $blockContainer = UIElements.createModal({
+ var $blockContainer = UI.createModal({
id: 'cp-filepicker-dialog',
$body: $body,
onClose: hideFileDialog
diff --git a/www/teams/inner.js b/www/teams/inner.js
index 4dccf34d1..ae67c6f6e 100644
--- a/www/teams/inner.js
+++ b/www/teams/inner.js
@@ -535,7 +535,7 @@ define([
};
var makePermissions = function () {
- var $blockContainer = UIElements.createModal({
+ var $blockContainer = UI.createModal({
id: 'cp-teams-roster-dialog',
}).show();