summaryrefslogtreecommitdiff
path: root/skins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-04-04 14:02:17 +0200
committerAleksander Machniak <alec@alec.pl>2013-04-04 14:02:17 +0200
commit443b92a7ee19e321b350750240e0fc54ec5be357 (patch)
tree9cd4ec8d5b0167f846ef85c0fb7c543c1a260f9f /skins
parent76a98da33e3724ce4007031a7f75890a8e74c85b (diff)
Add add_popup() method to make possible to register popup from a plugin.
It was possible with show_popup(), however sometimes it is needed to register a popup before show_popup() is being used.
Diffstat (limited to 'skins')
-rw-r--r--skins/larry/ui.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 58e03fbdc..75d38d9aa 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -38,6 +38,7 @@ function rcube_mail_ui()
this.init_tabs = init_tabs;
this.show_about = show_about;
this.show_popup = show_popup;
+ this.add_popup = add_popup;
this.set_searchmod = set_searchmod;
this.show_uploadform = show_uploadform;
this.show_header_row = show_header_row;
@@ -430,13 +431,25 @@ function rcube_mail_ui()
/**
+ * Register a popup menu
+ */
+ function add_popup(popup, config)
+ {
+ var obj = popups[popup] = $('#'+popup);
+ obj.appendTo(document.body); // move it to top for proper absolute positioning
+
+ if (obj.length)
+ popupconfig[popup] = $.extend(popupconfig[popup] || {}, config || {});
+ }
+
+ /**
* Trigger for popup menus
*/
function show_popup(popup, show, config)
{
// auto-register menu object
if (config || !popupconfig[popup])
- popupconfig[popup] = $.extend(popupconfig[popup] || {}, config);
+ add_popup(popup, config);
var visible = show_popupmenu(popup, show),
config = popupconfig[popup];