locomotivecms_wagon 2.2.0.beta1 → 2.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/generators/blank/config/metafields_schema.yml +1 -1
- data/generators/bootstrap/config/metafields_schema.yml +1 -1
- data/generators/{foundation5 → foundation}/Gemfile.tt +1 -1
- data/generators/{foundation5 → foundation}/Guardfile +0 -0
- data/generators/foundation/app/content_types/.gitkeep +0 -0
- data/generators/foundation/app/views/pages/404.liquid +11 -0
- data/generators/{foundation5 → foundation}/app/views/pages/404.liquid.haml +4 -3
- data/generators/{foundation5 → foundation}/app/views/pages/index.liquid +54 -78
- data/generators/foundation/app/views/pages/index.liquid.haml +144 -0
- data/generators/foundation/app/views/snippets/.gitkeep +0 -0
- data/generators/{foundation5 → foundation}/config/deploy.yml +2 -1
- data/generators/{foundation5 → foundation}/config/metafields_schema.yml +1 -1
- data/generators/{foundation5/config/site.yml.tt → foundation/config/site.yml} +2 -2
- data/generators/{foundation5 → foundation}/config/translations.yml +0 -0
- data/generators/foundation/data/.gitkeep +0 -0
- data/generators/foundation/log/.gitkeep +0 -0
- data/generators/foundation/public/images/.gitkeep +0 -0
- data/generators/foundation/public/javascripts/app.js +1 -0
- data/generators/foundation/public/javascripts/vendor/foundation.js +7472 -0
- data/generators/foundation/public/javascripts/vendor/foundation.min.js +3 -0
- data/generators/foundation/public/javascripts/vendor/what-input.js +212 -0
- data/generators/foundation/public/javascripts/vendor/what-input.min.js +1 -0
- data/generators/foundation/public/stylesheets/_settings.scss +529 -0
- data/generators/foundation/public/stylesheets/app.css +3 -0
- data/generators/foundation/public/stylesheets/app.scss +43 -0
- data/generators/foundation/public/stylesheets/foundation.css +3499 -0
- data/generators/foundation/public/stylesheets/foundation6/_global.scss +197 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_accordion-menu.scss +28 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_accordion.scss +112 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_badge.scss +55 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_breadcrumbs.scss +94 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_button-group.scss +115 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_button.scss +264 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_callout.scss +115 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_close-button.scss +61 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_drilldown.scss +67 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_dropdown-menu.scss +123 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_dropdown.scss +64 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_flex-video.scss +68 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_float.scss +27 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_label.scss +56 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_media-object.scss +74 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_menu.scss +213 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_off-canvas.scss +170 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_orbit.scss +186 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_pagination.scss +161 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_progress-bar.scss +83 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_reveal.scss +155 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_slider.scss +158 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_sticky.scss +38 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_switch.scss +231 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_table.scss +212 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_tabs.scss +137 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_thumbnail.scss +54 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_title-bar.scss +44 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_tooltip.scss +110 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_top-bar.scss +57 -0
- data/generators/foundation/public/stylesheets/foundation6/components/_visibility.scss +131 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_checkbox.scss +36 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_error.scss +81 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_fieldset.scss +53 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_forms.scss +32 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_help-text.scss +30 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_input-group.scss +70 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_label.scss +48 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_select.scss +64 -0
- data/generators/foundation/public/stylesheets/foundation6/forms/_text.scss +153 -0
- data/generators/foundation/public/stylesheets/foundation6/foundation.scss +91 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_classes.scss +132 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_column.scss +112 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_flex-grid.scss +191 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_grid.scss +33 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_gutter.scss +31 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_layout.scss +32 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_position.scss +71 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_row.scss +72 -0
- data/generators/foundation/public/stylesheets/foundation6/grid/_size.scss +24 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/_classes.scss +102 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/_settings.scss +61 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_fade.scss +29 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_hinge.scss +65 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_shake.scss +15 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_slide.scss +41 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_spin.scss +28 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_wiggle.scss +13 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/effects/_zoom.scss +15 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/motion-ui.scss +29 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_fade.scss +28 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_hinge.scss +43 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_slide.scss +42 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_spin.scss +39 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/transitions/_zoom.scss +39 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_animation.scss +7 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_args.scss +15 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_keyframe.scss +136 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_selector.scss +23 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_series.scss +54 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_transition.scss +45 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui/util/_unit.scss +7 -0
- data/generators/foundation/public/stylesheets/foundation6/motion-ui.scss +4 -0
- data/generators/foundation/public/stylesheets/foundation6/settings/_settings.scss +531 -0
- data/generators/foundation/public/stylesheets/foundation6/typography/_alignment.scss +21 -0
- data/generators/foundation/public/stylesheets/foundation6/typography/_base.scss +436 -0
- data/generators/foundation/public/stylesheets/foundation6/typography/_helpers.scss +77 -0
- data/generators/foundation/public/stylesheets/foundation6/typography/_print.scss +73 -0
- data/generators/foundation/public/stylesheets/foundation6/typography/_typography.scss +28 -0
- data/generators/foundation/public/stylesheets/foundation6/util/_breakpoint.scss +182 -0
- data/generators/foundation/public/stylesheets/foundation6/util/_color.scss +41 -0
- data/generators/foundation/public/stylesheets/foundation6/util/_mixins.scss +190 -0
- data/generators/foundation/public/stylesheets/foundation6/util/_selector.scss +39 -0
- data/generators/foundation/public/stylesheets/foundation6/util/_unit.scss +69 -0
- data/generators/foundation/public/stylesheets/foundation6/util/_util.scss +15 -0
- data/generators/foundation/public/stylesheets/foundation6/util/_value.scss +117 -0
- data/generators/{foundation5/public/stylesheets/normalize.css.scss → foundation/public/stylesheets/foundation6/vendor/normalize.scss} +8 -11
- data/generators/site_metafields/schema.yml.tt +1 -1
- data/lib/locomotive/wagon/commands/push_command.rb +1 -0
- data/lib/locomotive/wagon/commands/serve_command.rb +1 -0
- data/lib/locomotive/wagon/decorators/concerns/persist_assets_concern.rb +3 -3
- data/lib/locomotive/wagon/decorators/content_type_decorator.rb +5 -1
- data/lib/locomotive/wagon/generators/site/{foundation5.rb → foundation.rb} +8 -12
- data/lib/locomotive/wagon/generators/site.rb +1 -1
- data/lib/locomotive/wagon/version.rb +1 -1
- data/locomotivecms_wagon.gemspec +3 -2
- data/spec/fixtures/cassettes/authenticate.yml +38 -38
- data/spec/fixtures/cassettes/delete.yml +211 -211
- data/spec/fixtures/cassettes/push.yml +1333 -1374
- data/spec/integration/cli_spec.rb +1 -1
- data/spec/unit/decorators/content_entry_decorator_spec.rb +23 -0
- metadata +133 -104
- data/generators/foundation5/app/content_types/.empty_directory +0 -1
- data/generators/foundation5/app/views/pages/404.liquid +0 -10
- data/generators/foundation5/app/views/pages/index.liquid.haml +0 -157
- data/generators/foundation5/data/.empty_directory +0 -1
- data/generators/foundation5/icon.png +0 -0
- data/generators/foundation5/public/fonts/.empty_directory +0 -1
- data/generators/foundation5/public/images/.empty_directory +0 -1
- data/generators/foundation5/public/javascripts/foundation/foundation.abide.js +0 -299
- data/generators/foundation5/public/javascripts/foundation/foundation.accordion.js +0 -59
- data/generators/foundation5/public/javascripts/foundation/foundation.alert.js +0 -43
- data/generators/foundation5/public/javascripts/foundation/foundation.clearing.js +0 -534
- data/generators/foundation5/public/javascripts/foundation/foundation.dropdown.js +0 -311
- data/generators/foundation5/public/javascripts/foundation/foundation.equalizer.js +0 -74
- data/generators/foundation5/public/javascripts/foundation/foundation.interchange.js +0 -331
- data/generators/foundation5/public/javascripts/foundation/foundation.joyride.js +0 -843
- data/generators/foundation5/public/javascripts/foundation/foundation.js +0 -611
- data/generators/foundation5/public/javascripts/foundation/foundation.magellan.js +0 -178
- data/generators/foundation5/public/javascripts/foundation/foundation.offcanvas.js +0 -108
- data/generators/foundation5/public/javascripts/foundation/foundation.orbit.js +0 -610
- data/generators/foundation5/public/javascripts/foundation/foundation.reveal.js +0 -437
- data/generators/foundation5/public/javascripts/foundation/foundation.slider.js +0 -199
- data/generators/foundation5/public/javascripts/foundation/foundation.tab.js +0 -167
- data/generators/foundation5/public/javascripts/foundation/foundation.tooltip.js +0 -298
- data/generators/foundation5/public/javascripts/foundation/foundation.topbar.js +0 -425
- data/generators/foundation5/public/javascripts/foundation.js +0 -4161
- data/generators/foundation5/public/javascripts/foundation.min.js +0 -10
- data/generators/foundation5/public/javascripts/vendor/custom.modernizr.js +0 -4
- data/generators/foundation5/public/javascripts/vendor/custom.modernizr.min.js +0 -1
- data/generators/foundation5/public/javascripts/vendor/fastclick.js +0 -9
- data/generators/foundation5/public/javascripts/vendor/fastclick.min.js +0 -11
- data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.js +0 -645
- data/generators/foundation5/public/javascripts/vendor/jquery.autocomplete.min.js +0 -1
- data/generators/foundation5/public/javascripts/vendor/jquery.cookie.js +0 -8
- data/generators/foundation5/public/javascripts/vendor/jquery.cookie.min.js +0 -8
- data/generators/foundation5/public/javascripts/vendor/jquery.js +0 -26
- data/generators/foundation5/public/javascripts/vendor/jquery.min.js +0 -27
- data/generators/foundation5/public/javascripts/vendor/modernizr.js +0 -8
- data/generators/foundation5/public/javascripts/vendor/modernizr.min.js +0 -1
- data/generators/foundation5/public/javascripts/vendor/placeholder.js +0 -2
- data/generators/foundation5/public/javascripts/vendor/placeholder.min.js +0 -1
- data/generators/foundation5/public/samples/.empty_directory +0 -1
- data/generators/foundation5/public/stylesheets/application.css +0 -2
- data/generators/foundation5/public/stylesheets/application.css.scss +0 -3
- data/generators/foundation5/public/stylesheets/foundation/_functions.scss +0 -102
- data/generators/foundation5/public/stylesheets/foundation/_settings.scss +0 -1441
- data/generators/foundation5/public/stylesheets/foundation/components/_accordion.scss +0 -157
- data/generators/foundation5/public/stylesheets/foundation/components/_alert-boxes.scss +0 -128
- data/generators/foundation5/public/stylesheets/foundation/components/_block-grid.scss +0 -132
- data/generators/foundation5/public/stylesheets/foundation/components/_breadcrumbs.scss +0 -132
- data/generators/foundation5/public/stylesheets/foundation/components/_button-groups.scss +0 -197
- data/generators/foundation5/public/stylesheets/foundation/components/_buttons.scss +0 -259
- data/generators/foundation5/public/stylesheets/foundation/components/_clearing.scss +0 -247
- data/generators/foundation5/public/stylesheets/foundation/components/_dropdown-buttons.scss +0 -130
- data/generators/foundation5/public/stylesheets/foundation/components/_dropdown.scss +0 -262
- data/generators/foundation5/public/stylesheets/foundation/components/_flex-video.scss +0 -51
- data/generators/foundation5/public/stylesheets/foundation/components/_forms.scss +0 -585
- data/generators/foundation5/public/stylesheets/foundation/components/_global.scss +0 -460
- data/generators/foundation5/public/stylesheets/foundation/components/_grid.scss +0 -275
- data/generators/foundation5/public/stylesheets/foundation/components/_icon-bar.scss +0 -293
- data/generators/foundation5/public/stylesheets/foundation/components/_inline-lists.scss +0 -57
- data/generators/foundation5/public/stylesheets/foundation/components/_joyride.scss +0 -222
- data/generators/foundation5/public/stylesheets/foundation/components/_keystrokes.scss +0 -61
- data/generators/foundation5/public/stylesheets/foundation/components/_labels.scss +0 -106
- data/generators/foundation5/public/stylesheets/foundation/components/_magellan.scss +0 -34
- data/generators/foundation5/public/stylesheets/foundation/components/_offcanvas.scss +0 -513
- data/generators/foundation5/public/stylesheets/foundation/components/_orbit.scss +0 -368
- data/generators/foundation5/public/stylesheets/foundation/components/_pagination.scss +0 -162
- data/generators/foundation5/public/stylesheets/foundation/components/_panels.scss +0 -95
- data/generators/foundation5/public/stylesheets/foundation/components/_pricing-tables.scss +0 -150
- data/generators/foundation5/public/stylesheets/foundation/components/_progress-bars.scss +0 -79
- data/generators/foundation5/public/stylesheets/foundation/components/_range-slider.scss +0 -168
- data/generators/foundation5/public/stylesheets/foundation/components/_reveal.scss +0 -222
- data/generators/foundation5/public/stylesheets/foundation/components/_side-nav.scss +0 -116
- data/generators/foundation5/public/stylesheets/foundation/components/_split-buttons.scss +0 -191
- data/generators/foundation5/public/stylesheets/foundation/components/_sub-nav.scss +0 -123
- data/generators/foundation5/public/stylesheets/foundation/components/_switches.scss +0 -230
- data/generators/foundation5/public/stylesheets/foundation/components/_tables.scss +0 -135
- data/generators/foundation5/public/stylesheets/foundation/components/_tabs.scss +0 -123
- data/generators/foundation5/public/stylesheets/foundation/components/_thumbs.scss +0 -66
- data/generators/foundation5/public/stylesheets/foundation/components/_toolbar.scss +0 -70
- data/generators/foundation5/public/stylesheets/foundation/components/_tooltips.scss +0 -142
- data/generators/foundation5/public/stylesheets/foundation/components/_top-bar.scss +0 -685
- data/generators/foundation5/public/stylesheets/foundation/components/_type.scss +0 -525
- data/generators/foundation5/public/stylesheets/foundation/components/_visibility.scss +0 -408
- data/generators/foundation5/public/stylesheets/foundation.css +0 -6138
- data/generators/foundation5/public/stylesheets/foundation.css.scss +0 -45
- data/generators/foundation5/public/stylesheets/normalize.css +0 -357
- data/lib/locomotive/wagon/generators/site/foundation4.rb +0 -34
@@ -1,645 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Ajax Autocomplete for jQuery, version 1.2.7
|
3
|
-
* (c) 2013 Tomas Kirda
|
4
|
-
*
|
5
|
-
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
6
|
-
* For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
|
7
|
-
*
|
8
|
-
*/
|
9
|
-
|
10
|
-
/*jslint browser: true, white: true, plusplus: true */
|
11
|
-
/*global define, window, document, jQuery */
|
12
|
-
|
13
|
-
// Expose plugin as an AMD module if AMD loader is present:
|
14
|
-
(function (factory) {
|
15
|
-
'use strict';
|
16
|
-
if (typeof define === 'function' && define.amd) {
|
17
|
-
// AMD. Register as an anonymous module.
|
18
|
-
define(['jquery'], factory);
|
19
|
-
} else {
|
20
|
-
// Browser globals
|
21
|
-
factory(jQuery);
|
22
|
-
}
|
23
|
-
}(function ($) {
|
24
|
-
'use strict';
|
25
|
-
|
26
|
-
var
|
27
|
-
utils = (function () {
|
28
|
-
return {
|
29
|
-
|
30
|
-
extend: function (target, source) {
|
31
|
-
return $.extend(target, source);
|
32
|
-
},
|
33
|
-
|
34
|
-
createNode: function (html) {
|
35
|
-
var div = document.createElement('div');
|
36
|
-
div.innerHTML = html;
|
37
|
-
return div.firstChild;
|
38
|
-
}
|
39
|
-
|
40
|
-
};
|
41
|
-
}()),
|
42
|
-
|
43
|
-
keys = {
|
44
|
-
ESC: 27,
|
45
|
-
TAB: 9,
|
46
|
-
RETURN: 13,
|
47
|
-
UP: 38,
|
48
|
-
DOWN: 40
|
49
|
-
};
|
50
|
-
|
51
|
-
function Autocomplete(el, options) {
|
52
|
-
var noop = function () { },
|
53
|
-
that = this,
|
54
|
-
defaults = {
|
55
|
-
autoSelectFirst: false,
|
56
|
-
appendTo: 'body',
|
57
|
-
serviceUrl: null,
|
58
|
-
lookup: null,
|
59
|
-
onSelect: null,
|
60
|
-
width: 'auto',
|
61
|
-
minChars: 1,
|
62
|
-
maxHeight: 300,
|
63
|
-
deferRequestBy: 0,
|
64
|
-
params: {},
|
65
|
-
formatResult: Autocomplete.formatResult,
|
66
|
-
delimiter: null,
|
67
|
-
zIndex: 9999,
|
68
|
-
type: 'GET',
|
69
|
-
noCache: false,
|
70
|
-
onSearchStart: noop,
|
71
|
-
onSearchComplete: noop,
|
72
|
-
containerClass: 'autocomplete-suggestions',
|
73
|
-
tabDisabled: false,
|
74
|
-
dataType: 'text',
|
75
|
-
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
|
76
|
-
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
|
77
|
-
},
|
78
|
-
paramName: 'query',
|
79
|
-
transformResult: function (response) {
|
80
|
-
return typeof response === 'string' ? $.parseJSON(response) : response;
|
81
|
-
}
|
82
|
-
};
|
83
|
-
|
84
|
-
// Shared variables:
|
85
|
-
that.element = el;
|
86
|
-
that.el = $(el);
|
87
|
-
that.suggestions = [];
|
88
|
-
that.badQueries = [];
|
89
|
-
that.selectedIndex = -1;
|
90
|
-
that.currentValue = that.element.value;
|
91
|
-
that.intervalId = 0;
|
92
|
-
that.cachedResponse = [];
|
93
|
-
that.onChangeInterval = null;
|
94
|
-
that.onChange = null;
|
95
|
-
that.ignoreValueChange = false;
|
96
|
-
that.isLocal = false;
|
97
|
-
that.suggestionsContainer = null;
|
98
|
-
that.options = $.extend({}, defaults, options);
|
99
|
-
that.classes = {
|
100
|
-
selected: 'autocomplete-selected',
|
101
|
-
suggestion: 'autocomplete-suggestion'
|
102
|
-
};
|
103
|
-
|
104
|
-
// Initialize and set options:
|
105
|
-
that.initialize();
|
106
|
-
that.setOptions(options);
|
107
|
-
}
|
108
|
-
|
109
|
-
Autocomplete.utils = utils;
|
110
|
-
|
111
|
-
$.Autocomplete = Autocomplete;
|
112
|
-
|
113
|
-
Autocomplete.formatResult = function (suggestion, currentValue) {
|
114
|
-
var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g'),
|
115
|
-
pattern = '(' + currentValue.replace(reEscape, '\\$1') + ')';
|
116
|
-
|
117
|
-
return suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
|
118
|
-
};
|
119
|
-
|
120
|
-
Autocomplete.prototype = {
|
121
|
-
|
122
|
-
killerFn: null,
|
123
|
-
|
124
|
-
initialize: function () {
|
125
|
-
var that = this,
|
126
|
-
suggestionSelector = '.' + that.classes.suggestion,
|
127
|
-
selected = that.classes.selected,
|
128
|
-
options = that.options,
|
129
|
-
container;
|
130
|
-
|
131
|
-
// Remove autocomplete attribute to prevent native suggestions:
|
132
|
-
that.element.setAttribute('autocomplete', 'off');
|
133
|
-
|
134
|
-
that.killerFn = function (e) {
|
135
|
-
if ($(e.target).closest('.' + that.options.containerClass).length === 0) {
|
136
|
-
that.killSuggestions();
|
137
|
-
that.disableKillerFn();
|
138
|
-
}
|
139
|
-
};
|
140
|
-
|
141
|
-
// Determine suggestions width:
|
142
|
-
if (!options.width || options.width === 'auto') {
|
143
|
-
options.width = that.el.outerWidth();
|
144
|
-
}
|
145
|
-
|
146
|
-
that.suggestionsContainer = Autocomplete.utils.createNode('<div class="' + options.containerClass + '" style="position: absolute; display: none;"></div>');
|
147
|
-
|
148
|
-
container = $(that.suggestionsContainer);
|
149
|
-
|
150
|
-
container.appendTo(options.appendTo).width(options.width);
|
151
|
-
|
152
|
-
// Listen for mouse over event on suggestions list:
|
153
|
-
container.on('mouseover.autocomplete', suggestionSelector, function () {
|
154
|
-
that.activate($(this).data('index'));
|
155
|
-
});
|
156
|
-
|
157
|
-
// Deselect active element when mouse leaves suggestions container:
|
158
|
-
container.on('mouseout.autocomplete', function () {
|
159
|
-
that.selectedIndex = -1;
|
160
|
-
container.children('.' + selected).removeClass(selected);
|
161
|
-
});
|
162
|
-
|
163
|
-
// Listen for click event on suggestions list:
|
164
|
-
container.on('click.autocomplete', suggestionSelector, function () {
|
165
|
-
that.select($(this).data('index'), false);
|
166
|
-
});
|
167
|
-
|
168
|
-
that.fixPosition();
|
169
|
-
|
170
|
-
// Opera does not like keydown:
|
171
|
-
if (window.opera) {
|
172
|
-
that.el.on('keypress.autocomplete', function (e) { that.onKeyPress(e); });
|
173
|
-
} else {
|
174
|
-
that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
|
175
|
-
}
|
176
|
-
|
177
|
-
that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
|
178
|
-
that.el.on('blur.autocomplete', function () { that.onBlur(); });
|
179
|
-
that.el.on('focus.autocomplete', function () { that.fixPosition(); });
|
180
|
-
},
|
181
|
-
|
182
|
-
onBlur: function () {
|
183
|
-
this.enableKillerFn();
|
184
|
-
},
|
185
|
-
|
186
|
-
setOptions: function (suppliedOptions) {
|
187
|
-
var that = this,
|
188
|
-
options = that.options;
|
189
|
-
|
190
|
-
utils.extend(options, suppliedOptions);
|
191
|
-
|
192
|
-
that.isLocal = $.isArray(options.lookup);
|
193
|
-
|
194
|
-
if (that.isLocal) {
|
195
|
-
options.lookup = that.verifySuggestionsFormat(options.lookup);
|
196
|
-
}
|
197
|
-
|
198
|
-
// Adjust height, width and z-index:
|
199
|
-
$(that.suggestionsContainer).css({
|
200
|
-
'max-height': options.maxHeight + 'px',
|
201
|
-
'width': options.width + 'px',
|
202
|
-
'z-index': options.zIndex
|
203
|
-
});
|
204
|
-
},
|
205
|
-
|
206
|
-
clearCache: function () {
|
207
|
-
this.cachedResponse = [];
|
208
|
-
this.badQueries = [];
|
209
|
-
},
|
210
|
-
|
211
|
-
clear: function () {
|
212
|
-
this.clearCache();
|
213
|
-
this.currentValue = null;
|
214
|
-
this.suggestions = [];
|
215
|
-
},
|
216
|
-
|
217
|
-
disable: function () {
|
218
|
-
this.disabled = true;
|
219
|
-
},
|
220
|
-
|
221
|
-
enable: function () {
|
222
|
-
this.disabled = false;
|
223
|
-
},
|
224
|
-
|
225
|
-
fixPosition: function () {
|
226
|
-
var that = this,
|
227
|
-
offset;
|
228
|
-
|
229
|
-
// Don't adjsut position if custom container has been specified:
|
230
|
-
if (that.options.appendTo !== 'body') {
|
231
|
-
return;
|
232
|
-
}
|
233
|
-
|
234
|
-
offset = that.el.offset();
|
235
|
-
|
236
|
-
$(that.suggestionsContainer).css({
|
237
|
-
top: (offset.top + that.el.outerHeight()) + 'px',
|
238
|
-
left: offset.left + 'px'
|
239
|
-
});
|
240
|
-
},
|
241
|
-
|
242
|
-
enableKillerFn: function () {
|
243
|
-
var that = this;
|
244
|
-
$(document).on('click.autocomplete', that.killerFn);
|
245
|
-
},
|
246
|
-
|
247
|
-
disableKillerFn: function () {
|
248
|
-
var that = this;
|
249
|
-
$(document).off('click.autocomplete', that.killerFn);
|
250
|
-
},
|
251
|
-
|
252
|
-
killSuggestions: function () {
|
253
|
-
var that = this;
|
254
|
-
that.stopKillSuggestions();
|
255
|
-
that.intervalId = window.setInterval(function () {
|
256
|
-
that.hide();
|
257
|
-
that.stopKillSuggestions();
|
258
|
-
}, 300);
|
259
|
-
},
|
260
|
-
|
261
|
-
stopKillSuggestions: function () {
|
262
|
-
window.clearInterval(this.intervalId);
|
263
|
-
},
|
264
|
-
|
265
|
-
onKeyPress: function (e) {
|
266
|
-
var that = this;
|
267
|
-
|
268
|
-
// If suggestions are hidden and user presses arrow down, display suggestions:
|
269
|
-
if (!that.disabled && !that.visible && e.keyCode === keys.DOWN && that.currentValue) {
|
270
|
-
that.suggest();
|
271
|
-
return;
|
272
|
-
}
|
273
|
-
|
274
|
-
if (that.disabled || !that.visible) {
|
275
|
-
return;
|
276
|
-
}
|
277
|
-
|
278
|
-
switch (e.keyCode) {
|
279
|
-
case keys.ESC:
|
280
|
-
that.el.val(that.currentValue);
|
281
|
-
that.hide();
|
282
|
-
break;
|
283
|
-
case keys.TAB:
|
284
|
-
case keys.RETURN:
|
285
|
-
if (that.selectedIndex === -1) {
|
286
|
-
that.hide();
|
287
|
-
return;
|
288
|
-
}
|
289
|
-
that.select(that.selectedIndex, e.keyCode === keys.RETURN);
|
290
|
-
if (e.keyCode === keys.TAB && this.options.tabDisabled === false) {
|
291
|
-
return;
|
292
|
-
}
|
293
|
-
break;
|
294
|
-
case keys.UP:
|
295
|
-
that.moveUp();
|
296
|
-
break;
|
297
|
-
case keys.DOWN:
|
298
|
-
that.moveDown();
|
299
|
-
break;
|
300
|
-
default:
|
301
|
-
return;
|
302
|
-
}
|
303
|
-
|
304
|
-
// Cancel event if function did not return:
|
305
|
-
e.stopImmediatePropagation();
|
306
|
-
e.preventDefault();
|
307
|
-
},
|
308
|
-
|
309
|
-
onKeyUp: function (e) {
|
310
|
-
var that = this;
|
311
|
-
|
312
|
-
if (that.disabled) {
|
313
|
-
return;
|
314
|
-
}
|
315
|
-
|
316
|
-
switch (e.keyCode) {
|
317
|
-
case keys.UP:
|
318
|
-
case keys.DOWN:
|
319
|
-
return;
|
320
|
-
}
|
321
|
-
|
322
|
-
clearInterval(that.onChangeInterval);
|
323
|
-
|
324
|
-
if (that.currentValue !== that.el.val()) {
|
325
|
-
if (that.options.deferRequestBy > 0) {
|
326
|
-
// Defer lookup in case when value changes very quickly:
|
327
|
-
that.onChangeInterval = setInterval(function () {
|
328
|
-
that.onValueChange();
|
329
|
-
}, that.options.deferRequestBy);
|
330
|
-
} else {
|
331
|
-
that.onValueChange();
|
332
|
-
}
|
333
|
-
}
|
334
|
-
},
|
335
|
-
|
336
|
-
onValueChange: function () {
|
337
|
-
var that = this,
|
338
|
-
q;
|
339
|
-
|
340
|
-
clearInterval(that.onChangeInterval);
|
341
|
-
that.currentValue = that.element.value;
|
342
|
-
|
343
|
-
q = that.getQuery(that.currentValue);
|
344
|
-
that.selectedIndex = -1;
|
345
|
-
|
346
|
-
if (that.ignoreValueChange) {
|
347
|
-
that.ignoreValueChange = false;
|
348
|
-
return;
|
349
|
-
}
|
350
|
-
|
351
|
-
if (q.length < that.options.minChars) {
|
352
|
-
that.hide();
|
353
|
-
} else {
|
354
|
-
that.getSuggestions(q);
|
355
|
-
}
|
356
|
-
},
|
357
|
-
|
358
|
-
getQuery: function (value) {
|
359
|
-
var delimiter = this.options.delimiter,
|
360
|
-
parts;
|
361
|
-
|
362
|
-
if (!delimiter) {
|
363
|
-
return $.trim(value);
|
364
|
-
}
|
365
|
-
parts = value.split(delimiter);
|
366
|
-
return $.trim(parts[parts.length - 1]);
|
367
|
-
},
|
368
|
-
|
369
|
-
getSuggestionsLocal: function (query) {
|
370
|
-
var that = this,
|
371
|
-
queryLowerCase = query.toLowerCase(),
|
372
|
-
filter = that.options.lookupFilter;
|
373
|
-
|
374
|
-
return {
|
375
|
-
suggestions: $.grep(that.options.lookup, function (suggestion) {
|
376
|
-
return filter(suggestion, query, queryLowerCase);
|
377
|
-
})
|
378
|
-
};
|
379
|
-
},
|
380
|
-
|
381
|
-
getSuggestions: function (q) {
|
382
|
-
var response,
|
383
|
-
that = this,
|
384
|
-
options = that.options,
|
385
|
-
serviceUrl = options.serviceUrl;
|
386
|
-
|
387
|
-
response = that.isLocal ? that.getSuggestionsLocal(q) : that.cachedResponse[q];
|
388
|
-
|
389
|
-
if (response && $.isArray(response.suggestions)) {
|
390
|
-
that.suggestions = response.suggestions;
|
391
|
-
that.suggest();
|
392
|
-
} else if (!that.isBadQuery(q)) {
|
393
|
-
options.params[options.paramName] = q;
|
394
|
-
if (options.onSearchStart.call(that.element, options.params) === false) {
|
395
|
-
return;
|
396
|
-
}
|
397
|
-
if ($.isFunction(options.serviceUrl)) {
|
398
|
-
serviceUrl = options.serviceUrl.call(that.element, q);
|
399
|
-
}
|
400
|
-
$.ajax({
|
401
|
-
url: serviceUrl,
|
402
|
-
data: options.ignoreParams ? null : options.params,
|
403
|
-
type: options.type,
|
404
|
-
dataType: options.dataType
|
405
|
-
}).done(function (data) {
|
406
|
-
that.processResponse(data, q);
|
407
|
-
options.onSearchComplete.call(that.element, q);
|
408
|
-
});
|
409
|
-
}
|
410
|
-
},
|
411
|
-
|
412
|
-
isBadQuery: function (q) {
|
413
|
-
var badQueries = this.badQueries,
|
414
|
-
i = badQueries.length;
|
415
|
-
|
416
|
-
while (i--) {
|
417
|
-
if (q.indexOf(badQueries[i]) === 0) {
|
418
|
-
return true;
|
419
|
-
}
|
420
|
-
}
|
421
|
-
|
422
|
-
return false;
|
423
|
-
},
|
424
|
-
|
425
|
-
hide: function () {
|
426
|
-
var that = this;
|
427
|
-
that.visible = false;
|
428
|
-
that.selectedIndex = -1;
|
429
|
-
$(that.suggestionsContainer).hide();
|
430
|
-
},
|
431
|
-
|
432
|
-
suggest: function () {
|
433
|
-
if (this.suggestions.length === 0) {
|
434
|
-
this.hide();
|
435
|
-
return;
|
436
|
-
}
|
437
|
-
|
438
|
-
var that = this,
|
439
|
-
formatResult = that.options.formatResult,
|
440
|
-
value = that.getQuery(that.currentValue),
|
441
|
-
className = that.classes.suggestion,
|
442
|
-
classSelected = that.classes.selected,
|
443
|
-
container = $(that.suggestionsContainer),
|
444
|
-
html = '';
|
445
|
-
|
446
|
-
// Build suggestions inner HTML:
|
447
|
-
$.each(that.suggestions, function (i, suggestion) {
|
448
|
-
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
|
449
|
-
});
|
450
|
-
|
451
|
-
container.html(html).show();
|
452
|
-
that.visible = true;
|
453
|
-
|
454
|
-
// Select first value by default:
|
455
|
-
if (that.options.autoSelectFirst) {
|
456
|
-
that.selectedIndex = 0;
|
457
|
-
container.children().first().addClass(classSelected);
|
458
|
-
}
|
459
|
-
},
|
460
|
-
|
461
|
-
verifySuggestionsFormat: function (suggestions) {
|
462
|
-
// If suggestions is string array, convert them to supported format:
|
463
|
-
if (suggestions.length && typeof suggestions[0] === 'string') {
|
464
|
-
return $.map(suggestions, function (value) {
|
465
|
-
return { value: value, data: null };
|
466
|
-
});
|
467
|
-
}
|
468
|
-
|
469
|
-
return suggestions;
|
470
|
-
},
|
471
|
-
|
472
|
-
processResponse: function (response, originalQuery) {
|
473
|
-
var that = this,
|
474
|
-
options = that.options,
|
475
|
-
result = options.transformResult(response, originalQuery);
|
476
|
-
|
477
|
-
result.suggestions = that.verifySuggestionsFormat(result.suggestions);
|
478
|
-
|
479
|
-
// Cache results if cache is not disabled:
|
480
|
-
if (!options.noCache) {
|
481
|
-
that.cachedResponse[result[options.paramName]] = result;
|
482
|
-
if (result.suggestions.length === 0) {
|
483
|
-
that.badQueries.push(result[options.paramName]);
|
484
|
-
}
|
485
|
-
}
|
486
|
-
|
487
|
-
// Display suggestions only if returned query matches current value:
|
488
|
-
if (originalQuery === that.getQuery(that.currentValue)) {
|
489
|
-
that.suggestions = result.suggestions;
|
490
|
-
that.suggest();
|
491
|
-
}
|
492
|
-
},
|
493
|
-
|
494
|
-
activate: function (index) {
|
495
|
-
var that = this,
|
496
|
-
activeItem,
|
497
|
-
selected = that.classes.selected,
|
498
|
-
container = $(that.suggestionsContainer),
|
499
|
-
children = container.children();
|
500
|
-
|
501
|
-
container.children('.' + selected).removeClass(selected);
|
502
|
-
|
503
|
-
that.selectedIndex = index;
|
504
|
-
|
505
|
-
if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
|
506
|
-
activeItem = children.get(that.selectedIndex);
|
507
|
-
$(activeItem).addClass(selected);
|
508
|
-
return activeItem;
|
509
|
-
}
|
510
|
-
|
511
|
-
return null;
|
512
|
-
},
|
513
|
-
|
514
|
-
select: function (i, shouldIgnoreNextValueChange) {
|
515
|
-
var that = this,
|
516
|
-
selectedValue = that.suggestions[i];
|
517
|
-
|
518
|
-
if (selectedValue) {
|
519
|
-
that.el.val(selectedValue);
|
520
|
-
that.ignoreValueChange = shouldIgnoreNextValueChange;
|
521
|
-
that.hide();
|
522
|
-
that.onSelect(i);
|
523
|
-
}
|
524
|
-
},
|
525
|
-
|
526
|
-
moveUp: function () {
|
527
|
-
var that = this;
|
528
|
-
|
529
|
-
if (that.selectedIndex === -1) {
|
530
|
-
return;
|
531
|
-
}
|
532
|
-
|
533
|
-
if (that.selectedIndex === 0) {
|
534
|
-
$(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
|
535
|
-
that.selectedIndex = -1;
|
536
|
-
that.el.val(that.currentValue);
|
537
|
-
return;
|
538
|
-
}
|
539
|
-
|
540
|
-
that.adjustScroll(that.selectedIndex - 1);
|
541
|
-
},
|
542
|
-
|
543
|
-
moveDown: function () {
|
544
|
-
var that = this;
|
545
|
-
|
546
|
-
if (that.selectedIndex === (that.suggestions.length - 1)) {
|
547
|
-
return;
|
548
|
-
}
|
549
|
-
|
550
|
-
that.adjustScroll(that.selectedIndex + 1);
|
551
|
-
},
|
552
|
-
|
553
|
-
adjustScroll: function (index) {
|
554
|
-
var that = this,
|
555
|
-
activeItem = that.activate(index),
|
556
|
-
offsetTop,
|
557
|
-
upperBound,
|
558
|
-
lowerBound,
|
559
|
-
heightDelta = 25;
|
560
|
-
|
561
|
-
if (!activeItem) {
|
562
|
-
return;
|
563
|
-
}
|
564
|
-
|
565
|
-
offsetTop = activeItem.offsetTop;
|
566
|
-
upperBound = $(that.suggestionsContainer).scrollTop();
|
567
|
-
lowerBound = upperBound + that.options.maxHeight - heightDelta;
|
568
|
-
|
569
|
-
if (offsetTop < upperBound) {
|
570
|
-
$(that.suggestionsContainer).scrollTop(offsetTop);
|
571
|
-
} else if (offsetTop > lowerBound) {
|
572
|
-
$(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
|
573
|
-
}
|
574
|
-
|
575
|
-
that.el.val(that.getValue(that.suggestions[index].value));
|
576
|
-
},
|
577
|
-
|
578
|
-
onSelect: function (index) {
|
579
|
-
var that = this,
|
580
|
-
onSelectCallback = that.options.onSelect,
|
581
|
-
suggestion = that.suggestions[index];
|
582
|
-
|
583
|
-
that.el.val(that.getValue(suggestion.value));
|
584
|
-
|
585
|
-
if ($.isFunction(onSelectCallback)) {
|
586
|
-
onSelectCallback.call(that.element, suggestion);
|
587
|
-
}
|
588
|
-
},
|
589
|
-
|
590
|
-
getValue: function (value) {
|
591
|
-
var that = this,
|
592
|
-
delimiter = that.options.delimiter,
|
593
|
-
currentValue,
|
594
|
-
parts;
|
595
|
-
|
596
|
-
if (!delimiter) {
|
597
|
-
return value;
|
598
|
-
}
|
599
|
-
|
600
|
-
currentValue = that.currentValue;
|
601
|
-
parts = currentValue.split(delimiter);
|
602
|
-
|
603
|
-
if (parts.length === 1) {
|
604
|
-
return value;
|
605
|
-
}
|
606
|
-
|
607
|
-
return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
|
608
|
-
},
|
609
|
-
|
610
|
-
dispose: function () {
|
611
|
-
var that = this;
|
612
|
-
that.el.off('.autocomplete').removeData('autocomplete');
|
613
|
-
that.disableKillerFn();
|
614
|
-
$(that.suggestionsContainer).remove();
|
615
|
-
}
|
616
|
-
};
|
617
|
-
|
618
|
-
// Create chainable jQuery plugin:
|
619
|
-
$.fn.autocomplete = function (options, args) {
|
620
|
-
var dataKey = 'autocomplete';
|
621
|
-
// If function invoked without argument return
|
622
|
-
// instance of the first matched element:
|
623
|
-
if (arguments.length === 0) {
|
624
|
-
return this.first().data(dataKey);
|
625
|
-
}
|
626
|
-
|
627
|
-
return this.each(function () {
|
628
|
-
var inputElement = $(this),
|
629
|
-
instance = inputElement.data(dataKey);
|
630
|
-
|
631
|
-
if (typeof options === 'string') {
|
632
|
-
if (instance && typeof instance[options] === 'function') {
|
633
|
-
instance[options](args);
|
634
|
-
}
|
635
|
-
} else {
|
636
|
-
// If instance already exists, destroy it:
|
637
|
-
if (instance && instance.dispose) {
|
638
|
-
instance.dispose();
|
639
|
-
}
|
640
|
-
instance = new Autocomplete(this, options);
|
641
|
-
inputElement.data(dataKey, instance);
|
642
|
-
}
|
643
|
-
});
|
644
|
-
};
|
645
|
-
}));
|
@@ -1 +0,0 @@
|
|
1
|
-
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){"use strict";function t(n,s){var o=function(){},i=this,a={autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:t.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:o,onSearchComplete:o,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",lookupFilter:function(e,t,n){return-1!==e.value.toLowerCase().indexOf(n)},paramName:"query",transformResult:function(t){return"string"==typeof t?e.parseJSON(t):t}};i.element=n,i.el=e(n),i.suggestions=[],i.badQueries=[],i.selectedIndex=-1,i.currentValue=i.element.value,i.intervalId=0,i.cachedResponse=[],i.onChangeInterval=null,i.onChange=null,i.ignoreValueChange=!1,i.isLocal=!1,i.suggestionsContainer=null,i.options=e.extend({},a,s),i.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},i.initialize(),i.setOptions(s)}var n=function(){return{extend:function(t,n){return e.extend(t,n)},createNode:function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild}}}(),s={ESC:27,TAB:9,RETURN:13,UP:38,DOWN:40};t.utils=n,e.Autocomplete=t,t.formatResult=function(e,t){var n=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\"].join("|\\")+")","g"),s="("+t.replace(n,"\\$1")+")";return e.value.replace(new RegExp(s,"gi"),"<strong>$1</strong>")},t.prototype={killerFn:null,initialize:function(){var n,s=this,o="."+s.classes.suggestion,i=s.classes.selected,a=s.options;s.element.setAttribute("autocomplete","off"),s.killerFn=function(t){0===e(t.target).closest("."+s.options.containerClass).length&&(s.killSuggestions(),s.disableKillerFn())},a.width&&"auto"!==a.width||(a.width=s.el.outerWidth()),s.suggestionsContainer=t.utils.createNode('<div class="'+a.containerClass+'" style="position: absolute; display: none;"></div>'),n=e(s.suggestionsContainer),n.appendTo(a.appendTo).width(a.width),n.on("mouseover.autocomplete",o,function(){s.activate(e(this).data("index"))}),n.on("mouseout.autocomplete",function(){s.selectedIndex=-1,n.children("."+i).removeClass(i)}),n.on("click.autocomplete",o,function(){s.select(e(this).data("index"),!1)}),s.fixPosition(),window.opera?s.el.on("keypress.autocomplete",function(e){s.onKeyPress(e)}):s.el.on("keydown.autocomplete",function(e){s.onKeyPress(e)}),s.el.on("keyup.autocomplete",function(e){s.onKeyUp(e)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.fixPosition()})},onBlur:function(){this.enableKillerFn()},setOptions:function(t){var s=this,o=s.options;n.extend(o,t),s.isLocal=e.isArray(o.lookup),s.isLocal&&(o.lookup=s.verifySuggestionsFormat(o.lookup)),e(s.suggestionsContainer).css({"max-height":o.maxHeight+"px",width:o.width+"px","z-index":o.zIndex})},clearCache:function(){this.cachedResponse=[],this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue=null,this.suggestions=[]},disable:function(){this.disabled=!0},enable:function(){this.disabled=!1},fixPosition:function(){var t,n=this;"body"===n.options.appendTo&&(t=n.el.offset(),e(n.suggestionsContainer).css({top:t.top+n.el.outerHeight()+"px",left:t.left+"px"}))},enableKillerFn:function(){var t=this;e(document).on("click.autocomplete",t.killerFn)},disableKillerFn:function(){var t=this;e(document).off("click.autocomplete",t.killerFn)},killSuggestions:function(){var e=this;e.stopKillSuggestions(),e.intervalId=window.setInterval(function(){e.hide(),e.stopKillSuggestions()},300)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},onKeyPress:function(e){var t=this;if(!t.disabled&&!t.visible&&e.keyCode===s.DOWN&&t.currentValue)return t.suggest(),void 0;if(!t.disabled&&t.visible){switch(e.keyCode){case s.ESC:t.el.val(t.currentValue),t.hide();break;case s.TAB:case s.RETURN:if(-1===t.selectedIndex)return t.hide(),void 0;if(t.select(t.selectedIndex,e.keyCode===s.RETURN),e.keyCode===s.TAB&&this.options.tabDisabled===!1)return;break;case s.UP:t.moveUp();break;case s.DOWN:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.keyCode){case s.UP:case s.DOWN:return}clearInterval(t.onChangeInterval),t.currentValue!==t.el.val()&&(t.options.deferRequestBy>0?t.onChangeInterval=setInterval(function(){t.onValueChange()},t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){var e,t=this;return clearInterval(t.onChangeInterval),t.currentValue=t.element.value,e=t.getQuery(t.currentValue),t.selectedIndex=-1,t.ignoreValueChange?(t.ignoreValueChange=!1,void 0):(e.length<t.options.minChars?t.hide():t.getSuggestions(e),void 0)},getQuery:function(t){var n,s=this.options.delimiter;return s?(n=t.split(s),e.trim(n[n.length-1])):e.trim(t)},getSuggestionsLocal:function(t){var n=this,s=t.toLowerCase(),o=n.options.lookupFilter;return{suggestions:e.grep(n.options.lookup,function(e){return o(e,t,s)})}},getSuggestions:function(t){var n,s=this,o=s.options,i=o.serviceUrl;if(n=s.isLocal?s.getSuggestionsLocal(t):s.cachedResponse[t],n&&e.isArray(n.suggestions))s.suggestions=n.suggestions,s.suggest();else if(!s.isBadQuery(t)){if(o.params[o.paramName]=t,o.onSearchStart.call(s.element,o.params)===!1)return;e.isFunction(o.serviceUrl)&&(i=o.serviceUrl.call(s.element,t)),e.ajax({url:i,data:o.ignoreParams?null:o.params,type:o.type,dataType:o.dataType}).done(function(e){s.processResponse(e,t),o.onSearchComplete.call(s.element,t)})}},isBadQuery:function(e){for(var t=this.badQueries,n=t.length;n--;)if(0===e.indexOf(t[n]))return!0;return!1},hide:function(){var t=this;t.visible=!1,t.selectedIndex=-1,e(t.suggestionsContainer).hide()},suggest:function(){if(0===this.suggestions.length)return this.hide(),void 0;var t=this,n=t.options.formatResult,s=t.getQuery(t.currentValue),o=t.classes.suggestion,i=t.classes.selected,a=e(t.suggestionsContainer),l="";e.each(t.suggestions,function(e,t){l+='<div class="'+o+'" data-index="'+e+'">'+n(t,s)+"</div>"}),a.html(l).show(),t.visible=!0,t.options.autoSelectFirst&&(t.selectedIndex=0,a.children().first().addClass(i))},verifySuggestionsFormat:function(t){return t.length&&"string"==typeof t[0]?e.map(t,function(e){return{value:e,data:null}}):t},processResponse:function(e,t){var n=this,s=n.options,o=s.transformResult(e,t);o.suggestions=n.verifySuggestionsFormat(o.suggestions),s.noCache||(n.cachedResponse[o[s.paramName]]=o,0===o.suggestions.length&&n.badQueries.push(o[s.paramName])),t===n.getQuery(n.currentValue)&&(n.suggestions=o.suggestions,n.suggest())},activate:function(t){var n,s=this,o=s.classes.selected,i=e(s.suggestionsContainer),a=i.children();return i.children("."+o).removeClass(o),s.selectedIndex=t,-1!==s.selectedIndex&&a.length>s.selectedIndex?(n=a.get(s.selectedIndex),e(n).addClass(o),n):null},select:function(e,t){var n=this,s=n.suggestions[e];s&&(n.el.val(s),n.ignoreValueChange=t,n.hide(),n.onSelect(e))},moveUp:function(){var t=this;if(-1!==t.selectedIndex)return 0===t.selectedIndex?(e(t.suggestionsContainer).children().first().removeClass(t.classes.selected),t.selectedIndex=-1,t.el.val(t.currentValue),void 0):(t.adjustScroll(t.selectedIndex-1),void 0)},moveDown:function(){var e=this;e.selectedIndex!==e.suggestions.length-1&&e.adjustScroll(e.selectedIndex+1)},adjustScroll:function(t){var n,s,o,i=this,a=i.activate(t),l=25;a&&(n=a.offsetTop,s=e(i.suggestionsContainer).scrollTop(),o=s+i.options.maxHeight-l,s>n?e(i.suggestionsContainer).scrollTop(n):n>o&&e(i.suggestionsContainer).scrollTop(n-i.options.maxHeight+l),i.el.val(i.getValue(i.suggestions[t].value)))},onSelect:function(t){var n=this,s=n.options.onSelect,o=n.suggestions[t];n.el.val(n.getValue(o.value)),e.isFunction(s)&&s.call(n.element,o)},getValue:function(e){var t,n,s=this,o=s.options.delimiter;return o?(t=s.currentValue,n=t.split(o),1===n.length?e:t.substr(0,t.length-n[n.length-1].length)+e):e},dispose:function(){var t=this;t.el.off(".autocomplete").removeData("autocomplete"),t.disableKillerFn(),e(t.suggestionsContainer).remove()}},e.fn.autocomplete=function(n,s){var o="autocomplete";return 0===arguments.length?this.first().data(o):this.each(function(){var i=e(this),a=i.data(o);"string"==typeof n?a&&"function"==typeof a[n]&&a[n](s):(a&&a.dispose&&a.dispose(),a=new t(this,n),i.data(o,a))})}});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* jQuery Cookie Plugin v1.4.1
|
3
|
-
* https://github.com/carhartl/jquery-cookie
|
4
|
-
*
|
5
|
-
* Copyright 2013 Klaus Hartl
|
6
|
-
* Released under the MIT license
|
7
|
-
*/
|
8
|
-
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* jQuery Cookie Plugin v1.3.1
|
3
|
-
* https://github.com/carhartl/jquery-cookie
|
4
|
-
*
|
5
|
-
* Copyright 2013 Klaus Hartl
|
6
|
-
* Released under the MIT license
|
7
|
-
*/
|
8
|
-
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){function n(e){if(t.raw)return e;try{return decodeURIComponent(e.replace(i," "))}catch(n){}}function o(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e=n(e);try{return t.json?JSON.parse(e):e}catch(o){}}var i=/\+/g,t=e.cookie=function(i,r,c){if(void 0!==r){if(c=e.extend({},t.defaults,c),"number"==typeof c.expires){var a=c.expires,d=c.expires=new Date;d.setDate(d.getDate()+a)}return r=t.json?JSON.stringify(r):String(r),document.cookie=[t.raw?i:encodeURIComponent(i),"=",t.raw?r:encodeURIComponent(r),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}for(var u=i?void 0:{},f=document.cookie?document.cookie.split("; "):[],p=0,s=f.length;s>p;p++){var m=f[p].split("="),x=n(m.shift()),l=m.join("=");if(i&&i===x){u=o(l);break}i||void 0===(l=o(l))||(u[x]=l)}return u};t.defaults={},e.removeCookie=function(n,o){return void 0!==e.cookie(n)?(e.cookie(n,"",e.extend({},o,{expires:-1})),!0):!1}});
|