X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Ffk.autocomplete.js;h=2334bb4a2c19887b30f16fa761949fb2de4a1a43;hb=f38306e20b66ba9b2cd4d567e924d99cf797b868;hp=85b51baeb3078796392eb7d09c08faeca4e18a3d;hpb=d4911f15e97123590ad6ecdfd32c84a334134528;p=friendica.git diff --git a/js/fk.autocomplete.js b/js/fk.autocomplete.js index 85b51baeb3..2334bb4a2c 100644 --- a/js/fk.autocomplete.js +++ b/js/fk.autocomplete.js @@ -1,5 +1,5 @@ /** - * Friendika people autocomplete + * Friendica people autocomplete * * require jQuery, jquery.textareas */ @@ -14,22 +14,22 @@ function ACPopup(elm,backend_url){ this.kp_timer = false; this.url = backend_url; + var w = 530; + var h = 130; + + if(typeof elm.editorId == "undefined") { style = $(elm).offset(); w = $(elm).width(); h = $(elm).height(); } else { - style = $(elm.container).offset(); - w = elm.container.offsetWidth; - h = elm.container.offsetHeight; - // Quick fix for chrome until I get a tool to inspect the dom - // Chrome returns 0x0 - if(! w) - w = 530; - if(! h) - h = 130; - + var container = elm.getContainer(); + if(typeof container != "undefined") { + style = $(container).offset(); + w = $(container).width(); + h = $(container).height(); + } } style.top=style.top+h; @@ -89,7 +89,7 @@ ACPopup.prototype._search = function(){ }); } - ACPopup.prototype.add = function(label, value){ +ACPopup.prototype.add = function(label, value){ var that=this; var elm = $("
"+label+"
"); elm.click(function(e){ @@ -103,7 +103,8 @@ ACPopup.prototype._search = function(){ } else { txt = tinyMCE.activeEditor.getContent(); - newtxt = txt.replace(that.searchText,t+' '); + // alert(that.searchText + ':' + t); + newtxt = txt.replace('@' + that.searchText,'@' + t +' '); tinyMCE.activeEditor.setContent(newtxt); tinyMCE.activeEditor.focus(); that.close();