X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=js%2Ffk.autocomplete.js;h=509466bd9878f3810cadc00259af22db3bdc7198;hb=c47bae7a5f1ec1ee7966369dc0c9693564670065;hp=bf96e69373961653d9a420ebec89b77c59f731b5;hpb=bed0043b30c219a08aa0b352923299ea153d515c;p=friendica.git diff --git a/js/fk.autocomplete.js b/js/fk.autocomplete.js old mode 100644 new mode 100755 index bf96e69373..509466bd98 --- a/js/fk.autocomplete.js +++ b/js/fk.autocomplete.js @@ -1,5 +1,5 @@ /** - * Friendika people autocomplete + * Friendica people autocomplete * * require jQuery, jquery.textareas */ @@ -13,24 +13,41 @@ function ACPopup(elm,backend_url){ this.ready=true; this.kp_timer = false; this.url = backend_url; - - style = $(elm).offset(); - w = $(elm).width(); - h = $(elm).height(); + + 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; + + } + style.top=style.top+h; - style['max-height'] = '150px'; style.width = w; - style.border = '1px solid red'; - style.background = '#cccccc'; style.position = 'absolute'; - style.overflow = 'auto'; - style['z-index'] = '100000'; + /* style['max-height'] = '150px'; + style.border = '1px solid red'; + style.background = '#cccccc'; + + style.overflow = 'auto'; + style['z-index'] = '100000'; + */ style.display = 'none'; this.cont = $("
"); this.cont.css(style); - $(elm).after(this.cont); + $("body").append(this.cont); } ACPopup.prototype.close = function(){ $(this.cont).remove(); @@ -40,7 +57,7 @@ ACPopup.prototype.search = function(text){ var that = this; this.searchText=text; if (this.kp_timer) clearTimeout(this.kp_timer); - this.kp_timer = setTimeout( function(){that._search();}, 1000); + this.kp_timer = setTimeout( function(){that._search();}, 500); } ACPopup.prototype._search = function(){ console.log("_search"); @@ -63,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); + that.add(html, this.nick.replace(' ','') + '+' + this.id + ' - ' + this.link); }); } else { that.cont.hide(); @@ -72,23 +89,36 @@ ACPopup.prototype._search = function(){ }); } -ACPopup.prototype.add = function(label, value){ + ACPopup.prototype.add = function(label, value){ var that=this; var elm = $("