X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Ffk.autocomplete.js;h=b1db92c41447df473747736f08b68c8d856cad31;hb=a49bd0a6866a911d9d3c7a6df9a2cd23827a804f;hp=545fd16454aaea3ab949974dc386d0ff2c43f489;hpb=7b48b33b4905d671dc87dd95fcf102d2d2231aef;p=friendica.git diff --git a/js/fk.autocomplete.js b/js/fk.autocomplete.js index 545fd16454..b1db92c414 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; @@ -80,7 +80,7 @@ ACPopup.prototype._search = function(){ that.cont.show(); $(data.items).each(function(){ html = "{1} ({2})".format(this.photo, this.name, this.nick) - that.add(html, this.nick + '+' + this.id + ' - ' + this.link); + that.add(html, this.nick.replace(' ','') + '+' + this.id + ' - ' + this.link); }); } else { that.cont.hide(); @@ -103,6 +103,7 @@ ACPopup.prototype._search = function(){ } else { txt = tinyMCE.activeEditor.getContent(); + // alert(that.searchText + ':' + t); newtxt = txt.replace(that.searchText,t+' '); tinyMCE.activeEditor.setContent(newtxt); tinyMCE.activeEditor.focus();