aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/autocomplete.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-04-26 15:40:59 +0200
committerMario Vavti <mario@mariovavti.com>2018-04-26 15:40:59 +0200
commit63c76eae0c87a07e5ee0fc7b88a3e6c56bba6969 (patch)
tree3fd023b6dc4e5190c17932cf7c0f7332b30eeed7 /view/js/autocomplete.js
parent94317854665bc64c53271daada2ada15d238c988 (diff)
downloadvolse-hubzilla-63c76eae0c87a07e5ee0fc7b88a3e6c56bba6969.tar.gz
volse-hubzilla-63c76eae0c87a07e5ee0fc7b88a3e6c56bba6969.tar.bz2
volse-hubzilla-63c76eae0c87a07e5ee0fc7b88a3e6c56bba6969.zip
a better way to deal with js errors in autocomplete plugins if the object is not available
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r--view/js/autocomplete.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 7bbcd6451..5fbdab27b 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -180,6 +180,10 @@ function string2bb(element) {
*/
(function( $ ) {
$.fn.editor_autocomplete = function(backend_url, extra_channels) {
+
+ if(! this.length)
+ return;
+
if (typeof extra_channels === 'undefined') extra_channels = false;
// Autocomplete contacts
@@ -240,6 +244,10 @@ function string2bb(element) {
*/
(function( $ ) {
$.fn.search_autocomplete = function(backend_url) {
+
+ if(! this.length)
+ return;
+
// Autocomplete contacts
contacts = {
match: /(^@)([^\n]{3,})$/,
@@ -285,6 +293,10 @@ function string2bb(element) {
(function( $ ) {
$.fn.contact_autocomplete = function(backend_url, typ, autosubmit, onselect) {
+
+ if(! this.length)
+ return;
+
if(typeof typ === 'undefined') typ = '';
if(typeof autosubmit === 'undefined') autosubmit = false;
@@ -317,6 +329,10 @@ function string2bb(element) {
(function( $ ) {
$.fn.name_autocomplete = function(backend_url, typ, autosubmit, onselect) {
+
+ if(! this.length)
+ return;
+
if(typeof typ === 'undefined') typ = '';
if(typeof autosubmit === 'undefined') autosubmit = false;
@@ -349,6 +365,9 @@ function string2bb(element) {
(function( $ ) {
$.fn.bbco_autocomplete = function(type) {
+ if(! this.length)
+ return;
+
if(type=='bbcode') {
var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'observer.language','embed', 'highlight', 'url', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ];