Skip to content
This repository has been archived by the owner on Feb 18, 2018. It is now read-only.

Commit

Permalink
Introduce defaults command #15.
Browse files Browse the repository at this point in the history
Apply additional options (merged in existing defaults) with `$.fn.autoSuggest('defaults', additionalOtions);`

Replace the existing defaults for the *next* new autosuggest instance with `$.fn.autoSuggest('defaults', replaceOptions, true);`
  • Loading branch information
knalli committed Mar 29, 2013
1 parent 2e7f97d commit a75433a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,14 @@ echo json_encode($data);

## Release History

## 2013-03-29 Version 2.3.0

* Add method `defaults` allowing extending or overriding the defaults: i.e. `$.fn.autoSuggest('defaults', {searchObjProps: 'title'});`

## 2013-03-29 Version 2.2.0

* Change: Switch to Grunt 0.4

## 2013-03-03 Version 2.1.0

* Fix: Travis builds weren't be possible. Instead of using hooks in `travis.yml` this will be now managed by a `Gemfile` and `bundler`.
Expand Down
11 changes: 10 additions & 1 deletion dist/jquery.autoSuggest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jQuery AutoSuggest - v2.2.0 - 2013-03-29
/*! jQuery AutoSuggest - v2.3.0 - 2013-03-29
* URL: http://hlsolutions.github.com/jquery-autosuggest
* Copyright (c) 2013 Jan Philipp
* Licensed MIT, GPL */
Expand Down Expand Up @@ -1115,6 +1115,15 @@ Based on the 1.6er release dated in July, 2012
value = values[_i];
element.trigger('removeSelection', value);
}
},
defaults: function(options, replace) {
if (replace == null) {
replace = false;
}
if (replace) {
defaults = {};
}
$.extend(defaults, options);
}
};

Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.autoSuggest.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jquery.autoSuggest",
"title": "jQuery AutoSuggest",
"description": "An autosuggest and autocomplete plugin for jQuery. With CoffeeScript and SASS flavour.",
"version": "2.2.0",
"version": "2.3.0",
"homepage": "http://hlsolutions.github.com/jquery-autosuggest",
"author": {
"name": "Jan Philipp",
Expand Down
5 changes: 5 additions & 0 deletions src/jquery.autoSuggest.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,11 @@ pluginMethods =
element.trigger 'removeSelection', value
return

# plugin method to reset the defaults (optionally reset)
defaults : (options, replace = false) ->
defaults = {} if replace
$.extend defaults, options
return

# Define the actual jQuery plugin constructor.
$.fn.autoSuggest = (method) ->
Expand Down

0 comments on commit a75433a

Please sign in to comment.