/** * Created by imfaber on 19/05/2018. */ /** * @file * JavaScript file for the AdminGoto plugin. */ (function ($) { 'use strict'; // console.log(AdminGoto); $(function() { // Remap the filter functions for autocomplete to recognise the // extra value "command". var proto = $.ui.autocomplete.prototype; var initSource = proto._initSource; function filter(array, term) { var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), 'i'); return $.grep(array, function (value) { return matcher.test(value.title); }); } $.extend(proto, { _initSource: function () { if ($.isArray(this.options.source)) { this.source = function (request, response) { response(filter(this.options.source, request.term)); }; } else { initSource.call(this); } } }); var body = $('body'); /** * The HTML elements. */ AdminGoto.label = $('