From 5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Fri, 9 Sep 2011 22:47:49 -0700 Subject: move js plugins to root dir, begin writing tests, and change modal plugin to be more boss like --- docs/assets/js/application.js | 2 +- docs/assets/js/bootstrap-alerts.js | 72 --------- docs/assets/js/bootstrap-dropdown.js | 26 --- docs/assets/js/bootstrap-modal.js | 157 ------------------ docs/assets/js/bootstrap-popover.js | 67 -------- docs/assets/js/bootstrap-scrollspy.js | 0 docs/assets/js/bootstrap-tabs.js | 38 ----- docs/assets/js/bootstrap-twipsy.js | 288 ---------------------------------- docs/index.html | 2 +- docs/javascript.html | 128 +++++++-------- 10 files changed, 68 insertions(+), 712 deletions(-) delete mode 100644 docs/assets/js/bootstrap-alerts.js delete mode 100644 docs/assets/js/bootstrap-dropdown.js delete mode 100644 docs/assets/js/bootstrap-modal.js delete mode 100644 docs/assets/js/bootstrap-popover.js delete mode 100644 docs/assets/js/bootstrap-scrollspy.js delete mode 100644 docs/assets/js/bootstrap-tabs.js delete mode 100644 docs/assets/js/bootstrap-twipsy.js (limited to 'docs') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 475329398..db59c79f9 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -3,7 +3,7 @@ $(document).ready(function(){ // Dropdown example for topbar nav // =============================== - $(".topbar").dropdown() // catch any dropdowns on the page + $('body').dropdown() // catch any dropdowns on the page // table sort example diff --git a/docs/assets/js/bootstrap-alerts.js b/docs/assets/js/bootstrap-alerts.js deleted file mode 100644 index e27ac6482..000000000 --- a/docs/assets/js/bootstrap-alerts.js +++ /dev/null @@ -1,72 +0,0 @@ -(function( $ ){ - - /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) - * ======================================================= */ - - var transitionEnd - - $(function () { - - $.support.transition = (function () { - var thisBody = document.body || document.documentElement - , thisStyle = thisBody.style - , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined - return support - })() - - // set CSS transition event type - if ( $.support.transition ) { - transitionEnd = "TransitionEnd" - if ( $.browser.webkit ) { - transitionEnd = "webkitTransitionEnd" - } else if ( $.browser.mozilla ) { - transitionEnd = "transitionend" - } else if ( $.browser.opera ) { - transitionEnd = "oTransitionEnd" - } - } - - }) - - /* ALERT CLASS DEFINITION - * ====================== */ - - var Alert = function ( content ) { - var that = this - this.$element = $(content) - this.$element.delegate('.close', 'click', function (e) { - e.preventDefault() - that.close() - }) - } - - Alert.prototype = { - - close: function () { - var that = this - - this.$element.removeClass('in') - - function removeElement () { - that.$element.remove() - that.$element = null - } - - $.support.transition && this.$element.hasClass('fade') ? - this.$element.bind(transitionEnd, removeElement) : - removeElement() - } - - } - - - /* ALERT PLUGIN DEFINITION - * ======================= */ - - $.fn.alert = function ( options ) { - return this.each(function () { - new Alert(this) - }) - } - -})( jQuery || ender ) \ No newline at end of file diff --git a/docs/assets/js/bootstrap-dropdown.js b/docs/assets/js/bootstrap-dropdown.js deleted file mode 100644 index fe73e7994..000000000 --- a/docs/assets/js/bootstrap-dropdown.js +++ /dev/null @@ -1,26 +0,0 @@ -(function( $ ){ - - /* DROPDOWN PLUGIN DEFINITION - * ========================== */ - - var selector = 'a.menu, .dropdown-toggle' - - function clearMenus() { - $(selector).parent('li').removeClass('open') - } - - $(function () { - $('body').bind("click", clearMenus) - }) - - $.fn.dropdown = function ( options ) { - return this.each(function () { - $(this).delegate(selector, 'click', function (e) { - clearMenus() - $(this).parent('li').toggleClass('open') - return false - }) - }) - } - -})( jQuery || ender ) \ No newline at end of file diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js deleted file mode 100644 index 4bc395e1c..000000000 --- a/docs/assets/js/bootstrap-modal.js +++ /dev/null @@ -1,157 +0,0 @@ -(function( $ ){ - - /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) - * ======================================================= */ - - var transitionEnd - - $(function () { - - $.support.transition = (function () { - var thisBody = document.body || document.documentElement - , thisStyle = thisBody.style - , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined - return support - })() - - // set CSS transition event type - if ( $.support.transition ) { - transitionEnd = "TransitionEnd" - if ( $.browser.webkit ) { - transitionEnd = "webkitTransitionEnd" - } else if ( $.browser.mozilla ) { - transitionEnd = "transitionend" - } else if ( $.browser.opera ) { - transitionEnd = "oTransitionEnd" - } - } - - }) - - - /* MODAL PUBLIC CLASS DEFINITION - * ============================= */ - - var Modal = function ( options ) { - this.settings = $.extend({}, $.fn.modal.defaults) - - if ( typeof options == 'string' ) { - this.settings.content = options - } else if ( options ) { - $.extend( this.settings, options ) - } - - return this - } - - Modal.prototype = { - - toggle: function () { - return this[!this.isOpen ? 'open' : 'close']() - } - - , open: function () { - var that = this - this.isOpen = true - - this.$element = $(this.settings.content) - - _.escape.call(this) - _.backdrop.call(this) - - this.$element - .delegate('.close', 'click', function (e) { e.preventDefault(); that.close() }) - .appendTo(document.body) - .show() - - setTimeout(function () { - that.$element.addClass('in') - that.$backdrop && that.$backdrop.addClass('in') - }, 1) - - return this - } - - , close: function () { - var that = this - - this.isOpen = false - - _.escape.call(this) - _.backdrop.call(this) - - this.$element.removeClass('in') - - function removeElement () { - that.$element.remove() - that.$element = null - } - - $.support.transition && this.$element.hasClass('fade') ? - this.$element.bind(transitionEnd, removeElement) : - removeElement() - - return this - } - - } - - - /* MODAL PRIVATE METHODS - * ===================== */ - - var _ = { - - backdrop: function () { - var that = this - , animate = this.$element.hasClass('fade') ? 'fade' : '' - if ( this.isOpen && this.settings.backdrop ) { - this.$backdrop = $('