social_stream 0.20.2 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- data/base/app/assets/images/btn/permission_negative.png +0 -0
- data/base/app/assets/images/btn/permission_positive.png +0 -0
- data/base/app/assets/javascripts/activities.js.erb +2 -118
- data/base/app/assets/javascripts/social_stream-base.js +3 -0
- data/base/app/assets/javascripts/social_stream.timeline.js +42 -0
- data/base/app/assets/javascripts/social_stream.wall.js.erb +125 -0
- data/base/app/assets/stylesheets/cheesecake.css.scss +9 -1
- data/base/app/helpers/notifications_helper.rb +1 -5
- data/base/app/models/activity.rb +21 -2
- data/base/app/models/comment.rb +5 -0
- data/base/app/models/permission.rb +16 -1
- data/base/app/models/post.rb +5 -0
- data/base/app/views/activities/_new.html.erb +7 -6
- data/base/app/views/activities/_wall.html.erb +6 -0
- data/base/app/views/cheesecake/_index.html.erb +17 -0
- data/base/app/views/cheesecake/_sector_form.html.erb +15 -6
- data/base/app/views/comments/_new.html.erb +2 -2
- data/base/app/views/comments/create.js.erb +1 -3
- data/base/app/views/notifications/activities/_post.html.erb +0 -3
- data/base/app/views/permissions/_index.html.erb +2 -2
- data/base/app/views/posts/create.js.erb +1 -4
- data/base/config/locales/en.yml +33 -23
- data/base/config/locales/es.yml +53 -24
- data/base/db/migrate/20120208135718_group_title_and_description_in_activity_object.rb +52 -0
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/spec/factories/activity.rb +1 -1
- data/documents/db/migrate/20120208143721_documents_group_title_and_description_in_activity_object.rb +28 -0
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/documents/spec/factories/document.rb +1 -0
- data/documents/spec/factories/picture.rb +1 -0
- data/events/db/migrate/20120208143756_events_group_title_and_description_in_activity_object.rb +26 -0
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/linkser/app/views/links/create.js.erb +1 -3
- data/linkser/db/migrate/20120208143739_linkser_group_title_and_description_in_activity_object.rb +30 -0
- data/linkser/lib/social_stream/linkser/version.rb +1 -1
- data/linkser/social_stream-linkser.gemspec +1 -1
- data/presence/app/assets/images/black_arrow7.png +0 -0
- data/presence/app/assets/images/black_arrow8.png +0 -0
- data/presence/app/assets/images/black_arrow9.png +0 -0
- data/presence/app/assets/javascripts/chat_interface_manager.js.erb +191 -23
- data/presence/app/assets/javascripts/chat_persistence.js +15 -6
- data/presence/app/assets/javascripts/chat_utilities.js +13 -0
- data/presence/app/assets/javascripts/chat_window_manager.js +101 -20
- data/presence/app/assets/javascripts/social_stream-presence.js +2 -0
- data/presence/app/assets/javascripts/xmpp_client_management.js.erb +6 -5
- data/presence/app/assets/stylesheets/chat.css.scss +43 -3
- data/presence/app/assets/stylesheets/social_stream-presence.css +1 -0
- data/presence/app/helpers/xmpp_helper.rb +4 -2
- data/presence/app/views/chat/_contacts.html.erb +55 -42
- data/presence/config/locales/en.yml +4 -1
- data/presence/config/locales/es.yml +3 -1
- data/presence/db/migrate/20110928135031_add_status_column_to_user.rb +1 -1
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/presence/vendor/assets/javascripts/jquery.flexselect.js +265 -0
- data/presence/vendor/assets/javascripts/jquery.tools.tooltip.js +2 -1
- data/presence/vendor/assets/javascripts/liquidmetal.js +90 -0
- data/presence/vendor/assets/stylesheets/flexselect.css +39 -0
- data/social_stream.gemspec +5 -5
- metadata +45 -32
- data/base/app/views/activities/_filter.html.erb +0 -83
@@ -6,6 +6,8 @@ en:
|
|
6
6
|
unableconnect: "Chat Out of Service"
|
7
7
|
title: "Chat"
|
8
8
|
password: "Password"
|
9
|
+
zerousers: "No users connected"
|
10
|
+
zerocontacts: "No contacts found"
|
9
11
|
status:
|
10
12
|
choose: "Choose status"
|
11
13
|
available: "Available"
|
@@ -17,4 +19,5 @@ en:
|
|
17
19
|
checkbox: "Enable or disable Social Stream Chat"
|
18
20
|
update: "Update Settings"
|
19
21
|
notify:
|
20
|
-
offline: "You are offline"
|
22
|
+
offline: "You are offline"
|
23
|
+
guestOffline: "is offline"
|
@@ -6,6 +6,8 @@ es:
|
|
6
6
|
unableconnect: "Chat Fuera de servicio"
|
7
7
|
title: "Chat"
|
8
8
|
password: "Contraseña"
|
9
|
+
zerousers: "No hay contactos conectados"
|
10
|
+
zerocontacts: "No se encontró ningún contacto"
|
9
11
|
status:
|
10
12
|
choose: "Establecer estado"
|
11
13
|
available: "Disponible"
|
@@ -18,4 +20,4 @@ es:
|
|
18
20
|
update: "Guardar configuración"
|
19
21
|
notify:
|
20
22
|
offline: "Desconectado"
|
21
|
-
|
23
|
+
guestOffline: "está desconectado"
|
@@ -0,0 +1,265 @@
|
|
1
|
+
/**
|
2
|
+
* flexselect: a jQuery plugin, version: 0.3 (2011-12-17)
|
3
|
+
* @requires jQuery v1.3 or later
|
4
|
+
*
|
5
|
+
* FlexSelect is a jQuery plugin that makes it easy to convert a select box into
|
6
|
+
* a Quicksilver-style, autocompleting, flex matching selection tool.
|
7
|
+
*
|
8
|
+
* For usage and examples, visit:
|
9
|
+
* http://rmm5t.github.com/jquery-flexselect/
|
10
|
+
*
|
11
|
+
* Licensed under the MIT:
|
12
|
+
* http://www.opensource.org/licenses/mit-license.php
|
13
|
+
*
|
14
|
+
* Copyright (c) 2009-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
|
15
|
+
*/
|
16
|
+
(function($) {
|
17
|
+
$.flexselect = function(select, options) { this.init(select, options); };
|
18
|
+
|
19
|
+
$.extend($.flexselect.prototype, {
|
20
|
+
settings: {
|
21
|
+
allowMismatch: false,
|
22
|
+
selectedClass: "flexselect_selected",
|
23
|
+
dropdownClass: "flexselect_dropdown",
|
24
|
+
inputIdTransform: function(id) { return id + "_flexselect"; },
|
25
|
+
inputNameTransform: function(name) { return; },
|
26
|
+
dropdownIdTransform: function(id) { return id + "_flexselect_dropdown"; }
|
27
|
+
},
|
28
|
+
select: null,
|
29
|
+
input: null,
|
30
|
+
hidden: null,
|
31
|
+
dropdown: null,
|
32
|
+
dropdownList: null,
|
33
|
+
cache: [],
|
34
|
+
results: [],
|
35
|
+
lastAbbreviation: null,
|
36
|
+
abbreviationBeforeFocus: null,
|
37
|
+
selectedIndex: 0,
|
38
|
+
picked: false,
|
39
|
+
dropdownMouseover: false, // Workaround for poor IE behaviors
|
40
|
+
|
41
|
+
init: function(select, options) {
|
42
|
+
this.settings = $.extend({}, this.settings, options);
|
43
|
+
this.select = $(select);
|
44
|
+
this.preloadCache();
|
45
|
+
this.renderControls();
|
46
|
+
this.wire();
|
47
|
+
},
|
48
|
+
|
49
|
+
preloadCache: function() {
|
50
|
+
this.cache = this.select.children("option").map(function() {
|
51
|
+
return { name: $.trim($(this).text()), value: $(this).val(), score: 0.0 };
|
52
|
+
});
|
53
|
+
},
|
54
|
+
|
55
|
+
renderControls: function() {
|
56
|
+
var selected = this.select.children("option:selected");
|
57
|
+
|
58
|
+
this.hidden = $("<input type='hidden'/>").attr({
|
59
|
+
id: this.select.attr("id"),
|
60
|
+
name: this.select.attr("name")
|
61
|
+
}).val(selected.val());
|
62
|
+
|
63
|
+
this.input = $("<input type='text' autocomplete='off' />").attr({
|
64
|
+
id: this.settings.inputIdTransform(this.select.attr("id")),
|
65
|
+
name: this.settings.inputNameTransform(this.select.attr("name")),
|
66
|
+
accesskey: this.select.attr("accesskey"),
|
67
|
+
tabindex: this.select.attr("tabindex"),
|
68
|
+
style: this.select.attr("style")
|
69
|
+
}).addClass(this.select.attr("class")).val($.trim(selected.text()));
|
70
|
+
|
71
|
+
this.dropdown = $("<div></div>").attr({
|
72
|
+
id: this.settings.dropdownIdTransform(this.select.attr("id"))
|
73
|
+
}).addClass(this.settings.dropdownClass);
|
74
|
+
this.dropdownList = $("<ul></ul>");
|
75
|
+
this.dropdown.append(this.dropdownList);
|
76
|
+
|
77
|
+
this.select.after(this.input).after(this.hidden).remove();
|
78
|
+
$("body").append(this.dropdown);
|
79
|
+
},
|
80
|
+
|
81
|
+
wire: function() {
|
82
|
+
var self = this;
|
83
|
+
|
84
|
+
this.input.click(function() {
|
85
|
+
self.lastAbbreviation = null;
|
86
|
+
self.focus();
|
87
|
+
});
|
88
|
+
|
89
|
+
this.input.mouseup(function(event) {
|
90
|
+
// This is so Safari selection actually occurs.
|
91
|
+
event.preventDefault();
|
92
|
+
});
|
93
|
+
|
94
|
+
this.input.focus(function() {
|
95
|
+
self.abbreviationBeforeFocus = self.input.val();
|
96
|
+
self.input.select();
|
97
|
+
if (!self.picked) self.filterResults();
|
98
|
+
});
|
99
|
+
|
100
|
+
this.input.blur(function() {
|
101
|
+
if (!self.dropdownMouseover) {
|
102
|
+
self.hide();
|
103
|
+
if (!self.settings.allowMismatch && !self.picked) self.reset();
|
104
|
+
}
|
105
|
+
});
|
106
|
+
|
107
|
+
this.dropdownList.mouseover(function (event) {
|
108
|
+
if (event.target.tagName == "LI") {
|
109
|
+
var rows = self.dropdown.find("li");
|
110
|
+
self.markSelected(rows.index($(event.target)));
|
111
|
+
}
|
112
|
+
});
|
113
|
+
this.dropdownList.mouseleave(function () {
|
114
|
+
self.markSelected(-1);
|
115
|
+
});
|
116
|
+
this.dropdownList.mouseup(function (event) {
|
117
|
+
self.pickSelected();
|
118
|
+
self.focusAndHide();
|
119
|
+
});
|
120
|
+
this.dropdown.mouseover(function (event) {
|
121
|
+
self.dropdownMouseover = true;
|
122
|
+
});
|
123
|
+
this.dropdown.mouseleave(function (event) {
|
124
|
+
self.dropdownMouseover = false;
|
125
|
+
});
|
126
|
+
this.dropdown.mousedown(function (event) {
|
127
|
+
event.preventDefault();
|
128
|
+
});
|
129
|
+
|
130
|
+
this.input.keyup(function(event) {
|
131
|
+
switch (event.keyCode) {
|
132
|
+
case 13: // return
|
133
|
+
event.preventDefault();
|
134
|
+
self.pickSelected();
|
135
|
+
self.focusAndHide();
|
136
|
+
break;
|
137
|
+
case 27: // esc
|
138
|
+
event.preventDefault();
|
139
|
+
self.reset();
|
140
|
+
self.focusAndHide();
|
141
|
+
break;
|
142
|
+
default:
|
143
|
+
self.filterResults();
|
144
|
+
break;
|
145
|
+
}
|
146
|
+
});
|
147
|
+
|
148
|
+
this.input.keydown(function(event) {
|
149
|
+
switch (event.keyCode) {
|
150
|
+
case 9: // tab
|
151
|
+
self.pickSelected();
|
152
|
+
self.hide();
|
153
|
+
break;
|
154
|
+
case 33: // pgup
|
155
|
+
event.preventDefault();
|
156
|
+
self.markFirst();
|
157
|
+
break;
|
158
|
+
case 34: // pgedown
|
159
|
+
event.preventDefault();
|
160
|
+
self.markLast();
|
161
|
+
break;
|
162
|
+
case 38: // up
|
163
|
+
event.preventDefault();
|
164
|
+
self.moveSelected(-1);
|
165
|
+
break;
|
166
|
+
case 40: // down
|
167
|
+
event.preventDefault();
|
168
|
+
self.moveSelected(1);
|
169
|
+
break;
|
170
|
+
case 13: // return
|
171
|
+
case 27: // esc
|
172
|
+
event.preventDefault();
|
173
|
+
event.stopPropagation();
|
174
|
+
break;
|
175
|
+
}
|
176
|
+
});
|
177
|
+
},
|
178
|
+
|
179
|
+
filterResults: function() {
|
180
|
+
var abbreviation = this.input.val();
|
181
|
+
if (abbreviation == this.lastAbbreviation) return;
|
182
|
+
|
183
|
+
var results = [];
|
184
|
+
$.each(this.cache, function() {
|
185
|
+
this.score = LiquidMetal.score(this.name, abbreviation);
|
186
|
+
if (this.score > 0.0) results.push(this);
|
187
|
+
});
|
188
|
+
this.results = results;
|
189
|
+
|
190
|
+
this.sortResults();
|
191
|
+
this.renderDropdown();
|
192
|
+
this.markFirst();
|
193
|
+
this.lastAbbreviation = abbreviation;
|
194
|
+
this.picked = false;
|
195
|
+
},
|
196
|
+
|
197
|
+
sortResults: function() {
|
198
|
+
this.results.sort(function(a, b) { return b.score - a.score; });
|
199
|
+
},
|
200
|
+
|
201
|
+
renderDropdown: function() {
|
202
|
+
var dropdownBorderWidth = this.dropdown.outerWidth() - this.dropdown.innerWidth();
|
203
|
+
var inputOffset = this.input.offset();
|
204
|
+
this.dropdown.css({
|
205
|
+
width: (this.input.outerWidth() - dropdownBorderWidth) + "px",
|
206
|
+
top: (inputOffset.top + this.input.outerHeight()) + "px",
|
207
|
+
left: inputOffset.left + "px"
|
208
|
+
});
|
209
|
+
|
210
|
+
var list = this.dropdownList.html("");
|
211
|
+
$.each(this.results, function() {
|
212
|
+
// list.append($("<li/>").html(this.name + " <small>[" + Math.round(this.score*100)/100 + "]</small>"));
|
213
|
+
list.append($("<li/>").html(this.name));
|
214
|
+
});
|
215
|
+
this.dropdown.show();
|
216
|
+
},
|
217
|
+
|
218
|
+
markSelected: function(n) {
|
219
|
+
if (n > this.results.length) return;
|
220
|
+
|
221
|
+
var rows = this.dropdown.find("li");
|
222
|
+
rows.removeClass(this.settings.selectedClass);
|
223
|
+
this.selectedIndex = n;
|
224
|
+
|
225
|
+
if (n >= 0) $(rows[n]).addClass(this.settings.selectedClass);
|
226
|
+
},
|
227
|
+
|
228
|
+
pickSelected: function() {
|
229
|
+
var selected = this.results[this.selectedIndex];
|
230
|
+
if (selected) {
|
231
|
+
//this.input.val(selected.name);
|
232
|
+
//this.picked = true;
|
233
|
+
if(typeof changeSelectContactValue == "function"){
|
234
|
+
changeSelectContactValue(selected.name,selected.value);
|
235
|
+
}
|
236
|
+
this.hidden.val(selected.value);
|
237
|
+
} else if (this.settings.allowMismatch) {
|
238
|
+
this.hidden.val("");
|
239
|
+
} else {
|
240
|
+
this.reset();
|
241
|
+
}
|
242
|
+
this.input.val("");
|
243
|
+
},
|
244
|
+
|
245
|
+
hide: function() {
|
246
|
+
this.dropdown.hide();
|
247
|
+
this.lastAbbreviation = null;
|
248
|
+
},
|
249
|
+
|
250
|
+
moveSelected: function(n) { this.markSelected(this.selectedIndex+n); },
|
251
|
+
markFirst: function() { this.markSelected(0); },
|
252
|
+
markLast: function() { this.markSelected(this.results.length - 1); },
|
253
|
+
reset: function() { this.input.val(this.abbreviationBeforeFocus); },
|
254
|
+
focus: function() { this.input.focus(); },
|
255
|
+
focusAndHide: function() { this.hide(); //this.focus();
|
256
|
+
}
|
257
|
+
});
|
258
|
+
|
259
|
+
$.fn.flexselect = function(options) {
|
260
|
+
this.each(function() {
|
261
|
+
if (this.tagName == "SELECT") new $.flexselect(this, options);
|
262
|
+
});
|
263
|
+
return this;
|
264
|
+
};
|
265
|
+
})(jQuery);
|
@@ -8,4 +8,5 @@
|
|
8
8
|
* http://flowplayer.org/tools/
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),
|
11
|
+
(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),
|
12
|
+
k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=b||a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.bind(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.bind(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=c||a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/**
|
2
|
+
* LiquidMetal, version: 1.0 (2011-12-17)
|
3
|
+
*
|
4
|
+
* A mimetic poly-alloy of Quicksilver's scoring algorithm, essentially
|
5
|
+
* LiquidMetal.
|
6
|
+
*
|
7
|
+
* For usage and examples, visit:
|
8
|
+
* http://github.com/rmm5t/liquidmetal
|
9
|
+
*
|
10
|
+
* Licensed under the MIT:
|
11
|
+
* http://www.opensource.org/licenses/mit-license.php
|
12
|
+
*
|
13
|
+
* Copyright (c) 2009-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org)
|
14
|
+
*/
|
15
|
+
var LiquidMetal = (function() {
|
16
|
+
var SCORE_NO_MATCH = 0.0;
|
17
|
+
var SCORE_MATCH = 1.0;
|
18
|
+
var SCORE_TRAILING = 0.8;
|
19
|
+
var SCORE_TRAILING_BUT_STARTED = 0.9;
|
20
|
+
var SCORE_BUFFER = 0.85;
|
21
|
+
|
22
|
+
return {
|
23
|
+
score: function(string, abbreviation) {
|
24
|
+
// Short circuits
|
25
|
+
if (abbreviation.length === 0) return SCORE_TRAILING;
|
26
|
+
if (abbreviation.length > string.length) return SCORE_NO_MATCH;
|
27
|
+
|
28
|
+
var scores = this.buildScoreArray(string, abbreviation);
|
29
|
+
|
30
|
+
// complete miss:
|
31
|
+
if ( scores === false ) return 0;
|
32
|
+
|
33
|
+
var sum = 0.0;
|
34
|
+
for (var i = 0; i < scores.length; i++) {
|
35
|
+
sum += scores[i];
|
36
|
+
}
|
37
|
+
|
38
|
+
return (sum / scores.length);
|
39
|
+
},
|
40
|
+
|
41
|
+
buildScoreArray: function(string, abbreviation) {
|
42
|
+
var scores = new Array(string.length);
|
43
|
+
var lower = string.toLowerCase();
|
44
|
+
var chars = abbreviation.toLowerCase();
|
45
|
+
|
46
|
+
var lastIndex = -1;
|
47
|
+
var started = false;
|
48
|
+
for (var i = 0; i < chars.length; i++) {
|
49
|
+
var c = chars[i];
|
50
|
+
var index = lower.indexOf(c, lastIndex+1);
|
51
|
+
|
52
|
+
if (index === -1) return false; // signal no match
|
53
|
+
if (index === 0) started = true;
|
54
|
+
|
55
|
+
if (isNewWord(string, index)) {
|
56
|
+
scores[index-1] = 1;
|
57
|
+
fillArray(scores, SCORE_BUFFER, lastIndex+1, index-1);
|
58
|
+
}
|
59
|
+
else if (isUpperCase(string, index)) {
|
60
|
+
fillArray(scores, SCORE_BUFFER, lastIndex+1, index);
|
61
|
+
}
|
62
|
+
else {
|
63
|
+
fillArray(scores, SCORE_NO_MATCH, lastIndex+1, index);
|
64
|
+
}
|
65
|
+
|
66
|
+
scores[index] = SCORE_MATCH;
|
67
|
+
lastIndex = index;
|
68
|
+
}
|
69
|
+
|
70
|
+
var trailingScore = started ? SCORE_TRAILING_BUT_STARTED : SCORE_TRAILING;
|
71
|
+
fillArray(scores, trailingScore, lastIndex+1, scores.length);
|
72
|
+
return scores;
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
function isUpperCase(string, index) {
|
77
|
+
var c = string.charAt(index);
|
78
|
+
return ("A" <= c && c <= "Z");
|
79
|
+
}
|
80
|
+
|
81
|
+
function isNewWord(string, index) {
|
82
|
+
var c = string.charAt(index-1);
|
83
|
+
return (c == " " || c == "\t");
|
84
|
+
}
|
85
|
+
|
86
|
+
function fillArray(array, value, from, to) {
|
87
|
+
for (var i = from; i < to; i++) { array[i] = value; }
|
88
|
+
return array;
|
89
|
+
}
|
90
|
+
})();
|
@@ -0,0 +1,39 @@
|
|
1
|
+
.flexselect_dropdown {
|
2
|
+
display: none;
|
3
|
+
position: absolute;
|
4
|
+
z-index: 999999;
|
5
|
+
margin: 0;
|
6
|
+
padding: 0;
|
7
|
+
border: 1px solid WindowFrame;
|
8
|
+
max-height: 200px;
|
9
|
+
overflow-x: hidden;
|
10
|
+
overflow-y: auto;
|
11
|
+
background-color: Window;
|
12
|
+
color: WindowText;
|
13
|
+
text-align: left;
|
14
|
+
box-shadow: 0 6px 12px #ccc;
|
15
|
+
-webkit-box-shadow: 0 6px 12px #ccc;
|
16
|
+
}
|
17
|
+
|
18
|
+
.flexselect_dropdown ul {
|
19
|
+
width: 100%;
|
20
|
+
list-style-position: outside;
|
21
|
+
list-style: none;
|
22
|
+
padding: 0;
|
23
|
+
margin: 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
.flexselect_dropdown li {
|
27
|
+
margin: 0px;
|
28
|
+
padding: 2px 5px;
|
29
|
+
cursor: pointer;
|
30
|
+
display: block;
|
31
|
+
width: 100%;
|
32
|
+
font: Menu;
|
33
|
+
overflow: hidden;
|
34
|
+
}
|
35
|
+
|
36
|
+
.flexselect_selected {
|
37
|
+
background-color: Highlight;
|
38
|
+
color: HighlightText;
|
39
|
+
}
|