From 1c6fa9010daf0d0c21de9e20fe6ac4dba1788d90 Mon Sep 17 00:00:00 2001 From: Katie Zhu Date: Mon, 9 Jun 2014 22:18:05 -0700 Subject: [PATCH] MD/CommonJS/Globals #12909 --- js/.jscsrc | 3 +-- js/.jshintrc | 4 ++-- js/affix.js | 8 ++++++-- js/alert.js | 8 ++++++-- js/button.js | 8 ++++++-- js/carousel.js | 8 ++++++-- js/collapse.js | 8 ++++++-- js/dropdown.js | 8 ++++++-- js/modal.js | 8 ++++++-- js/popover.js | 8 ++++++-- js/scrollspy.js | 8 ++++++-- js/tab.js | 8 ++++++-- js/tooltip.js | 8 ++++++-- js/transition.js | 8 ++++++-- 14 files changed, 75 insertions(+), 28 deletions(-) diff --git a/js/.jscsrc b/js/.jscsrc index fb6cd10c23ef..e6eb84560053 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -11,10 +11,9 @@ "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, "disallowSpacesInsideArrayBrackets": true, - "disallowSpacesInsideParentheses": true, "disallowTrailingComma": true, + "disallowSpacesInsideParentheses": true, "disallowTrailingWhitespace": true, - "requireCamelCaseOrUpperCaseIdentifiers": true, "requireCapitalizedConstructors": true, "requireCommaBeforeLineBreak": true, "requireDotNotation": true, diff --git a/js/.jshintrc b/js/.jshintrc index a59e1d00a113..0cf661ddc2ca 100644 --- a/js/.jshintrc +++ b/js/.jshintrc @@ -9,7 +9,7 @@ "latedef" : true, "laxbreak" : true, "nonbsp" : true, - "strict" : true, "undef" : true, - "unused" : true + "unused" : true, + "predef" : [ "define", "require" ] } diff --git a/js/affix.js b/js/affix.js index 5af32fee640f..d5f591fb5ed4 100644 --- a/js/affix.js +++ b/js/affix.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // AFFIX CLASS DEFINITION @@ -139,4 +143,4 @@ }) }) -}(jQuery); +}); diff --git a/js/alert.js b/js/alert.js index 905aacc150f7..f7fc6fb8e29f 100644 --- a/js/alert.js +++ b/js/alert.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // ALERT CLASS DEFINITION @@ -89,4 +93,4 @@ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) -}(jQuery); +}); diff --git a/js/button.js b/js/button.js index aa7145072289..cab7d8c3da97 100644 --- a/js/button.js +++ b/js/button.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // BUTTON PUBLIC CLASS DEFINITION @@ -107,4 +111,4 @@ e.preventDefault() }) -}(jQuery); +}); diff --git a/js/carousel.js b/js/carousel.js index f0117980d960..af51cf50d541 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // CAROUSEL CLASS DEFINITION @@ -209,4 +213,4 @@ }) }) -}(jQuery); +}); diff --git a/js/collapse.js b/js/collapse.js index 87098dbd2350..d5d74d07b980 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION @@ -178,4 +182,4 @@ Plugin.call($target, option) }) -}(jQuery); +}); diff --git a/js/dropdown.js b/js/dropdown.js index bc671fef010a..39d2951eb6bf 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // DROPDOWN CLASS DEFINITION @@ -148,4 +152,4 @@ .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown) -}(jQuery); +}); diff --git a/js/modal.js b/js/modal.js index f23ba825f271..2c363ec331ed 100644 --- a/js/modal.js +++ b/js/modal.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // MODAL CLASS DEFINITION @@ -277,4 +281,4 @@ Plugin.call($target, option, this) }) -}(jQuery); +}); diff --git a/js/popover.js b/js/popover.js index c8ec3bef4087..8d2840c2e8ec 100644 --- a/js/popover.js +++ b/js/popover.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // POPOVER PUBLIC CLASS DEFINITION @@ -110,4 +114,4 @@ return this } -}(jQuery); +}); diff --git a/js/scrollspy.js b/js/scrollspy.js index d527e9c2d92f..78858680e355 100644 --- a/js/scrollspy.js +++ b/js/scrollspy.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // SCROLLSPY CLASS DEFINITION @@ -157,4 +161,4 @@ }) }) -}(jQuery); +}); diff --git a/js/tab.js b/js/tab.js index 51f5cbb6870e..57ae6bc9f230 100644 --- a/js/tab.js +++ b/js/tab.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // TAB CLASS DEFINITION @@ -125,4 +129,4 @@ Plugin.call($(this), 'show') }) -}(jQuery); +}); diff --git a/js/tooltip.js b/js/tooltip.js index b4ced6d2af9f..692651457f9a 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -8,7 +8,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // TOOLTIP PUBLIC CLASS DEFINITION @@ -454,4 +458,4 @@ return this } -}(jQuery); +}); diff --git a/js/transition.js b/js/transition.js index e8c8f992fff4..8fcf8ff4bd28 100644 --- a/js/transition.js +++ b/js/transition.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) @@ -46,4 +50,4 @@ $.support.transition = transitionEnd() }) -}(jQuery); +});