applicious_utils 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/applicious_utils/Applicious/applicious.coffee +9 -0
- data/app/assets/javascripts/applicious_utils/Applicious/facebook.coffee +12 -0
- data/app/assets/javascripts/applicious_utils/FbMultiFriendSelector/README.md +122 -0
- data/app/assets/javascripts/applicious_utils/FbMultiFriendSelector/index.html +100 -0
- data/app/assets/javascripts/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select-list.css +158 -0
- data/app/assets/javascripts/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select.css +160 -0
- data/app/assets/javascripts/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select.js +366 -0
- data/app/assets/javascripts/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select.min.js +11 -0
- data/app/assets/javascripts/applicious_utils/LightboxMe/LICENSE +11 -0
- data/app/assets/javascripts/applicious_utils/LightboxMe/README.markdown +44 -0
- data/app/assets/javascripts/applicious_utils/LightboxMe/jquery.lightbox_me.js +250 -0
- data/app/assets/javascripts/applicious_utils/index.js +4 -0
- data/app/assets/stylesheets/applicious_utils/Applicious/applicious.css +0 -0
- data/app/assets/stylesheets/applicious_utils/FbMultiFriendSelector/README.md +122 -0
- data/app/assets/stylesheets/applicious_utils/FbMultiFriendSelector/index.html +100 -0
- data/app/assets/stylesheets/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select-list.css +158 -0
- data/app/assets/stylesheets/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select.css +160 -0
- data/app/assets/stylesheets/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select.js +366 -0
- data/app/assets/stylesheets/applicious_utils/FbMultiFriendSelector/jquery.facebook.multifriend.select.min.js +11 -0
- data/app/assets/stylesheets/applicious_utils/index.css +9 -0
- data/applicious_utils-0.0.1.gem +0 -0
- data/applicious_utils-0.0.2.gem +0 -0
- data/applicious_utils-0.0.3.gem +0 -0
- data/applicious_utils-0.0.4.gem +0 -0
- data/applicious_utils-0.0.5.gem +0 -0
- data/applicious_utils.gemspec +22 -0
- data/lib/applicious_utils/applicious_railtie.rb +11 -0
- data/lib/applicious_utils/engine.rb +5 -0
- data/lib/applicious_utils/version.rb +3 -0
- data/lib/applicious_utils/view_helpers.rb +16 -0
- data/lib/applicious_utils.rb +4 -0
- data/pkg/applicious_utils-0.0.4.gem +0 -0
- metadata +81 -0
@@ -0,0 +1,366 @@
|
|
1
|
+
// Copyright 2010 Mike Brevoort http://mike.brevoort.com @mbrevoort
|
2
|
+
//
|
3
|
+
// v1.0 jquery-facebook-multi-friend-selector
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
|
17
|
+
(function($) {
|
18
|
+
var JFMFS = function(element, options) {
|
19
|
+
var elem = $(element),
|
20
|
+
obj = this,
|
21
|
+
uninitializedImagefriendElements = [], // for images that are initialized
|
22
|
+
keyUpTimer,
|
23
|
+
friends_per_row = 0,
|
24
|
+
friend_height_px = 0,
|
25
|
+
first_element_offset_px;
|
26
|
+
|
27
|
+
var settings = $.extend({
|
28
|
+
max_selected: -1,
|
29
|
+
max_selected_message: "{0} of {1} selected",
|
30
|
+
pre_selected_friends: [],
|
31
|
+
exclude_friends: [],
|
32
|
+
friend_fields: "id,name",
|
33
|
+
sorter: function(a, b) {
|
34
|
+
var x = a.name.toLowerCase();
|
35
|
+
var y = b.name.toLowerCase();
|
36
|
+
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
37
|
+
},
|
38
|
+
labels: {
|
39
|
+
selected: "Selected",
|
40
|
+
filter_default: "Start typing a name",
|
41
|
+
filter_title: "Find Friends:",
|
42
|
+
all: "All",
|
43
|
+
max_selected_message: "{0} of {1} selected"
|
44
|
+
}
|
45
|
+
}, options || {});
|
46
|
+
var lastSelected; // used when shift-click is performed to know where to start from to select multiple elements
|
47
|
+
|
48
|
+
var arrayToObjectGraph = function(a) {
|
49
|
+
var o = {};
|
50
|
+
for(var i=0, l=a.length; i<l; i++){
|
51
|
+
o[a[i]]='';
|
52
|
+
}
|
53
|
+
return o;
|
54
|
+
};
|
55
|
+
|
56
|
+
// ----------+----------+----------+----------+----------+----------+----------+
|
57
|
+
// Initialization of container
|
58
|
+
// ----------+----------+----------+----------+----------+----------+----------+
|
59
|
+
elem.html(
|
60
|
+
"<div id='jfmfs-friend-selector'>" +
|
61
|
+
" <div id='jfmfs-inner-header'>" +
|
62
|
+
" <span class='jfmfs-title'>" + settings.labels.filter_title + " </span><input type='text' id='jfmfs-friend-filter-text' value='" + settings.labels.filter_default + "'/>" +
|
63
|
+
" <a class='filter-link selected' id='jfmfs-filter-all' href='#'>" + settings.labels.all + "</a>" +
|
64
|
+
" <a class='filter-link' id='jfmfs-filter-selected' href='#'>" + settings.labels.selected + " (<span id='jfmfs-selected-count'>0</span>)</a>" +
|
65
|
+
((settings.max_selected > 0) ? "<div id='jfmfs-max-selected-wrapper'></div>" : "") +
|
66
|
+
" </div>" +
|
67
|
+
" <div id='jfmfs-friend-container'></div>" +
|
68
|
+
"</div>"
|
69
|
+
);
|
70
|
+
|
71
|
+
var friend_container = $("#jfmfs-friend-container"),
|
72
|
+
container = $("#jfmfs-friend-selector"),
|
73
|
+
preselected_friends_graph = arrayToObjectGraph(settings.pre_selected_friends),
|
74
|
+
excluded_friends_graph = arrayToObjectGraph(settings.exclude_friends),
|
75
|
+
all_friends;
|
76
|
+
|
77
|
+
FB.api('/me/friends?fields=' + settings.friend_fields, function(response) {
|
78
|
+
var sortedFriendData = response.data.sort(settings.sorter),
|
79
|
+
preselectedFriends = {},
|
80
|
+
buffer = [],
|
81
|
+
selectedClass = "";
|
82
|
+
|
83
|
+
$.each(sortedFriendData, function(i, friend) {
|
84
|
+
if(! (friend.id in excluded_friends_graph)) {
|
85
|
+
selectedClass = (friend.id in preselected_friends_graph) ? "selected" : "";
|
86
|
+
buffer.push("<div class='jfmfs-friend " + selectedClass + " ' id='" + friend.id +"'><img/><div class='friend-name'>" + friend.name + "</div></div>");
|
87
|
+
}
|
88
|
+
});
|
89
|
+
friend_container.append(buffer.join(""));
|
90
|
+
|
91
|
+
uninitializedImagefriendElements = $(".jfmfs-friend", elem);
|
92
|
+
uninitializedImagefriendElements.bind('inview', function (event, visible) {
|
93
|
+
if( $(this).attr('src') === undefined) {
|
94
|
+
$("img", $(this)).attr("src", "//graph.facebook.com/" + this.id + "/picture");
|
95
|
+
}
|
96
|
+
$(this).unbind('inview');
|
97
|
+
});
|
98
|
+
|
99
|
+
init();
|
100
|
+
});
|
101
|
+
|
102
|
+
|
103
|
+
// ----------+----------+----------+----------+----------+----------+----------+
|
104
|
+
// Public functions
|
105
|
+
// ----------+----------+----------+----------+----------+----------+----------+
|
106
|
+
|
107
|
+
this.getSelectedIds = function() {
|
108
|
+
var ids = [];
|
109
|
+
$.each(elem.find(".jfmfs-friend.selected"), function(i, friend) {
|
110
|
+
ids.push($(friend).attr("id"));
|
111
|
+
});
|
112
|
+
return ids;
|
113
|
+
};
|
114
|
+
|
115
|
+
this.getSelectedIdsAndNames = function() {
|
116
|
+
var selected = [];
|
117
|
+
$.each(elem.find(".jfmfs-friend.selected"), function(i, friend) {
|
118
|
+
selected.push( {id: $(friend).attr("id"), name: $(friend).find(".friend-name").text()});
|
119
|
+
});
|
120
|
+
return selected;
|
121
|
+
};
|
122
|
+
|
123
|
+
this.clearSelected = function () {
|
124
|
+
all_friends.removeClass("selected");
|
125
|
+
};
|
126
|
+
|
127
|
+
// ----------+----------+----------+----------+----------+----------+----------+
|
128
|
+
// Private functions
|
129
|
+
// ----------+----------+----------+----------+----------+----------+----------+
|
130
|
+
|
131
|
+
var init = function() {
|
132
|
+
all_friends = $(".jfmfs-friend", elem);
|
133
|
+
|
134
|
+
// calculate friends per row
|
135
|
+
first_element_offset_px = all_friends.first().offset().top;
|
136
|
+
for(var i=0, l=all_friends.length; i < l; i++ ) {
|
137
|
+
if($(all_friends[i]).offset().top === first_element_offset_px) {
|
138
|
+
friends_per_row++;
|
139
|
+
} else {
|
140
|
+
friend_height_px = $(all_friends[i]).offset().top - first_element_offset_px;
|
141
|
+
break;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
// handle when a friend is clicked for selection
|
146
|
+
elem.delegate(".jfmfs-friend", 'click', function(event) {
|
147
|
+
|
148
|
+
// if the element is being selected, test if the max number of items have
|
149
|
+
// already been selected, if so, just return
|
150
|
+
if(!$(this).hasClass("selected") &&
|
151
|
+
maxSelectedEnabled() &&
|
152
|
+
$(".jfmfs-friend.selected").length >= settings.max_selected &&
|
153
|
+
settings.max_selected != 1) {
|
154
|
+
return;
|
155
|
+
}
|
156
|
+
|
157
|
+
// if the max is 1 then unselect the current and select the new
|
158
|
+
if(settings.max_selected == 1) {
|
159
|
+
elem.find(".selected").removeClass("selected");
|
160
|
+
}
|
161
|
+
|
162
|
+
$(this).toggleClass("selected");
|
163
|
+
$(this).removeClass("hover");
|
164
|
+
|
165
|
+
// support shift-click operations to select multiple items at a time
|
166
|
+
if( $(this).hasClass("selected")) {
|
167
|
+
if ( !lastSelected ) {
|
168
|
+
lastSelected = $(this);
|
169
|
+
}
|
170
|
+
else {
|
171
|
+
if( event.shiftKey ) {
|
172
|
+
var selIndex = $(this).index();
|
173
|
+
var lastIndex = lastSelected.index();
|
174
|
+
var end = Math.max(selIndex,lastIndex);
|
175
|
+
var start = Math.min(selIndex,lastIndex);
|
176
|
+
for(var i=start; i<=end; i++) {
|
177
|
+
var aFriend = $( all_friends[i] );
|
178
|
+
if(!aFriend.hasClass("hide-non-selected") && !aFriend.hasClass("hide-filtered")) {
|
179
|
+
if( maxSelectedEnabled() && $(".jfmfs-friend.selected").length < settings.max_selected ) {
|
180
|
+
$( all_friends[i] ).addClass("selected");
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
// keep track of last selected, this is used for the shift-select functionality
|
189
|
+
lastSelected = $(this);
|
190
|
+
|
191
|
+
// update the count of the total number selected
|
192
|
+
updateSelectedCount();
|
193
|
+
|
194
|
+
if( maxSelectedEnabled() ) {
|
195
|
+
updateMaxSelectedMessage();
|
196
|
+
}
|
197
|
+
elem.trigger("jfmfs.selection.changed", [obj.getSelectedIdsAndNames()]);
|
198
|
+
});
|
199
|
+
|
200
|
+
// filter by selected, hide all non-selected
|
201
|
+
$("#jfmfs-filter-selected").click(function(event) {
|
202
|
+
event.preventDefault();
|
203
|
+
all_friends.not(".selected").addClass("hide-non-selected");
|
204
|
+
$(".filter-link").removeClass("selected");
|
205
|
+
$(this).addClass("selected");
|
206
|
+
});
|
207
|
+
|
208
|
+
// remove filter, show all
|
209
|
+
$("#jfmfs-filter-all").click(function(event) {
|
210
|
+
event.preventDefault();
|
211
|
+
all_friends.removeClass("hide-non-selected");
|
212
|
+
$(".filter-link").removeClass("selected");
|
213
|
+
$(this).addClass("selected");
|
214
|
+
});
|
215
|
+
|
216
|
+
// hover effect on friends
|
217
|
+
elem.find(".jfmfs-friend:not(.selected)").live(
|
218
|
+
'hover', function (ev) {
|
219
|
+
if (ev.type == 'mouseover') {
|
220
|
+
$(this).addClass("hover");
|
221
|
+
}
|
222
|
+
if (ev.type == 'mouseout') {
|
223
|
+
$(this).removeClass("hover");
|
224
|
+
}
|
225
|
+
});
|
226
|
+
|
227
|
+
// filter as you type
|
228
|
+
elem.find("#jfmfs-friend-filter-text")
|
229
|
+
.keyup( function() {
|
230
|
+
var filter = $(this).val();
|
231
|
+
clearTimeout(keyUpTimer);
|
232
|
+
keyUpTimer = setTimeout( function() {
|
233
|
+
if(filter == '') {
|
234
|
+
all_friends.removeClass("hide-filtered");
|
235
|
+
}
|
236
|
+
else {
|
237
|
+
container.find(".friend-name:not(:Contains(" + filter +"))").parent().addClass("hide-filtered");
|
238
|
+
container.find(".friend-name:Contains(" + filter +")").parent().removeClass("hide-filtered");
|
239
|
+
}
|
240
|
+
showImagesInViewPort();
|
241
|
+
}, 400);
|
242
|
+
})
|
243
|
+
.focus( function() {
|
244
|
+
if($.trim($(this).val()) == 'Start typing a name') {
|
245
|
+
$(this).val('');
|
246
|
+
}
|
247
|
+
})
|
248
|
+
.blur(function() {
|
249
|
+
if($.trim($(this).val()) == '') {
|
250
|
+
$(this).val('Start typing a name');
|
251
|
+
}
|
252
|
+
});
|
253
|
+
|
254
|
+
// hover states on the buttons
|
255
|
+
elem.find(".jfmfs-button").hover(
|
256
|
+
function(){ $(this).addClass("jfmfs-button-hover");} ,
|
257
|
+
function(){ $(this).removeClass("jfmfs-button-hover");}
|
258
|
+
);
|
259
|
+
|
260
|
+
// manages lazy loading of images
|
261
|
+
var getViewportHeight = function() {
|
262
|
+
var height = window.innerHeight; // Safari, Opera
|
263
|
+
var mode = document.compatMode;
|
264
|
+
|
265
|
+
if ( (mode || !$.support.boxModel) ) { // IE, Gecko
|
266
|
+
height = (mode == 'CSS1Compat') ?
|
267
|
+
document.documentElement.clientHeight : // Standards
|
268
|
+
document.body.clientHeight; // Quirks
|
269
|
+
}
|
270
|
+
|
271
|
+
return height;
|
272
|
+
};
|
273
|
+
|
274
|
+
var showImagesInViewPort = function() {
|
275
|
+
var container_height_px = friend_container.innerHeight(),
|
276
|
+
scroll_top_px = friend_container.scrollTop(),
|
277
|
+
container_offset_px = friend_container.offset().top,
|
278
|
+
$el, top_px,
|
279
|
+
elementVisitedCount = 0,
|
280
|
+
foundVisible = false,
|
281
|
+
allVisibleFriends = $(".jfmfs-friend:not(.hide-filtered )");
|
282
|
+
|
283
|
+
$.each(allVisibleFriends, function(i, $el){
|
284
|
+
elementVisitedCount++;
|
285
|
+
if($el !== null) {
|
286
|
+
$el = $(allVisibleFriends[i]);
|
287
|
+
top_px = (first_element_offset_px + (friend_height_px * Math.ceil(elementVisitedCount/friends_per_row))) - scroll_top_px - container_offset_px;
|
288
|
+
if (top_px + friend_height_px >= -10 &&
|
289
|
+
top_px - friend_height_px < container_height_px) { // give some extra padding for broser differences
|
290
|
+
$el.data('inview', true);
|
291
|
+
$el.trigger('inview', [ true ]);
|
292
|
+
foundVisible = true;
|
293
|
+
}
|
294
|
+
else {
|
295
|
+
if(foundVisible) {
|
296
|
+
return false;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
}
|
300
|
+
});
|
301
|
+
};
|
302
|
+
|
303
|
+
var updateSelectedCount = function() {
|
304
|
+
$("#jfmfs-selected-count").html( selectedCount() );
|
305
|
+
};
|
306
|
+
|
307
|
+
friend_container.bind('scroll', $.debounce( 250, showImagesInViewPort ));
|
308
|
+
|
309
|
+
updateMaxSelectedMessage();
|
310
|
+
showImagesInViewPort();
|
311
|
+
updateSelectedCount();
|
312
|
+
elem.trigger("jfmfs.friendload.finished");
|
313
|
+
};
|
314
|
+
|
315
|
+
var selectedCount = function() {
|
316
|
+
return $(".jfmfs-friend.selected").length;
|
317
|
+
};
|
318
|
+
|
319
|
+
var maxSelectedEnabled = function () {
|
320
|
+
return settings.max_selected > 0;
|
321
|
+
};
|
322
|
+
|
323
|
+
var updateMaxSelectedMessage = function() {
|
324
|
+
var message = settings.labels.max_selected_message.replace("{0}", selectedCount()).replace("{1}", settings.max_selected);
|
325
|
+
$("#jfmfs-max-selected-wrapper").html( message );
|
326
|
+
};
|
327
|
+
|
328
|
+
};
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
$.fn.jfmfs = function(options) {
|
333
|
+
return this.each(function() {
|
334
|
+
var element = $(this);
|
335
|
+
|
336
|
+
// Return early if this element already has a plugin instance
|
337
|
+
if (element.data('jfmfs')) { return; }
|
338
|
+
|
339
|
+
// pass options to plugin constructor
|
340
|
+
var jfmfs = new JFMFS(this, options);
|
341
|
+
|
342
|
+
// Store plugin object in this element's data
|
343
|
+
element.data('jfmfs', jfmfs);
|
344
|
+
|
345
|
+
});
|
346
|
+
};
|
347
|
+
|
348
|
+
// todo, make this more ambiguous
|
349
|
+
jQuery.expr[':'].Contains = function(a, i, m) {
|
350
|
+
return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
|
351
|
+
};
|
352
|
+
|
353
|
+
|
354
|
+
})(jQuery);
|
355
|
+
|
356
|
+
if($.debounce === undefined) {
|
357
|
+
/*
|
358
|
+
* jQuery throttle / debounce - v1.1 - 3/7/2010
|
359
|
+
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
360
|
+
*
|
361
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
362
|
+
* Dual licensed under the MIT and GPL licenses.
|
363
|
+
* http://benalman.com/about/license/
|
364
|
+
*/
|
365
|
+
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
|
366
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
(function(a){var t=function(j,l){var b=a(j),m=this,g=[],o,v=0,k=0,r,c=a.extend({max_selected:-1,max_selected_message:"{0} of {1} selected",pre_selected_friends:[],exclude_friends:[],friend_fields:"id,name",sorter:function(d,h){var f=d.name.toLowerCase(),p=h.name.toLowerCase();return f<p?-1:f>p?1:0},labels:{selected:"Selected",filter_default:"Start typing a name",filter_title:"Find Friends:",all:"All",max_selected_message:"{0} of {1} selected"}},l||{}),u,w=function(d){for(var h={},f=0,p=d.length;f<
|
2
|
+
p;f++)h[d[f]]="";return h};b.html("<div id='jfmfs-friend-selector'> <div id='jfmfs-inner-header'> <span class='jfmfs-title'>"+c.labels.filter_title+" </span><input type='text' id='jfmfs-friend-filter-text' value='"+c.labels.filter_default+"'/> <a class='filter-link selected' id='jfmfs-filter-all' href='#'>"+c.labels.all+"</a> <a class='filter-link' id='jfmfs-filter-selected' href='#'>"+c.labels.selected+" (<span id='jfmfs-selected-count'>0</span>)</a>"+(c.max_selected>0?"<div id='jfmfs-max-selected-wrapper'></div>":
|
3
|
+
"")+" </div> <div id='jfmfs-friend-container'></div></div>");var q=a("#jfmfs-friend-container"),x=a("#jfmfs-friend-selector"),F=w(c.pre_selected_friends),G=w(c.exclude_friends),i;FB.api("/me/friends?fields="+c.friend_fields,function(d){d=d.data.sort(c.sorter);var h=[],f="";a.each(d,function(p,e){if(!(e.id in G)){f=e.id in F?"selected":"";h.push("<div class='jfmfs-friend "+f+" ' id='"+e.id+"'><img/><div class='friend-name'>"+e.name+"</div></div>")}});q.append(h.join(""));g=a(".jfmfs-friend",
|
4
|
+
b);g.bind("inview",function(){a(this).attr("src")===undefined&&a("img",a(this)).attr("src","//graph.facebook.com/"+this.id+"/picture");a(this).unbind("inview")});H()});this.getSelectedIds=function(){var d=[];a.each(b.find(".jfmfs-friend.selected"),function(h,f){d.push(a(f).attr("id"))});return d};this.getSelectedIdsAndNames=function(){var d=[];a.each(b.find(".jfmfs-friend.selected"),function(h,f){d.push({id:a(f).attr("id"),name:a(f).find(".friend-name").text()})});return d};this.clearSelected=function(){i.removeClass("selected")};
|
5
|
+
var H=function(){i=a(".jfmfs-friend",b);r=i.first().offset().top;for(var d=0,h=i.length;d<h;d++)if(a(i[d]).offset().top===r)v++;else{k=a(i[d]).offset().top-r;break}b.delegate(".jfmfs-friend","click",function(e){if(!(!a(this).hasClass("selected")&&c.max_selected>0&&a(".jfmfs-friend.selected").length>=c.max_selected&&c.max_selected!=1)){c.max_selected==1&&b.find(".selected").removeClass("selected");a(this).toggleClass("selected");a(this).removeClass("hover");if(a(this).hasClass("selected"))if(u){if(e.shiftKey){var n=
|
6
|
+
a(this).index(),s=u.index();e=Math.max(n,s);for(n=Math.min(n,s);n<=e;n++){s=a(i[n]);!s.hasClass("hide-non-selected")&&!s.hasClass("hide-filtered")&&c.max_selected>0&&a(".jfmfs-friend.selected").length<c.max_selected&&a(i[n]).addClass("selected")}}}else u=a(this);u=a(this);p();c.max_selected>0&&A();b.trigger("jfmfs.selection.changed",[m.getSelectedIdsAndNames()])}});a("#jfmfs-filter-selected").click(function(e){e.preventDefault();i.not(".selected").addClass("hide-non-selected");a(".filter-link").removeClass("selected");
|
7
|
+
a(this).addClass("selected")});a("#jfmfs-filter-all").click(function(e){e.preventDefault();i.removeClass("hide-non-selected");a(".filter-link").removeClass("selected");a(this).addClass("selected")});b.find(".jfmfs-friend:not(.selected)").live("hover",function(e){e.type=="mouseover"&&a(this).addClass("hover");e.type=="mouseout"&&a(this).removeClass("hover")});b.find("#jfmfs-friend-filter-text").keyup(function(){var e=a(this).val();clearTimeout(o);o=setTimeout(function(){if(e=="")i.removeClass("hide-filtered");
|
8
|
+
else{x.find(".friend-name:not(:Contains("+e+"))").parent().addClass("hide-filtered");x.find(".friend-name:Contains("+e+")").parent().removeClass("hide-filtered")}f()},400)}).focus(function(){a.trim(a(this).val())=="Start typing a name"&&a(this).val("")}).blur(function(){a.trim(a(this).val())==""&&a(this).val("Start typing a name")});b.find(".jfmfs-button").hover(function(){a(this).addClass("jfmfs-button-hover")},function(){a(this).removeClass("jfmfs-button-hover")});var f=function(){var e=q.innerHeight(),
|
9
|
+
n=q.scrollTop(),s=q.offset().top,z,B=0,C=false,D=a(".jfmfs-friend:not(.hide-filtered )");a.each(D,function(I,y){B++;if(y!==null){y=a(D[I]);z=r+k*Math.ceil(B/v)-n-s;if(z+k>=-10&&z-k<e){y.data("inview",true);y.trigger("inview",[true]);C=true}else if(C)return false}})},p=function(){a("#jfmfs-selected-count").html(E())};q.bind("scroll",a.debounce(250,f));A();f();p();b.trigger("jfmfs.friendload.finished")},E=function(){return a(".jfmfs-friend.selected").length},A=function(){var d=c.labels.max_selected_message.replace("{0}",
|
10
|
+
E()).replace("{1}",c.max_selected);a("#jfmfs-max-selected-wrapper").html(d)}};a.fn.jfmfs=function(j){return this.each(function(){var l=a(this);if(!l.data("jfmfs")){var b=new t(this,j);l.data("jfmfs",b)}})};jQuery.expr[":"].Contains=function(j,l,b){return jQuery(j).text().toUpperCase().indexOf(b[3].toUpperCase())>=0}})(jQuery);
|
11
|
+
$.debounce===undefined&&function(a,t){var j=a.jQuery||a.Cowboy||(a.Cowboy={}),l;j.throttle=l=function(b,m,g,o){function v(){function c(){r=+new Date;g.apply(w,x)}function u(){k=t}var w=this,q=+new Date-r,x=arguments;o&&!k&&c();k&&clearTimeout(k);if(o===t&&q>b)c();else if(m!==true)k=setTimeout(o?u:c,o===t?b-q:b)}var k,r=0;if(typeof m!=="boolean"){o=g;g=m;m=t}if(j.guid)v.guid=g.guid=g.guid||j.guid++;return v};j.debounce=function(b,m,g){return g===t?l(b,m,false):l(b,g,m!==false)}}(this);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
you may not use this file except in compliance with the License.
|
3
|
+
You may obtain a copy of the License at
|
4
|
+
|
5
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
See the License for the specific language governing permissions and
|
11
|
+
limitations under the License.
|
@@ -0,0 +1,44 @@
|
|
1
|
+
jquery.lightbox_me.js
|
2
|
+
version 2.2
|
3
|
+
|
4
|
+
Have you ever had a DOM element that you wanted lightboxed, but didn't want all the fanciness of all the lightbox-related plug-ins out there? Lightbox_me is for you.
|
5
|
+
|
6
|
+
Lightbox_me is an essential tool for the jQuery developer's toolbox. Feed it a DOM element wrapped in a jQuery object and it will lightbox it for you, no muss no fuss.
|
7
|
+
|
8
|
+
View more information at http://buckwilson.me/lightboxme
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Lightbox_me is a jQuery plugin and requires jQuery to be included in order to work.
|
15
|
+
|
16
|
+
Include both jQuery and the lightbox_me JavaScript file before calling the plugin in your JavaScript.
|
17
|
+
|
18
|
+
Invoke the lightbox by calling the plugin on a jQuery object:
|
19
|
+
$(dom).lightbox_me();
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
26
|
+
you may not use this file except in compliance with the License.
|
27
|
+
You may obtain a copy of the License at
|
28
|
+
|
29
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
30
|
+
|
31
|
+
Unless required by applicable law or agreed to in writing, software
|
32
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
33
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
34
|
+
See the License for the specific language governing permissions and
|
35
|
+
limitations under the License.
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
## Author Information
|
40
|
+
|
41
|
+
Lightbox_me was created by Buck Wilson for Jive Software.
|
42
|
+
http://buckwilson.me
|
43
|
+
http://jivesoftware.com
|
44
|
+
|