quantum 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8771006356dc26776c64a173e08433929487bf2e
4
- data.tar.gz: 6561e6581433bab3f00d14a06b353fe02c05a9ff
3
+ metadata.gz: e5286bf7e1895f14c74d07a865ff9f0338061307
4
+ data.tar.gz: 5b69d90c596fa5e86872895dc47813a8babae955
5
5
  SHA512:
6
- metadata.gz: 20be75709c55e6e83fdd550cd2a71bb906c5f27511c52c777ac73e27bcc5c0c240a0e8b71397eb567d1691d08f93e08ab32b64d2c1da1583f0ac4802370cd12b
7
- data.tar.gz: 3f9ec3d023c92a81340a462c87184361550752f547daefcc5179262c3ab7968325912c84836be4a64265da15d7630a833fa2d2e85e7adca03f16bbfc416035cc
6
+ metadata.gz: 165770183fd965ab77e04319f842fb278086d565cf2dd2a5df385fefd4fd602f8d66ba644e35e3e9c4c97314942cb5f7e5468d78a14c29cf7235487f6f89b6de
7
+ data.tar.gz: 747fdd5de4277999540651ddc6d0f54c37ff26481b3bba3a0aea162393e7470fb07290e9bd11929ffc6c0d7bdbb723f617700810f25b092c46b313d2f7b555d2
@@ -1,3 +1,3 @@
1
1
  module Quantum
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -0,0 +1,260 @@
1
+ String.prototype.rightChars = function(n){
2
+ if (n <= 0) {
3
+ return "";
4
+ }
5
+ else if (n > this.length) {
6
+ return this;
7
+ }
8
+ else {
9
+ return this.substring(this.length, this.length - n);
10
+ }
11
+ };
12
+
13
+ (function($) {
14
+ var
15
+ options = {
16
+ highlightSpeed : 20,
17
+ typeSpeed : 100,
18
+ clearDelay : 500,
19
+ typeDelay : 200,
20
+ clearOnHighlight : true,
21
+ typerDataAttr : 'data-typer-targets',
22
+ typerInterval : 2000
23
+ },
24
+ highlight,
25
+ clearText,
26
+ backspace,
27
+ type,
28
+ spanWithColor,
29
+ clearDelay,
30
+ typeDelay,
31
+ clearData,
32
+ isNumber,
33
+ typeWithAttribute,
34
+ getHighlightInterval,
35
+ getTypeInterval,
36
+ typerInterval;
37
+
38
+ spanWithColor = function(color, backgroundColor) {
39
+ if (color === 'rgba(0, 0, 0, 0)') {
40
+ color = 'rgb(255, 255, 255)';
41
+ }
42
+
43
+ return $('<span></span>')
44
+ .css('color', color)
45
+ .css('background-color', backgroundColor);
46
+ };
47
+
48
+ isNumber = function (n) {
49
+ return !isNaN(parseFloat(n)) && isFinite(n);
50
+ };
51
+
52
+ clearData = function ($e) {
53
+ $e.removeData([
54
+ 'typePosition',
55
+ 'highlightPosition',
56
+ 'leftStop',
57
+ 'rightStop',
58
+ 'primaryColor',
59
+ 'backgroundColor',
60
+ 'text',
61
+ 'typing'
62
+ ]);
63
+ };
64
+
65
+ type = function ($e) {
66
+ var
67
+ // position = $e.data('typePosition'),
68
+ text = $e.data('text'),
69
+ oldLeft = $e.data('oldLeft'),
70
+ oldRight = $e.data('oldRight');
71
+
72
+ // if (!isNumber(position)) {
73
+ // position = $e.data('leftStop');
74
+ // }
75
+
76
+ if (!text || text.length === 0) {
77
+ clearData($e);
78
+ return;
79
+ }
80
+
81
+
82
+ $e.text(
83
+ oldLeft +
84
+ text.charAt(0) +
85
+ oldRight
86
+ ).data({
87
+ oldLeft: oldLeft + text.charAt(0),
88
+ text: text.substring(1)
89
+ });
90
+
91
+ // $e.text($e.text() + text.substring(position, position + 1));
92
+
93
+ // $e.data('typePosition', position + 1);
94
+
95
+ setTimeout(function () {
96
+ type($e);
97
+ }, getTypeInterval());
98
+ };
99
+
100
+ clearText = function ($e) {
101
+ $e.find('span').remove();
102
+
103
+ setTimeout(function () {
104
+ type($e);
105
+ }, typeDelay());
106
+ };
107
+
108
+ highlight = function ($e) {
109
+ var
110
+ position = $e.data('highlightPosition'),
111
+ leftText,
112
+ highlightedText,
113
+ rightText;
114
+
115
+ if (!isNumber(position)) {
116
+ position = $e.data('rightStop') + 1;
117
+ }
118
+
119
+ if (position <= $e.data('leftStop')) {
120
+ setTimeout(function () {
121
+ clearText($e);
122
+ }, clearDelay());
123
+ return;
124
+ }
125
+
126
+ leftText = $e.text().substring(0, position - 1);
127
+ highlightedText = $e.text().substring(position - 1, $e.data('rightStop') + 1);
128
+ rightText = $e.text().substring($e.data('rightStop') + 1);
129
+
130
+ $e.html(leftText)
131
+ .append(
132
+ spanWithColor(
133
+ $e.data('backgroundColor'),
134
+ $e.data('primaryColor')
135
+ )
136
+ .append(highlightedText)
137
+ )
138
+ .append(rightText);
139
+
140
+ $e.data('highlightPosition', position - 1);
141
+
142
+ setTimeout(function () {
143
+ return highlight($e);
144
+ }, getHighlightInterval());
145
+ };
146
+
147
+ typeWithAttribute = function ($e) {
148
+ var targets;
149
+
150
+ if ($e.data('typing')) {
151
+ return;
152
+ }
153
+
154
+ try {
155
+ targets = JSON.parse($e.attr($.typer.options.typerDataAttr)).targets;
156
+ } catch (e) {}
157
+
158
+ if (typeof targets === "undefined") {
159
+ targets = $.map($e.attr($.typer.options.typerDataAttr).split(','), function (e) {
160
+ return $.trim(e);
161
+ });
162
+ }
163
+
164
+ $e.typeTo(targets[Math.floor(Math.random()*targets.length)]);
165
+ };
166
+
167
+ // Expose our options to the world.
168
+ $.typer = (function () {
169
+ return { options: options };
170
+ })();
171
+
172
+ $.extend($.typer, {
173
+ options: options
174
+ });
175
+
176
+ //-- Methods to attach to jQuery sets
177
+
178
+ $.fn.typer = function() {
179
+ var $elements = $(this);
180
+
181
+ return $elements.each(function () {
182
+ var $e = $(this);
183
+
184
+ if (typeof $e.attr($.typer.options.typerDataAttr) === "undefined") {
185
+ return;
186
+ }
187
+
188
+ typeWithAttribute($e);
189
+ setInterval(function () {
190
+ typeWithAttribute($e);
191
+ }, typerInterval());
192
+ });
193
+ };
194
+
195
+ $.fn.typeTo = function (newString) {
196
+ var
197
+ $e = $(this),
198
+ currentText = $e.text(),
199
+ i = 0,
200
+ j = 0;
201
+
202
+ if (currentText === newString) {
203
+ console.log("Our strings our equal, nothing to type");
204
+ return $e;
205
+ }
206
+
207
+ if (currentText !== $e.html()) {
208
+ console.error("Typer does not work on elements with child elements.");
209
+ return $e;
210
+ }
211
+
212
+ $e.data('typing', true);
213
+
214
+ while (currentText.charAt(i) === newString.charAt(i)) {
215
+ i++;
216
+ }
217
+
218
+ while (currentText.rightChars(j) === newString.rightChars(j)) {
219
+ j++;
220
+ }
221
+
222
+ newString = newString.substring(i, newString.length - j + 1);
223
+
224
+ $e.data({
225
+ oldLeft: currentText.substring(0, i),
226
+ oldRight: currentText.rightChars(j - 1),
227
+ leftStop: i,
228
+ rightStop: currentText.length - j,
229
+ primaryColor: $e.css('color'),
230
+ backgroundColor: $e.css('background-color'),
231
+ text: newString
232
+ });
233
+
234
+ highlight($e);
235
+
236
+ return $e;
237
+ };
238
+
239
+ //-- Helper methods. These can one day be customized further to include things like ranges of delays.
240
+
241
+ getHighlightInterval = function () {
242
+ return $.typer.options.highlightSpeed;
243
+ };
244
+
245
+ getTypeInterval = function () {
246
+ return $.typer.options.typeSpeed;
247
+ },
248
+
249
+ clearDelay = function () {
250
+ return $.typer.options.clearDelay;
251
+ },
252
+
253
+ typeDelay = function () {
254
+ return $.typer.options.typeDelay;
255
+ };
256
+
257
+ typerInterval = function () {
258
+ return $.typer.options.typerInterval;
259
+ };
260
+ })(jQuery);
@@ -41,12 +41,14 @@
41
41
  .pagination ul > li.active:first-child {
42
42
  border-bottom-left-radius: 2px;
43
43
  border-top-left-radius: 2px;
44
+ border-left-width: 1px;
44
45
  }
45
46
  .pagination ul > li:last-child > a,
46
47
  .pagination ul > li:last-child > span,
47
48
  .pagination ul > li.active:last-child {
48
49
  border-bottom-right-radius: 2px;
49
50
  border-top-right-radius: 2px;
51
+ border-right-width: 1px;
50
52
  }
51
53
  .pagination-centered { text-align: center; }
52
54
  .pagination-right { text-align: right; }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quantum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2013-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,6 +101,7 @@ files:
101
101
  - vendor/assets/javascripts/tooltip.js
102
102
  - vendor/assets/javascripts/transitions.js
103
103
  - vendor/assets/javascripts/typeahead.js
104
+ - vendor/assets/javascripts/typer.js
104
105
  - vendor/assets/javascripts/wizard.js
105
106
  - vendor/assets/stylesheets/ad.css.scss
106
107
  - vendor/assets/stylesheets/alert.css.scss
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  version: '0'
158
159
  requirements: []
159
160
  rubyforge_project:
160
- rubygems_version: 2.1.0
161
+ rubygems_version: 2.1.3
161
162
  signing_key:
162
163
  specification_version: 4
163
164
  summary: Quantum Responsive Web Framework