a better way to deal with js errors in autocomplete plugins if the object is not available
This commit is contained in:
parent
9431785466
commit
63c76eae0c
@ -180,6 +180,10 @@ function string2bb(element) {
|
|||||||
*/
|
*/
|
||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
$.fn.editor_autocomplete = function(backend_url, extra_channels) {
|
$.fn.editor_autocomplete = function(backend_url, extra_channels) {
|
||||||
|
|
||||||
|
if(! this.length)
|
||||||
|
return;
|
||||||
|
|
||||||
if (typeof extra_channels === 'undefined') extra_channels = false;
|
if (typeof extra_channels === 'undefined') extra_channels = false;
|
||||||
|
|
||||||
// Autocomplete contacts
|
// Autocomplete contacts
|
||||||
@ -240,6 +244,10 @@ function string2bb(element) {
|
|||||||
*/
|
*/
|
||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
$.fn.search_autocomplete = function(backend_url) {
|
$.fn.search_autocomplete = function(backend_url) {
|
||||||
|
|
||||||
|
if(! this.length)
|
||||||
|
return;
|
||||||
|
|
||||||
// Autocomplete contacts
|
// Autocomplete contacts
|
||||||
contacts = {
|
contacts = {
|
||||||
match: /(^@)([^\n]{3,})$/,
|
match: /(^@)([^\n]{3,})$/,
|
||||||
@ -285,6 +293,10 @@ function string2bb(element) {
|
|||||||
|
|
||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
$.fn.contact_autocomplete = function(backend_url, typ, autosubmit, onselect) {
|
$.fn.contact_autocomplete = function(backend_url, typ, autosubmit, onselect) {
|
||||||
|
|
||||||
|
if(! this.length)
|
||||||
|
return;
|
||||||
|
|
||||||
if(typeof typ === 'undefined') typ = '';
|
if(typeof typ === 'undefined') typ = '';
|
||||||
if(typeof autosubmit === 'undefined') autosubmit = false;
|
if(typeof autosubmit === 'undefined') autosubmit = false;
|
||||||
|
|
||||||
@ -317,6 +329,10 @@ function string2bb(element) {
|
|||||||
|
|
||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
$.fn.name_autocomplete = function(backend_url, typ, autosubmit, onselect) {
|
$.fn.name_autocomplete = function(backend_url, typ, autosubmit, onselect) {
|
||||||
|
|
||||||
|
if(! this.length)
|
||||||
|
return;
|
||||||
|
|
||||||
if(typeof typ === 'undefined') typ = '';
|
if(typeof typ === 'undefined') typ = '';
|
||||||
if(typeof autosubmit === 'undefined') autosubmit = false;
|
if(typeof autosubmit === 'undefined') autosubmit = false;
|
||||||
|
|
||||||
@ -349,6 +365,9 @@ function string2bb(element) {
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
$.fn.bbco_autocomplete = function(type) {
|
$.fn.bbco_autocomplete = function(type) {
|
||||||
|
|
||||||
|
if(! this.length)
|
||||||
|
return;
|
||||||
|
|
||||||
if(type=='bbcode') {
|
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_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', ];
|
var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ];
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if($("#search-text").length)
|
$("#search-text").contact_autocomplete(baseurl + '/search_ac','',true);
|
||||||
$("#search-text").contact_autocomplete(baseurl + '/search_ac','',true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user