jquery-ui.autocomplete.match
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "jquery-ui.autocomplete.match", | ||
"main": "./lib/jquery-ui.autocomplete.match.js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/asleepwalker/jquery-ui.autocomplete.match", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -1,2 +0,2 @@ | ||
module.exports = function(grunt) { | ||
module.exports = function (grunt) { | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
@@ -22,5 +22,6 @@ grunt.loadNpmTasks('grunt-jscs'); | ||
validateIndentation: '\t', | ||
disallowMultipleVarDecl: null, | ||
requireMultipleVarDecl: true, | ||
requireCurlyBraces: ['if', 'else', 'for', 'while', 'do', 'try', 'catch', 'case'] | ||
requireCurlyBraces: ['if', 'else', 'for', 'while', 'do', 'try', 'catch', 'case'], | ||
requireTrailingComma: false, | ||
requirePaddingNewLinesAfterBlocks: false, | ||
requireDollarBeforejQueryAssignment: false | ||
} | ||
@@ -27,0 +28,0 @@ } |
/* | ||
* jQueryUI.Autocomplete.Match, v1.0.1 | ||
* jQueryUI.Autocomplete.Match, v1.0.2 | ||
* (c) 2014–2017 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru> | ||
@@ -7,15 +7,37 @@ * https://github.com/asleepwalker/jquery-ui.autocomplete.match.js | ||
(function($) { | ||
(function (factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
define(['jquery'], factory); | ||
} else if (typeof module === 'object' && module.exports) { | ||
module.exports = function (root, jQuery) { | ||
if (jQuery === undefined) { | ||
if (typeof window !== 'undefined') { | ||
jQuery = require('jquery'); | ||
} else { | ||
jQuery = require('jquery')(root); | ||
} | ||
} | ||
factory(jQuery); | ||
return jQuery; | ||
}; | ||
} else { | ||
factory(jQuery); | ||
} | ||
}(function ($) { | ||
$.extend($.ui.autocomplete.prototype, { | ||
highlight: false, | ||
_renderItem: function(ul, item) { | ||
var term = this.element.val(), | ||
matcher = new RegExp($.ui.autocomplete.escapeRegex(term), 'gi'), | ||
label = item.label, | ||
matchClass = typeof this.options.highlight == 'string' ? this.options.highlight : 'ui-autocomplete-match'; | ||
_renderItem: function (ul, item) { | ||
var term = this.element.val(); | ||
var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), 'gi'); | ||
var label = item.label; | ||
var matchClass = typeof this.options.highlight == 'string' ? | ||
this.options.highlight | ||
: 'ui-autocomplete-match'; | ||
return $('<li>') | ||
.data('item.autocomplete', item) | ||
.html(this.options.highlight ? label.replace(matcher, '<span class="' + matchClass + '">$&</span>') : label) | ||
.html(this.options.highlight ? | ||
label.replace(matcher, '<span class="' + matchClass + '">$&</span>') | ||
: label) | ||
.appendTo(ul); | ||
@@ -25,2 +47,2 @@ } | ||
})(jQuery); | ||
})); |
{ | ||
"name": "jquery-ui.autocomplete.match", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "jQuery UI plugin for Autocomplete Widget to highlight matches in dropdown lists", | ||
@@ -35,6 +35,6 @@ "main": "lib/jquery-ui.autocomplete.match.js", | ||
"devDependencies": { | ||
"grunt": "~0.4.5", | ||
"grunt-contrib-jshint": "~0.11.0", | ||
"grunt-jscs": "~1.5.0" | ||
"grunt": "~1.0.1", | ||
"grunt-contrib-jshint": "~1.1.0", | ||
"grunt-jscs": "~3.0.1" | ||
} | ||
} |
5873
105