pushnote 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -3
  3. data/.pushnote.yml +1 -0
  4. data/README.md +30 -11
  5. data/Rakefile +0 -20
  6. data/bin/pushnote +2 -19
  7. data/bin/pushnoted +58 -0
  8. data/lib/pushnote.rb +3 -0
  9. data/lib/pushnote/cli.rb +40 -0
  10. data/lib/pushnote/configuration.rb +12 -0
  11. data/lib/pushnote/note.rb +36 -0
  12. data/lib/pushnote/version.rb +1 -1
  13. data/pushnote.gemspec +5 -15
  14. metadata +10 -192
  15. data/.rspec +0 -3
  16. data/config.codekit +0 -1005
  17. data/config.ru +0 -2
  18. data/config/database.yml +0 -17
  19. data/db/migrate/20150131202537_create_notes_table.rb +0 -9
  20. data/db/schema.rb +0 -23
  21. data/lib/pushnote/adapters.rb +0 -1
  22. data/lib/pushnote/adapters/base.rb +0 -7
  23. data/lib/pushnote/adapters/local.rb +0 -17
  24. data/lib/pushnote/app.rb +0 -50
  25. data/lib/pushnote/models/note.rb +0 -4
  26. data/lib/pushnote/public/css/foundation.css +0 -6139
  27. data/lib/pushnote/public/css/foundation.min.css +0 -1
  28. data/lib/pushnote/public/css/normalize.css +0 -427
  29. data/lib/pushnote/public/humans.txt +0 -8
  30. data/lib/pushnote/public/img/.gitkeep +0 -1
  31. data/lib/pushnote/public/index.html +0 -166
  32. data/lib/pushnote/public/js/foundation.min.js +0 -5960
  33. data/lib/pushnote/public/js/foundation/foundation.abide.js +0 -318
  34. data/lib/pushnote/public/js/foundation/foundation.accordion.js +0 -67
  35. data/lib/pushnote/public/js/foundation/foundation.alert.js +0 -43
  36. data/lib/pushnote/public/js/foundation/foundation.clearing.js +0 -558
  37. data/lib/pushnote/public/js/foundation/foundation.dropdown.js +0 -439
  38. data/lib/pushnote/public/js/foundation/foundation.equalizer.js +0 -73
  39. data/lib/pushnote/public/js/foundation/foundation.interchange.js +0 -348
  40. data/lib/pushnote/public/js/foundation/foundation.joyride.js +0 -924
  41. data/lib/pushnote/public/js/foundation/foundation.js +0 -690
  42. data/lib/pushnote/public/js/foundation/foundation.magellan.js +0 -198
  43. data/lib/pushnote/public/js/foundation/foundation.offcanvas.js +0 -152
  44. data/lib/pushnote/public/js/foundation/foundation.orbit.js +0 -472
  45. data/lib/pushnote/public/js/foundation/foundation.reveal.js +0 -449
  46. data/lib/pushnote/public/js/foundation/foundation.slider.js +0 -267
  47. data/lib/pushnote/public/js/foundation/foundation.tab.js +0 -217
  48. data/lib/pushnote/public/js/foundation/foundation.tooltip.js +0 -300
  49. data/lib/pushnote/public/js/foundation/foundation.topbar.js +0 -445
  50. data/lib/pushnote/public/js/vendor/fastclick.js +0 -9
  51. data/lib/pushnote/public/js/vendor/jquery.cookie.js +0 -8
  52. data/lib/pushnote/public/js/vendor/jquery.js +0 -26
  53. data/lib/pushnote/public/js/vendor/modernizr.js +0 -8
  54. data/lib/pushnote/public/js/vendor/placeholder.js +0 -2
  55. data/lib/pushnote/public/robots.txt +0 -4
  56. data/lib/pushnote/views/index.erb +0 -15
  57. data/lib/pushnote/views/layout.erb +0 -48
  58. data/lib/pushnote/views/show.erb +0 -8
  59. data/spec/lib/controllers/notes_spec.rb +0 -21
  60. data/spec/spec_helper.rb +0 -16
@@ -1,690 +0,0 @@
1
- /*
2
- * Foundation Responsive Library
3
- * http://foundation.zurb.com
4
- * Copyright 2014, ZURB
5
- * Free to use under the MIT license.
6
- * http://www.opensource.org/licenses/mit-license.php
7
- */
8
-
9
- (function ($, window, document, undefined) {
10
- 'use strict';
11
-
12
- var header_helpers = function (class_array) {
13
- var i = class_array.length;
14
- var head = $('head');
15
-
16
- while (i--) {
17
- if(head.has('.' + class_array[i]).length === 0) {
18
- head.append('<meta class="' + class_array[i] + '" />');
19
- }
20
- }
21
- };
22
-
23
- header_helpers([
24
- 'foundation-mq-small',
25
- 'foundation-mq-small-only',
26
- 'foundation-mq-medium',
27
- 'foundation-mq-medium-only',
28
- 'foundation-mq-large',
29
- 'foundation-mq-large-only',
30
- 'foundation-mq-xlarge',
31
- 'foundation-mq-xlarge-only',
32
- 'foundation-mq-xxlarge',
33
- 'foundation-data-attribute-namespace']);
34
-
35
- // Enable FastClick if present
36
-
37
- $(function() {
38
- if (typeof FastClick !== 'undefined') {
39
- // Don't attach to body if undefined
40
- if (typeof document.body !== 'undefined') {
41
- FastClick.attach(document.body);
42
- }
43
- }
44
- });
45
-
46
- // private Fast Selector wrapper,
47
- // returns jQuery object. Only use where
48
- // getElementById is not available.
49
- var S = function (selector, context) {
50
- if (typeof selector === 'string') {
51
- if (context) {
52
- var cont;
53
- if (context.jquery) {
54
- cont = context[0];
55
- if (!cont) return context;
56
- } else {
57
- cont = context;
58
- }
59
- return $(cont.querySelectorAll(selector));
60
- }
61
-
62
- return $(document.querySelectorAll(selector));
63
- }
64
-
65
- return $(selector, context);
66
- };
67
-
68
- // Namespace functions.
69
-
70
- var attr_name = function (init) {
71
- var arr = [];
72
- if (!init) arr.push('data');
73
- if (this.namespace.length > 0) arr.push(this.namespace);
74
- arr.push(this.name);
75
-
76
- return arr.join('-');
77
- };
78
-
79
- var add_namespace = function (str) {
80
- var parts = str.split('-'),
81
- i = parts.length,
82
- arr = [];
83
-
84
- while (i--) {
85
- if (i !== 0) {
86
- arr.push(parts[i]);
87
- } else {
88
- if (this.namespace.length > 0) {
89
- arr.push(this.namespace, parts[i]);
90
- } else {
91
- arr.push(parts[i]);
92
- }
93
- }
94
- }
95
-
96
- return arr.reverse().join('-');
97
- };
98
-
99
- // Event binding and data-options updating.
100
-
101
- var bindings = function (method, options) {
102
- var self = this,
103
- should_bind_events = !S(this).data(this.attr_name(true));
104
-
105
- if (S(this.scope).is('[' + this.attr_name() +']')) {
106
- S(this.scope).data(this.attr_name(true) + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope))));
107
-
108
- if (should_bind_events) {
109
- this.events(this.scope);
110
- }
111
-
112
- } else {
113
- S('[' + this.attr_name() +']', this.scope).each(function () {
114
- var should_bind_events = !S(this).data(self.attr_name(true) + '-init');
115
- S(this).data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options(S(this))));
116
-
117
- if (should_bind_events) {
118
- self.events(this);
119
- }
120
- });
121
- }
122
- // # Patch to fix #5043 to move this *after* the if/else clause in order for Backbone and similar frameworks to have improved control over event binding and data-options updating.
123
- if (typeof method === 'string') {
124
- return this[method].call(this, options);
125
- }
126
-
127
- };
128
-
129
- var single_image_loaded = function (image, callback) {
130
- function loaded () {
131
- callback(image[0]);
132
- }
133
-
134
- function bindLoad () {
135
- this.one('load', loaded);
136
-
137
- if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
138
- var src = this.attr( 'src' ),
139
- param = src.match( /\?/ ) ? '&' : '?';
140
-
141
- param += 'random=' + (new Date()).getTime();
142
- this.attr('src', src + param);
143
- }
144
- }
145
-
146
- if (!image.attr('src')) {
147
- loaded();
148
- return;
149
- }
150
-
151
- if (image[0].complete || image[0].readyState === 4) {
152
- loaded();
153
- } else {
154
- bindLoad.call(image);
155
- }
156
- };
157
-
158
- /*
159
- https://github.com/paulirish/matchMedia.js
160
- */
161
-
162
- window.matchMedia = window.matchMedia || (function( doc ) {
163
-
164
- 'use strict';
165
-
166
- var bool,
167
- docElem = doc.documentElement,
168
- refNode = docElem.firstElementChild || docElem.firstChild,
169
- // fakeBody required for <FF4 when executed in <head>
170
- fakeBody = doc.createElement( 'body' ),
171
- div = doc.createElement( 'div' );
172
-
173
- div.id = 'mq-test-1';
174
- div.style.cssText = 'position:absolute;top:-100em';
175
- fakeBody.style.background = 'none';
176
- fakeBody.appendChild(div);
177
-
178
- return function (q) {
179
-
180
- div.innerHTML = '&shy;<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>';
181
-
182
- docElem.insertBefore( fakeBody, refNode );
183
- bool = div.offsetWidth === 42;
184
- docElem.removeChild( fakeBody );
185
-
186
- return {
187
- matches: bool,
188
- media: q
189
- };
190
-
191
- };
192
-
193
- }( document ));
194
-
195
- /*
196
- * jquery.requestAnimationFrame
197
- * https://github.com/gnarf37/jquery-requestAnimationFrame
198
- * Requires jQuery 1.8+
199
- *
200
- * Copyright (c) 2012 Corey Frang
201
- * Licensed under the MIT license.
202
- */
203
-
204
- (function($) {
205
-
206
- // requestAnimationFrame polyfill adapted from Erik Möller
207
- // fixes from Paul Irish and Tino Zijdel
208
- // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
209
- // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
210
-
211
- var animating,
212
- lastTime = 0,
213
- vendors = ['webkit', 'moz'],
214
- requestAnimationFrame = window.requestAnimationFrame,
215
- cancelAnimationFrame = window.cancelAnimationFrame,
216
- jqueryFxAvailable = 'undefined' !== typeof jQuery.fx;
217
-
218
- for (; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
219
- requestAnimationFrame = window[ vendors[lastTime] + 'RequestAnimationFrame' ];
220
- cancelAnimationFrame = cancelAnimationFrame ||
221
- window[ vendors[lastTime] + 'CancelAnimationFrame' ] ||
222
- window[ vendors[lastTime] + 'CancelRequestAnimationFrame' ];
223
- }
224
-
225
- function raf() {
226
- if (animating) {
227
- requestAnimationFrame(raf);
228
-
229
- if (jqueryFxAvailable) {
230
- jQuery.fx.tick();
231
- }
232
- }
233
- }
234
-
235
- if (requestAnimationFrame) {
236
- // use rAF
237
- window.requestAnimationFrame = requestAnimationFrame;
238
- window.cancelAnimationFrame = cancelAnimationFrame;
239
-
240
- if (jqueryFxAvailable) {
241
- jQuery.fx.timer = function (timer) {
242
- if (timer() && jQuery.timers.push(timer) && !animating) {
243
- animating = true;
244
- raf();
245
- }
246
- };
247
-
248
- jQuery.fx.stop = function () {
249
- animating = false;
250
- };
251
- }
252
- } else {
253
- // polyfill
254
- window.requestAnimationFrame = function (callback) {
255
- var currTime = new Date().getTime(),
256
- timeToCall = Math.max(0, 16 - (currTime - lastTime)),
257
- id = window.setTimeout(function () {
258
- callback(currTime + timeToCall);
259
- }, timeToCall);
260
- lastTime = currTime + timeToCall;
261
- return id;
262
- };
263
-
264
- window.cancelAnimationFrame = function (id) {
265
- clearTimeout(id);
266
- };
267
-
268
- }
269
-
270
- }( jQuery ));
271
-
272
-
273
- function removeQuotes (string) {
274
- if (typeof string === 'string' || string instanceof String) {
275
- string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, '');
276
- }
277
-
278
- return string;
279
- }
280
-
281
- window.Foundation = {
282
- name : 'Foundation',
283
-
284
- version : '5.5.0',
285
-
286
- media_queries : {
287
- 'small' : S('.foundation-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
288
- 'small-only' : S('.foundation-mq-small-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
289
- 'medium' : S('.foundation-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
290
- 'medium-only' : S('.foundation-mq-medium-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
291
- 'large' : S('.foundation-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
292
- 'large-only' : S('.foundation-mq-large-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
293
- 'xlarge' : S('.foundation-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
294
- 'xlarge-only' : S('.foundation-mq-xlarge-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
295
- 'xxlarge' : S('.foundation-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
296
- },
297
-
298
- stylesheet : $('<style></style>').appendTo('head')[0].sheet,
299
-
300
- global: {
301
- namespace: undefined
302
- },
303
-
304
- init : function (scope, libraries, method, options, response) {
305
- var args = [scope, method, options, response],
306
- responses = [];
307
-
308
- // check RTL
309
- this.rtl = /rtl/i.test(S('html').attr('dir'));
310
-
311
- // set foundation global scope
312
- this.scope = scope || this.scope;
313
-
314
- this.set_namespace();
315
-
316
- if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
317
- if (this.libs.hasOwnProperty(libraries)) {
318
- responses.push(this.init_lib(libraries, args));
319
- }
320
- } else {
321
- for (var lib in this.libs) {
322
- responses.push(this.init_lib(lib, libraries));
323
- }
324
- }
325
-
326
- S(window).load(function(){
327
- S(window)
328
- .trigger('resize.fndtn.clearing')
329
- .trigger('resize.fndtn.dropdown')
330
- .trigger('resize.fndtn.equalizer')
331
- .trigger('resize.fndtn.interchange')
332
- .trigger('resize.fndtn.joyride')
333
- .trigger('resize.fndtn.magellan')
334
- .trigger('resize.fndtn.topbar')
335
- .trigger('resize.fndtn.slider');
336
- });
337
-
338
- return scope;
339
- },
340
-
341
- init_lib : function (lib, args) {
342
- if (this.libs.hasOwnProperty(lib)) {
343
- this.patch(this.libs[lib]);
344
-
345
- if (args && args.hasOwnProperty(lib)) {
346
- if (typeof this.libs[lib].settings !== 'undefined') {
347
- $.extend(true, this.libs[lib].settings, args[lib]);
348
- }
349
- else if (typeof this.libs[lib].defaults !== 'undefined') {
350
- $.extend(true, this.libs[lib].defaults, args[lib]);
351
- }
352
- return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
353
- }
354
-
355
- args = args instanceof Array ? args : new Array(args);
356
- return this.libs[lib].init.apply(this.libs[lib], args);
357
- }
358
-
359
- return function () {};
360
- },
361
-
362
- patch : function (lib) {
363
- lib.scope = this.scope;
364
- lib.namespace = this.global.namespace;
365
- lib.rtl = this.rtl;
366
- lib['data_options'] = this.utils.data_options;
367
- lib['attr_name'] = attr_name;
368
- lib['add_namespace'] = add_namespace;
369
- lib['bindings'] = bindings;
370
- lib['S'] = this.utils.S;
371
- },
372
-
373
- inherit : function (scope, methods) {
374
- var methods_arr = methods.split(' '),
375
- i = methods_arr.length;
376
-
377
- while (i--) {
378
- if (this.utils.hasOwnProperty(methods_arr[i])) {
379
- scope[methods_arr[i]] = this.utils[methods_arr[i]];
380
- }
381
- }
382
- },
383
-
384
- set_namespace: function () {
385
-
386
- // Description:
387
- // Don't bother reading the namespace out of the meta tag
388
- // if the namespace has been set globally in javascript
389
- //
390
- // Example:
391
- // Foundation.global.namespace = 'my-namespace';
392
- // or make it an empty string:
393
- // Foundation.global.namespace = '';
394
- //
395
- //
396
-
397
- // If the namespace has not been set (is undefined), try to read it out of the meta element.
398
- // Otherwise use the globally defined namespace, even if it's empty ('')
399
- var namespace = ( this.global.namespace === undefined ) ? $('.foundation-data-attribute-namespace').css('font-family') : this.global.namespace;
400
-
401
- // Finally, if the namsepace is either undefined or false, set it to an empty string.
402
- // Otherwise use the namespace value.
403
- this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace;
404
- },
405
-
406
- libs : {},
407
-
408
- // methods that can be inherited in libraries
409
- utils : {
410
-
411
- // Description:
412
- // Fast Selector wrapper returns jQuery object. Only use where getElementById
413
- // is not available.
414
- //
415
- // Arguments:
416
- // Selector (String): CSS selector describing the element(s) to be
417
- // returned as a jQuery object.
418
- //
419
- // Scope (String): CSS selector describing the area to be searched. Default
420
- // is document.
421
- //
422
- // Returns:
423
- // Element (jQuery Object): jQuery object containing elements matching the
424
- // selector within the scope.
425
- S : S,
426
-
427
- // Description:
428
- // Executes a function a max of once every n milliseconds
429
- //
430
- // Arguments:
431
- // Func (Function): Function to be throttled.
432
- //
433
- // Delay (Integer): Function execution threshold in milliseconds.
434
- //
435
- // Returns:
436
- // Lazy_function (Function): Function with throttling applied.
437
- throttle : function (func, delay) {
438
- var timer = null;
439
-
440
- return function () {
441
- var context = this, args = arguments;
442
-
443
- if (timer == null) {
444
- timer = setTimeout(function () {
445
- func.apply(context, args);
446
- timer = null;
447
- }, delay);
448
- }
449
- };
450
- },
451
-
452
- // Description:
453
- // Executes a function when it stops being invoked for n seconds
454
- // Modified version of _.debounce() http://underscorejs.org
455
- //
456
- // Arguments:
457
- // Func (Function): Function to be debounced.
458
- //
459
- // Delay (Integer): Function execution threshold in milliseconds.
460
- //
461
- // Immediate (Bool): Whether the function should be called at the beginning
462
- // of the delay instead of the end. Default is false.
463
- //
464
- // Returns:
465
- // Lazy_function (Function): Function with debouncing applied.
466
- debounce : function (func, delay, immediate) {
467
- var timeout, result;
468
- return function () {
469
- var context = this, args = arguments;
470
- var later = function () {
471
- timeout = null;
472
- if (!immediate) result = func.apply(context, args);
473
- };
474
- var callNow = immediate && !timeout;
475
- clearTimeout(timeout);
476
- timeout = setTimeout(later, delay);
477
- if (callNow) result = func.apply(context, args);
478
- return result;
479
- };
480
- },
481
-
482
- // Description:
483
- // Parses data-options attribute
484
- //
485
- // Arguments:
486
- // El (jQuery Object): Element to be parsed.
487
- //
488
- // Returns:
489
- // Options (Javascript Object): Contents of the element's data-options
490
- // attribute.
491
- data_options : function (el, data_attr_name) {
492
- data_attr_name = data_attr_name || 'options';
493
- var opts = {}, ii, p, opts_arr,
494
- data_options = function (el) {
495
- var namespace = Foundation.global.namespace;
496
-
497
- if (namespace.length > 0) {
498
- return el.data(namespace + '-' + data_attr_name);
499
- }
500
-
501
- return el.data(data_attr_name);
502
- };
503
-
504
- var cached_options = data_options(el);
505
-
506
- if (typeof cached_options === 'object') {
507
- return cached_options;
508
- }
509
-
510
- opts_arr = (cached_options || ':').split(';');
511
- ii = opts_arr.length;
512
-
513
- function isNumber (o) {
514
- return ! isNaN (o-0) && o !== null && o !== '' && o !== false && o !== true;
515
- }
516
-
517
- function trim (str) {
518
- if (typeof str === 'string') return $.trim(str);
519
- return str;
520
- }
521
-
522
- while (ii--) {
523
- p = opts_arr[ii].split(':');
524
- p = [p[0], p.slice(1).join(':')];
525
-
526
- if (/true/i.test(p[1])) p[1] = true;
527
- if (/false/i.test(p[1])) p[1] = false;
528
- if (isNumber(p[1])) {
529
- if (p[1].indexOf('.') === -1) {
530
- p[1] = parseInt(p[1], 10);
531
- } else {
532
- p[1] = parseFloat(p[1]);
533
- }
534
- }
535
-
536
- if (p.length === 2 && p[0].length > 0) {
537
- opts[trim(p[0])] = trim(p[1]);
538
- }
539
- }
540
-
541
- return opts;
542
- },
543
-
544
- // Description:
545
- // Adds JS-recognizable media queries
546
- //
547
- // Arguments:
548
- // Media (String): Key string for the media query to be stored as in
549
- // Foundation.media_queries
550
- //
551
- // Class (String): Class name for the generated <meta> tag
552
- register_media : function (media, media_class) {
553
- if(Foundation.media_queries[media] === undefined) {
554
- $('head').append('<meta class="' + media_class + '"/>');
555
- Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
556
- }
557
- },
558
-
559
- // Description:
560
- // Add custom CSS within a JS-defined media query
561
- //
562
- // Arguments:
563
- // Rule (String): CSS rule to be appended to the document.
564
- //
565
- // Media (String): Optional media query string for the CSS rule to be
566
- // nested under.
567
- add_custom_rule : function (rule, media) {
568
- if (media === undefined && Foundation.stylesheet) {
569
- Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
570
- } else {
571
- var query = Foundation.media_queries[media];
572
-
573
- if (query !== undefined) {
574
- Foundation.stylesheet.insertRule('@media ' +
575
- Foundation.media_queries[media] + '{ ' + rule + ' }');
576
- }
577
- }
578
- },
579
-
580
- // Description:
581
- // Performs a callback function when an image is fully loaded
582
- //
583
- // Arguments:
584
- // Image (jQuery Object): Image(s) to check if loaded.
585
- //
586
- // Callback (Function): Function to execute when image is fully loaded.
587
- image_loaded : function (images, callback) {
588
- var self = this,
589
- unloaded = images.length;
590
-
591
- if (unloaded === 0) {
592
- callback(images);
593
- }
594
-
595
- images.each(function () {
596
- single_image_loaded(self.S(this), function () {
597
- unloaded -= 1;
598
- if (unloaded === 0) {
599
- callback(images);
600
- }
601
- });
602
- });
603
- },
604
-
605
- // Description:
606
- // Returns a random, alphanumeric string
607
- //
608
- // Arguments:
609
- // Length (Integer): Length of string to be generated. Defaults to random
610
- // integer.
611
- //
612
- // Returns:
613
- // Rand (String): Pseudo-random, alphanumeric string.
614
- random_str : function () {
615
- if (!this.fidx) this.fidx = 0;
616
- this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-');
617
-
618
- return this.prefix + (this.fidx++).toString(36);
619
- },
620
-
621
- // Description:
622
- // Helper for window.matchMedia
623
- //
624
- // Arguments:
625
- // mq (String): Media query
626
- //
627
- // Returns:
628
- // (Boolean): Whether the media query passes or not
629
- match : function (mq) {
630
- return window.matchMedia(mq).matches;
631
- },
632
-
633
- // Description:
634
- // Helpers for checking Foundation default media queries with JS
635
- //
636
- // Returns:
637
- // (Boolean): Whether the media query passes or not
638
-
639
- is_small_up : function () {
640
- return this.match(Foundation.media_queries.small);
641
- },
642
-
643
- is_medium_up : function () {
644
- return this.match(Foundation.media_queries.medium);
645
- },
646
-
647
- is_large_up : function () {
648
- return this.match(Foundation.media_queries.large);
649
- },
650
-
651
- is_xlarge_up : function () {
652
- return this.match(Foundation.media_queries.xlarge);
653
- },
654
-
655
- is_xxlarge_up : function () {
656
- return this.match(Foundation.media_queries.xxlarge);
657
- },
658
-
659
- is_small_only : function () {
660
- return !this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
661
- },
662
-
663
- is_medium_only : function () {
664
- return this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
665
- },
666
-
667
- is_large_only : function () {
668
- return this.is_medium_up() && this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
669
- },
670
-
671
- is_xlarge_only : function () {
672
- return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && !this.is_xxlarge_up();
673
- },
674
-
675
- is_xxlarge_only : function () {
676
- return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && this.is_xxlarge_up();
677
- }
678
- }
679
- };
680
-
681
- $.fn.foundation = function () {
682
- var args = Array.prototype.slice.call(arguments, 0);
683
-
684
- return this.each(function () {
685
- Foundation.init.apply(Foundation, [this].concat(args));
686
- return this;
687
- });
688
- };
689
-
690
- }(jQuery, window, window.document));