Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

amd compliance

  • Loading branch information...
commit d3a40e18649892d2b05fd57b408aef4307c0fcec 1 parent d069b86
@talos authored
Showing with 14 additions and 5 deletions.
  1. +12 −3 jquery-rescale.js
  2. +1 −1  jquery-rescale.min.js
  3. +1 −1  package.json
View
15 jquery-rescale.js
@@ -32,9 +32,18 @@
implied, of John Krauss.
**/
-/*globals jQuery*/
+/*globals define, jQuery*/
-(function ($) {
+(function (factory) {
+ "use strict";
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function ($) {
"use strict";
var properties = [
[ 'transform', 'transform-origin' ],
@@ -131,4 +140,4 @@
settings.x + '% ' + settings.y + '%'));
});
};
-}(jQuery));
+}));
View
2  jquery-rescale.min.js
@@ -30,4 +30,4 @@
documentation are those of the authors and should not be
interpreted as representing official policies, either expressed or
implied, of John Krauss.
-**//*globals jQuery*/(function(a){"use strict";var b=[["transform","transform-origin"],["-ms-transform","-ms-transform-origin"],["-webkit-transform","-webkit-transform-origin"],["-o-transform","-o-transform-origin"],["-moz-transform","-moz-transform-origin"]],c=b.length,d={w:50,h:50,distort:!0,direction:0},e=function(a,d){var e={},f;for(f=0;f<c;f+=1)e[b[f][0]]=a,e[b[f][1]]=d;return e};a.fn.rescale=function(b,c,f){if(b===null||typeof b=="undefined"||c===null||typeof c=="undefined")return this;var g=a.extend({},d,f);return a.each(this,function(d,f){var i=a(f),j=i.width(),k=i.height(),l=b/j,m=c/k;g.direction>0?(l=l<1?1:l,m=m<1?1:m):g.direction<0&&(l=l>1?1:l,m=m>1?1:m),g.distort===!1&&(l>m?l=m:m=l),i.data("rescale",{width:j*l,height:k*m}).css(e("scale("+l+","+m+")",g.x+"% "+g.y+"%"))})}})(jQuery);
+**//*globals define, jQuery*/(function(a){"use strict",typeof define=="function"&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){"use strict";var b=[["transform","transform-origin"],["-ms-transform","-ms-transform-origin"],["-webkit-transform","-webkit-transform-origin"],["-o-transform","-o-transform-origin"],["-moz-transform","-moz-transform-origin"]],c=b.length,d={w:50,h:50,distort:!0,direction:0},e=function(a,d){var e={},f;for(f=0;f<c;f+=1)e[b[f][0]]=a,e[b[f][1]]=d;return e};a.fn.rescale=function(b,c,f){if(b===null||typeof b=="undefined"||c===null||typeof c=="undefined")return this;var g=a.extend({},d,f);return a.each(this,function(d,f){var i=a(f),j=i.width(),k=i.height(),l=b/j,m=c/k;g.direction>0?(l=l<1?1:l,m=m<1?1:m):g.direction<0&&(l=l>1?1:l,m=m>1?1:m),g.distort===!1&&(l>m?l=m:m=l),i.data("rescale",{width:j*l,height:k*m}).css(e("scale("+l+","+m+")",g.x+"% "+g.y+"%"))})}});
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "jquery-rescale",
- "version": "0.3.0",
+ "version": "0.3.1",
"title": "jQuery-rescale",
"author": {
"name": "John Krauss",
Please sign in to comment.
Something went wrong with that request. Please try again.