diff --git a/etemplate/js/et2_widget_url.js b/etemplate/js/et2_widget_url.js index f0b35f011a..e9abd98ebd 100644 --- a/etemplate/js/et2_widget_url.js +++ b/etemplate/js/et2_widget_url.js @@ -308,6 +308,51 @@ var et2_url_ro = et2_valueWidget.extend([et2_IDetachedDOM], this.span.attr("target", "_blank"); } } + // Add contact_plus button + if (this.options.contact_plus) + { + // If user doesn't have access to addressbook, stop + if(!egw.app('addressbook')) return; + + // Bind onmouseenter event on tag in order to add contact plus + this.span.on ({ + mouseenter: function (event) + { + event.stopImmediatePropagation(); + var self = this; + jQuery(this).tooltip({ + items: 'a.et2_email', + position: {my:"right top", at:"left top", collision:"flipfit"}, + tooltipClass: "et2_email_popup", + content: function() + { + // Here we could do all sorts of things + var extra = { + 'presets[email]': jQuery(this).text() + }; + + return jQuery('') + .on('click', function() { + egw.open('','addressbook','add',extra); + }); + }, + close: function( event, ui ) + { + ui.tooltip.hover( + function () { + jQuery(this).stop(true).fadeTo(400, 1); + //.fadeIn("slow"); // doesn't work because of stop() + }, + function () { + jQuery(this).fadeOut("400", function(){ jQuery(this).remove();}); + } + ); + } + }) + .tooltip("open"); + }, + }); + } break; } }, @@ -339,51 +384,7 @@ var et2_url_ro = et2_valueWidget.extend([et2_IDetachedDOM], { _nodes[0].setAttribute("class", _values["class"]); } - // Add contact_plus button - if (this.options.contact_plus && this._type == "url-email" ) - { - // If user doesn't have access to addressbook, stop - if(!egw.app('addressbook')) return; - - // Bind onmouseenter event on tag in order to add contact plus - this.span.on ({ - mouseenter: function (event) - { - event.stopImmediatePropagation(); - var self = this; - jQuery(this).tooltip({ - items: 'a.et2_email', - position: {my:"right top", at:"left top", collision:"flipfit"}, - tooltipClass: "et2_email_popup", - content: function() - { - // Here we could do all sorts of things - var extra = { - 'presets[email]': jQuery(this).text() - }; - - return jQuery('') - .on('click', function() { - egw.open('','addressbook','add',extra); - }); - }, - close: function( event, ui ) - { - ui.tooltip.hover( - function () { - jQuery(this).stop(true).fadeTo(400, 1); - //.fadeIn("slow"); // doesn't work because of stop() - }, - function () { - jQuery(this).fadeOut("400", function(){ jQuery(this).remove();}); - } - ); - } - }) - .tooltip("open"); - }, - }); - } + } }); et2_register_widget(et2_url_ro, ["url_ro", "url-email_ro", "url-phone_ro"]); \ No newline at end of file