diff options
author | Rafael Xavier de Souza <rxaviers@gmail.com> | 2013-07-12 13:40:48 -0300 |
---|---|---|
committer | Rafael Xavier de Souza <rxaviers@gmail.com> | 2014-01-24 18:22:14 -0200 |
commit | 96e027e4b14345722cc39589f59ce2ce5e94b991 (patch) | |
tree | ca32a2fff151af28597c158198550eca6e5b8f18 | |
parent | 2651f4571e76979d93cf10d50edc452b0311a5f2 (diff) | |
download | jquery-ui-96e027e4b14345722cc39589f59ce2ce5e94b991.tar.gz jquery-ui-96e027e4b14345722cc39589f59ce2ce5e94b991.zip |
All: Wrap source files with UMD return exports
Ref #9464
Ref gh-1029
38 files changed, 609 insertions, 99 deletions
diff --git a/ui/.jshintrc b/ui/.jshintrc index 073418812..98a79b5db 100644 --- a/ui/.jshintrc +++ b/ui/.jshintrc @@ -18,6 +18,7 @@ "jquery": true, "globals": { + "define": false, "Globalize": false } } diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index c63c807ba..b2a3c2021 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -12,9 +12,23 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget( "ui.accordion", { +return $.widget( "ui.accordion", { version: "@VERSION", options: { active: 0, @@ -562,4 +576,4 @@ $.widget( "ui.accordion", { } }); -})( jQuery ); +})); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index e40e703b9..e5545abc0 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -14,7 +14,23 @@ * jquery.ui.position.js * jquery.ui.menu.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget", + "./jquery.ui.position", + "./jquery.ui.menu" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { $.widget( "ui.autocomplete", { version: "@VERSION", @@ -602,4 +618,6 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, { } }); -}( jQuery )); +return $.ui.autocomplete; + +})); diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 6bde7863f..659ecbf37 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -12,7 +12,21 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { var lastActive, baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", @@ -390,4 +404,6 @@ $.widget( "ui.buttonset", { } }); -}( jQuery ) ); +return $.ui.button; + +})); diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 6340c6d64..cb6760017 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -8,7 +8,17 @@ * * http://api.jqueryui.com/category/ui-core/ */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { // $.ui might exist from components with no dependencies, e.g., $.ui.position $.ui = $.ui || {}; @@ -286,4 +296,4 @@ $.ui.plugin = { } }; -})( jQuery ); +})); diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index e4961a1df..19bc61f8f 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -11,7 +11,20 @@ * Depends: * jquery.ui.core.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { $.extend($.ui, { datepicker: { version: "@VERSION" } }); @@ -2056,4 +2069,6 @@ $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); $.datepicker.version = "@VERSION"; -})(jQuery); +return $.datepicker; + +})); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 7f90908bd..857bdaffe 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -17,9 +17,28 @@ * jquery.ui.position.js * jquery.ui.resizable.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget", + "./jquery.ui.button", + "./jquery.ui.draggable", + "./jquery.ui.mouse", + "./jquery.ui.position", + "./jquery.ui.resizable" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget( "ui.dialog", { +return $.widget( "ui.dialog", { version: "@VERSION", options: { appendTo: "body", @@ -841,4 +860,4 @@ $.widget( "ui.dialog", { } }); -}( jQuery )); +})); diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 2de1d0162..7393de28c 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -13,7 +13,22 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.mouse", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { $.widget("ui.draggable", $.ui.mouse, { version: "@VERSION", @@ -1004,4 +1019,6 @@ $.ui.plugin.add("draggable", "zIndex", { } }); -})(jQuery); +return $.ui.draggable; + +})); diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index f9f2620da..e78ff1f8c 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -14,7 +14,23 @@ * jquery.ui.mouse.js * jquery.ui.draggable.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget", + "./jquery.ui.mouse", + "./jquery.ui.draggable" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { $.widget( "ui.droppable", { version: "@VERSION", @@ -401,4 +417,6 @@ $.ui.ddmanager = { } }; -})( jQuery ); +return $.ui.droppable; + +})); diff --git a/ui/jquery.ui.effect-blind.js b/ui/jquery.ui.effect-blind.js index 26aeab05c..1648a9ad3 100644 --- a/ui/jquery.ui.effect-blind.js +++ b/ui/jquery.ui.effect-blind.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.blind = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.blind = function( o, done ) { // Create element var el = $( this ), rvertical = /up|down|vertical/, @@ -77,4 +90,4 @@ $.effects.effect.blind = function( o, done ) { }); }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-bounce.js b/ui/jquery.ui.effect-bounce.js index 107a6ea94..01a83861c 100644 --- a/ui/jquery.ui.effect-bounce.js +++ b/ui/jquery.ui.effect-bounce.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.effects.effect.bounce = function( o, done ) { +return $.effects.effect.bounce = function( o, done ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], @@ -110,4 +123,4 @@ $.effects.effect.bounce = function( o, done ) { }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-clip.js b/ui/jquery.ui.effect-clip.js index 34f6d7f99..9be25434b 100644 --- a/ui/jquery.ui.effect-clip.js +++ b/ui/jquery.ui.effect-clip.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.clip = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.clip = function( o, done ) { // Create element var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], @@ -64,4 +77,4 @@ $.effects.effect.clip = function( o, done ) { }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-drop.js b/ui/jquery.ui.effect-drop.js index 2d19c91c4..aad87a0db 100644 --- a/ui/jquery.ui.effect-drop.js +++ b/ui/jquery.ui.effect-drop.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.drop = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.drop = function( o, done ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], @@ -62,4 +75,4 @@ $.effects.effect.drop = function( o, done ) { }); }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-explode.js b/ui/jquery.ui.effect-explode.js index e81ad9be0..6cfc47115 100644 --- a/ui/jquery.ui.effect-explode.js +++ b/ui/jquery.ui.effect-explode.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.explode = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.explode = function( o, done ) { var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, cells = rows, @@ -94,4 +107,4 @@ $.effects.effect.explode = function( o, done ) { } }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-fade.js b/ui/jquery.ui.effect-fade.js index b44140025..543a5210d 100644 --- a/ui/jquery.ui.effect-fade.js +++ b/ui/jquery.ui.effect-fade.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.fade = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.fade = function( o, done ) { var el = $( this ), mode = $.effects.setMode( el, o.mode || "toggle" ); @@ -27,4 +40,4 @@ $.effects.effect.fade = function( o, done ) { }); }; -})( jQuery ); +})); diff --git a/ui/jquery.ui.effect-fold.js b/ui/jquery.ui.effect-fold.js index fdb6e5fae..677b93406 100644 --- a/ui/jquery.ui.effect-fold.js +++ b/ui/jquery.ui.effect-fold.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.fold = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.fold = function( o, done ) { // Create element var el = $( this ), @@ -73,4 +86,4 @@ $.effects.effect.fold = function( o, done ) { }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-highlight.js b/ui/jquery.ui.effect-highlight.js index 2dc72082e..9c0f2d315 100644 --- a/ui/jquery.ui.effect-highlight.js +++ b/ui/jquery.ui.effect-highlight.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.highlight = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.highlight = function( o, done ) { var elem = $( this ), props = [ "backgroundImage", "backgroundColor", "opacity" ], mode = $.effects.setMode( elem, o.mode || "show" ), @@ -47,4 +60,4 @@ $.effects.effect.highlight = function( o, done ) { }); }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-puff.js b/ui/jquery.ui.effect-puff.js index a910defb2..4940ca390 100644 --- a/ui/jquery.ui.effect-puff.js +++ b/ui/jquery.ui.effect-puff.js @@ -12,9 +12,23 @@ * jquery.ui.effect.js * jquery.ui.effect-scale.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.puff = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect", + "./jquery.ui.effect-scale" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.puff = function( o, done ) { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || "hide" ), hide = mode === "hide", @@ -47,4 +61,4 @@ $.effects.effect.puff = function( o, done ) { elem.effect( o ); }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-pulsate.js b/ui/jquery.ui.effect-pulsate.js index 61d86df13..5bbff1e3d 100644 --- a/ui/jquery.ui.effect-pulsate.js +++ b/ui/jquery.ui.effect-pulsate.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.pulsate = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.pulsate = function( o, done ) { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || "show" ), show = mode === "show", @@ -60,4 +73,4 @@ $.effects.effect.pulsate = function( o, done ) { elem.dequeue(); }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-scale.js b/ui/jquery.ui.effect-scale.js index 42dc2281c..233e318c4 100644 --- a/ui/jquery.ui.effect-scale.js +++ b/ui/jquery.ui.effect-scale.js @@ -12,9 +12,23 @@ * jquery.ui.effect.js * jquery.ui.effect-size.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.scale = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect", + "./jquery.ui.effect-size" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.scale = function( o, done ) { // Create element var el = $( this ), @@ -76,4 +90,4 @@ $.effects.effect.scale = function( o, done ) { }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-shake.js b/ui/jquery.ui.effect-shake.js index 1e7e827e7..ef03a103f 100644 --- a/ui/jquery.ui.effect-shake.js +++ b/ui/jquery.ui.effect-shake.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.shake = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.shake = function( o, done ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], @@ -71,4 +84,4 @@ $.effects.effect.shake = function( o, done ) { }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-size.js b/ui/jquery.ui.effect-size.js index 6bdbd433d..1b01bf49a 100644 --- a/ui/jquery.ui.effect-size.js +++ b/ui/jquery.ui.effect-size.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.effects.effect.size = function( o, done ) { +return $.effects.effect.size = function( o, done ) { // Create element var original, baseline, factor, @@ -220,4 +233,4 @@ $.effects.effect.size = function( o, done ) { }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-slide.js b/ui/jquery.ui.effect-slide.js index 3fa63433e..4f4fd4f69 100644 --- a/ui/jquery.ui.effect-slide.js +++ b/ui/jquery.ui.effect-slide.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.slide = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.slide = function( o, done ) { // Create element var el = $( this ), @@ -61,4 +74,4 @@ $.effects.effect.slide = function( o, done ) { }); }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect-transfer.js b/ui/jquery.ui.effect-transfer.js index 31fbfa219..da7351f6d 100644 --- a/ui/jquery.ui.effect-transfer.js +++ b/ui/jquery.ui.effect-transfer.js @@ -11,9 +11,22 @@ * Depends: * jquery.ui.effect.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { -$.effects.effect.transfer = function( o, done ) { + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.effect" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + +return $.effects.effect.transfer = function( o, done ) { var elem = $( this ), target = $( o.to ), targetFixed = target.css( "position" ) === "fixed", @@ -44,4 +57,4 @@ $.effects.effect.transfer = function( o, done ) { }); }; -})(jQuery); +})); diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js index 3852cf5be..570561421 100644 --- a/ui/jquery.ui.effect.js +++ b/ui/jquery.ui.effect.js @@ -8,7 +8,17 @@ * * http://api.jqueryui.com/category/effects-core/ */ -(function($, undefined) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { var dataSpace = "ui-effects-"; @@ -1282,4 +1292,6 @@ $.each( baseEasings, function( name, easeIn ) { })(); -})(jQuery); +return $.effects; + +})); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 8c9f5a9be..597ed01e7 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -13,9 +13,24 @@ * jquery.ui.widget.js * jquery.ui.position.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget", + "./jquery.ui.position" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget( "ui.menu", { +return $.widget( "ui.menu", { version: "@VERSION", defaultElement: "<ul>", delay: 300, @@ -627,4 +642,4 @@ $.widget( "ui.menu", { } }); -}( jQuery )); +})); diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index ce1ecca72..4f60c28fc 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -11,14 +11,27 @@ * Depends: * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { var mouseHandled = false; $( document ).mouseup( function() { mouseHandled = false; }); -$.widget("ui.mouse", { +return $.widget("ui.mouse", { version: "@VERSION", options: { cancel: "input,textarea,button,select,option", @@ -174,4 +187,4 @@ $.widget("ui.mouse", { _mouseCapture: function(/* event */) { return true; } }); -})(jQuery); +})); diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index f304c1908..0017ead79 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -8,7 +8,17 @@ * * http://api.jqueryui.com/position/ */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { (function() { $.ui = $.ui || {}; @@ -498,4 +508,7 @@ $.ui.position = { })(); })(); -}( jQuery ) ); + +return $.ui.position; + +})); diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js index 0eaa8b41e..e8f90e990 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -12,9 +12,23 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget( "ui.progressbar", { +return $.widget( "ui.progressbar", { version: "@VERSION", options: { max: 100, @@ -146,4 +160,4 @@ $.widget( "ui.progressbar", { } }); -})( jQuery ); +})); diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 636cf4123..43158ee4a 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -13,7 +13,22 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.mouse", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { $.widget("ui.resizable", $.ui.mouse, { version: "@VERSION", @@ -1021,4 +1036,6 @@ $.ui.plugin.add("resizable", "grid", { }); -})(jQuery); +return $.ui.resizable; + +})); diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js index 7b9d7b209..107fc33c5 100644 --- a/ui/jquery.ui.selectable.js +++ b/ui/jquery.ui.selectable.js @@ -13,9 +13,24 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.mouse", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget("ui.selectable", $.ui.mouse, { +return $.widget("ui.selectable", $.ui.mouse, { version: "@VERSION", options: { appendTo: "body", @@ -274,4 +289,4 @@ $.widget("ui.selectable", $.ui.mouse, { }); -})(jQuery); +})); diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index be7660101..37f241de6 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -16,7 +16,7 @@ */ (function( $, undefined ) { -$.widget( "ui.selectmenu", { +return $.widget( "ui.selectmenu", { version: "@VERSION", defaultElement: "<select>", options: { diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index 7c67221b3..627352fba 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -13,9 +13,24 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.mouse", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget( "ui.slider", $.ui.mouse, { +return $.widget( "ui.slider", $.ui.mouse, { version: "@VERSION", widgetEventPrefix: "slide", @@ -679,4 +694,4 @@ $.widget( "ui.slider", $.ui.mouse, { } }); -}(jQuery)); +})); diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 01e644f44..1e39a9e32 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -13,9 +13,24 @@ * jquery.ui.mouse.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.mouse", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget("ui.sortable", $.ui.mouse, { +return $.widget("ui.sortable", $.ui.mouse, { version: "@VERSION", widgetEventPrefix: "sort", ready: false, @@ -1297,4 +1312,4 @@ $.widget("ui.sortable", $.ui.mouse, { }); -})(jQuery); +})); diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 30b5983a1..5c23f664d 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -13,7 +13,22 @@ * jquery.ui.widget.js * jquery.ui.button.js */ -(function( $ ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget", + "./jquery.ui.button" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { function spinner_modifier( fn ) { return function() { @@ -26,7 +41,7 @@ function spinner_modifier( fn ) { }; } -$.widget( "ui.spinner", { +return $.widget( "ui.spinner", { version: "@VERSION", defaultElement: "<input>", widgetEventPrefix: "spin", @@ -502,4 +517,4 @@ $.widget( "ui.spinner", { } }); -}( jQuery ) ); +})); diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index eb822c112..3f63c902d 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -12,9 +12,23 @@ * jquery.ui.core.js * jquery.ui.widget.js */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget( "ui.tabs", { +return $.widget( "ui.tabs", { version: "@VERSION", delay: 300, options: { @@ -855,4 +869,4 @@ $.widget( "ui.tabs", { } }); -})( jQuery ); +})); diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 274bcebdf..816662fe6 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -13,9 +13,24 @@ * jquery.ui.widget.js * jquery.ui.position.js */ -(function( $ ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ + "jquery", + "./jquery.ui.core", + "./jquery.ui.widget", + "./jquery.ui.position" + ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { -$.widget( "ui.tooltip", { +return $.widget( "ui.tooltip", { version: "@VERSION", options: { content: function() { @@ -431,4 +446,4 @@ $.widget( "ui.tooltip", { } }); -}( jQuery ) ); +})); diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index b62b877f7..2486610ef 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -8,7 +8,17 @@ * * http://api.jqueryui.com/jQuery.widget/ */ -(function( $, undefined ) { +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { var widget_uuid = 0, widget_slice = Array.prototype.slice; @@ -529,4 +539,6 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { }; }); -})( jQuery ); +return $.widget; + +})); |