typus 3.1.0.rc14 → 3.1.0.rc15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/.gitmodules +3 -0
  2. data/README.md +10 -14
  3. data/Rakefile +7 -5
  4. data/app/assets/javascripts/typus.js +1 -0
  5. data/app/assets/javascripts/typus/jquery.application.js +0 -2
  6. data/app/assets/stylesheets/typus.css +13 -1
  7. data/app/assets/stylesheets/typus/account.css +53 -0
  8. data/app/assets/stylesheets/typus/actions.css +11 -0
  9. data/app/assets/stylesheets/typus/content.css +92 -0
  10. data/app/assets/stylesheets/typus/defaults.css +31 -0
  11. data/app/assets/stylesheets/typus/errors.css +33 -0
  12. data/app/assets/stylesheets/typus/footer.css +8 -0
  13. data/app/assets/stylesheets/typus/forms.css +52 -0
  14. data/app/assets/stylesheets/typus/hacks.css +20 -0
  15. data/app/assets/stylesheets/typus/header.css +55 -0
  16. data/app/assets/stylesheets/typus/layout.css +4 -0
  17. data/app/assets/stylesheets/typus/pagination.css +34 -8
  18. data/app/assets/stylesheets/typus/sidebar.css +23 -0
  19. data/app/assets/stylesheets/typus/tables.css +47 -0
  20. data/app/helpers/admin/base_helper.rb +1 -1
  21. data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +1 -0
  22. data/app/helpers/admin/resources/data_types/tree_helper.rb +1 -0
  23. data/app/helpers/admin/resources/display_helper.rb +1 -1
  24. data/app/helpers/admin/resources/form_helper.rb +1 -0
  25. data/app/helpers/admin/resources_helper.rb +3 -5
  26. data/app/views/admin/account/forgot_password.html.erb +7 -1
  27. data/app/views/admin/base/user_guide.html.erb +61 -57
  28. data/app/views/admin/dashboard/show.html.erb +6 -16
  29. data/app/views/admin/dashboard/widgets/_applications.html.erb +31 -0
  30. data/app/views/admin/dashboard/widgets/_models.html.erb +23 -0
  31. data/app/views/admin/dashboard/widgets/_models_extended.html.erb +25 -0
  32. data/app/views/admin/dashboard/widgets/_resources.html.erb +23 -0
  33. data/app/views/admin/resources/_actions.html.erb +23 -0
  34. data/app/views/admin/resources/edit.html.erb +26 -20
  35. data/app/views/admin/resources/edit/_actions.html.erb +7 -0
  36. data/app/views/admin/resources/edit/_rencently_edited.html.erb +8 -0
  37. data/app/views/admin/resources/index.html.erb +42 -32
  38. data/app/views/admin/resources/new.html.erb +16 -8
  39. data/app/views/admin/resources/show.html.erb +22 -14
  40. data/app/views/admin/session/new.html.erb +9 -1
  41. data/app/views/admin/templates/_belongs_to.html.erb +1 -1
  42. data/app/views/admin/templates/_belongs_to_with_autocomplete.html.erb +1 -1
  43. data/app/views/admin/templates/_boolean.html.erb +1 -1
  44. data/app/views/admin/templates/_date.html.erb +1 -1
  45. data/app/views/admin/templates/_datetime.html.erb +1 -1
  46. data/app/views/admin/templates/_dragonfly.html.erb +1 -1
  47. data/app/views/admin/templates/_paperclip.html.erb +1 -1
  48. data/app/views/admin/templates/_password.html.erb +1 -1
  49. data/app/views/admin/templates/_selector.html.erb +1 -1
  50. data/app/views/admin/templates/_string.html.erb +1 -1
  51. data/app/views/admin/templates/_string_with_preview.html.erb +1 -1
  52. data/app/views/admin/templates/_text.html.erb +1 -1
  53. data/app/views/admin/templates/_text_with_ckeditor.html.erb +16 -2
  54. data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +16 -2
  55. data/app/views/admin/templates/_time.html.erb +1 -1
  56. data/app/views/admin/templates/_tree.html.erb +1 -1
  57. data/app/views/helpers/admin/resources/_sidebar.html.erb +36 -12
  58. data/app/views/helpers/admin/resources/_table.html.erb +5 -3
  59. data/app/views/layouts/admin/base.html.erb +16 -29
  60. data/app/views/layouts/admin/headless.html.erb +1 -1
  61. data/app/views/layouts/admin/session.html.erb +6 -0
  62. data/lib/support/fake_user.rb +2 -8
  63. data/lib/typus.rb +6 -2
  64. data/lib/typus/authentication/devise.rb +19 -0
  65. data/lib/typus/controller/headless.rb +1 -1
  66. data/lib/typus/orm/active_record/admin_user_v1.rb +15 -1
  67. data/lib/typus/orm/active_record/admin_user_v2.rb +16 -2
  68. data/lib/typus/orm/active_record/user/class_methods.rb +2 -3
  69. data/lib/typus/orm/active_record/user/instance_methods.rb +5 -2
  70. data/lib/typus/orm/active_record/user/instance_methods_more.rb +19 -0
  71. data/lib/typus/version.rb +1 -1
  72. data/vendor/assets/adapt/css/1200.css +357 -0
  73. data/vendor/assets/adapt/css/1200.min.css +1 -0
  74. data/vendor/assets/adapt/css/1560.css +357 -0
  75. data/vendor/assets/adapt/css/1560.min.css +1 -0
  76. data/vendor/assets/adapt/css/720.css +357 -0
  77. data/vendor/assets/adapt/css/720.min.css +1 -0
  78. data/vendor/assets/adapt/css/960.css +357 -0
  79. data/vendor/assets/adapt/css/960.min.css +1 -0
  80. data/vendor/assets/adapt/css/fluid.css +345 -0
  81. data/vendor/assets/adapt/css/fluid.min.css +1 -0
  82. data/vendor/assets/adapt/css/master.css +120 -0
  83. data/vendor/assets/adapt/css/mobile.css +20 -0
  84. data/vendor/assets/adapt/css/mobile.min.css +1 -0
  85. data/vendor/assets/adapt/css/reset.css +202 -0
  86. data/vendor/assets/adapt/css/text.css +81 -0
  87. data/vendor/assets/adapt/images/h1.png +0 -0
  88. data/vendor/assets/adapt/js/adapt.js +135 -0
  89. data/vendor/assets/adapt/js/adapt.min.js +1 -0
  90. data/vendor/assets/formalize/.gitignore +1 -0
  91. data/vendor/assets/formalize/css/_formalize.sass +332 -0
  92. data/vendor/assets/formalize/css/demo.css +47 -0
  93. data/vendor/assets/formalize/css/formalize.css +395 -0
  94. data/vendor/assets/formalize/css/reset.css +202 -0
  95. data/vendor/assets/formalize/css/text.css +81 -0
  96. data/vendor/assets/formalize/images/button.png +0 -0
  97. data/vendor/assets/formalize/images/select_arrow.gif +0 -0
  98. data/vendor/assets/formalize/js/dojo.formalize.js +166 -0
  99. data/vendor/assets/formalize/js/dojo.formalize.min.js +1 -0
  100. data/vendor/assets/formalize/js/extjs.formalize.js +163 -0
  101. data/vendor/assets/formalize/js/extjs.formalize.min.js +1 -0
  102. data/vendor/assets/formalize/js/jquery.formalize.js +150 -0
  103. data/vendor/assets/formalize/js/jquery.formalize.min.js +1 -0
  104. data/vendor/assets/formalize/js/mootools.formalize.js +155 -0
  105. data/vendor/assets/formalize/js/mootools.formalize.min.js +1 -0
  106. data/vendor/assets/formalize/js/prototype.formalize.js +163 -0
  107. data/vendor/assets/formalize/js/prototype.formalize.min.js +1 -0
  108. data/vendor/assets/formalize/js/yui.formalize.js +152 -0
  109. data/vendor/assets/formalize/js/yui.formalize.min.js +1 -0
  110. metadata +79 -47
  111. data/app/assets/stylesheets/typus/screen.css +0 -340
  112. data/app/helpers/admin/dashboard_helper.rb +0 -8
  113. data/app/views/admin/dashboard/_applications.html.erb +0 -21
  114. data/config/locales/typus.ca.models.yml +0 -17
  115. data/config/locales/typus.ca.yml +0 -80
  116. data/config/locales/typus.de.models.yml +0 -17
  117. data/config/locales/typus.de.yml +0 -79
  118. data/config/locales/typus.el.models.yml +0 -17
  119. data/config/locales/typus.el.yml +0 -81
  120. data/config/locales/typus.es.models.yml +0 -18
  121. data/config/locales/typus.es.yml +0 -81
  122. data/config/locales/typus.fr.models.yml +0 -18
  123. data/config/locales/typus.fr.yml +0 -85
  124. data/config/locales/typus.hu.models.yml +0 -17
  125. data/config/locales/typus.hu.yml +0 -79
  126. data/config/locales/typus.it.models.yml +0 -18
  127. data/config/locales/typus.it.yml +0 -88
  128. data/config/locales/typus.locale.models.yml.template +0 -17
  129. data/config/locales/typus.locale.yml.template +0 -80
  130. data/config/locales/typus.pt-BR.models.yml +0 -17
  131. data/config/locales/typus.pt-BR.yml +0 -79
  132. data/config/locales/typus.pt-PT.models.yml +0 -17
  133. data/config/locales/typus.pt-PT.yml +0 -83
  134. data/config/locales/typus.ru.models.yml +0 -17
  135. data/config/locales/typus.ru.yml +0 -79
  136. data/config/locales/typus.zh-CN.models.yml +0 -17
  137. data/config/locales/typus.zh-CN.yml +0 -78
@@ -0,0 +1 @@
1
+ .container_12{width:92%;margin-left:4%;margin-right:4%}.grid_1,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9,.grid_10,.grid_11,.grid_12{display:inline;float:left;margin-left:1%;margin-right:1%}.push_1,.pull_1,.push_2,.pull_2,.push_3,.pull_3,.push_4,.pull_4,.push_5,.pull_5,.push_6,.pull_6,.push_7,.pull_7,.push_8,.pull_8,.push_9,.pull_9,.push_10,.pull_10,.push_11,.pull_11{position:relative}.alpha{margin-left:0}.omega{margin-right:0}.container_12 .grid_1{width:6.333%}.container_12 .grid_2{width:14.667%}.container_12 .grid_3{width:23.0%}.container_12 .grid_4{width:31.333%}.container_12 .grid_5{width:39.667%}.container_12 .grid_6{width:48.0%}.container_12 .grid_7{width:56.333%}.container_12 .grid_8{width:64.667%}.container_12 .grid_9{width:73.0%}.container_12 .grid_10{width:81.333%}.container_12 .grid_11{width:89.667%}.container_12 .grid_12{width:98.0%}.container_12 .prefix_1{padding-left:8.333%}.container_12 .prefix_2{padding-left:16.667%}.container_12 .prefix_3{padding-left:25.0%}.container_12 .prefix_4{padding-left:33.333%}.container_12 .prefix_5{padding-left:41.667%}.container_12 .prefix_6{padding-left:50.0%}.container_12 .prefix_7{padding-left:58.333%}.container_12 .prefix_8{padding-left:66.667%}.container_12 .prefix_9{padding-left:75.0%}.container_12 .prefix_10{padding-left:83.333%}.container_12 .prefix_11{padding-left:91.667%}.container_12 .suffix_1{padding-right:8.333%}.container_12 .suffix_2{padding-right:16.667%}.container_12 .suffix_3{padding-right:25.0%}.container_12 .suffix_4{padding-right:33.333%}.container_12 .suffix_5{padding-right:41.667%}.container_12 .suffix_6{padding-right:50.0%}.container_12 .suffix_7{padding-right:58.333%}.container_12 .suffix_8{padding-right:66.667%}.container_12 .suffix_9{padding-right:75.0%}.container_12 .suffix_10{padding-right:83.333%}.container_12 .suffix_11{padding-right:91.667%}.container_12 .push_1{left:8.333%}.container_12 .push_2{left:16.667%}.container_12 .push_3{left:25.0%}.container_12 .push_4{left:33.333%}.container_12 .push_5{left:41.667%}.container_12 .push_6{left:50.0%}.container_12 .push_7{left:58.333%}.container_12 .push_8{left:66.667%}.container_12 .push_9{left:75.0%}.container_12 .push_10{left:83.333%}.container_12 .push_11{left:91.667%}.container_12 .pull_1{left:-8.333%}.container_12 .pull_2{left:-16.667%}.container_12 .pull_3{left:-25.0%}.container_12 .pull_4{left:-33.333%}.container_12 .pull_5{left:-41.667%}.container_12 .pull_6{left:-50.0%}.container_12 .pull_7{left:-58.333%}.container_12 .pull_8{left:-66.667%}.container_12 .pull_9{left:-75.0%}.container_12 .pull_10{left:-83.333%}.container_12 .pull_11{left:-91.667%}.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0}.clearfix:before,.clearfix:after,.container_12:before,.container_12:after{content:'.';display:block;overflow:hidden;visibility:hidden;font-size:0;line-height:0;width:0;height:0}.clearfix:after,.container_12:after{clear:both}.clearfix,.container_12{zoom:1}
@@ -0,0 +1,120 @@
1
+ @import 'reset.css';
2
+ @import 'text.css';
3
+
4
+ /* `Basic HTML
5
+ ----------------------------------------------------------------------------------------------------*/
6
+
7
+ body {
8
+ background: #fff;
9
+ color: #333;
10
+ }
11
+
12
+ h1 {
13
+ background: #eee url(../images/h1.png) no-repeat right center;
14
+ border-bottom: 1px solid #ccc;
15
+ padding: 10px 90px 10px 15px;
16
+ text-shadow: #fff 0 1px 0;
17
+ }
18
+
19
+ h2,
20
+ h3,
21
+ h4,
22
+ h5,
23
+ h6 {
24
+ line-height: 1;
25
+ }
26
+
27
+ a {
28
+ color: #06c;
29
+ }
30
+
31
+ a:hover {
32
+ color: #c60;
33
+ }
34
+
35
+ small {
36
+ font-size: 11px;
37
+ }
38
+
39
+ /* `Misc Classes
40
+ ----------------------------------------------------------------------------------------------------*/
41
+
42
+ .align_center {
43
+ text-align: center;
44
+ }
45
+
46
+ .align_right {
47
+ text-align: right;
48
+ }
49
+
50
+ /* `Data Table
51
+ ----------------------------------------------------------------------------------------------------*/
52
+
53
+ .data,
54
+ .data th,
55
+ .data td {
56
+ border-style: solid;
57
+ border-color: #ddd;
58
+ }
59
+
60
+ .data {
61
+ border-width: 0 1px 1px;
62
+ width: 100%;
63
+ }
64
+
65
+ .data caption {
66
+ padding: 0 10px 5px;
67
+ text-transform: uppercase;
68
+ }
69
+
70
+ .data th,
71
+ .data td {
72
+ border-top-width: 1px;
73
+ padding: 5px 10px;
74
+ }
75
+
76
+ .data th {
77
+ white-space: nowrap;
78
+ }
79
+
80
+ .data thead th {
81
+ background: #eee;
82
+ font-weight: bold;
83
+ text-shadow: #fff 0 1px 0;
84
+ }
85
+
86
+ .data tbody th {
87
+ width: 1px;
88
+ }
89
+
90
+ .data tr th:first-child {
91
+ text-align: right;
92
+ }
93
+
94
+ /* `Code
95
+ ----------------------------------------------------------------------------------------------------*/
96
+
97
+ pre,
98
+ code {
99
+ font-size: 12px;
100
+ font-family: Menlo, Courier, monospace;
101
+ }
102
+
103
+ pre,
104
+ .notice {
105
+ background: #ffe;
106
+ border: 1px solid;
107
+ border-color: #eed #ccb #bba #ddc;
108
+ overflow: auto;
109
+ padding: 10px 0 10px 10px;
110
+ }
111
+
112
+ * html pre {
113
+ overflow: hidden;
114
+ width: 97%;
115
+ }
116
+
117
+ code {
118
+ background: #ff9;
119
+ padding: 0 2px;
120
+ }
@@ -0,0 +1,20 @@
1
+ .grid_1,
2
+ .grid_2,
3
+ .grid_3,
4
+ .grid_4,
5
+ .grid_5,
6
+ .grid_6,
7
+ .grid_7,
8
+ .grid_8,
9
+ .grid_9,
10
+ .grid_10,
11
+ .grid_11,
12
+ .grid_12 {
13
+ margin-left: 10px;
14
+ margin-right: 10px;
15
+ }
16
+
17
+ .align_center,
18
+ .align_right {
19
+ text-align: left;
20
+ }
@@ -0,0 +1 @@
1
+ .grid_1,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9,.grid_10,.grid_11,.grid_12{margin-left:10px;margin-right:10px}.align_center,.align_right{text-align:left}
@@ -0,0 +1,202 @@
1
+ /* `XHTML, HTML4, HTML5 Reset
2
+ ----------------------------------------------------------------------------------------------------*/
3
+
4
+ a,
5
+ abbr,
6
+ acronym,
7
+ address,
8
+ applet,
9
+ article,
10
+ aside,
11
+ audio,
12
+ b,
13
+ big,
14
+ blockquote,
15
+ body,
16
+ canvas,
17
+ caption,
18
+ center,
19
+ cite,
20
+ code,
21
+ dd,
22
+ del,
23
+ details,
24
+ dfn,
25
+ dialog,
26
+ div,
27
+ dl,
28
+ dt,
29
+ em,
30
+ embed,
31
+ fieldset,
32
+ figcaption,
33
+ figure,
34
+ font,
35
+ footer,
36
+ form,
37
+ h1,
38
+ h2,
39
+ h3,
40
+ h4,
41
+ h5,
42
+ h6,
43
+ header,
44
+ hgroup,
45
+ hr,
46
+ html,
47
+ i,
48
+ iframe,
49
+ img,
50
+ ins,
51
+ kbd,
52
+ label,
53
+ legend,
54
+ li,
55
+ mark,
56
+ menu,
57
+ meter,
58
+ nav,
59
+ object,
60
+ ol,
61
+ output,
62
+ p,
63
+ pre,
64
+ progress,
65
+ q,
66
+ rp,
67
+ rt,
68
+ ruby,
69
+ s,
70
+ samp,
71
+ section,
72
+ small,
73
+ span,
74
+ strike,
75
+ strong,
76
+ sub,
77
+ summary,
78
+ sup,
79
+ table,
80
+ tbody,
81
+ td,
82
+ tfoot,
83
+ th,
84
+ thead,
85
+ time,
86
+ tr,
87
+ tt,
88
+ u,
89
+ ul,
90
+ var,
91
+ video,
92
+ xmp {
93
+ border: 0;
94
+ margin: 0;
95
+ padding: 0;
96
+ font-size: 100%;
97
+ }
98
+
99
+ html,
100
+ body {
101
+ height: 100%;
102
+ }
103
+
104
+ article,
105
+ aside,
106
+ details,
107
+ figcaption,
108
+ figure,
109
+ footer,
110
+ header,
111
+ hgroup,
112
+ menu,
113
+ nav,
114
+ section {
115
+ /*
116
+ Override the default (display: inline) for
117
+ browsers that do not recognize HTML5 tags.
118
+
119
+ IE8 (and lower) requires a shiv:
120
+ http://ejohn.org/blog/html5-shiv
121
+ */
122
+ display: block;
123
+ }
124
+
125
+ b,
126
+ strong {
127
+ /*
128
+ Makes browsers agree.
129
+ IE + Opera = font-weight: bold.
130
+ Gecko + WebKit = font-weight: bolder.
131
+ */
132
+ font-weight: bold;
133
+ }
134
+
135
+ img {
136
+ color: transparent;
137
+ font-size: 0;
138
+ vertical-align: middle;
139
+ /*
140
+ For IE.
141
+ http://css-tricks.com/ie-fix-bicubic-scaling-for-images
142
+ */
143
+ -ms-interpolation-mode: bicubic;
144
+ }
145
+
146
+ li {
147
+ /*
148
+ For IE6 + IE7.
149
+ */
150
+ display: list-item;
151
+ }
152
+
153
+ table {
154
+ border-collapse: collapse;
155
+ border-spacing: 0;
156
+ }
157
+
158
+ th,
159
+ td,
160
+ caption {
161
+ font-weight: normal;
162
+ vertical-align: top;
163
+ text-align: left;
164
+ }
165
+
166
+ q {
167
+ quotes: none;
168
+ }
169
+
170
+ q:before,
171
+ q:after {
172
+ content: '';
173
+ content: none;
174
+ }
175
+
176
+ sub,
177
+ sup,
178
+ small {
179
+ font-size: 75%;
180
+ }
181
+
182
+ sub,
183
+ sup {
184
+ line-height: 0;
185
+ position: relative;
186
+ vertical-align: baseline;
187
+ }
188
+
189
+ sub {
190
+ bottom: -0.25em;
191
+ }
192
+
193
+ sup {
194
+ top: -0.5em;
195
+ }
196
+
197
+ svg {
198
+ /*
199
+ For IE9.
200
+ */
201
+ overflow: hidden;
202
+ }
@@ -0,0 +1,81 @@
1
+ /*
2
+ 960 Grid System ~ Text CSS.
3
+ Learn more ~ http://960.gs/
4
+
5
+ Licensed under GPL and MIT.
6
+ */
7
+
8
+ /* `Basic HTML
9
+ ----------------------------------------------------------------------------------------------------*/
10
+
11
+ body {
12
+ font: 13px/1.5 'Helvetica Neue', Arial, 'Liberation Sans', FreeSans, sans-serif;
13
+ }
14
+
15
+ hr {
16
+ border: 0 #ccc solid;
17
+ border-top-width: 1px;
18
+ clear: both;
19
+ height: 0;
20
+ }
21
+
22
+ /* `Headings
23
+ ----------------------------------------------------------------------------------------------------*/
24
+
25
+ h1 {
26
+ font-size: 25px;
27
+ }
28
+
29
+ h2 {
30
+ font-size: 23px;
31
+ }
32
+
33
+ h3 {
34
+ font-size: 21px;
35
+ }
36
+
37
+ h4 {
38
+ font-size: 19px;
39
+ }
40
+
41
+ h5 {
42
+ font-size: 17px;
43
+ }
44
+
45
+ h6 {
46
+ font-size: 15px;
47
+ }
48
+
49
+ /* `Spacing
50
+ ----------------------------------------------------------------------------------------------------*/
51
+
52
+ ol {
53
+ list-style: decimal;
54
+ }
55
+
56
+ ul {
57
+ list-style: disc;
58
+ }
59
+
60
+ li {
61
+ margin-left: 30px;
62
+ }
63
+
64
+ p,
65
+ dl,
66
+ hr,
67
+ h1,
68
+ h2,
69
+ h3,
70
+ h4,
71
+ h5,
72
+ h6,
73
+ ol,
74
+ ul,
75
+ pre,
76
+ table,
77
+ address,
78
+ fieldset,
79
+ figure {
80
+ margin-bottom: 20px;
81
+ }
@@ -0,0 +1,135 @@
1
+ /*
2
+ Adapt.js licensed under GPL and MIT.
3
+
4
+ Read more here: http://adapt.960.gs
5
+ */
6
+
7
+ // Closure.
8
+ (function(w, d, config, undefined) {
9
+ // If no config, exit.
10
+ if (!config) {
11
+ return;
12
+ }
13
+
14
+ // Empty vars to use later.
15
+ var url, url_old, timer;
16
+
17
+ // Alias config values.
18
+ var callback = typeof config.callback === 'function' ? config.callback : undefined;
19
+ var path = config.path ? config.path : '';
20
+ var range = config.range;
21
+ var range_len = range.length;
22
+
23
+ // Create empty link tag:
24
+ // <link rel="stylesheet" />
25
+ var css = d.createElement('link');
26
+ css.rel = 'stylesheet';
27
+
28
+ // Called from within adapt().
29
+ function change(i, width) {
30
+ // Set the URL.
31
+ css.href = url;
32
+ url_old = url;
33
+
34
+ // Call callback, if defined.
35
+ callback && callback(i, width);
36
+ }
37
+
38
+ // Adapt to width.
39
+ function adapt() {
40
+ // This clearInterval is for IE.
41
+ // Really it belongs in react(),
42
+ // but doesn't do any harm here.
43
+ clearInterval(timer);
44
+
45
+ // Parse browser width.
46
+ var width = w.innerWidth || d.documentElement.clientWidth || d.body.clientWidth || 0;
47
+
48
+ // While loop vars.
49
+ var arr, arr_0, val_1, val_2, is_range, file;
50
+
51
+ // How many ranges?
52
+ var i = range_len;
53
+ var last = range_len - 1;
54
+
55
+ while (i--) {
56
+ // Turn string into array.
57
+ arr = range[i].split('=');
58
+
59
+ // Width is to the left of "=".
60
+ arr_0 = arr[0];
61
+
62
+ // File name is to the right of "=".
63
+ // Presuppoes a file with no spaces.
64
+ // If no file specified, assign [i].
65
+ file = arr[1] ? arr[1].replace(/\s/g, '') : i;
66
+
67
+ // Assume min/max if "to" isn't present.
68
+ is_range = arr_0.match('to');
69
+
70
+ // If it's a range, split left/right sides of "to",
71
+ // and then convert each one into numerical values.
72
+ // If it's not a range, turn maximum into a number.
73
+ val_1 = is_range ? parseInt(arr_0.split('to')[0], 10) : parseInt(arr_0, 10);
74
+ val_2 = is_range ? parseInt(arr_0.split('to')[1], 10) : undefined;
75
+
76
+ // Check for maxiumum or range.
77
+ if ((!val_2 && i === last && width > val_1) || (width > val_1 && width <= val_2)) {
78
+ // Built full URL to CSS file.
79
+ url = path + file;
80
+ break;
81
+ }
82
+ else {
83
+ // Blank if no conditions met.
84
+ url = '';
85
+ }
86
+ }
87
+
88
+ // Was it created yet?
89
+ if (!url_old) {
90
+ // Apply changes.
91
+ change(i, width);
92
+
93
+ // Add the CSS, only if path is defined.
94
+ // Use faster document.head if possible.
95
+ path && (d.head || d.getElementsByTagName('head')[0]).appendChild(css);
96
+ }
97
+ else if (url_old !== url) {
98
+ // Apply changes.
99
+ change(i, width);
100
+ }
101
+ }
102
+
103
+ // Fire off once.
104
+ adapt();
105
+
106
+ // Slight delay.
107
+ function react() {
108
+ // Clear interval as window resize fires,
109
+ // so that it only calls adapt() when the
110
+ // user has finished resizing the window.
111
+ clearInterval(timer);
112
+ timer = setInterval(adapt, 100);
113
+ }
114
+
115
+ // Do we want to watch for
116
+ // resize and device tilt?
117
+ if (config.dynamic) {
118
+ // Event listener for window resize,
119
+ // also triggered by phone rotation.
120
+ if (w.addEventListener) {
121
+ // Good browsers.
122
+ w.addEventListener('resize', react, false);
123
+ }
124
+ else if (w.attachEvent) {
125
+ // Legacy IE support.
126
+ w.attachEvent('onresize', react);
127
+ }
128
+ else {
129
+ // Old-school fallback.
130
+ w.onresize = react;
131
+ }
132
+ }
133
+
134
+ // Pass in window, document, config, undefined.
135
+ })(this, this.document, ADAPT_CONFIG);