Permalink
Browse files

add noConflict functionality to all bootstrap plugins

  • Loading branch information...
fat committed Dec 7, 2012
1 parent 1c5b8e9 commit a7eb9c294a575b5471ddec45ae75e1d09f7ace4c
Showing with 519 additions and 22 deletions.
  1. +11 −0 docs/assets/js/bootstrap-affix.js
  2. +11 −0 docs/assets/js/bootstrap-alert.js
  3. +11 −0 docs/assets/js/bootstrap-button.js
  4. +10 −0 docs/assets/js/bootstrap-carousel.js
  5. +14 −3 docs/assets/js/bootstrap-collapse.js
  6. +11 −0 docs/assets/js/bootstrap-dropdown.js
  7. +11 −0 docs/assets/js/bootstrap-modal.js
  8. +12 −1 docs/assets/js/bootstrap-popover.js
  9. +11 −0 docs/assets/js/bootstrap-scrollspy.js
  10. +11 −0 docs/assets/js/bootstrap-tab.js
  11. +11 −0 docs/assets/js/bootstrap-tooltip.js
  12. +12 −1 docs/assets/js/bootstrap-typeahead.js
  13. +136 −6 docs/assets/js/bootstrap.js
  14. +18 −1 docs/assets/js/bootstrap.min.js
  15. +8 −0 docs/javascript.html
  16. +8 −0 docs/templates/pages/javascript.mustache
  17. +11 −0 js/bootstrap-affix.js
  18. +11 −0 js/bootstrap-alert.js
  19. +11 −0 js/bootstrap-button.js
  20. +10 −0 js/bootstrap-carousel.js
  21. +14 −3 js/bootstrap-collapse.js
  22. +11 −0 js/bootstrap-dropdown.js
  23. +11 −0 js/bootstrap-modal.js
  24. +12 −1 js/bootstrap-popover.js
  25. +11 −0 js/bootstrap-scrollspy.js
  26. +11 −0 js/bootstrap-tab.js
  27. +11 −0 js/bootstrap-tooltip.js
  28. +12 −1 js/bootstrap-typeahead.js
  29. +6 −0 js/tests/unit/bootstrap-affix.js
  30. +6 −0 js/tests/unit/bootstrap-alert.js
  31. +6 −0 js/tests/unit/bootstrap-button.js
  32. +6 −0 js/tests/unit/bootstrap-carousel.js
  33. +6 −0 js/tests/unit/bootstrap-collapse.js
  34. +8 −2 js/tests/unit/bootstrap-dropdown.js
  35. +6 −0 js/tests/unit/bootstrap-modal.js
  36. +9 −3 js/tests/unit/bootstrap-popover.js
  37. +6 −0 js/tests/unit/bootstrap-scrollspy.js
  38. +6 −0 js/tests/unit/bootstrap-tab.js
  39. +6 −0 js/tests/unit/bootstrap-tooltip.js
  40. +6 −0 js/tests/unit/bootstrap-typeahead.js
@@ -68,6 +68,8 @@
/* AFFIX PLUGIN DEFINITION
* ======================= */
+ var old = $.fn.affix
+
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
@@ -85,6 +87,15 @@
}
+ /* AFFIX NO CONFLICT
+ * ================= */
+
+ $.fn.affix.noConflict = function () {
+ $.fn.affix = old
+ return this
+ }
+
+
/* AFFIX DATA-API
* ============== */
@@ -68,6 +68,8 @@
/* ALERT PLUGIN DEFINITION
* ======================= */
+ var old = $.fn.alert
+
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
@@ -80,6 +82,15 @@
$.fn.alert.Constructor = Alert
+ /* ALERT NO CONFLICT
+ * ================= */
+
+ $.fn.alert.noConflict = function () {
+ $.fn.alert = old
+ return this
+ }
+
+
/* ALERT DATA-API
* ============== */
@@ -64,6 +64,8 @@
/* BUTTON PLUGIN DEFINITION
* ======================== */
+ var old = $.fn.button
+
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
@@ -82,6 +84,15 @@
$.fn.button.Constructor = Button
+ /* BUTTON NO CONFLICT
+ * ================== */
+
+ $.fn.button.noConflict = function () {
+ $.fn.button = old
+ return this
+ }
+
+
/* BUTTON DATA-API
* =============== */
@@ -141,6 +141,8 @@
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
+ var old = $.fn.carousel
+
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
@@ -162,6 +164,14 @@
$.fn.carousel.Constructor = Carousel
+ /* CAROUSEL NO CONFLICT
+ * ==================== */
+
+ $.fn.carousel.noConflict = function () {
+ $.fn.carousel = old
+ return this
+ }
+
/* CAROUSEL DATA-API
* ================= */
@@ -120,8 +120,10 @@
}
- /* COLLAPSIBLE PLUGIN DEFINITION
- * ============================== */
+ /* COLLAPSE PLUGIN DEFINITION
+ * ========================== */
+
+ var old = $.fn.collapse
$.fn.collapse = function (option) {
return this.each(function () {
@@ -140,9 +142,18 @@
$.fn.collapse.Constructor = Collapse
- /* COLLAPSIBLE DATA-API
+ /* COLLAPSE NO CONFLICT
* ==================== */
+ $.fn.collapse.noConflict = function () {
+ $.fn.collapse = old
+ return this
+ }
+
+
+ /* COLLAPSE DATA-API
+ * ================= */
+
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
, target = $this.attr('data-target')
@@ -124,6 +124,8 @@
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
+ var old = $.fn.dropdown
+
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
@@ -136,6 +138,15 @@
$.fn.dropdown.Constructor = Dropdown
+ /* DROPDOWN NO CONFLICT
+ * ==================== */
+
+ $.fn.dropdown.noConflict = function () {
+ $.fn.dropdown = old
+ return this
+ }
+
+
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
@@ -193,6 +193,8 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
+ var old = $.fn.modal
+
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
@@ -213,6 +215,15 @@
$.fn.modal.Constructor = Modal
+ /* MODAL NO CONFLICT
+ * ================= */
+
+ $.fn.modal.noConflict = function () {
+ $.fn.modal = old
+ return this
+ }
+
+
/* MODAL DATA-API
* ============== */
@@ -81,6 +81,8 @@
/* POPOVER PLUGIN DEFINITION
* ======================= */
+ var old = $.fn.popover
+
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
@@ -100,4 +102,13 @@
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
})
-}(window.jQuery);
+
+ /* POPOVER NO CONFLICT
+ * =================== */
+
+ $.fn.popover.noConflict = function () {
+ $.fn.popover = old
+ return this
+ }
+
+}(window.jQuery);
@@ -121,6 +121,8 @@
/* SCROLLSPY PLUGIN DEFINITION
* =========================== */
+ var old = $.fn.scrollspy
+
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this)
@@ -138,6 +140,15 @@
}
+ /* SCROLLSPY NO CONFLICT
+ * ===================== */
+
+ $.fn.scrollspy.noConflict = function () {
+ $.fn.scrollspy = old
+ return this
+ }
+
+
/* SCROLLSPY DATA-API
* ================== */
@@ -110,6 +110,8 @@
/* TAB PLUGIN DEFINITION
* ===================== */
+ var old = $.fn.tab
+
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
@@ -122,6 +124,15 @@
$.fn.tab.Constructor = Tab
+ /* TAB NO CONFLICT
+ * =============== */
+
+ $.fn.tab.noConflict = function () {
+ $.fn.tab = old
+ return this
+ }
+
+
/* TAB DATA-API
* ============ */
@@ -250,6 +250,8 @@
/* TOOLTIP PLUGIN DEFINITION
* ========================= */
+ var old = $.fn.tooltip
+
$.fn.tooltip = function ( option ) {
return this.each(function () {
var $this = $(this)
@@ -273,4 +275,13 @@
, html: false
}
+
+ /* TOOLTIP NO CONFLICT
+ * =================== */
+
+ $.fn.tooltip.noConflict = function () {
+ $.fn.tooltip = old
+ return this
+ }
+
}(window.jQuery);
@@ -276,6 +276,8 @@
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
+ var old = $.fn.typeahead
+
$.fn.typeahead = function (option) {
return this.each(function () {
var $this = $(this)
@@ -297,7 +299,16 @@
$.fn.typeahead.Constructor = Typeahead
- /* TYPEAHEAD DATA-API
+ /* TYPEAHEAD NO CONFLICT
+ * =================== */
+
+ $.fn.typeahead.noConflict = function () {
+ $.fn.typeahead = old
+ return this
+ }
+
+
+ /* TYPEAHEAD DATA-API
* ================== */
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
Oops, something went wrong.

0 comments on commit a7eb9c2

Please sign in to comment.