ratchet_design 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ratchet/core.js +3 -3
  3. data/app/assets/javascripts/ratchet/enhancement/_collapse.js +3 -6
  4. data/app/assets/javascripts/ratchet/enhancement/_swap.js +61 -72
  5. data/app/assets/javascripts/ratchet/enhancement/lightbox.js +43 -135
  6. data/app/assets/javascripts/ratchet/{enhancement → utility}/loader.js +7 -2
  7. data/app/assets/stylesheets/ratchet/_core.scss +1 -1
  8. data/app/assets/stylesheets/ratchet/enhancement/_lightbox.scss +8 -3
  9. data/app/assets/stylesheets/ratchet/{enhancement → utility}/_loader.scss +0 -0
  10. data/app/views/layouts/ratchet/default.html.slim +1 -1
  11. data/lib/ratchet_design/version.rb +1 -1
  12. data/public/assets/ratchet/core-0.1.1.js +103 -0
  13. data/public/assets/ratchet/core-0.1.1.js.gz +0 -0
  14. data/public/assets/ratchet/core-0.1.1.map.json +1 -0
  15. data/public/assets/ratchet/core-0.1.7.js +18018 -0
  16. data/public/assets/ratchet/fonts-woff-0.1.1.css +55 -0
  17. data/public/assets/ratchet/{fonts-woff-0.1.8.css.gz → fonts-woff-0.1.1.css.gz} +0 -0
  18. data/public/assets/ratchet/{fonts-woff-0.1.8.css → fonts-woff-0.1.7.css} +0 -0
  19. data/public/assets/ratchet/fonts-woff2-0.1.1.css +55 -0
  20. data/public/assets/ratchet/{fonts-woff2-0.1.8.css.gz → fonts-woff2-0.1.1.css.gz} +0 -0
  21. data/public/assets/ratchet/{fonts-woff2-0.1.8.css → fonts-woff2-0.1.7.css} +0 -0
  22. metadata +15 -13
  23. data/app/assets/javascripts/ratchet/utility/ajax.js +0 -122
  24. data/public/assets/ratchet/core-0.1.8.js +0 -107
  25. data/public/assets/ratchet/core-0.1.8.js.gz +0 -0
  26. data/public/assets/ratchet/core-0.1.8.map.json +0 -1
@@ -1,122 +0,0 @@
1
- /**
2
- * Ajax 0.0.1
3
- * Ajax module in Vanilla JS
4
- * @author Fernando Daciuk (@fdaciuk) & Kyle Foster (@hkfoster)
5
- * @source https://github.com/fdaciuk/ajax
6
- * @license MIT
7
- **/
8
-
9
- // Public API function
10
- var ajax = function( options ) {
11
- var methods = [ 'get', 'post', 'put', 'delete' ];
12
- options = options || {};
13
- options.baseUrl = options.baseUrl || '';
14
- if ( options.method && options.url ) {
15
- return xhrConnection(
16
- options.method,
17
- options.baseUrl + options.url,
18
- maybeData( options.data ),
19
- options
20
- );
21
- }
22
- return methods.reduce( function( acc, method ) {
23
- acc[ method ] = function( url, data ) {
24
- return xhrConnection(
25
- method,
26
- options.baseUrl + url,
27
- maybeData( data ),
28
- options
29
- );
30
- };
31
- return acc;
32
- }, {});
33
-
34
- function maybeData( data ) {
35
- return data || null;
36
- }
37
-
38
- function xhrConnection( type, url, data, options ) {
39
- var returnMethods = [ 'then', 'catch', 'always' ];
40
- var promiseMethods = returnMethods.reduce( function( promise, method ) {
41
- promise[ method ] = function( callback ) {
42
- promise[ method ] = callback;
43
- return promise;
44
- };
45
- return promise;
46
- }, {});
47
- var xhr = new XMLHttpRequest();
48
- xhr.open( type, url, true );
49
- xhr.withCredentials = options.hasOwnProperty( 'withCredentials' );
50
- setHeaders( xhr, options.headers );
51
- xhr.addEventListener( 'readystatechange', ready( promiseMethods, xhr ), false );
52
- xhr.send( objectToQueryString( data ) );
53
- promiseMethods.abort = function() {
54
- return xhr.abort();
55
- };
56
- return promiseMethods;
57
- }
58
-
59
- function setHeaders( xhr, headers ) {
60
- headers = headers || {};
61
- if ( !hasContentType( headers ) ) {
62
- headers[ 'Content-Type' ] = 'application/x-www-form-urlencoded';
63
- }
64
- Object.keys( headers ).forEach( function( name ) {
65
- ( headers[ name ] && xhr.setRequestHeader( name, headers[ name ] ) );
66
- });
67
- }
68
-
69
- function hasContentType( headers ) {
70
- return Object.keys( headers ).some( function( name ) {
71
- return name.toLowerCase() === 'content-type';
72
- });
73
- }
74
-
75
- function ready( promiseMethods, xhr ) {
76
- return function handleReady() {
77
- if ( xhr.readyState === xhr.DONE ) {
78
- xhr.removeEventListener( 'readystatechange', handleReady, false );
79
- promiseMethods.always.apply( promiseMethods, parseResponse( xhr ) );
80
-
81
- if ( xhr.status >= 200 && xhr.status < 300 ) {
82
- promiseMethods.then.apply( promiseMethods, parseResponse( xhr ) );
83
- } else {
84
- promiseMethods.catch.apply( promiseMethods, parseResponse( xhr ) );
85
- }
86
- }
87
- };
88
- }
89
-
90
- function parseResponse( xhr ) {
91
- var result;
92
- try {
93
- result = JSON.parse( xhr.responseText );
94
- } catch ( e ) {
95
- result = xhr.responseText;
96
- }
97
- return [ result, xhr ];
98
- }
99
-
100
- function objectToQueryString( data ) {
101
- return isObject( data ) ? getQueryString( data ) : data;
102
- }
103
-
104
- function isObject( data ) {
105
- return Object.prototype.toString.call( data ) === '[ object Object ]';
106
- }
107
-
108
- function getQueryString( object ) {
109
- return Object.keys( object ).reduce( function( acc, item ) {
110
- var prefix = !acc ? '' : acc + '&';
111
- return prefix + encode( item ) + '=' + encode( object[ item ] );
112
- }, '' );
113
- }
114
-
115
- function encode( value ) {
116
- return encodeURIComponent( value );
117
- }
118
-
119
- };
120
-
121
- // Public API
122
- module.exports = ajax;