videos 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/js/controllers.index.js +19 -6
- data/app/js/lib/underscore.js +150 -83
- data/lib/videos/core_ext/pathname.rb +3 -1
- data/lib/videos/version.rb +1 -1
- metadata +30 -19
- checksums.yaml +0 -7
data/app/js/controllers.index.js
CHANGED
@@ -17,14 +17,27 @@ controllers.index = function(search, sort, sortDirection) {
|
|
17
17
|
|
18
18
|
var videos = store;
|
19
19
|
if(search && search != "") {
|
20
|
-
var words = search.split(/\s+/)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
var words = _.partition(search.split(/\s+/), function(word) {
|
21
|
+
return word.match(/^-/);
|
22
|
+
});
|
23
|
+
|
24
|
+
var includedWords = words[1];
|
25
|
+
var excludedWords = words[0];
|
26
|
+
|
27
|
+
function containsRegex(regex, video) {
|
28
|
+
return video.title.match(regex) || video.resolution.match(regex);
|
29
|
+
}
|
30
|
+
|
31
|
+
_.each(includedWords, function(word) {
|
32
|
+
videos = _.filter(videos, _.partial(containsRegex, RegExp(word, "i")));
|
33
|
+
});
|
34
|
+
|
35
|
+
_.each(excludedWords, function(word) {
|
36
|
+
word = word.substr(1);
|
37
|
+
videos = _.reject(videos, _.partial(containsRegex, RegExp(word, "i")));
|
26
38
|
});
|
27
39
|
}
|
40
|
+
|
28
41
|
if(!sort) sort = "publishedOn";
|
29
42
|
videos = _.sortBy(videos, sortFor(sort));
|
30
43
|
|
data/app/js/lib/underscore.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
// Underscore.js 1.
|
1
|
+
// Underscore.js 1.6.0
|
2
2
|
// http://underscorejs.org
|
3
|
-
// (c) 2009-
|
3
|
+
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
4
4
|
// Underscore may be freely distributed under the MIT license.
|
5
5
|
|
6
6
|
(function() {
|
@@ -65,7 +65,7 @@
|
|
65
65
|
}
|
66
66
|
|
67
67
|
// Current version.
|
68
|
-
_.VERSION = '1.
|
68
|
+
_.VERSION = '1.6.0';
|
69
69
|
|
70
70
|
// Collection Functions
|
71
71
|
// --------------------
|
@@ -74,7 +74,7 @@
|
|
74
74
|
// Handles objects with the built-in `forEach`, arrays, and raw objects.
|
75
75
|
// Delegates to **ECMAScript 5**'s native `forEach` if available.
|
76
76
|
var each = _.each = _.forEach = function(obj, iterator, context) {
|
77
|
-
if (obj == null) return;
|
77
|
+
if (obj == null) return obj;
|
78
78
|
if (nativeForEach && obj.forEach === nativeForEach) {
|
79
79
|
obj.forEach(iterator, context);
|
80
80
|
} else if (obj.length === +obj.length) {
|
@@ -87,6 +87,7 @@
|
|
87
87
|
if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
|
88
88
|
}
|
89
89
|
}
|
90
|
+
return obj;
|
90
91
|
};
|
91
92
|
|
92
93
|
// Return the results of applying the iterator to each element.
|
@@ -152,10 +153,10 @@
|
|
152
153
|
};
|
153
154
|
|
154
155
|
// Return the first value which passes a truth test. Aliased as `detect`.
|
155
|
-
_.find = _.detect = function(obj,
|
156
|
+
_.find = _.detect = function(obj, predicate, context) {
|
156
157
|
var result;
|
157
158
|
any(obj, function(value, index, list) {
|
158
|
-
if (
|
159
|
+
if (predicate.call(context, value, index, list)) {
|
159
160
|
result = value;
|
160
161
|
return true;
|
161
162
|
}
|
@@ -166,33 +167,33 @@
|
|
166
167
|
// Return all the elements that pass a truth test.
|
167
168
|
// Delegates to **ECMAScript 5**'s native `filter` if available.
|
168
169
|
// Aliased as `select`.
|
169
|
-
_.filter = _.select = function(obj,
|
170
|
+
_.filter = _.select = function(obj, predicate, context) {
|
170
171
|
var results = [];
|
171
172
|
if (obj == null) return results;
|
172
|
-
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(
|
173
|
+
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context);
|
173
174
|
each(obj, function(value, index, list) {
|
174
|
-
if (
|
175
|
+
if (predicate.call(context, value, index, list)) results.push(value);
|
175
176
|
});
|
176
177
|
return results;
|
177
178
|
};
|
178
179
|
|
179
180
|
// Return all the elements for which a truth test fails.
|
180
|
-
_.reject = function(obj,
|
181
|
+
_.reject = function(obj, predicate, context) {
|
181
182
|
return _.filter(obj, function(value, index, list) {
|
182
|
-
return !
|
183
|
+
return !predicate.call(context, value, index, list);
|
183
184
|
}, context);
|
184
185
|
};
|
185
186
|
|
186
187
|
// Determine whether all of the elements match a truth test.
|
187
188
|
// Delegates to **ECMAScript 5**'s native `every` if available.
|
188
189
|
// Aliased as `all`.
|
189
|
-
_.every = _.all = function(obj,
|
190
|
-
|
190
|
+
_.every = _.all = function(obj, predicate, context) {
|
191
|
+
predicate || (predicate = _.identity);
|
191
192
|
var result = true;
|
192
193
|
if (obj == null) return result;
|
193
|
-
if (nativeEvery && obj.every === nativeEvery) return obj.every(
|
194
|
+
if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context);
|
194
195
|
each(obj, function(value, index, list) {
|
195
|
-
if (!(result = result &&
|
196
|
+
if (!(result = result && predicate.call(context, value, index, list))) return breaker;
|
196
197
|
});
|
197
198
|
return !!result;
|
198
199
|
};
|
@@ -200,13 +201,13 @@
|
|
200
201
|
// Determine if at least one element in the object matches a truth test.
|
201
202
|
// Delegates to **ECMAScript 5**'s native `some` if available.
|
202
203
|
// Aliased as `any`.
|
203
|
-
var any = _.some = _.any = function(obj,
|
204
|
-
|
204
|
+
var any = _.some = _.any = function(obj, predicate, context) {
|
205
|
+
predicate || (predicate = _.identity);
|
205
206
|
var result = false;
|
206
207
|
if (obj == null) return result;
|
207
|
-
if (nativeSome && obj.some === nativeSome) return obj.some(
|
208
|
+
if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context);
|
208
209
|
each(obj, function(value, index, list) {
|
209
|
-
if (result || (result =
|
210
|
+
if (result || (result = predicate.call(context, value, index, list))) return breaker;
|
210
211
|
});
|
211
212
|
return !!result;
|
212
213
|
};
|
@@ -232,25 +233,19 @@
|
|
232
233
|
|
233
234
|
// Convenience version of a common use case of `map`: fetching a property.
|
234
235
|
_.pluck = function(obj, key) {
|
235
|
-
return _.map(obj,
|
236
|
+
return _.map(obj, _.property(key));
|
236
237
|
};
|
237
238
|
|
238
239
|
// Convenience version of a common use case of `filter`: selecting only objects
|
239
240
|
// containing specific `key:value` pairs.
|
240
|
-
_.where = function(obj, attrs
|
241
|
-
|
242
|
-
return _[first ? 'find' : 'filter'](obj, function(value) {
|
243
|
-
for (var key in attrs) {
|
244
|
-
if (attrs[key] !== value[key]) return false;
|
245
|
-
}
|
246
|
-
return true;
|
247
|
-
});
|
241
|
+
_.where = function(obj, attrs) {
|
242
|
+
return _.filter(obj, _.matches(attrs));
|
248
243
|
};
|
249
244
|
|
250
245
|
// Convenience version of a common use case of `find`: getting the first object
|
251
246
|
// containing specific `key:value` pairs.
|
252
247
|
_.findWhere = function(obj, attrs) {
|
253
|
-
return _.
|
248
|
+
return _.find(obj, _.matches(attrs));
|
254
249
|
};
|
255
250
|
|
256
251
|
// Return the maximum element or (element-based computation).
|
@@ -260,13 +255,15 @@
|
|
260
255
|
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
|
261
256
|
return Math.max.apply(Math, obj);
|
262
257
|
}
|
263
|
-
|
264
|
-
var result = {computed : -Infinity, value: -Infinity};
|
258
|
+
var result = -Infinity, lastComputed = -Infinity;
|
265
259
|
each(obj, function(value, index, list) {
|
266
260
|
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
267
|
-
computed >
|
261
|
+
if (computed > lastComputed) {
|
262
|
+
result = value;
|
263
|
+
lastComputed = computed;
|
264
|
+
}
|
268
265
|
});
|
269
|
-
return result
|
266
|
+
return result;
|
270
267
|
};
|
271
268
|
|
272
269
|
// Return the minimum element (or element-based computation).
|
@@ -274,16 +271,18 @@
|
|
274
271
|
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
|
275
272
|
return Math.min.apply(Math, obj);
|
276
273
|
}
|
277
|
-
|
278
|
-
var result = {computed : Infinity, value: Infinity};
|
274
|
+
var result = Infinity, lastComputed = Infinity;
|
279
275
|
each(obj, function(value, index, list) {
|
280
276
|
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
281
|
-
computed <
|
277
|
+
if (computed < lastComputed) {
|
278
|
+
result = value;
|
279
|
+
lastComputed = computed;
|
280
|
+
}
|
282
281
|
});
|
283
|
-
return result
|
282
|
+
return result;
|
284
283
|
};
|
285
284
|
|
286
|
-
// Shuffle an array, using the modern version of the
|
285
|
+
// Shuffle an array, using the modern version of the
|
287
286
|
// [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
|
288
287
|
_.shuffle = function(obj) {
|
289
288
|
var rand;
|
@@ -297,11 +296,12 @@
|
|
297
296
|
return shuffled;
|
298
297
|
};
|
299
298
|
|
300
|
-
// Sample **n** random values from
|
301
|
-
// If **n** is not specified, returns a single random element
|
299
|
+
// Sample **n** random values from a collection.
|
300
|
+
// If **n** is not specified, returns a single random element.
|
302
301
|
// The internal `guard` argument allows it to work with `map`.
|
303
302
|
_.sample = function(obj, n, guard) {
|
304
|
-
if (
|
303
|
+
if (n == null || guard) {
|
304
|
+
if (obj.length !== +obj.length) obj = _.values(obj);
|
305
305
|
return obj[_.random(obj.length - 1)];
|
306
306
|
}
|
307
307
|
return _.shuffle(obj).slice(0, Math.max(0, n));
|
@@ -309,12 +309,14 @@
|
|
309
309
|
|
310
310
|
// An internal function to generate lookup iterators.
|
311
311
|
var lookupIterator = function(value) {
|
312
|
-
|
312
|
+
if (value == null) return _.identity;
|
313
|
+
if (_.isFunction(value)) return value;
|
314
|
+
return _.property(value);
|
313
315
|
};
|
314
316
|
|
315
317
|
// Sort the object's values by a criterion produced by an iterator.
|
316
|
-
_.sortBy = function(obj,
|
317
|
-
|
318
|
+
_.sortBy = function(obj, iterator, context) {
|
319
|
+
iterator = lookupIterator(iterator);
|
318
320
|
return _.pluck(_.map(obj, function(value, index, list) {
|
319
321
|
return {
|
320
322
|
value: value,
|
@@ -334,9 +336,9 @@
|
|
334
336
|
|
335
337
|
// An internal function used for aggregate "group by" operations.
|
336
338
|
var group = function(behavior) {
|
337
|
-
return function(obj,
|
339
|
+
return function(obj, iterator, context) {
|
338
340
|
var result = {};
|
339
|
-
|
341
|
+
iterator = lookupIterator(iterator);
|
340
342
|
each(obj, function(value, index) {
|
341
343
|
var key = iterator.call(context, value, index, obj);
|
342
344
|
behavior(result, key, value);
|
@@ -348,7 +350,7 @@
|
|
348
350
|
// Groups the object's values by a criterion. Pass either a string attribute
|
349
351
|
// to group by, or a function that returns the criterion.
|
350
352
|
_.groupBy = group(function(result, key, value) {
|
351
|
-
|
353
|
+
_.has(result, key) ? result[key].push(value) : result[key] = [value];
|
352
354
|
});
|
353
355
|
|
354
356
|
// Indexes the object's values by a criterion, similar to `groupBy`, but for
|
@@ -367,7 +369,7 @@
|
|
367
369
|
// Use a comparator function to figure out the smallest index at which
|
368
370
|
// an object should be inserted so as to maintain order. Uses binary search.
|
369
371
|
_.sortedIndex = function(array, obj, iterator, context) {
|
370
|
-
iterator =
|
372
|
+
iterator = lookupIterator(iterator);
|
371
373
|
var value = iterator.call(context, obj);
|
372
374
|
var low = 0, high = array.length;
|
373
375
|
while (low < high) {
|
@@ -399,7 +401,9 @@
|
|
399
401
|
// allows it to work with `_.map`.
|
400
402
|
_.first = _.head = _.take = function(array, n, guard) {
|
401
403
|
if (array == null) return void 0;
|
402
|
-
|
404
|
+
if ((n == null) || guard) return array[0];
|
405
|
+
if (n < 0) return [];
|
406
|
+
return slice.call(array, 0, n);
|
403
407
|
};
|
404
408
|
|
405
409
|
// Returns everything but the last entry of the array. Especially useful on
|
@@ -414,11 +418,8 @@
|
|
414
418
|
// values in the array. The **guard** check allows it to work with `_.map`.
|
415
419
|
_.last = function(array, n, guard) {
|
416
420
|
if (array == null) return void 0;
|
417
|
-
if ((n == null) || guard)
|
418
|
-
|
419
|
-
} else {
|
420
|
-
return slice.call(array, Math.max(array.length - n, 0));
|
421
|
-
}
|
421
|
+
if ((n == null) || guard) return array[array.length - 1];
|
422
|
+
return slice.call(array, Math.max(array.length - n, 0));
|
422
423
|
};
|
423
424
|
|
424
425
|
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
|
@@ -459,6 +460,16 @@
|
|
459
460
|
return _.difference(array, slice.call(arguments, 1));
|
460
461
|
};
|
461
462
|
|
463
|
+
// Split an array into two arrays: one whose elements all satisfy the given
|
464
|
+
// predicate, and one whose elements all do not satisfy the predicate.
|
465
|
+
_.partition = function(array, predicate) {
|
466
|
+
var pass = [], fail = [];
|
467
|
+
each(array, function(elem) {
|
468
|
+
(predicate(elem) ? pass : fail).push(elem);
|
469
|
+
});
|
470
|
+
return [pass, fail];
|
471
|
+
};
|
472
|
+
|
462
473
|
// Produce a duplicate-free version of the array. If the array has already
|
463
474
|
// been sorted, you have the option of using a faster algorithm.
|
464
475
|
// Aliased as `unique`.
|
@@ -492,7 +503,7 @@
|
|
492
503
|
var rest = slice.call(arguments, 1);
|
493
504
|
return _.filter(_.uniq(array), function(item) {
|
494
505
|
return _.every(rest, function(other) {
|
495
|
-
return _.
|
506
|
+
return _.contains(other, item);
|
496
507
|
});
|
497
508
|
});
|
498
509
|
};
|
@@ -507,7 +518,7 @@
|
|
507
518
|
// Zip together multiple lists into a single array -- elements that share
|
508
519
|
// an index go together.
|
509
520
|
_.zip = function() {
|
510
|
-
var length = _.max(_.pluck(arguments,
|
521
|
+
var length = _.max(_.pluck(arguments, 'length').concat(0));
|
511
522
|
var results = new Array(length);
|
512
523
|
for (var i = 0; i < length; i++) {
|
513
524
|
results[i] = _.pluck(arguments, '' + i);
|
@@ -613,19 +624,27 @@
|
|
613
624
|
};
|
614
625
|
|
615
626
|
// Partially apply a function by creating a version that has had some of its
|
616
|
-
// arguments pre-filled, without changing its dynamic `this` context.
|
627
|
+
// arguments pre-filled, without changing its dynamic `this` context. _ acts
|
628
|
+
// as a placeholder, allowing any combination of arguments to be pre-filled.
|
617
629
|
_.partial = function(func) {
|
618
|
-
var
|
630
|
+
var boundArgs = slice.call(arguments, 1);
|
619
631
|
return function() {
|
620
|
-
|
632
|
+
var position = 0;
|
633
|
+
var args = boundArgs.slice();
|
634
|
+
for (var i = 0, length = args.length; i < length; i++) {
|
635
|
+
if (args[i] === _) args[i] = arguments[position++];
|
636
|
+
}
|
637
|
+
while (position < arguments.length) args.push(arguments[position++]);
|
638
|
+
return func.apply(this, args);
|
621
639
|
};
|
622
640
|
};
|
623
641
|
|
624
|
-
// Bind
|
625
|
-
//
|
642
|
+
// Bind a number of an object's methods to that object. Remaining arguments
|
643
|
+
// are the method names to be bound. Useful for ensuring that all callbacks
|
644
|
+
// defined on an object belong to it.
|
626
645
|
_.bindAll = function(obj) {
|
627
646
|
var funcs = slice.call(arguments, 1);
|
628
|
-
if (funcs.length === 0) throw new Error(
|
647
|
+
if (funcs.length === 0) throw new Error('bindAll must be passed function names');
|
629
648
|
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
|
630
649
|
return obj;
|
631
650
|
};
|
@@ -664,12 +683,13 @@
|
|
664
683
|
var previous = 0;
|
665
684
|
options || (options = {});
|
666
685
|
var later = function() {
|
667
|
-
previous = options.leading === false ? 0 :
|
686
|
+
previous = options.leading === false ? 0 : _.now();
|
668
687
|
timeout = null;
|
669
688
|
result = func.apply(context, args);
|
689
|
+
context = args = null;
|
670
690
|
};
|
671
691
|
return function() {
|
672
|
-
var now =
|
692
|
+
var now = _.now();
|
673
693
|
if (!previous && options.leading === false) previous = now;
|
674
694
|
var remaining = wait - (now - previous);
|
675
695
|
context = this;
|
@@ -679,6 +699,7 @@
|
|
679
699
|
timeout = null;
|
680
700
|
previous = now;
|
681
701
|
result = func.apply(context, args);
|
702
|
+
context = args = null;
|
682
703
|
} else if (!timeout && options.trailing !== false) {
|
683
704
|
timeout = setTimeout(later, remaining);
|
684
705
|
}
|
@@ -692,24 +713,33 @@
|
|
692
713
|
// leading edge, instead of the trailing.
|
693
714
|
_.debounce = function(func, wait, immediate) {
|
694
715
|
var timeout, args, context, timestamp, result;
|
716
|
+
|
717
|
+
var later = function() {
|
718
|
+
var last = _.now() - timestamp;
|
719
|
+
if (last < wait) {
|
720
|
+
timeout = setTimeout(later, wait - last);
|
721
|
+
} else {
|
722
|
+
timeout = null;
|
723
|
+
if (!immediate) {
|
724
|
+
result = func.apply(context, args);
|
725
|
+
context = args = null;
|
726
|
+
}
|
727
|
+
}
|
728
|
+
};
|
729
|
+
|
695
730
|
return function() {
|
696
731
|
context = this;
|
697
732
|
args = arguments;
|
698
|
-
timestamp =
|
699
|
-
var later = function() {
|
700
|
-
var last = (new Date()) - timestamp;
|
701
|
-
if (last < wait) {
|
702
|
-
timeout = setTimeout(later, wait - last);
|
703
|
-
} else {
|
704
|
-
timeout = null;
|
705
|
-
if (!immediate) result = func.apply(context, args);
|
706
|
-
}
|
707
|
-
};
|
733
|
+
timestamp = _.now();
|
708
734
|
var callNow = immediate && !timeout;
|
709
735
|
if (!timeout) {
|
710
736
|
timeout = setTimeout(later, wait);
|
711
737
|
}
|
712
|
-
if (callNow)
|
738
|
+
if (callNow) {
|
739
|
+
result = func.apply(context, args);
|
740
|
+
context = args = null;
|
741
|
+
}
|
742
|
+
|
713
743
|
return result;
|
714
744
|
};
|
715
745
|
};
|
@@ -731,11 +761,7 @@
|
|
731
761
|
// allowing you to adjust arguments, run code before and after, and
|
732
762
|
// conditionally execute the original function.
|
733
763
|
_.wrap = function(func, wrapper) {
|
734
|
-
return
|
735
|
-
var args = [func];
|
736
|
-
push.apply(args, arguments);
|
737
|
-
return wrapper.apply(this, args);
|
738
|
-
};
|
764
|
+
return _.partial(wrapper, func);
|
739
765
|
};
|
740
766
|
|
741
767
|
// Returns a function that is the composition of a list of functions, each
|
@@ -765,8 +791,9 @@
|
|
765
791
|
|
766
792
|
// Retrieve the names of an object's properties.
|
767
793
|
// Delegates to **ECMAScript 5**'s native `Object.keys`
|
768
|
-
_.keys =
|
769
|
-
if (
|
794
|
+
_.keys = function(obj) {
|
795
|
+
if (!_.isObject(obj)) return [];
|
796
|
+
if (nativeKeys) return nativeKeys(obj);
|
770
797
|
var keys = [];
|
771
798
|
for (var key in obj) if (_.has(obj, key)) keys.push(key);
|
772
799
|
return keys;
|
@@ -921,7 +948,8 @@
|
|
921
948
|
// from different frames are.
|
922
949
|
var aCtor = a.constructor, bCtor = b.constructor;
|
923
950
|
if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
|
924
|
-
_.isFunction(bCtor) && (bCtor instanceof bCtor))
|
951
|
+
_.isFunction(bCtor) && (bCtor instanceof bCtor))
|
952
|
+
&& ('constructor' in a && 'constructor' in b)) {
|
925
953
|
return false;
|
926
954
|
}
|
927
955
|
// Add the first object to the stack of traversed objects.
|
@@ -1061,6 +1089,30 @@
|
|
1061
1089
|
return value;
|
1062
1090
|
};
|
1063
1091
|
|
1092
|
+
_.constant = function(value) {
|
1093
|
+
return function () {
|
1094
|
+
return value;
|
1095
|
+
};
|
1096
|
+
};
|
1097
|
+
|
1098
|
+
_.property = function(key) {
|
1099
|
+
return function(obj) {
|
1100
|
+
return obj[key];
|
1101
|
+
};
|
1102
|
+
};
|
1103
|
+
|
1104
|
+
// Returns a predicate for checking whether an object has a given set of `key:value` pairs.
|
1105
|
+
_.matches = function(attrs) {
|
1106
|
+
return function(obj) {
|
1107
|
+
if (obj === attrs) return true; //avoid comparing an object to itself.
|
1108
|
+
for (var key in attrs) {
|
1109
|
+
if (attrs[key] !== obj[key])
|
1110
|
+
return false;
|
1111
|
+
}
|
1112
|
+
return true;
|
1113
|
+
}
|
1114
|
+
};
|
1115
|
+
|
1064
1116
|
// Run a function **n** times.
|
1065
1117
|
_.times = function(n, iterator, context) {
|
1066
1118
|
var accum = Array(Math.max(0, n));
|
@@ -1077,6 +1129,9 @@
|
|
1077
1129
|
return min + Math.floor(Math.random() * (max - min + 1));
|
1078
1130
|
};
|
1079
1131
|
|
1132
|
+
// A (possibly faster) way to get the current timestamp as an integer.
|
1133
|
+
_.now = Date.now || function() { return new Date().getTime(); };
|
1134
|
+
|
1080
1135
|
// List of HTML entities for escaping.
|
1081
1136
|
var entityMap = {
|
1082
1137
|
escape: {
|
@@ -1273,4 +1328,16 @@
|
|
1273
1328
|
|
1274
1329
|
});
|
1275
1330
|
|
1331
|
+
// AMD registration happens at the end for compatibility with AMD loaders
|
1332
|
+
// that may not enforce next-turn semantics on modules. Even though general
|
1333
|
+
// practice for AMD registration is to be anonymous, underscore registers
|
1334
|
+
// as a named module because, like jQuery, it is a base library that is
|
1335
|
+
// popular enough to be bundled in a third party lib, but not be part of
|
1336
|
+
// an AMD load request. Those cases could generate an error when an
|
1337
|
+
// anonymous define() is called outside of a loader request.
|
1338
|
+
if (typeof define === 'function' && define.amd) {
|
1339
|
+
define('underscore', [], function() {
|
1340
|
+
return _;
|
1341
|
+
});
|
1342
|
+
}
|
1276
1343
|
}).call(this);
|
@@ -7,8 +7,10 @@ class Pathname
|
|
7
7
|
out
|
8
8
|
end
|
9
9
|
|
10
|
+
VIDEO_EXTS = %w(.mp4 .mkv .flv .avi .m4v .mov .wmv .mpg .webm)
|
11
|
+
|
10
12
|
def video?
|
11
|
-
file? && extname &&
|
13
|
+
file? && extname && VIDEO_EXTS.any? { |t| extname.downcase.start_with?(t) }
|
12
14
|
end
|
13
15
|
|
14
16
|
def hidden?
|
data/lib/videos/version.rb
CHANGED
metadata
CHANGED
@@ -1,83 +1,94 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: videos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Brenton "B-Train" Fletcher
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 1.0.0
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 1.0.0
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: addressable
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: 2.3.5
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: 2.3.5
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: naturally
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: 1.0.3
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: 1.0.3
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rmagick
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- -
|
67
|
+
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: 2.13.1
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- -
|
75
|
+
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: 2.13.1
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: nokogiri
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- -
|
83
|
+
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: '0'
|
76
86
|
type: :runtime
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- -
|
91
|
+
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: '0'
|
83
94
|
description: A collection of videos is a directory (the container) containing both
|
@@ -94,7 +105,7 @@ executables:
|
|
94
105
|
extensions: []
|
95
106
|
extra_rdoc_files: []
|
96
107
|
files:
|
97
|
-
-
|
108
|
+
- .gitignore
|
98
109
|
- LICENSE
|
99
110
|
- Rakefile
|
100
111
|
- app/css/app.css
|
@@ -1133,27 +1144,27 @@ files:
|
|
1133
1144
|
- videos.gemspec
|
1134
1145
|
homepage: http://github.com/bloopletech/videos
|
1135
1146
|
licenses: []
|
1136
|
-
metadata: {}
|
1137
1147
|
post_install_message:
|
1138
1148
|
rdoc_options: []
|
1139
1149
|
require_paths:
|
1140
1150
|
- lib
|
1141
1151
|
required_ruby_version: !ruby/object:Gem::Requirement
|
1152
|
+
none: false
|
1142
1153
|
requirements:
|
1143
|
-
- -
|
1154
|
+
- - ! '>='
|
1144
1155
|
- !ruby/object:Gem::Version
|
1145
1156
|
version: '0'
|
1146
1157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1158
|
+
none: false
|
1147
1159
|
requirements:
|
1148
|
-
- -
|
1160
|
+
- - ! '>='
|
1149
1161
|
- !ruby/object:Gem::Version
|
1150
1162
|
version: 1.3.6
|
1151
1163
|
requirements: []
|
1152
1164
|
rubyforge_project: videos
|
1153
|
-
rubygems_version:
|
1165
|
+
rubygems_version: 1.8.25
|
1154
1166
|
signing_key:
|
1155
|
-
specification_version:
|
1167
|
+
specification_version: 3
|
1156
1168
|
summary: Videos indexes a collection of videos and creates a SPA that browses the
|
1157
1169
|
collection.
|
1158
1170
|
test_files: []
|
1159
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: e1f53f982cad87b47efee78c1482a21bfb831f8e
|
4
|
-
data.tar.gz: aaba1db31f5c16e77e0c1bdfdd64fbb579be5b24
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 6bfb33dc1c72e7dc12e991081154a0429352257ed607ed83928ba146f8fe2b3f5ae4eef145b25ac5fb6d27bd353f51575c40bab3409a1fcd44c9ef8970eb7571
|
7
|
-
data.tar.gz: 5601186c920b9e7024d3ab9ee8107eb41b2082ed4248a6d01b3c299ce34cb16aa2370d1224213ad0ad223f7e5e9a05616b12e66078fe2e0420ec1957d6417154
|