X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Fautocomplete.js;h=8020478722413cf47937e6f88d6268cccabb62b3;hb=de431e185e81cf7fe3f73b2977f777c040964479;hp=108447ad22281ce37892a6e014ad21d3936813d0;hpb=f83040f625730d35db81c6a50916719c4d5be4ae;p=friendica.git diff --git a/js/autocomplete.js b/js/autocomplete.js index 108447ad22..8020478722 100644 --- a/js/autocomplete.js +++ b/js/autocomplete.js @@ -104,6 +104,13 @@ function basic_replace(item) { return '$1'+item.name+' '; } +function webbie_replace(item) { + if(typeof item.replace !== 'undefined') + return '$1'+item.replace; + + return '$1'+item.nick+' '; +} + function trim_replace(item) { if(typeof item.replace !== 'undefined') return '$1'+item.replace; @@ -163,6 +170,9 @@ function listNewLineAutocomplete(id) { setCaretPosition(text, caretPos + 5); return true; } + else { + return false; + } } function string2bb(element) { @@ -213,7 +223,7 @@ function string2bb(element) { match: /(^@)([^\n]{2,})$/, index: 2, search: function(term, callback) { contact_search(term, callback, backend_url, 'x', 'contact'); }, - replace: basic_replace, + replace: webbie_replace, template: contact_format, }; @@ -222,7 +232,7 @@ function string2bb(element) { match: /(^!)([^\n]{2,})$/, index: 2, search: function(term, callback) { contact_search(term, callback, backend_url, 'x', 'community'); }, - replace: basic_replace, + replace: webbie_replace, template: contact_format, }; this.attr('autocomplete', 'off'); @@ -286,7 +296,7 @@ function string2bb(element) { $.fn.bbco_autocomplete = function(type) { if(type=='bbcode') { - var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size']; + var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'quote', 'code', 'spoiler', 'map', 'img', 'url', 'audio', 'video', 'youtube', 'vimeo', 'list', 'ul', 'ol', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'nobb', 'noparse', 'pre', 'abstract']; var open_elements = ['*', 'hr']; var elements = open_close_elements.concat(open_elements); @@ -325,11 +335,12 @@ function string2bb(element) { a.on('textComplete:select', function(e, value, strategy) { value; }); a.keypress(function(e){ - e.stopImmediatePropagation(); if (e.keyCode == 13) { var x = listNewLineAutocomplete(this.id); - if(x) + if(x) { + e.stopImmediatePropagation(); e.preventDefault(); + } } }); };