jqtools-rails 0.1.2 → 0.1.3

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.
@@ -0,0 +1,6 @@
1
+ ## Changelog
2
+
3
+ *0.1.3*
4
+
5
+ * Added KnobKnob and Fullscreen
6
+ * Improved Readme
data/README.md CHANGED
@@ -2,10 +2,16 @@
2
2
 
3
3
  This gem is a Rails engine and is configured to integrate with Rails asset pipeline.
4
4
 
5
+ This gem was extracted from the JQuery Tools project, v1.2.6
6
+
7
+ ## Install
8
+
5
9
  Simply add to Gemfile and bundle:
6
10
 
7
11
  `gem 'jqtools-rails'`
8
12
 
13
+ ## Add tools
14
+
9
15
  You can choose to use either the minified js for all the tools:
10
16
 
11
17
  ```text
@@ -21,6 +27,56 @@ Or the tools individually
21
27
  //= require dateinput/dateinput.js
22
28
  ```
23
29
 
30
+ ## Tools included
31
+
32
+ * dateinput
33
+ * overlay
34
+ * rangeinput
35
+ * tabs
36
+ * toolbox
37
+ * tooltip
38
+ * validator
39
+
40
+ In addition to the original toolset, the following have been added:
41
+
42
+ * fullscreen
43
+ * knobs
44
+
45
+ ## Fullscreen
46
+
47
+ See [jQuery-FullScreen](https://github.com/martinaglv/jQuery-FullScreen)
48
+
49
+ ```javascript
50
+ // The plugin sets the $.support.fullscreen flag:
51
+ if($.support.fullscreen){
52
+
53
+ // Show your full screen button here
54
+
55
+ $('#fullScreen').click(function(e){
56
+ $('#content').fullScreen();
57
+ });
58
+ }
59
+ ```
60
+
61
+ ## Knobs
62
+
63
+ See [KnobKnob](https://github.com/martinaglv/KnobKnob)
64
+
65
+ ```javascript
66
+ $('#elem').knobKnob({
67
+ snap : 10, // Snap to zero if less than this deg.
68
+ value: 154, // Default rotation
69
+ turn : function(ratio){
70
+ // Do what you want here. Ratio moves from 0 to 1
71
+ // relative to the knob rotation. 0 - off, 1 - max
72
+ }
73
+ });
74
+ ``
75
+
76
+ Demo [pretty-switches](http://tutorialzine.com/2011/11/pretty-switches-css3-jquery/)
77
+
78
+ Note: You also need to add `knobs.css` to your project, fx using your `application.css` manifest.
79
+
24
80
  ## Contributing to jqtools-rails
25
81
 
26
82
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "jqtools-rails"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = "2012-08-02"
12
+ s.date = "2012-08-26"
13
13
  s.description = "Gem is an engine and is configured to integrate with Rails asset pipeline"
14
14
  s.email = "kmandrup@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
+ "CHANGELOG.md",
22
23
  "Gemfile",
23
24
  "Gemfile.lock",
24
25
  "LICENSE.txt",
@@ -30,7 +31,10 @@ Gem::Specification.new do |s|
30
31
  "spec/jqtools-rails_spec.rb",
31
32
  "spec/spec_helper.rb",
32
33
  "vendor/assets/javascripts/dateinput/dateinput.js",
34
+ "vendor/assets/javascripts/effect/fullscreen.jquery.js",
33
35
  "vendor/assets/javascripts/jquery.tools.min.js",
36
+ "vendor/assets/javascripts/knobs/knobs.jquery.js",
37
+ "vendor/assets/javascripts/knobs/transform.js",
34
38
  "vendor/assets/javascripts/overlay/overlay.apple.js",
35
39
  "vendor/assets/javascripts/overlay/overlay.js",
36
40
  "vendor/assets/javascripts/rangeinput/rangeinput.js",
@@ -46,7 +50,8 @@ Gem::Specification.new do |s|
46
50
  "vendor/assets/javascripts/tooltip/tooltip.dynamic.js",
47
51
  "vendor/assets/javascripts/tooltip/tooltip.js",
48
52
  "vendor/assets/javascripts/tooltip/tooltip.slide.js",
49
- "vendor/assets/javascripts/validator/validator.js"
53
+ "vendor/assets/javascripts/validator/validator.js",
54
+ "vendor/assets/stylesheets/knobs.css"
50
55
  ]
51
56
  s.homepage = "http://github.com/kristianmandrup/jqtools-rails"
52
57
  s.licenses = ["MIT"]
@@ -1,6 +1,8 @@
1
1
  module JQueryTools
2
2
  module Rails
3
3
  class Engine < ::Rails::Engine
4
+ initializer 'jq tools' do
5
+ end
4
6
  end
5
7
  end
6
8
  end
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @name jQuery KnobKnob plugin
3
+ * @author Martin Angelov
4
+ * @version 1.0
5
+ * @url http://tutorialzine.com/2011/11/pretty-switches-css3-jquery/
6
+ * @license MIT License
7
+ */
8
+
9
+ (function($){
10
+
11
+ $.fn.knobKnob = function(props){
12
+
13
+ var options = $.extend({
14
+ snap: 0,
15
+ value: 0,
16
+ turn: function(){}
17
+ }, props || {});
18
+
19
+ var tpl = '<div class="knob">\
20
+ <div class="top"></div>\
21
+ <div class="base"></div>\
22
+ </div>';
23
+
24
+ return this.each(function(){
25
+
26
+ var el = $(this);
27
+ el.append(tpl);
28
+
29
+ var knob = $('.knob',el),
30
+ knobTop = knob.find('.top'),
31
+ startDeg = -1,
32
+ currentDeg = 0,
33
+ rotation = 0,
34
+ lastDeg = 0,
35
+ doc = $(document);
36
+
37
+ if(options.value > 0 && options.value <= 359){
38
+ rotation = lastDeg = currentDeg = options.value;
39
+ knobTop.css('transform','rotate('+(currentDeg)+'deg)');
40
+ options.turn(currentDeg/359);
41
+ }
42
+
43
+ knob.on('mousedown touchstart', function(e){
44
+
45
+ e.preventDefault();
46
+
47
+ var offset = knob.offset();
48
+ var center = {
49
+ y : offset.top + knob.height()/2,
50
+ x: offset.left + knob.width()/2
51
+ };
52
+
53
+ var a, b, deg, tmp,
54
+ rad2deg = 180/Math.PI;
55
+
56
+ knob.on('mousemove.rem touchmove.rem',function(e){
57
+
58
+ e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
59
+
60
+ a = center.y - e.pageY;
61
+ b = center.x - e.pageX;
62
+ deg = Math.atan2(a,b)*rad2deg;
63
+
64
+ // we have to make sure that negative
65
+ // angles are turned into positive:
66
+ if(deg<0){
67
+ deg = 360 + deg;
68
+ }
69
+
70
+ // Save the starting position of the drag
71
+ if(startDeg == -1){
72
+ startDeg = deg;
73
+ }
74
+
75
+ // Calculating the current rotation
76
+ tmp = Math.floor((deg-startDeg) + rotation);
77
+
78
+ // Making sure the current rotation
79
+ // stays between 0 and 359
80
+ if(tmp < 0){
81
+ tmp = 360 + tmp;
82
+ }
83
+ else if(tmp > 359){
84
+ tmp = tmp % 360;
85
+ }
86
+
87
+ // Snapping in the off position:
88
+ if(options.snap && tmp < options.snap){
89
+ tmp = 0;
90
+ }
91
+
92
+ // This would suggest we are at an end position;
93
+ // we need to block further rotation.
94
+ if(Math.abs(tmp - lastDeg) > 180){
95
+ return false;
96
+ }
97
+
98
+ currentDeg = tmp;
99
+ lastDeg = tmp;
100
+
101
+ knobTop.css('transform','rotate('+(currentDeg)+'deg)');
102
+ options.turn(currentDeg/360);
103
+ });
104
+
105
+ doc.on('mouseup.rem touchend.rem',function(){
106
+ knob.off('.rem');
107
+ doc.off('.rem');
108
+
109
+ // Saving the current rotation
110
+ rotation = currentDeg;
111
+
112
+ // Marking the starting degree as invalid
113
+ startDeg = -1;
114
+ });
115
+
116
+ });
117
+ });
118
+ };
119
+
120
+ })(jQuery);
@@ -0,0 +1,532 @@
1
+ /*
2
+ * transform: A jQuery cssHooks adding cross-browser 2d transform capabilities to $.fn.css() and $.fn.animate()
3
+ *
4
+ * limitations:
5
+ * - requires jQuery 1.4.3+
6
+ * - Should you use the *translate* property, then your elements need to be absolutely positionned in a relatively positionned wrapper **or it will fail in IE678**.
7
+ * - transformOrigin is not accessible
8
+ *
9
+ * latest version and complete README available on Github:
10
+ * https://github.com/louisremi/jquery.transform.js
11
+ *
12
+ * Copyright 2011 @louis_remi
13
+ * Licensed under the MIT license.
14
+ *
15
+ * This saved you an hour of work?
16
+ * Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON
17
+ *
18
+ */
19
+ (function( $ ) {
20
+
21
+ /*
22
+ * Feature tests and global variables
23
+ */
24
+ var div = document.createElement('div'),
25
+ divStyle = div.style,
26
+ propertyName = 'transform',
27
+ suffix = 'Transform',
28
+ testProperties = [
29
+ 'O' + suffix,
30
+ 'ms' + suffix,
31
+ 'Webkit' + suffix,
32
+ 'Moz' + suffix,
33
+ // prefix-less property
34
+ propertyName
35
+ ],
36
+ i = testProperties.length,
37
+ supportProperty,
38
+ supportMatrixFilter,
39
+ propertyHook,
40
+ propertyGet,
41
+ rMatrix = /Matrix([^)]*)/;
42
+
43
+ // test different vendor prefixes of this property
44
+ while ( i-- ) {
45
+ if ( testProperties[i] in divStyle ) {
46
+ $.support[propertyName] = supportProperty = testProperties[i];
47
+ continue;
48
+ }
49
+ }
50
+ // IE678 alternative
51
+ if ( !supportProperty ) {
52
+ $.support.matrixFilter = supportMatrixFilter = divStyle.filter === '';
53
+ }
54
+ // prevent IE memory leak
55
+ div = divStyle = null;
56
+
57
+ // px isn't the default unit of this property
58
+ $.cssNumber[propertyName] = true;
59
+
60
+ /*
61
+ * fn.css() hooks
62
+ */
63
+ if ( supportProperty && supportProperty != propertyName ) {
64
+ // Modern browsers can use jQuery.cssProps as a basic hook
65
+ $.cssProps[propertyName] = supportProperty;
66
+
67
+ // Firefox needs a complete hook because it stuffs matrix with 'px'
68
+ if ( supportProperty == 'Moz' + suffix ) {
69
+ propertyHook = {
70
+ get: function( elem, computed ) {
71
+ return (computed ?
72
+ // remove 'px' from the computed matrix
73
+ $.css( elem, supportProperty ).split('px').join(''):
74
+ elem.style[supportProperty]
75
+ )
76
+ },
77
+ set: function( elem, value ) {
78
+ // remove 'px' from matrices
79
+ elem.style[supportProperty] = /matrix[^)p]*\)/.test(value) ?
80
+ value.replace(/matrix((?:[^,]*,){4})([^,]*),([^)]*)/, 'matrix$1$2px,$3px'):
81
+ value;
82
+ }
83
+ }
84
+ /* Fix two jQuery bugs still present in 1.5.1
85
+ * - rupper is incompatible with IE9, see http://jqbug.com/8346
86
+ * - jQuery.css is not really jQuery.cssProps aware, see http://jqbug.com/8402
87
+ */
88
+ } else if ( /^1\.[0-5](?:\.|$)/.test($.fn.jquery) ) {
89
+ propertyHook = {
90
+ get: function( elem, computed ) {
91
+ return (computed ?
92
+ $.css( elem, supportProperty.replace(/^ms/, 'Ms') ):
93
+ elem.style[supportProperty]
94
+ )
95
+ }
96
+ }
97
+ }
98
+ /* TODO: leverage hardware acceleration of 3d transform in Webkit only
99
+ else if ( supportProperty == 'Webkit' + suffix && support3dTransform ) {
100
+ propertyHook = {
101
+ set: function( elem, value ) {
102
+ elem.style[supportProperty] =
103
+ value.replace();
104
+ }
105
+ }
106
+ }*/
107
+
108
+ } else if ( supportMatrixFilter ) {
109
+ propertyHook = {
110
+ get: function( elem, computed ) {
111
+ var elemStyle = ( computed && elem.currentStyle ? elem.currentStyle : elem.style ),
112
+ matrix;
113
+
114
+ if ( elemStyle && rMatrix.test( elemStyle.filter ) ) {
115
+ matrix = RegExp.$1.split(',');
116
+ matrix = [
117
+ matrix[0].split('=')[1],
118
+ matrix[2].split('=')[1],
119
+ matrix[1].split('=')[1],
120
+ matrix[3].split('=')[1]
121
+ ];
122
+ } else {
123
+ matrix = [1,0,0,1];
124
+ }
125
+ matrix[4] = elemStyle ? elemStyle.left : 0;
126
+ matrix[5] = elemStyle ? elemStyle.top : 0;
127
+ return "matrix(" + matrix + ")";
128
+ },
129
+ set: function( elem, value, animate ) {
130
+ var elemStyle = elem.style,
131
+ currentStyle,
132
+ Matrix,
133
+ filter;
134
+
135
+ if ( !animate ) {
136
+ elemStyle.zoom = 1;
137
+ }
138
+
139
+ value = matrix(value);
140
+
141
+ // rotate, scale and skew
142
+ if ( !animate || animate.M ) {
143
+ Matrix = [
144
+ "Matrix("+
145
+ "M11="+value[0],
146
+ "M12="+value[2],
147
+ "M21="+value[1],
148
+ "M22="+value[3],
149
+ "SizingMethod='auto expand'"
150
+ ].join();
151
+ filter = ( currentStyle = elem.currentStyle ) && currentStyle.filter || elemStyle.filter || "";
152
+
153
+ elemStyle.filter = rMatrix.test(filter) ?
154
+ filter.replace(rMatrix, Matrix) :
155
+ filter + " progid:DXImageTransform.Microsoft." + Matrix + ")";
156
+
157
+ // center the transform origin, from pbakaus's Transformie http://github.com/pbakaus/transformie
158
+ if ( (centerOrigin = $.transform.centerOrigin) ) {
159
+ elemStyle[centerOrigin == 'margin' ? 'marginLeft' : 'left'] = -(elem.offsetWidth/2) + (elem.clientWidth/2) + 'px';
160
+ elemStyle[centerOrigin == 'margin' ? 'marginTop' : 'top'] = -(elem.offsetHeight/2) + (elem.clientHeight/2) + 'px';
161
+ }
162
+ }
163
+
164
+ // translate
165
+ if ( !animate || animate.T ) {
166
+ // We assume that the elements are absolute positionned inside a relative positionned wrapper
167
+ elemStyle.left = value[4] + 'px';
168
+ elemStyle.top = value[5] + 'px';
169
+ }
170
+ }
171
+ }
172
+ }
173
+ // populate jQuery.cssHooks with the appropriate hook if necessary
174
+ if ( propertyHook ) {
175
+ $.cssHooks[propertyName] = propertyHook;
176
+ }
177
+ // we need a unique setter for the animation logic
178
+ propertyGet = propertyHook && propertyHook.get || $.css;
179
+
180
+ /*
181
+ * fn.animate() hooks
182
+ */
183
+ $.fx.step.transform = function( fx ) {
184
+ var elem = fx.elem,
185
+ start = fx.start,
186
+ end = fx.end,
187
+ split,
188
+ pos = fx.pos,
189
+ transform,
190
+ translate,
191
+ rotate,
192
+ scale,
193
+ skew,
194
+ T = false,
195
+ M = false,
196
+ prop;
197
+ translate = rotate = scale = skew = '';
198
+
199
+ // fx.end and fx.start need to be converted to their translate/rotate/scale/skew components
200
+ // so that we can interpolate them
201
+ if ( !start || typeof start === "string" ) {
202
+ // the following block can be commented out with jQuery 1.5.1+, see #7912
203
+ if (!start) {
204
+ start = propertyGet( elem, supportProperty );
205
+ }
206
+
207
+ // force layout only once per animation
208
+ if ( supportMatrixFilter ) {
209
+ elem.style.zoom = 1;
210
+ }
211
+
212
+ // if the start computed matrix is in end, we are doing a relative animation
213
+ split = end.split(start);
214
+ if ( split.length == 2 ) {
215
+ // remove the start computed matrix to make animations more accurate
216
+ end = split.join('');
217
+ fx.origin = start;
218
+ start = 'none';
219
+ }
220
+
221
+ // start is either 'none' or a matrix(...) that has to be parsed
222
+ fx.start = start = start == 'none'?
223
+ {
224
+ translate: [0,0],
225
+ rotate: 0,
226
+ scale: [1,1],
227
+ skew: [0,0]
228
+ }:
229
+ unmatrix( toArray(start) );
230
+
231
+ // fx.end has to be parsed and decomposed
232
+ fx.end = end = ~end.indexOf('matrix')?
233
+ // bullet-proof parser
234
+ unmatrix(matrix(end)):
235
+ // faster and more precise parser
236
+ components(end);
237
+
238
+ // get rid of properties that do not change
239
+ for ( prop in start) {
240
+ if ( prop == 'rotate' ?
241
+ start[prop] == end[prop]:
242
+ start[prop][0] == end[prop][0] && start[prop][1] == end[prop][1]
243
+ ) {
244
+ delete start[prop];
245
+ }
246
+ }
247
+ }
248
+
249
+ /*
250
+ * We want a fast interpolation algorithm.
251
+ * This implies avoiding function calls and sacrifying DRY principle:
252
+ * - avoid $.each(function(){})
253
+ * - round values using bitewise hacks, see http://jsperf.com/math-round-vs-hack/3
254
+ */
255
+ if ( start.translate ) {
256
+ // round translate to the closest pixel
257
+ translate = ' translate('+
258
+ ((start.translate[0] + (end.translate[0] - start.translate[0]) * pos + .5) | 0) +'px,'+
259
+ ((start.translate[1] + (end.translate[1] - start.translate[1]) * pos + .5) | 0) +'px'+
260
+ ')';
261
+ T = true;
262
+ }
263
+ if ( start.rotate != undefined ) {
264
+ rotate = ' rotate('+ (start.rotate + (end.rotate - start.rotate) * pos) +'rad)';
265
+ M = true;
266
+ }
267
+ if ( start.scale ) {
268
+ scale = ' scale('+
269
+ (start.scale[0] + (end.scale[0] - start.scale[0]) * pos) +','+
270
+ (start.scale[1] + (end.scale[1] - start.scale[1]) * pos) +
271
+ ')';
272
+ M = true;
273
+ }
274
+ if ( start.skew ) {
275
+ skew = ' skew('+
276
+ (start.skew[0] + (end.skew[0] - start.skew[0]) * pos) +'rad,'+
277
+ (start.skew[1] + (end.skew[1] - start.skew[1]) * pos) +'rad'+
278
+ ')';
279
+ M = true;
280
+ }
281
+
282
+ // In case of relative animation, restore the origin computed matrix here.
283
+ transform = fx.origin ?
284
+ fx.origin + translate + skew + scale + rotate:
285
+ translate + rotate + scale + skew;
286
+
287
+ propertyHook && propertyHook.set ?
288
+ propertyHook.set( elem, transform, {M: M, T: T} ):
289
+ elem.style[supportProperty] = transform;
290
+ };
291
+
292
+ /*
293
+ * Utility functions
294
+ */
295
+
296
+ // turns a transform string into its 'matrix(A,B,C,D,X,Y)' form (as an array, though)
297
+ function matrix( transform ) {
298
+ transform = transform.split(')');
299
+ var
300
+ trim = $.trim
301
+ // last element of the array is an empty string, get rid of it
302
+ , i = transform.length -1
303
+ , split, prop, val
304
+ , A = 1
305
+ , B = 0
306
+ , C = 0
307
+ , D = 1
308
+ , A_, B_, C_, D_
309
+ , tmp1, tmp2
310
+ , X = 0
311
+ , Y = 0
312
+ ;
313
+ // Loop through the transform properties, parse and multiply them
314
+ while (i--) {
315
+ split = transform[i].split('(');
316
+ prop = trim(split[0]);
317
+ val = split[1];
318
+ A_ = B_ = C_ = D_ = 0;
319
+
320
+ switch (prop) {
321
+ case 'translateX':
322
+ X += parseInt(val, 10);
323
+ continue;
324
+
325
+ case 'translateY':
326
+ Y += parseInt(val, 10);
327
+ continue;
328
+
329
+ case 'translate':
330
+ val = val.split(',');
331
+ X += parseInt(val[0], 10);
332
+ Y += parseInt(val[1] || 0, 10);
333
+ continue;
334
+
335
+ case 'rotate':
336
+ val = toRadian(val);
337
+ A_ = Math.cos(val);
338
+ B_ = Math.sin(val);
339
+ C_ = -Math.sin(val);
340
+ D_ = Math.cos(val);
341
+ break;
342
+
343
+ case 'scaleX':
344
+ A_ = val;
345
+ D_ = 1;
346
+ break;
347
+
348
+ case 'scaleY':
349
+ A_ = 1;
350
+ D_ = val;
351
+ break;
352
+
353
+ case 'scale':
354
+ val = val.split(',');
355
+ A_ = val[0];
356
+ D_ = val.length>1 ? val[1] : val[0];
357
+ break;
358
+
359
+ case 'skewX':
360
+ A_ = D_ = 1;
361
+ C_ = Math.tan(toRadian(val));
362
+ break;
363
+
364
+ case 'skewY':
365
+ A_ = D_ = 1;
366
+ B_ = Math.tan(toRadian(val));
367
+ break;
368
+
369
+ case 'skew':
370
+ A_ = D_ = 1;
371
+ val = val.split(',');
372
+ C_ = Math.tan(toRadian(val[0]));
373
+ B_ = Math.tan(toRadian(val[1] || 0));
374
+ break;
375
+
376
+ case 'matrix':
377
+ val = val.split(',');
378
+ A_ = +val[0];
379
+ B_ = +val[1];
380
+ C_ = +val[2];
381
+ D_ = +val[3];
382
+ X += parseInt(val[4], 10);
383
+ Y += parseInt(val[5], 10);
384
+ }
385
+ // Matrix product
386
+ tmp1 = A * A_ + B * C_;
387
+ B = A * B_ + B * D_;
388
+ tmp2 = C * A_ + D * C_;
389
+ D = C * B_ + D * D_;
390
+ A = tmp1;
391
+ C = tmp2;
392
+ }
393
+ return [A,B,C,D,X,Y];
394
+ }
395
+
396
+ // turns a matrix into its rotate, scale and skew components
397
+ // algorithm from http://hg.mozilla.org/mozilla-central/file/7cb3e9795d04/layout/style/nsStyleAnimation.cpp
398
+ function unmatrix(matrix) {
399
+ var
400
+ scaleX
401
+ , scaleY
402
+ , skew
403
+ , A = matrix[0]
404
+ , B = matrix[1]
405
+ , C = matrix[2]
406
+ , D = matrix[3]
407
+ ;
408
+
409
+ // Make sure matrix is not singular
410
+ if ( A * D - B * C ) {
411
+ // step (3)
412
+ scaleX = Math.sqrt( A * A + B * B );
413
+ A /= scaleX;
414
+ B /= scaleX;
415
+ // step (4)
416
+ skew = A * C + B * D;
417
+ C -= A * skew;
418
+ D -= B * skew;
419
+ // step (5)
420
+ scaleY = Math.sqrt( C * C + D * D );
421
+ C /= scaleY;
422
+ D /= scaleY;
423
+ skew /= scaleY;
424
+ // step (6)
425
+ if ( A * D < B * C ) {
426
+ //scaleY = -scaleY;
427
+ //skew = -skew;
428
+ A = -A;
429
+ B = -B;
430
+ skew = -skew;
431
+ scaleX = -scaleX;
432
+ }
433
+
434
+ // matrix is singular and cannot be interpolated
435
+ } else {
436
+ rotate = scaleX = scaleY = skew = 0;
437
+ }
438
+
439
+ return {
440
+ translate: [+matrix[4], +matrix[5]],
441
+ rotate: Math.atan2(B, A),
442
+ scale: [scaleX, scaleY],
443
+ skew: [skew, 0]
444
+ }
445
+ }
446
+
447
+ // parse tranform components of a transform string not containing 'matrix(...)'
448
+ function components( transform ) {
449
+ // split the != transforms
450
+ transform = transform.split(')');
451
+
452
+ var translate = [0,0],
453
+ rotate = 0,
454
+ scale = [1,1],
455
+ skew = [0,0],
456
+ i = transform.length -1,
457
+ trim = $.trim,
458
+ split, name, value;
459
+
460
+ // add components
461
+ while ( i-- ) {
462
+ split = transform[i].split('(');
463
+ name = trim(split[0]);
464
+ value = split[1];
465
+
466
+ if (name == 'translateX') {
467
+ translate[0] += parseInt(value, 10);
468
+
469
+ } else if (name == 'translateY') {
470
+ translate[1] += parseInt(value, 10);
471
+
472
+ } else if (name == 'translate') {
473
+ value = value.split(',');
474
+ translate[0] += parseInt(value[0], 10);
475
+ translate[1] += parseInt(value[1] || 0, 10);
476
+
477
+ } else if (name == 'rotate') {
478
+ rotate += toRadian(value);
479
+
480
+ } else if (name == 'scaleX') {
481
+ scale[0] *= value;
482
+
483
+ } else if (name == 'scaleY') {
484
+ scale[1] *= value;
485
+
486
+ } else if (name == 'scale') {
487
+ value = value.split(',');
488
+ scale[0] *= value[0];
489
+ scale[1] *= (value.length>1? value[1] : value[0]);
490
+
491
+ } else if (name == 'skewX') {
492
+ skew[0] += toRadian(value);
493
+
494
+ } else if (name == 'skewY') {
495
+ skew[1] += toRadian(value);
496
+
497
+ } else if (name == 'skew') {
498
+ value = value.split(',');
499
+ skew[0] += toRadian(value[0]);
500
+ skew[1] += toRadian(value[1] || '0');
501
+ }
502
+ }
503
+
504
+ return {
505
+ translate: translate,
506
+ rotate: rotate,
507
+ scale: scale,
508
+ skew: skew
509
+ };
510
+ }
511
+
512
+ // converts an angle string in any unit to a radian Float
513
+ function toRadian(value) {
514
+ return ~value.indexOf('deg') ?
515
+ parseInt(value,10) * (Math.PI * 2 / 360):
516
+ ~value.indexOf('grad') ?
517
+ parseInt(value,10) * (Math.PI/200):
518
+ parseFloat(value);
519
+ }
520
+
521
+ // Converts 'matrix(A,B,C,D,X,Y)' to [A,B,C,D,X,Y]
522
+ function toArray(matrix) {
523
+ // Fremove the unit of X and Y for Firefox
524
+ matrix = /\(([^,]*),([^,]*),([^,]*),([^,]*),([^,p]*)(?:px)?,([^)p]*)(?:px)?/.exec(matrix);
525
+ return [matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6]];
526
+ }
527
+
528
+ $.transform = {
529
+ centerOrigin: 'margin'
530
+ };
531
+
532
+ })( jQuery );
@@ -0,0 +1,51 @@
1
+ /*----------------------------
2
+ knobKnob Styles
3
+ -----------------------------*/
4
+
5
+ .knob{
6
+ width:83px;
7
+ height:83px;
8
+ position:relative;
9
+ }
10
+
11
+ .knob .top{
12
+ position:absolute;
13
+ top:0;
14
+ left:0;
15
+ width:83px;
16
+ height:83px;
17
+ background:url('knob.png') no-repeat;
18
+ z-index:10;
19
+ cursor:default !important;
20
+ }
21
+
22
+ .knob .base{
23
+ width:83px;
24
+ height:83px;
25
+ border-radius:50%;
26
+ box-shadow:0 5px 0 #4a5056,5px 5px 5px #000;
27
+ position:absolute;
28
+ top:0;
29
+ left:0;
30
+ z-index:1;
31
+ }
32
+
33
+ .knob .top:after{
34
+ content:'';
35
+ width:10px;
36
+ height:10px;
37
+ background-color:#666;
38
+ position:absolute;
39
+ top:50%;
40
+ left:10px;
41
+ margin-top:-5px;
42
+ border-radius: 50%;
43
+ cursor:default !important;
44
+ box-shadow: 0 0 1px #5a5a5a inset;
45
+ }
46
+
47
+ .knob [draggable] {
48
+ -moz-user-select: none;
49
+ -webkit-user-select: none;
50
+ user-select: none;
51
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jqtools-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-02 00:00:00.000000000 Z
12
+ date: 2012-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -101,6 +101,7 @@ extra_rdoc_files:
101
101
  files:
102
102
  - .document
103
103
  - .rspec
104
+ - CHANGELOG.md
104
105
  - Gemfile
105
106
  - Gemfile.lock
106
107
  - LICENSE.txt
@@ -112,7 +113,10 @@ files:
112
113
  - spec/jqtools-rails_spec.rb
113
114
  - spec/spec_helper.rb
114
115
  - vendor/assets/javascripts/dateinput/dateinput.js
116
+ - vendor/assets/javascripts/effect/fullscreen.jquery.js
115
117
  - vendor/assets/javascripts/jquery.tools.min.js
118
+ - vendor/assets/javascripts/knobs/knobs.jquery.js
119
+ - vendor/assets/javascripts/knobs/transform.js
116
120
  - vendor/assets/javascripts/overlay/overlay.apple.js
117
121
  - vendor/assets/javascripts/overlay/overlay.js
118
122
  - vendor/assets/javascripts/rangeinput/rangeinput.js
@@ -129,6 +133,7 @@ files:
129
133
  - vendor/assets/javascripts/tooltip/tooltip.js
130
134
  - vendor/assets/javascripts/tooltip/tooltip.slide.js
131
135
  - vendor/assets/javascripts/validator/validator.js
136
+ - vendor/assets/stylesheets/knobs.css
132
137
  homepage: http://github.com/kristianmandrup/jqtools-rails
133
138
  licenses:
134
139
  - MIT
@@ -144,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
149
  version: '0'
145
150
  segments:
146
151
  - 0
147
- hash: -755217790919762864
152
+ hash: 2209119423417733693
148
153
  required_rubygems_version: !ruby/object:Gem::Requirement
149
154
  none: false
150
155
  requirements: