rjack-solr 3.6.2.0-java → 4.0.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +5 -0
- data/Manifest.txt +268 -33
- data/NOTICE.txt +1 -1
- data/README.rdoc +6 -6
- data/assembly.xml +2 -2
- data/bin/rjack-solr-fg +1 -1
- data/init/rjack-solr +2 -2
- data/lib/rjack-solr.rb +7 -2
- data/lib/rjack-solr/base.rb +2 -2
- data/lib/rjack-solr/commons-cli-1.2.jar +0 -0
- data/lib/rjack-solr/config.rb +1 -1
- data/lib/rjack-solr/server.rb +1 -1
- data/lib/rjack-solr/solr-core-4.0.0.jar +0 -0
- data/lib/rjack-solr/solr-solrj-4.0.0.jar +0 -0
- data/pom.xml +19 -6
- data/test/test_solr.rb +7 -5
- data/webapp/META-INF/LICENSE.txt +0 -940
- data/webapp/META-INF/MANIFEST.MF +5 -5
- data/webapp/META-INF/NOTICE.txt +160 -93
- data/webapp/WEB-INF/web.xml +57 -43
- data/webapp/admin.html +140 -0
- data/webapp/css/chosen.css +392 -0
- data/webapp/css/styles/analysis.css +293 -0
- data/webapp/css/styles/cloud.css +331 -0
- data/webapp/css/styles/common.css +593 -0
- data/webapp/css/styles/cores.css +203 -0
- data/webapp/css/styles/dashboard.css +127 -0
- data/webapp/css/styles/dataimport.css +222 -0
- data/webapp/css/styles/index.css +195 -0
- data/webapp/css/styles/java-properties.css +33 -0
- data/webapp/css/styles/logging.css +323 -0
- data/webapp/css/styles/menu.css +272 -0
- data/webapp/css/styles/plugins.css +175 -0
- data/webapp/css/styles/query.css +137 -0
- data/webapp/css/styles/replication.css +494 -0
- data/webapp/css/styles/schema-browser.css +476 -0
- data/webapp/css/styles/threads.css +153 -0
- data/webapp/img/ZeroClipboard.swf +0 -0
- data/webapp/img/chosen-sprite.png +0 -0
- data/webapp/img/div.gif +0 -0
- data/webapp/{admin → img}/favicon.ico +0 -0
- data/webapp/img/filetypes/7z.png +0 -0
- data/webapp/img/filetypes/README +27 -0
- data/webapp/img/filetypes/ai.png +0 -0
- data/webapp/img/filetypes/aiff.png +0 -0
- data/webapp/img/filetypes/asc.png +0 -0
- data/webapp/img/filetypes/audio.png +0 -0
- data/webapp/img/filetypes/bin.png +0 -0
- data/webapp/img/filetypes/bz2.png +0 -0
- data/webapp/img/filetypes/c.png +0 -0
- data/webapp/img/filetypes/cfc.png +0 -0
- data/webapp/img/filetypes/cfm.png +0 -0
- data/webapp/img/filetypes/chm.png +0 -0
- data/webapp/img/filetypes/class.png +0 -0
- data/webapp/img/filetypes/conf.png +0 -0
- data/webapp/img/filetypes/cpp.png +0 -0
- data/webapp/img/filetypes/cs.png +0 -0
- data/webapp/img/filetypes/css.png +0 -0
- data/webapp/img/filetypes/csv.png +0 -0
- data/webapp/img/filetypes/deb.png +0 -0
- data/webapp/img/filetypes/divx.png +0 -0
- data/webapp/img/filetypes/doc.png +0 -0
- data/webapp/img/filetypes/dot.png +0 -0
- data/webapp/img/filetypes/eml.png +0 -0
- data/webapp/img/filetypes/enc.png +0 -0
- data/webapp/img/filetypes/file.png +0 -0
- data/webapp/img/filetypes/gif.png +0 -0
- data/webapp/img/filetypes/gz.png +0 -0
- data/webapp/img/filetypes/hlp.png +0 -0
- data/webapp/img/filetypes/htm.png +0 -0
- data/webapp/img/filetypes/html.png +0 -0
- data/webapp/img/filetypes/image.png +0 -0
- data/webapp/img/filetypes/iso.png +0 -0
- data/webapp/img/filetypes/jar.png +0 -0
- data/webapp/img/filetypes/java.png +0 -0
- data/webapp/img/filetypes/jpeg.png +0 -0
- data/webapp/img/filetypes/jpg.png +0 -0
- data/webapp/img/filetypes/js.png +0 -0
- data/webapp/img/filetypes/lua.png +0 -0
- data/webapp/img/filetypes/m.png +0 -0
- data/webapp/img/filetypes/mm.png +0 -0
- data/webapp/img/filetypes/mov.png +0 -0
- data/webapp/img/filetypes/mp3.png +0 -0
- data/webapp/img/filetypes/mpg.png +0 -0
- data/webapp/img/filetypes/odc.png +0 -0
- data/webapp/img/filetypes/odf.png +0 -0
- data/webapp/img/filetypes/odg.png +0 -0
- data/webapp/img/filetypes/odi.png +0 -0
- data/webapp/img/filetypes/odp.png +0 -0
- data/webapp/img/filetypes/ods.png +0 -0
- data/webapp/img/filetypes/odt.png +0 -0
- data/webapp/img/filetypes/ogg.png +0 -0
- data/webapp/img/filetypes/pdf.png +0 -0
- data/webapp/img/filetypes/pgp.png +0 -0
- data/webapp/img/filetypes/php.png +0 -0
- data/webapp/img/filetypes/pl.png +0 -0
- data/webapp/img/filetypes/png.png +0 -0
- data/webapp/img/filetypes/ppt.png +0 -0
- data/webapp/img/filetypes/ps.png +0 -0
- data/webapp/img/filetypes/py.png +0 -0
- data/webapp/img/filetypes/ram.png +0 -0
- data/webapp/img/filetypes/rar.png +0 -0
- data/webapp/img/filetypes/rb.png +0 -0
- data/webapp/img/filetypes/rm.png +0 -0
- data/webapp/img/filetypes/rpm.png +0 -0
- data/webapp/img/filetypes/rtf.png +0 -0
- data/webapp/img/filetypes/sig.png +0 -0
- data/webapp/img/filetypes/sql.png +0 -0
- data/webapp/img/filetypes/swf.png +0 -0
- data/webapp/img/filetypes/sxc.png +0 -0
- data/webapp/img/filetypes/sxd.png +0 -0
- data/webapp/img/filetypes/sxi.png +0 -0
- data/webapp/img/filetypes/sxw.png +0 -0
- data/webapp/img/filetypes/tar.png +0 -0
- data/webapp/img/filetypes/tex.png +0 -0
- data/webapp/img/filetypes/tgz.png +0 -0
- data/webapp/img/filetypes/txt.png +0 -0
- data/webapp/img/filetypes/vcf.png +0 -0
- data/webapp/img/filetypes/video.png +0 -0
- data/webapp/img/filetypes/vsd.png +0 -0
- data/webapp/img/filetypes/wav.png +0 -0
- data/webapp/img/filetypes/wma.png +0 -0
- data/webapp/img/filetypes/wmv.png +0 -0
- data/webapp/img/filetypes/xls.png +0 -0
- data/webapp/img/filetypes/xml.png +0 -0
- data/webapp/img/filetypes/xpi.png +0 -0
- data/webapp/img/filetypes/xvid.png +0 -0
- data/webapp/img/filetypes/zip.png +0 -0
- data/webapp/img/ico/arrow-000-small.png +0 -0
- data/webapp/img/ico/arrow-circle.png +0 -0
- data/webapp/img/ico/arrow-switch.png +0 -0
- data/webapp/img/ico/asterisk.png +0 -0
- data/webapp/img/ico/battery.png +0 -0
- data/webapp/img/ico/block-small.png +0 -0
- data/webapp/img/ico/block.png +0 -0
- data/webapp/img/ico/book-open-text.png +0 -0
- data/webapp/img/ico/box.png +0 -0
- data/webapp/img/ico/bug.png +0 -0
- data/webapp/img/ico/chart.png +0 -0
- data/webapp/img/ico/chevron-small-expand.png +0 -0
- data/webapp/img/ico/chevron-small.png +0 -0
- data/webapp/img/ico/clipboard-list.png +0 -0
- data/webapp/img/ico/clipboard-paste-document-text.png +0 -0
- data/webapp/img/ico/clipboard-paste.png +0 -0
- data/webapp/img/ico/clock-select-remain.png +0 -0
- data/webapp/img/ico/clock-select.png +0 -0
- data/webapp/img/ico/construction.png +0 -0
- data/webapp/img/ico/cross-0.png +0 -0
- data/webapp/img/ico/cross-1.png +0 -0
- data/webapp/img/ico/cross.png +0 -0
- data/webapp/img/ico/dashboard.png +0 -0
- data/webapp/img/ico/database.png +0 -0
- data/webapp/img/ico/databases.png +0 -0
- data/webapp/img/ico/disk-black.png +0 -0
- data/webapp/img/ico/document-convert.png +0 -0
- data/webapp/img/ico/document-import.png +0 -0
- data/webapp/img/ico/document-list.png +0 -0
- data/webapp/img/ico/document-text.png +0 -0
- data/webapp/img/ico/download-cloud.png +0 -0
- data/webapp/img/ico/exclamation-button.png +0 -0
- data/webapp/img/ico/eye.png +0 -0
- data/webapp/img/ico/folder-export.png +0 -0
- data/webapp/img/ico/folder-tree.png +0 -0
- data/webapp/img/ico/folder.png +0 -0
- data/webapp/img/ico/funnel-small.png +0 -0
- data/webapp/img/ico/funnel.png +0 -0
- data/webapp/img/ico/gear.png +0 -0
- data/webapp/img/ico/globe-network.png +0 -0
- data/webapp/img/ico/globe.png +0 -0
- data/webapp/img/ico/hammer-screwdriver.png +0 -0
- data/webapp/img/ico/hand.png +0 -0
- data/webapp/img/ico/highlighter-text.png +0 -0
- data/webapp/img/ico/hourglass--exclamation.png +0 -0
- data/webapp/img/ico/hourglass.png +0 -0
- data/webapp/img/ico/inbox-document-text.png +0 -0
- data/webapp/img/ico/information-button.png +0 -0
- data/webapp/img/ico/information-small.png +0 -0
- data/webapp/img/ico/information-white.png +0 -0
- data/webapp/img/ico/information.png +0 -0
- data/webapp/img/ico/jar.png +0 -0
- data/webapp/img/ico/magnifier.png +0 -0
- data/webapp/img/ico/mail.png +0 -0
- data/webapp/img/ico/memory.png +0 -0
- data/webapp/img/ico/molecule.png +0 -0
- data/webapp/img/ico/network-cloud.png +0 -0
- data/webapp/img/ico/network-status-away.png +0 -0
- data/webapp/img/ico/network-status-busy.png +0 -0
- data/webapp/img/ico/network-status-offline.png +0 -0
- data/webapp/img/ico/network-status.png +0 -0
- data/webapp/img/ico/network.png +0 -0
- data/webapp/img/ico/node-design.png +0 -0
- data/webapp/img/ico/node-master.png +0 -0
- data/webapp/img/ico/node-select.png +0 -0
- data/webapp/img/ico/node-slave.png +0 -0
- data/webapp/img/ico/node.png +0 -0
- data/webapp/img/ico/pencil-small.png +0 -0
- data/webapp/img/ico/plus-button.png +0 -0
- data/webapp/img/ico/processor.png +0 -0
- data/webapp/img/ico/prohibition.png +0 -0
- data/webapp/img/ico/property.png +0 -0
- data/webapp/img/ico/question-small-white.png +0 -0
- data/webapp/img/ico/question-white.png +0 -0
- data/webapp/img/ico/question.png +0 -0
- data/webapp/img/ico/receipt-invoice.png +0 -0
- data/webapp/img/ico/receipt.png +0 -0
- data/webapp/img/ico/script-code.png +0 -0
- data/webapp/img/ico/server-cast.png +0 -0
- data/webapp/img/ico/server.png +0 -0
- data/webapp/img/ico/sitemap.png +0 -0
- data/webapp/img/ico/slash.png +0 -0
- data/webapp/img/ico/status-away.png +0 -0
- data/webapp/img/ico/status-busy.png +0 -0
- data/webapp/img/ico/status-offline.png +0 -0
- data/webapp/img/ico/status.png +0 -0
- data/webapp/img/ico/system-monitor--exclamation.png +0 -0
- data/webapp/img/ico/system-monitor.png +0 -0
- data/webapp/img/ico/table.png +0 -0
- data/webapp/img/ico/terminal.png +0 -0
- data/webapp/img/ico/tick-circle.png +0 -0
- data/webapp/img/ico/tick-red.png +0 -0
- data/webapp/img/ico/tick.png +0 -0
- data/webapp/img/ico/toggle-small-expand.png +0 -0
- data/webapp/img/ico/toggle-small.png +0 -0
- data/webapp/img/ico/toolbox.png +0 -0
- data/webapp/img/ico/ui-accordion.png +0 -0
- data/webapp/img/ico/ui-address-bar.png +0 -0
- data/webapp/img/ico/ui-check-box-uncheck.png +0 -0
- data/webapp/img/ico/ui-check-box.png +0 -0
- data/webapp/img/ico/ui-radio-button-uncheck.png +0 -0
- data/webapp/img/ico/ui-radio-button.png +0 -0
- data/webapp/img/ico/ui-text-field-select.png +0 -0
- data/webapp/img/ico/users.png +0 -0
- data/webapp/img/ico/wooden-box.png +0 -0
- data/webapp/img/ico/zone.png +0 -0
- data/webapp/img/loader-light.gif +0 -0
- data/webapp/img/loader.gif +0 -0
- data/webapp/img/lucene-ico.png +0 -0
- data/webapp/img/solr-ico.png +0 -0
- data/webapp/{admin/solr_small.png → img/solr.png} +0 -0
- data/webapp/img/tree.png +0 -0
- data/webapp/js/lib/ZeroClipboard.js +317 -0
- data/webapp/js/lib/chosen.js +953 -0
- data/webapp/{admin/get-properties.jsp → js/lib/console.js} +13 -10
- data/webapp/js/lib/d3.js +9342 -0
- data/webapp/js/lib/highlight.js +1 -0
- data/webapp/{admin/jquery-1.4.3.min.js → js/lib/jquery-1.7.2.min.js} +0 -0
- data/webapp/js/lib/jquery.blockUI.js +499 -0
- data/webapp/js/lib/jquery.cookie.js +47 -0
- data/webapp/js/lib/jquery.form.js +782 -0
- data/webapp/js/lib/jquery.jstree.js +3510 -0
- data/webapp/js/lib/jquery.sammy.js +1856 -0
- data/webapp/js/lib/jquery.sparkline.js +1271 -0
- data/webapp/js/lib/jquery.timeago.js +165 -0
- data/webapp/js/lib/linker.js +48 -0
- data/webapp/js/lib/order.js +189 -0
- data/webapp/js/main.js +57 -0
- data/webapp/js/require.js +11319 -0
- data/webapp/js/scripts/analysis.js +549 -0
- data/webapp/js/scripts/app.js +368 -0
- data/webapp/js/scripts/cloud.js +719 -0
- data/webapp/js/scripts/cores.js +540 -0
- data/webapp/js/scripts/dashboard.js +540 -0
- data/webapp/js/scripts/dataimport.js +567 -0
- data/webapp/js/scripts/file.js +56 -0
- data/webapp/js/scripts/index.js +344 -0
- data/webapp/js/scripts/java-properties.js +107 -0
- data/webapp/js/scripts/logging.js +519 -0
- data/webapp/js/scripts/ping.js +72 -0
- data/webapp/js/scripts/plugins.js +426 -0
- data/webapp/js/scripts/query.js +170 -0
- data/webapp/js/scripts/replication.js +557 -0
- data/webapp/js/scripts/schema-browser.js +1206 -0
- data/webapp/js/scripts/threads.js +159 -0
- data/webapp/tpl/analysis.html +83 -0
- data/webapp/tpl/cloud.html +54 -0
- data/webapp/tpl/cores.html +215 -0
- data/webapp/tpl/dashboard.html +164 -0
- data/webapp/tpl/dataimport.html +123 -0
- data/webapp/tpl/index.html +250 -0
- data/webapp/tpl/logging.html +23 -0
- data/webapp/tpl/plugins.html +39 -0
- data/webapp/tpl/query.html +318 -0
- data/webapp/tpl/replication.html +207 -0
- data/webapp/tpl/schema-browser.html +178 -0
- data/webapp/tpl/threads.html +56 -0
- metadata +307 -40
- data/lib/rjack-solr/solr-core-3.6.2.jar +0 -0
- data/lib/rjack-solr/solr-solrj-3.6.2.jar +0 -0
- data/webapp/admin/_info.jsp +0 -120
- data/webapp/admin/action.jsp +0 -94
- data/webapp/admin/analysis.jsp +0 -496
- data/webapp/admin/analysis.xsl +0 -179
- data/webapp/admin/dataimport.jsp +0 -53
- data/webapp/admin/debug.jsp +0 -103
- data/webapp/admin/distributiondump.jsp +0 -160
- data/webapp/admin/form.jsp +0 -152
- data/webapp/admin/get-file.jsp +0 -72
- data/webapp/admin/header.jsp +0 -44
- data/webapp/admin/index.jsp +0 -162
- data/webapp/admin/meta.xsl +0 -34
- data/webapp/admin/ping.jsp +0 -52
- data/webapp/admin/ping.xsl +0 -71
- data/webapp/admin/raw-schema.jsp +0 -38
- data/webapp/admin/registry.jsp +0 -107
- data/webapp/admin/registry.xsl +0 -321
- data/webapp/admin/replication/header.jsp +0 -89
- data/webapp/admin/replication/index.jsp +0 -378
- data/webapp/admin/schema.jsp +0 -690
- data/webapp/admin/solr-admin.css +0 -215
- data/webapp/admin/stats.jsp +0 -92
- data/webapp/admin/stats.xsl +0 -220
- data/webapp/admin/tabular.xsl +0 -141
- data/webapp/admin/threaddump.jsp +0 -110
- data/webapp/admin/threaddump.xsl +0 -103
- data/webapp/index.jsp +0 -49
@@ -0,0 +1,953 @@
|
|
1
|
+
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
2
|
+
// by Patrick Filler for Harvest, http://getharvest.com
|
3
|
+
//
|
4
|
+
// Version 0.9.8
|
5
|
+
// Full source at https://github.com/harvesthq/chosen
|
6
|
+
// Copyright (c) 2011 Harvest http://getharvest.com
|
7
|
+
|
8
|
+
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
9
|
+
// This file is generated by `cake build`, do not edit it by hand.
|
10
|
+
(function() {
|
11
|
+
var SelectParser;
|
12
|
+
|
13
|
+
SelectParser = (function() {
|
14
|
+
|
15
|
+
function SelectParser() {
|
16
|
+
this.options_index = 0;
|
17
|
+
this.parsed = [];
|
18
|
+
}
|
19
|
+
|
20
|
+
SelectParser.prototype.add_node = function(child) {
|
21
|
+
if (child.nodeName === "OPTGROUP") {
|
22
|
+
return this.add_group(child);
|
23
|
+
} else {
|
24
|
+
return this.add_option(child);
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
SelectParser.prototype.add_group = function(group) {
|
29
|
+
var group_position, option, _i, _len, _ref, _results;
|
30
|
+
group_position = this.parsed.length;
|
31
|
+
this.parsed.push({
|
32
|
+
array_index: group_position,
|
33
|
+
group: true,
|
34
|
+
label: group.label,
|
35
|
+
children: 0,
|
36
|
+
disabled: group.disabled
|
37
|
+
});
|
38
|
+
_ref = group.childNodes;
|
39
|
+
_results = [];
|
40
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
41
|
+
option = _ref[_i];
|
42
|
+
_results.push(this.add_option(option, group_position, group.disabled));
|
43
|
+
}
|
44
|
+
return _results;
|
45
|
+
};
|
46
|
+
|
47
|
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
48
|
+
if (option.nodeName === "OPTION") {
|
49
|
+
if (option.text !== "") {
|
50
|
+
if (group_position != null) this.parsed[group_position].children += 1;
|
51
|
+
this.parsed.push({
|
52
|
+
array_index: this.parsed.length,
|
53
|
+
options_index: this.options_index,
|
54
|
+
value: option.value,
|
55
|
+
text: option.text,
|
56
|
+
html: option.innerHTML,
|
57
|
+
selected: option.selected,
|
58
|
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
59
|
+
group_array_index: group_position,
|
60
|
+
classes: option.className,
|
61
|
+
style: option.style.cssText
|
62
|
+
});
|
63
|
+
} else {
|
64
|
+
this.parsed.push({
|
65
|
+
array_index: this.parsed.length,
|
66
|
+
options_index: this.options_index,
|
67
|
+
empty: true
|
68
|
+
});
|
69
|
+
}
|
70
|
+
return this.options_index += 1;
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
return SelectParser;
|
75
|
+
|
76
|
+
})();
|
77
|
+
|
78
|
+
SelectParser.select_to_array = function(select) {
|
79
|
+
var child, parser, _i, _len, _ref;
|
80
|
+
parser = new SelectParser();
|
81
|
+
_ref = select.childNodes;
|
82
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
83
|
+
child = _ref[_i];
|
84
|
+
parser.add_node(child);
|
85
|
+
}
|
86
|
+
return parser.parsed;
|
87
|
+
};
|
88
|
+
|
89
|
+
this.SelectParser = SelectParser;
|
90
|
+
|
91
|
+
}).call(this);
|
92
|
+
|
93
|
+
/*
|
94
|
+
Chosen source: generate output using 'cake build'
|
95
|
+
Copyright (c) 2011 by Harvest
|
96
|
+
*/
|
97
|
+
|
98
|
+
(function() {
|
99
|
+
var AbstractChosen, root;
|
100
|
+
|
101
|
+
root = this;
|
102
|
+
|
103
|
+
AbstractChosen = (function() {
|
104
|
+
|
105
|
+
function AbstractChosen(form_field, options) {
|
106
|
+
this.form_field = form_field;
|
107
|
+
this.options = options != null ? options : {};
|
108
|
+
this.set_default_values();
|
109
|
+
this.is_multiple = this.form_field.multiple;
|
110
|
+
this.default_text_default = this.is_multiple ? "Select Some Options" : "Select an Option";
|
111
|
+
this.setup();
|
112
|
+
this.set_up_html();
|
113
|
+
this.register_observers();
|
114
|
+
this.finish_setup();
|
115
|
+
}
|
116
|
+
|
117
|
+
AbstractChosen.prototype.set_default_values = function() {
|
118
|
+
var _this = this;
|
119
|
+
this.click_test_action = function(evt) {
|
120
|
+
return _this.test_active_click(evt);
|
121
|
+
};
|
122
|
+
this.activate_action = function(evt) {
|
123
|
+
return _this.activate_field(evt);
|
124
|
+
};
|
125
|
+
this.active_field = false;
|
126
|
+
this.mouse_on_container = false;
|
127
|
+
this.results_showing = false;
|
128
|
+
this.result_highlighted = null;
|
129
|
+
this.result_single_selected = null;
|
130
|
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
131
|
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
132
|
+
this.search_contains = this.options.search_contains || false;
|
133
|
+
this.choices = 0;
|
134
|
+
return this.results_none_found = this.options.no_results_text || "No results match";
|
135
|
+
};
|
136
|
+
|
137
|
+
AbstractChosen.prototype.mouse_enter = function() {
|
138
|
+
return this.mouse_on_container = true;
|
139
|
+
};
|
140
|
+
|
141
|
+
AbstractChosen.prototype.mouse_leave = function() {
|
142
|
+
return this.mouse_on_container = false;
|
143
|
+
};
|
144
|
+
|
145
|
+
AbstractChosen.prototype.input_focus = function(evt) {
|
146
|
+
var _this = this;
|
147
|
+
if (!this.active_field) {
|
148
|
+
return setTimeout((function() {
|
149
|
+
return _this.container_mousedown();
|
150
|
+
}), 50);
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
154
|
+
AbstractChosen.prototype.input_blur = function(evt) {
|
155
|
+
var _this = this;
|
156
|
+
if (!this.mouse_on_container) {
|
157
|
+
this.active_field = false;
|
158
|
+
return setTimeout((function() {
|
159
|
+
return _this.blur_test();
|
160
|
+
}), 100);
|
161
|
+
}
|
162
|
+
};
|
163
|
+
|
164
|
+
AbstractChosen.prototype.result_add_option = function(option) {
|
165
|
+
var classes, style;
|
166
|
+
if (!option.disabled) {
|
167
|
+
option.dom_id = this.container_id + "_o_" + option.array_index;
|
168
|
+
classes = option.selected && this.is_multiple ? [] : ["active-result"];
|
169
|
+
if (option.selected) classes.push("result-selected");
|
170
|
+
if (option.group_array_index != null) classes.push("group-option");
|
171
|
+
if (option.classes !== "") classes.push(option.classes);
|
172
|
+
style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
|
173
|
+
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
|
174
|
+
} else {
|
175
|
+
return "";
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
179
|
+
AbstractChosen.prototype.results_update_field = function() {
|
180
|
+
this.result_clear_highlight();
|
181
|
+
this.result_single_selected = null;
|
182
|
+
return this.results_build();
|
183
|
+
};
|
184
|
+
|
185
|
+
AbstractChosen.prototype.results_toggle = function() {
|
186
|
+
if (this.results_showing) {
|
187
|
+
return this.results_hide();
|
188
|
+
} else {
|
189
|
+
return this.results_show();
|
190
|
+
}
|
191
|
+
};
|
192
|
+
|
193
|
+
AbstractChosen.prototype.results_search = function(evt) {
|
194
|
+
if (this.results_showing) {
|
195
|
+
return this.winnow_results();
|
196
|
+
} else {
|
197
|
+
return this.results_show();
|
198
|
+
}
|
199
|
+
};
|
200
|
+
|
201
|
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
202
|
+
var stroke, _ref;
|
203
|
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
204
|
+
this.search_field_scale();
|
205
|
+
switch (stroke) {
|
206
|
+
case 8:
|
207
|
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
|
208
|
+
return this.keydown_backstroke();
|
209
|
+
} else if (!this.pending_backstroke) {
|
210
|
+
this.result_clear_highlight();
|
211
|
+
return this.results_search();
|
212
|
+
}
|
213
|
+
break;
|
214
|
+
case 13:
|
215
|
+
evt.preventDefault();
|
216
|
+
if (this.results_showing) return this.result_select(evt);
|
217
|
+
break;
|
218
|
+
case 27:
|
219
|
+
if (this.results_showing) this.results_hide();
|
220
|
+
return true;
|
221
|
+
case 9:
|
222
|
+
case 38:
|
223
|
+
case 40:
|
224
|
+
case 16:
|
225
|
+
case 91:
|
226
|
+
case 17:
|
227
|
+
break;
|
228
|
+
default:
|
229
|
+
return this.results_search();
|
230
|
+
}
|
231
|
+
};
|
232
|
+
|
233
|
+
AbstractChosen.prototype.generate_field_id = function() {
|
234
|
+
var new_id;
|
235
|
+
new_id = this.generate_random_id();
|
236
|
+
this.form_field.id = new_id;
|
237
|
+
return new_id;
|
238
|
+
};
|
239
|
+
|
240
|
+
AbstractChosen.prototype.generate_random_char = function() {
|
241
|
+
var chars, newchar, rand;
|
242
|
+
chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
|
243
|
+
rand = Math.floor(Math.random() * chars.length);
|
244
|
+
return newchar = chars.substring(rand, rand + 1);
|
245
|
+
};
|
246
|
+
|
247
|
+
return AbstractChosen;
|
248
|
+
|
249
|
+
})();
|
250
|
+
|
251
|
+
root.AbstractChosen = AbstractChosen;
|
252
|
+
|
253
|
+
}).call(this);
|
254
|
+
|
255
|
+
/*
|
256
|
+
Chosen source: generate output using 'cake build'
|
257
|
+
Copyright (c) 2011 by Harvest
|
258
|
+
*/
|
259
|
+
|
260
|
+
(function() {
|
261
|
+
var $, Chosen, get_side_border_padding, root,
|
262
|
+
__hasProp = Object.prototype.hasOwnProperty,
|
263
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
264
|
+
|
265
|
+
root = this;
|
266
|
+
|
267
|
+
$ = jQuery;
|
268
|
+
|
269
|
+
$.fn.extend({
|
270
|
+
chosen: function(options) {
|
271
|
+
if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
|
272
|
+
return this;
|
273
|
+
}
|
274
|
+
return $(this).each(function(input_field) {
|
275
|
+
if (!($(this)).hasClass("chzn-done")) return new Chosen(this, options);
|
276
|
+
});
|
277
|
+
}
|
278
|
+
});
|
279
|
+
|
280
|
+
Chosen = (function(_super) {
|
281
|
+
|
282
|
+
__extends(Chosen, _super);
|
283
|
+
|
284
|
+
function Chosen() {
|
285
|
+
Chosen.__super__.constructor.apply(this, arguments);
|
286
|
+
}
|
287
|
+
|
288
|
+
Chosen.prototype.setup = function() {
|
289
|
+
this.form_field_jq = $(this.form_field);
|
290
|
+
return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
|
291
|
+
};
|
292
|
+
|
293
|
+
Chosen.prototype.finish_setup = function() {
|
294
|
+
return this.form_field_jq.addClass("chzn-done");
|
295
|
+
};
|
296
|
+
|
297
|
+
Chosen.prototype.set_up_html = function() {
|
298
|
+
var container_div, dd_top, dd_width, sf_width;
|
299
|
+
this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
|
300
|
+
this.container_id += "_chzn";
|
301
|
+
this.f_width = this.form_field_jq.outerWidth();
|
302
|
+
this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
|
303
|
+
container_div = $("<div />", {
|
304
|
+
id: this.container_id,
|
305
|
+
"class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
|
306
|
+
style: 'width: ' + this.f_width + 'px;'
|
307
|
+
});
|
308
|
+
if (this.is_multiple) {
|
309
|
+
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
310
|
+
} else {
|
311
|
+
container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="search" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
|
312
|
+
}
|
313
|
+
this.form_field_jq.hide().after(container_div);
|
314
|
+
this.container = $('#' + this.container_id);
|
315
|
+
this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
|
316
|
+
this.dropdown = this.container.find('div.chzn-drop').first();
|
317
|
+
dd_top = this.container.height();
|
318
|
+
dd_width = this.f_width - get_side_border_padding(this.dropdown);
|
319
|
+
this.dropdown.css({
|
320
|
+
"width": dd_width + "px",
|
321
|
+
"top": dd_top + "px"
|
322
|
+
});
|
323
|
+
this.search_field = this.container.find('input').first();
|
324
|
+
this.search_results = this.container.find('ul.chzn-results').first();
|
325
|
+
this.search_field_scale();
|
326
|
+
this.search_no_results = this.container.find('li.no-results').first();
|
327
|
+
if (this.is_multiple) {
|
328
|
+
this.search_choices = this.container.find('ul.chzn-choices').first();
|
329
|
+
this.search_container = this.container.find('li.search-field').first();
|
330
|
+
} else {
|
331
|
+
this.search_container = this.container.find('div.chzn-search').first();
|
332
|
+
this.selected_item = this.container.find('.chzn-single').first();
|
333
|
+
sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
|
334
|
+
sf_width = dd_width - get_side_border_padding(this.search_container);
|
335
|
+
this.search_field.css({
|
336
|
+
"width": sf_width + "px"
|
337
|
+
});
|
338
|
+
}
|
339
|
+
this.results_build();
|
340
|
+
this.set_tab_index();
|
341
|
+
return this.form_field_jq.trigger("liszt:ready", {
|
342
|
+
chosen: this
|
343
|
+
});
|
344
|
+
};
|
345
|
+
|
346
|
+
Chosen.prototype.register_observers = function() {
|
347
|
+
var _this = this;
|
348
|
+
this.container.mousedown(function(evt) {
|
349
|
+
return _this.container_mousedown(evt);
|
350
|
+
});
|
351
|
+
this.container.mouseup(function(evt) {
|
352
|
+
return _this.container_mouseup(evt);
|
353
|
+
});
|
354
|
+
this.container.mouseenter(function(evt) {
|
355
|
+
return _this.mouse_enter(evt);
|
356
|
+
});
|
357
|
+
this.container.mouseleave(function(evt) {
|
358
|
+
return _this.mouse_leave(evt);
|
359
|
+
});
|
360
|
+
this.search_results.mouseup(function(evt) {
|
361
|
+
return _this.search_results_mouseup(evt);
|
362
|
+
});
|
363
|
+
this.search_results.mouseover(function(evt) {
|
364
|
+
return _this.search_results_mouseover(evt);
|
365
|
+
});
|
366
|
+
this.search_results.mouseout(function(evt) {
|
367
|
+
return _this.search_results_mouseout(evt);
|
368
|
+
});
|
369
|
+
this.form_field_jq.bind("liszt:updated", function(evt) {
|
370
|
+
return _this.results_update_field(evt);
|
371
|
+
});
|
372
|
+
this.search_field.blur(function(evt) {
|
373
|
+
return _this.input_blur(evt);
|
374
|
+
});
|
375
|
+
this.search_field.keyup(function(evt) {
|
376
|
+
return _this.keyup_checker(evt);
|
377
|
+
});
|
378
|
+
this.search_field.keydown(function(evt) {
|
379
|
+
return _this.keydown_checker(evt);
|
380
|
+
});
|
381
|
+
if (this.is_multiple) {
|
382
|
+
this.search_choices.click(function(evt) {
|
383
|
+
return _this.choices_click(evt);
|
384
|
+
});
|
385
|
+
return this.search_field.focus(function(evt) {
|
386
|
+
return _this.input_focus(evt);
|
387
|
+
});
|
388
|
+
} else {
|
389
|
+
return this.container.click(function(evt) {
|
390
|
+
return evt.preventDefault();
|
391
|
+
});
|
392
|
+
}
|
393
|
+
};
|
394
|
+
|
395
|
+
Chosen.prototype.search_field_disabled = function() {
|
396
|
+
this.is_disabled = this.form_field_jq[0].disabled;
|
397
|
+
if (this.is_disabled) {
|
398
|
+
this.container.addClass('chzn-disabled');
|
399
|
+
this.search_field[0].disabled = true;
|
400
|
+
if (!this.is_multiple) {
|
401
|
+
this.selected_item.unbind("focus", this.activate_action);
|
402
|
+
}
|
403
|
+
return this.close_field();
|
404
|
+
} else {
|
405
|
+
this.container.removeClass('chzn-disabled');
|
406
|
+
this.search_field[0].disabled = false;
|
407
|
+
if (!this.is_multiple) {
|
408
|
+
return this.selected_item.bind("focus", this.activate_action);
|
409
|
+
}
|
410
|
+
}
|
411
|
+
};
|
412
|
+
|
413
|
+
Chosen.prototype.container_mousedown = function(evt) {
|
414
|
+
var target_closelink;
|
415
|
+
if (!this.is_disabled) {
|
416
|
+
target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
|
417
|
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
418
|
+
evt.stopPropagation();
|
419
|
+
}
|
420
|
+
if (!this.pending_destroy_click && !target_closelink) {
|
421
|
+
if (!this.active_field) {
|
422
|
+
if (this.is_multiple) this.search_field.val("");
|
423
|
+
$(document).click(this.click_test_action);
|
424
|
+
this.results_show();
|
425
|
+
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
|
426
|
+
evt.preventDefault();
|
427
|
+
this.results_toggle();
|
428
|
+
}
|
429
|
+
return this.activate_field();
|
430
|
+
} else {
|
431
|
+
return this.pending_destroy_click = false;
|
432
|
+
}
|
433
|
+
}
|
434
|
+
};
|
435
|
+
|
436
|
+
Chosen.prototype.container_mouseup = function(evt) {
|
437
|
+
if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
|
438
|
+
};
|
439
|
+
|
440
|
+
Chosen.prototype.blur_test = function(evt) {
|
441
|
+
if (!this.active_field && this.container.hasClass("chzn-container-active")) {
|
442
|
+
return this.close_field();
|
443
|
+
}
|
444
|
+
};
|
445
|
+
|
446
|
+
Chosen.prototype.close_field = function() {
|
447
|
+
$(document).unbind("click", this.click_test_action);
|
448
|
+
if (!this.is_multiple) {
|
449
|
+
this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
|
450
|
+
this.search_field.attr("tabindex", -1);
|
451
|
+
}
|
452
|
+
this.active_field = false;
|
453
|
+
this.results_hide();
|
454
|
+
this.container.removeClass("chzn-container-active");
|
455
|
+
this.winnow_results_clear();
|
456
|
+
this.clear_backstroke();
|
457
|
+
this.show_search_field_default();
|
458
|
+
return this.search_field_scale();
|
459
|
+
};
|
460
|
+
|
461
|
+
Chosen.prototype.activate_field = function() {
|
462
|
+
if (!this.is_multiple && !this.active_field) {
|
463
|
+
this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
|
464
|
+
this.selected_item.attr("tabindex", -1);
|
465
|
+
}
|
466
|
+
this.container.addClass("chzn-container-active");
|
467
|
+
this.active_field = true;
|
468
|
+
this.search_field.val(this.search_field.val());
|
469
|
+
return this.search_field.focus();
|
470
|
+
};
|
471
|
+
|
472
|
+
Chosen.prototype.test_active_click = function(evt) {
|
473
|
+
if ($(evt.target).parents('#' + this.container_id).length) {
|
474
|
+
return this.active_field = true;
|
475
|
+
} else {
|
476
|
+
return this.close_field();
|
477
|
+
}
|
478
|
+
};
|
479
|
+
|
480
|
+
Chosen.prototype.results_build = function() {
|
481
|
+
var content, data, _i, _len, _ref;
|
482
|
+
this.parsing = true;
|
483
|
+
this.results_data = root.SelectParser.select_to_array(this.form_field);
|
484
|
+
if (this.is_multiple && this.choices > 0) {
|
485
|
+
this.search_choices.find("li.search-choice").remove();
|
486
|
+
this.choices = 0;
|
487
|
+
} else if (!this.is_multiple) {
|
488
|
+
this.selected_item.find("span").text(this.default_text);
|
489
|
+
if (this.form_field.options.length <= this.disable_search_threshold) {
|
490
|
+
this.container.addClass("chzn-container-single-nosearch");
|
491
|
+
} else {
|
492
|
+
this.container.removeClass("chzn-container-single-nosearch");
|
493
|
+
}
|
494
|
+
}
|
495
|
+
content = '';
|
496
|
+
_ref = this.results_data;
|
497
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
498
|
+
data = _ref[_i];
|
499
|
+
if (data.group) {
|
500
|
+
content += this.result_add_group(data);
|
501
|
+
} else if (!data.empty) {
|
502
|
+
content += this.result_add_option(data);
|
503
|
+
if (data.selected && this.is_multiple) {
|
504
|
+
this.choice_build(data);
|
505
|
+
} else if (data.selected && !this.is_multiple) {
|
506
|
+
this.selected_item.removeClass("chzn-default").find("span").text(data.text);
|
507
|
+
if (this.allow_single_deselect) this.single_deselect_control_build();
|
508
|
+
}
|
509
|
+
}
|
510
|
+
}
|
511
|
+
this.search_field_disabled();
|
512
|
+
this.show_search_field_default();
|
513
|
+
this.search_field_scale();
|
514
|
+
this.search_results.html(content);
|
515
|
+
return this.parsing = false;
|
516
|
+
};
|
517
|
+
|
518
|
+
Chosen.prototype.result_add_group = function(group) {
|
519
|
+
if (!group.disabled) {
|
520
|
+
group.dom_id = this.container_id + "_g_" + group.array_index;
|
521
|
+
return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
|
522
|
+
} else {
|
523
|
+
return "";
|
524
|
+
}
|
525
|
+
};
|
526
|
+
|
527
|
+
Chosen.prototype.result_do_highlight = function(el) {
|
528
|
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
529
|
+
if (el.length) {
|
530
|
+
this.result_clear_highlight();
|
531
|
+
this.result_highlight = el;
|
532
|
+
this.result_highlight.addClass("highlighted");
|
533
|
+
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
534
|
+
visible_top = this.search_results.scrollTop();
|
535
|
+
visible_bottom = maxHeight + visible_top;
|
536
|
+
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
537
|
+
high_bottom = high_top + this.result_highlight.outerHeight();
|
538
|
+
if (high_bottom >= visible_bottom) {
|
539
|
+
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
540
|
+
} else if (high_top < visible_top) {
|
541
|
+
return this.search_results.scrollTop(high_top);
|
542
|
+
}
|
543
|
+
}
|
544
|
+
};
|
545
|
+
|
546
|
+
Chosen.prototype.result_clear_highlight = function() {
|
547
|
+
if (this.result_highlight) this.result_highlight.removeClass("highlighted");
|
548
|
+
return this.result_highlight = null;
|
549
|
+
};
|
550
|
+
|
551
|
+
Chosen.prototype.results_show = function() {
|
552
|
+
var dd_top;
|
553
|
+
if (!this.is_multiple) {
|
554
|
+
this.selected_item.addClass("chzn-single-with-drop");
|
555
|
+
if (this.result_single_selected) {
|
556
|
+
this.result_do_highlight(this.result_single_selected);
|
557
|
+
}
|
558
|
+
}
|
559
|
+
dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
|
560
|
+
this.dropdown.css({
|
561
|
+
"top": dd_top + "px",
|
562
|
+
"left": 0
|
563
|
+
});
|
564
|
+
this.results_showing = true;
|
565
|
+
this.search_field.focus();
|
566
|
+
this.search_field.val(this.search_field.val());
|
567
|
+
return this.winnow_results();
|
568
|
+
};
|
569
|
+
|
570
|
+
Chosen.prototype.results_hide = function() {
|
571
|
+
if (!this.is_multiple) {
|
572
|
+
this.selected_item.removeClass("chzn-single-with-drop");
|
573
|
+
}
|
574
|
+
this.result_clear_highlight();
|
575
|
+
this.dropdown.css({
|
576
|
+
"left": "-9000px"
|
577
|
+
});
|
578
|
+
return this.results_showing = false;
|
579
|
+
};
|
580
|
+
|
581
|
+
Chosen.prototype.set_tab_index = function(el) {
|
582
|
+
var ti;
|
583
|
+
if (this.form_field_jq.attr("tabindex")) {
|
584
|
+
ti = this.form_field_jq.attr("tabindex");
|
585
|
+
this.form_field_jq.attr("tabindex", -1);
|
586
|
+
if (this.is_multiple) {
|
587
|
+
return this.search_field.attr("tabindex", ti);
|
588
|
+
} else {
|
589
|
+
this.selected_item.attr("tabindex", ti);
|
590
|
+
return this.search_field.attr("tabindex", -1);
|
591
|
+
}
|
592
|
+
}
|
593
|
+
};
|
594
|
+
|
595
|
+
Chosen.prototype.show_search_field_default = function() {
|
596
|
+
if (this.is_multiple && this.choices < 1 && !this.active_field) {
|
597
|
+
this.search_field.val(this.default_text);
|
598
|
+
return this.search_field.addClass("default");
|
599
|
+
} else {
|
600
|
+
this.search_field.val("");
|
601
|
+
return this.search_field.removeClass("default");
|
602
|
+
}
|
603
|
+
};
|
604
|
+
|
605
|
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
606
|
+
var target;
|
607
|
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
608
|
+
if (target.length) {
|
609
|
+
this.result_highlight = target;
|
610
|
+
return this.result_select(evt);
|
611
|
+
}
|
612
|
+
};
|
613
|
+
|
614
|
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
615
|
+
var target;
|
616
|
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
617
|
+
if (target) return this.result_do_highlight(target);
|
618
|
+
};
|
619
|
+
|
620
|
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
621
|
+
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
622
|
+
return this.result_clear_highlight();
|
623
|
+
}
|
624
|
+
};
|
625
|
+
|
626
|
+
Chosen.prototype.choices_click = function(evt) {
|
627
|
+
evt.preventDefault();
|
628
|
+
if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
|
629
|
+
return this.results_show();
|
630
|
+
}
|
631
|
+
};
|
632
|
+
|
633
|
+
Chosen.prototype.choice_build = function(item) {
|
634
|
+
var choice_id, link,
|
635
|
+
_this = this;
|
636
|
+
choice_id = this.container_id + "_c_" + item.array_index;
|
637
|
+
this.choices += 1;
|
638
|
+
this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
|
639
|
+
link = $('#' + choice_id).find("a").first();
|
640
|
+
return link.click(function(evt) {
|
641
|
+
return _this.choice_destroy_link_click(evt);
|
642
|
+
});
|
643
|
+
};
|
644
|
+
|
645
|
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
646
|
+
evt.preventDefault();
|
647
|
+
if (!this.is_disabled) {
|
648
|
+
this.pending_destroy_click = true;
|
649
|
+
return this.choice_destroy($(evt.target));
|
650
|
+
} else {
|
651
|
+
return evt.stopPropagation;
|
652
|
+
}
|
653
|
+
};
|
654
|
+
|
655
|
+
Chosen.prototype.choice_destroy = function(link) {
|
656
|
+
this.choices -= 1;
|
657
|
+
this.show_search_field_default();
|
658
|
+
if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
|
659
|
+
this.results_hide();
|
660
|
+
}
|
661
|
+
this.result_deselect(link.attr("rel"));
|
662
|
+
return link.parents('li').first().remove();
|
663
|
+
};
|
664
|
+
|
665
|
+
Chosen.prototype.results_reset = function(evt) {
|
666
|
+
this.form_field.options[0].selected = true;
|
667
|
+
this.selected_item.find("span").text(this.default_text);
|
668
|
+
if (!this.is_multiple) this.selected_item.addClass("chzn-default");
|
669
|
+
this.show_search_field_default();
|
670
|
+
$(evt.target).remove();
|
671
|
+
this.form_field_jq.trigger("change");
|
672
|
+
if (this.active_field) return this.results_hide();
|
673
|
+
};
|
674
|
+
|
675
|
+
Chosen.prototype.result_select = function(evt) {
|
676
|
+
var high, high_id, item, position;
|
677
|
+
if (this.result_highlight) {
|
678
|
+
high = this.result_highlight;
|
679
|
+
high_id = high.attr("id");
|
680
|
+
this.result_clear_highlight();
|
681
|
+
if (this.is_multiple) {
|
682
|
+
this.result_deactivate(high);
|
683
|
+
} else {
|
684
|
+
this.search_results.find(".result-selected").removeClass("result-selected");
|
685
|
+
this.result_single_selected = high;
|
686
|
+
this.selected_item.removeClass("chzn-default");
|
687
|
+
}
|
688
|
+
high.addClass("result-selected");
|
689
|
+
position = high_id.substr(high_id.lastIndexOf("_") + 1);
|
690
|
+
item = this.results_data[position];
|
691
|
+
item.selected = true;
|
692
|
+
this.form_field.options[item.options_index].selected = true;
|
693
|
+
if (this.is_multiple) {
|
694
|
+
this.choice_build(item);
|
695
|
+
} else {
|
696
|
+
this.selected_item.find("span").first().text(item.text);
|
697
|
+
if (this.allow_single_deselect) this.single_deselect_control_build();
|
698
|
+
}
|
699
|
+
if (!(evt.metaKey && this.is_multiple)) this.results_hide();
|
700
|
+
this.search_field.val("");
|
701
|
+
this.form_field_jq.trigger("change");
|
702
|
+
return this.search_field_scale();
|
703
|
+
}
|
704
|
+
};
|
705
|
+
|
706
|
+
Chosen.prototype.result_activate = function(el) {
|
707
|
+
return el.addClass("active-result");
|
708
|
+
};
|
709
|
+
|
710
|
+
Chosen.prototype.result_deactivate = function(el) {
|
711
|
+
return el.removeClass("active-result");
|
712
|
+
};
|
713
|
+
|
714
|
+
Chosen.prototype.result_deselect = function(pos) {
|
715
|
+
var result, result_data;
|
716
|
+
result_data = this.results_data[pos];
|
717
|
+
result_data.selected = false;
|
718
|
+
this.form_field.options[result_data.options_index].selected = false;
|
719
|
+
result = $("#" + this.container_id + "_o_" + pos);
|
720
|
+
result.removeClass("result-selected").addClass("active-result").show();
|
721
|
+
this.result_clear_highlight();
|
722
|
+
this.winnow_results();
|
723
|
+
this.form_field_jq.trigger("change");
|
724
|
+
return this.search_field_scale();
|
725
|
+
};
|
726
|
+
|
727
|
+
Chosen.prototype.single_deselect_control_build = function() {
|
728
|
+
if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
|
729
|
+
return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
730
|
+
}
|
731
|
+
};
|
732
|
+
|
733
|
+
Chosen.prototype.winnow_results = function() {
|
734
|
+
var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
|
735
|
+
this.no_results_clear();
|
736
|
+
results = 0;
|
737
|
+
searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
|
738
|
+
regexAnchor = this.search_contains ? "" : "^";
|
739
|
+
regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
740
|
+
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
741
|
+
_ref = this.results_data;
|
742
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
743
|
+
option = _ref[_i];
|
744
|
+
if (!option.disabled && !option.empty) {
|
745
|
+
if (option.group) {
|
746
|
+
$('#' + option.dom_id).css('display', 'none');
|
747
|
+
} else if (!(this.is_multiple && option.selected)) {
|
748
|
+
found = false;
|
749
|
+
result_id = option.dom_id;
|
750
|
+
result = $("#" + result_id);
|
751
|
+
if (regex.test(option.html)) {
|
752
|
+
found = true;
|
753
|
+
results += 1;
|
754
|
+
} else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
|
755
|
+
parts = option.html.replace(/\[|\]/g, "").split(" ");
|
756
|
+
if (parts.length) {
|
757
|
+
for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
|
758
|
+
part = parts[_j];
|
759
|
+
if (regex.test(part)) {
|
760
|
+
found = true;
|
761
|
+
results += 1;
|
762
|
+
}
|
763
|
+
}
|
764
|
+
}
|
765
|
+
}
|
766
|
+
if (found) {
|
767
|
+
if (searchText.length) {
|
768
|
+
startpos = option.html.search(zregex);
|
769
|
+
text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
|
770
|
+
text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
771
|
+
} else {
|
772
|
+
text = option.html;
|
773
|
+
}
|
774
|
+
result.html(text);
|
775
|
+
this.result_activate(result);
|
776
|
+
if (option.group_array_index != null) {
|
777
|
+
$("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
|
778
|
+
}
|
779
|
+
} else {
|
780
|
+
if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
|
781
|
+
this.result_clear_highlight();
|
782
|
+
}
|
783
|
+
this.result_deactivate(result);
|
784
|
+
}
|
785
|
+
}
|
786
|
+
}
|
787
|
+
}
|
788
|
+
if (results < 1 && searchText.length) {
|
789
|
+
return this.no_results(searchText);
|
790
|
+
} else {
|
791
|
+
return this.winnow_results_set_highlight();
|
792
|
+
}
|
793
|
+
};
|
794
|
+
|
795
|
+
Chosen.prototype.winnow_results_clear = function() {
|
796
|
+
var li, lis, _i, _len, _results;
|
797
|
+
this.search_field.val("");
|
798
|
+
lis = this.search_results.find("li");
|
799
|
+
_results = [];
|
800
|
+
for (_i = 0, _len = lis.length; _i < _len; _i++) {
|
801
|
+
li = lis[_i];
|
802
|
+
li = $(li);
|
803
|
+
if (li.hasClass("group-result")) {
|
804
|
+
_results.push(li.css('display', 'auto'));
|
805
|
+
} else if (!this.is_multiple || !li.hasClass("result-selected")) {
|
806
|
+
_results.push(this.result_activate(li));
|
807
|
+
} else {
|
808
|
+
_results.push(void 0);
|
809
|
+
}
|
810
|
+
}
|
811
|
+
return _results;
|
812
|
+
};
|
813
|
+
|
814
|
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
815
|
+
var do_high, selected_results;
|
816
|
+
if (!this.result_highlight) {
|
817
|
+
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
818
|
+
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
819
|
+
if (do_high != null) return this.result_do_highlight(do_high);
|
820
|
+
}
|
821
|
+
};
|
822
|
+
|
823
|
+
Chosen.prototype.no_results = function(terms) {
|
824
|
+
var no_results_html;
|
825
|
+
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
826
|
+
no_results_html.find("span").first().html(terms);
|
827
|
+
return this.search_results.append(no_results_html);
|
828
|
+
};
|
829
|
+
|
830
|
+
Chosen.prototype.no_results_clear = function() {
|
831
|
+
return this.search_results.find(".no-results").remove();
|
832
|
+
};
|
833
|
+
|
834
|
+
Chosen.prototype.keydown_arrow = function() {
|
835
|
+
var first_active, next_sib;
|
836
|
+
if (!this.result_highlight) {
|
837
|
+
first_active = this.search_results.find("li.active-result").first();
|
838
|
+
if (first_active) this.result_do_highlight($(first_active));
|
839
|
+
} else if (this.results_showing) {
|
840
|
+
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
841
|
+
if (next_sib) this.result_do_highlight(next_sib);
|
842
|
+
}
|
843
|
+
if (!this.results_showing) return this.results_show();
|
844
|
+
};
|
845
|
+
|
846
|
+
Chosen.prototype.keyup_arrow = function() {
|
847
|
+
var prev_sibs;
|
848
|
+
if (!this.results_showing && !this.is_multiple) {
|
849
|
+
return this.results_show();
|
850
|
+
} else if (this.result_highlight) {
|
851
|
+
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
852
|
+
if (prev_sibs.length) {
|
853
|
+
return this.result_do_highlight(prev_sibs.first());
|
854
|
+
} else {
|
855
|
+
if (this.choices > 0) this.results_hide();
|
856
|
+
return this.result_clear_highlight();
|
857
|
+
}
|
858
|
+
}
|
859
|
+
};
|
860
|
+
|
861
|
+
Chosen.prototype.keydown_backstroke = function() {
|
862
|
+
if (this.pending_backstroke) {
|
863
|
+
this.choice_destroy(this.pending_backstroke.find("a").first());
|
864
|
+
return this.clear_backstroke();
|
865
|
+
} else {
|
866
|
+
this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
|
867
|
+
return this.pending_backstroke.addClass("search-choice-focus");
|
868
|
+
}
|
869
|
+
};
|
870
|
+
|
871
|
+
Chosen.prototype.clear_backstroke = function() {
|
872
|
+
if (this.pending_backstroke) {
|
873
|
+
this.pending_backstroke.removeClass("search-choice-focus");
|
874
|
+
}
|
875
|
+
return this.pending_backstroke = null;
|
876
|
+
};
|
877
|
+
|
878
|
+
Chosen.prototype.keydown_checker = function(evt) {
|
879
|
+
var stroke, _ref;
|
880
|
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
881
|
+
this.search_field_scale();
|
882
|
+
if (stroke !== 8 && this.pending_backstroke) this.clear_backstroke();
|
883
|
+
switch (stroke) {
|
884
|
+
case 8:
|
885
|
+
this.backstroke_length = this.search_field.val().length;
|
886
|
+
break;
|
887
|
+
case 9:
|
888
|
+
if (this.results_showing && !this.is_multiple) this.result_select(evt);
|
889
|
+
this.mouse_on_container = false;
|
890
|
+
break;
|
891
|
+
case 13:
|
892
|
+
evt.preventDefault();
|
893
|
+
break;
|
894
|
+
case 38:
|
895
|
+
evt.preventDefault();
|
896
|
+
this.keyup_arrow();
|
897
|
+
break;
|
898
|
+
case 40:
|
899
|
+
this.keydown_arrow();
|
900
|
+
break;
|
901
|
+
}
|
902
|
+
};
|
903
|
+
|
904
|
+
Chosen.prototype.search_field_scale = function() {
|
905
|
+
var dd_top, div, h, style, style_block, styles, w, _i, _len;
|
906
|
+
if (this.is_multiple) {
|
907
|
+
h = 0;
|
908
|
+
w = 0;
|
909
|
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
910
|
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
911
|
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
912
|
+
style = styles[_i];
|
913
|
+
style_block += style + ":" + this.search_field.css(style) + ";";
|
914
|
+
}
|
915
|
+
div = $('<div />', {
|
916
|
+
'style': style_block
|
917
|
+
});
|
918
|
+
div.text(this.search_field.val());
|
919
|
+
$('body').append(div);
|
920
|
+
w = div.width() + 25;
|
921
|
+
div.remove();
|
922
|
+
if (w > this.f_width - 10) w = this.f_width - 10;
|
923
|
+
this.search_field.css({
|
924
|
+
'width': w + 'px'
|
925
|
+
});
|
926
|
+
dd_top = this.container.height();
|
927
|
+
return this.dropdown.css({
|
928
|
+
"top": dd_top + "px"
|
929
|
+
});
|
930
|
+
}
|
931
|
+
};
|
932
|
+
|
933
|
+
Chosen.prototype.generate_random_id = function() {
|
934
|
+
var string;
|
935
|
+
string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
|
936
|
+
while ($("#" + string).length > 0) {
|
937
|
+
string += this.generate_random_char();
|
938
|
+
}
|
939
|
+
return string;
|
940
|
+
};
|
941
|
+
|
942
|
+
return Chosen;
|
943
|
+
|
944
|
+
})(AbstractChosen);
|
945
|
+
|
946
|
+
get_side_border_padding = function(elmt) {
|
947
|
+
var side_border_padding;
|
948
|
+
return side_border_padding = elmt.outerWidth() - elmt.width();
|
949
|
+
};
|
950
|
+
|
951
|
+
root.get_side_border_padding = get_side_border_padding;
|
952
|
+
|
953
|
+
}).call(this);
|