├── static ├── bootstrap.zip ├── img │ ├── glyphicons-halflings.png │ └── glyphicons-halflings-white.png ├── js │ ├── bootstrap-transition.js │ ├── bootstrap-alert.js │ ├── bootstrap-button.js │ ├── bootstrap-popover.js │ ├── bootstrap-tab.js │ ├── bootstrap-dropdown.js │ ├── bootstrap-scrollspy.js │ ├── bootstrap-collapse.js │ ├── bootstrap-carousel.js │ ├── bootstrap-modal.js │ ├── bootstrap-tooltip.js │ ├── bootstrap-typeahead.js │ ├── bootstrap.min.js │ └── bootstrap.js └── css │ ├── bootstrap-responsive.min.css │ └── bootstrap-responsive.css └── README.md /static/bootstrap.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rfyiamcool/happyshell/HEAD/static/bootstrap.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## 前言 3 | 4 | 整理文档的时候,看到了以前学python时候搞过的一个项目。 5 | 用的是flask实现的一个运维管理平台。 6 | 7 | 8 | -------------------------------------------------------------------------------- /static/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rfyiamcool/happyshell/HEAD/static/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /static/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rfyiamcool/happyshell/HEAD/static/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /static/js/bootstrap-transition.js: -------------------------------------------------------------------------------- 1 | /* =================================================== 2 | * bootstrap-transition.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#transitions 4 | * =================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) 27 | * ======================================================= */ 28 | 29 | $(function () { 30 | 31 | $.support.transition = (function () { 32 | 33 | var transitionEnd = (function () { 34 | 35 | var el = document.createElement('bootstrap') 36 | , transEndEventNames = { 37 | 'WebkitTransition' : 'webkitTransitionEnd' 38 | , 'MozTransition' : 'transitionend' 39 | , 'OTransition' : 'oTransitionEnd otransitionend' 40 | , 'transition' : 'transitionend' 41 | } 42 | , name 43 | 44 | for (name in transEndEventNames){ 45 | if (el.style[name] !== undefined) { 46 | return transEndEventNames[name] 47 | } 48 | } 49 | 50 | }()) 51 | 52 | return transitionEnd && { 53 | end: transitionEnd 54 | } 55 | 56 | })() 57 | 58 | }) 59 | 60 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-alert.js: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * bootstrap-alert.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#alerts 4 | * ========================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* ALERT CLASS DEFINITION 27 | * ====================== */ 28 | 29 | var dismiss = '[data-dismiss="alert"]' 30 | , Alert = function (el) { 31 | $(el).on('click', dismiss, this.close) 32 | } 33 | 34 | Alert.prototype.close = function (e) { 35 | var $this = $(this) 36 | , selector = $this.attr('data-target') 37 | , $parent 38 | 39 | if (!selector) { 40 | selector = $this.attr('href') 41 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 42 | } 43 | 44 | $parent = $(selector) 45 | 46 | e && e.preventDefault() 47 | 48 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) 49 | 50 | $parent.trigger(e = $.Event('close')) 51 | 52 | if (e.isDefaultPrevented()) return 53 | 54 | $parent.removeClass('in') 55 | 56 | function removeElement() { 57 | $parent 58 | .trigger('closed') 59 | .remove() 60 | } 61 | 62 | $.support.transition && $parent.hasClass('fade') ? 63 | $parent.on($.support.transition.end, removeElement) : 64 | removeElement() 65 | } 66 | 67 | 68 | /* ALERT PLUGIN DEFINITION 69 | * ======================= */ 70 | 71 | var old = $.fn.alert 72 | 73 | $.fn.alert = function (option) { 74 | return this.each(function () { 75 | var $this = $(this) 76 | , data = $this.data('alert') 77 | if (!data) $this.data('alert', (data = new Alert(this))) 78 | if (typeof option == 'string') data[option].call($this) 79 | }) 80 | } 81 | 82 | $.fn.alert.Constructor = Alert 83 | 84 | 85 | /* ALERT NO CONFLICT 86 | * ================= */ 87 | 88 | $.fn.alert.noConflict = function () { 89 | $.fn.alert = old 90 | return this 91 | } 92 | 93 | 94 | /* ALERT DATA-API 95 | * ============== */ 96 | 97 | $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) 98 | 99 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-button.js: -------------------------------------------------------------------------------- 1 | /* ============================================================ 2 | * bootstrap-button.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#buttons 4 | * ============================================================ 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* BUTTON PUBLIC CLASS DEFINITION 27 | * ============================== */ 28 | 29 | var Button = function (element, options) { 30 | this.$element = $(element) 31 | this.options = $.extend({}, $.fn.button.defaults, options) 32 | } 33 | 34 | Button.prototype.setState = function (state) { 35 | var d = 'disabled' 36 | , $el = this.$element 37 | , data = $el.data() 38 | , val = $el.is('input') ? 'val' : 'html' 39 | 40 | state = state + 'Text' 41 | data.resetText || $el.data('resetText', $el[val]()) 42 | 43 | $el[val](data[state] || this.options[state]) 44 | 45 | // push to event loop to allow forms to submit 46 | setTimeout(function () { 47 | state == 'loadingText' ? 48 | $el.addClass(d).attr(d, d) : 49 | $el.removeClass(d).removeAttr(d) 50 | }, 0) 51 | } 52 | 53 | Button.prototype.toggle = function () { 54 | var $parent = this.$element.closest('[data-toggle="buttons-radio"]') 55 | 56 | $parent && $parent 57 | .find('.active') 58 | .removeClass('active') 59 | 60 | this.$element.toggleClass('active') 61 | } 62 | 63 | 64 | /* BUTTON PLUGIN DEFINITION 65 | * ======================== */ 66 | 67 | var old = $.fn.button 68 | 69 | $.fn.button = function (option) { 70 | return this.each(function () { 71 | var $this = $(this) 72 | , data = $this.data('button') 73 | , options = typeof option == 'object' && option 74 | if (!data) $this.data('button', (data = new Button(this, options))) 75 | if (option == 'toggle') data.toggle() 76 | else if (option) data.setState(option) 77 | }) 78 | } 79 | 80 | $.fn.button.defaults = { 81 | loadingText: 'loading...' 82 | } 83 | 84 | $.fn.button.Constructor = Button 85 | 86 | 87 | /* BUTTON NO CONFLICT 88 | * ================== */ 89 | 90 | $.fn.button.noConflict = function () { 91 | $.fn.button = old 92 | return this 93 | } 94 | 95 | 96 | /* BUTTON DATA-API 97 | * =============== */ 98 | 99 | $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { 100 | var $btn = $(e.target) 101 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') 102 | $btn.button('toggle') 103 | }) 104 | 105 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-popover.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * bootstrap-popover.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#popovers 4 | * =========================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* POPOVER PUBLIC CLASS DEFINITION 27 | * =============================== */ 28 | 29 | var Popover = function (element, options) { 30 | this.init('popover', element, options) 31 | } 32 | 33 | 34 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js 35 | ========================================== */ 36 | 37 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { 38 | 39 | constructor: Popover 40 | 41 | , setContent: function () { 42 | var $tip = this.tip() 43 | , title = this.getTitle() 44 | , content = this.getContent() 45 | 46 | $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) 47 | $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) 48 | 49 | $tip.removeClass('fade top bottom left right in') 50 | } 51 | 52 | , hasContent: function () { 53 | return this.getTitle() || this.getContent() 54 | } 55 | 56 | , getContent: function () { 57 | var content 58 | , $e = this.$element 59 | , o = this.options 60 | 61 | content = $e.attr('data-content') 62 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) 63 | 64 | return content 65 | } 66 | 67 | , tip: function () { 68 | if (!this.$tip) { 69 | this.$tip = $(this.options.template) 70 | } 71 | return this.$tip 72 | } 73 | 74 | , destroy: function () { 75 | this.hide().$element.off('.' + this.type).removeData(this.type) 76 | } 77 | 78 | }) 79 | 80 | 81 | /* POPOVER PLUGIN DEFINITION 82 | * ======================= */ 83 | 84 | var old = $.fn.popover 85 | 86 | $.fn.popover = function (option) { 87 | return this.each(function () { 88 | var $this = $(this) 89 | , data = $this.data('popover') 90 | , options = typeof option == 'object' && option 91 | if (!data) $this.data('popover', (data = new Popover(this, options))) 92 | if (typeof option == 'string') data[option]() 93 | }) 94 | } 95 | 96 | $.fn.popover.Constructor = Popover 97 | 98 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { 99 | placement: 'right' 100 | , trigger: 'click' 101 | , content: '' 102 | , template: '

' 103 | }) 104 | 105 | 106 | /* POPOVER NO CONFLICT 107 | * =================== */ 108 | 109 | $.fn.popover.noConflict = function () { 110 | $.fn.popover = old 111 | return this 112 | } 113 | 114 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-tab.js: -------------------------------------------------------------------------------- 1 | /* ======================================================== 2 | * bootstrap-tab.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#tabs 4 | * ======================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ======================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* TAB CLASS DEFINITION 27 | * ==================== */ 28 | 29 | var Tab = function (element) { 30 | this.element = $(element) 31 | } 32 | 33 | Tab.prototype = { 34 | 35 | constructor: Tab 36 | 37 | , show: function () { 38 | var $this = this.element 39 | , $ul = $this.closest('ul:not(.dropdown-menu)') 40 | , selector = $this.attr('data-target') 41 | , previous 42 | , $target 43 | , e 44 | 45 | if (!selector) { 46 | selector = $this.attr('href') 47 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 48 | } 49 | 50 | if ( $this.parent('li').hasClass('active') ) return 51 | 52 | previous = $ul.find('.active:last a')[0] 53 | 54 | e = $.Event('show', { 55 | relatedTarget: previous 56 | }) 57 | 58 | $this.trigger(e) 59 | 60 | if (e.isDefaultPrevented()) return 61 | 62 | $target = $(selector) 63 | 64 | this.activate($this.parent('li'), $ul) 65 | this.activate($target, $target.parent(), function () { 66 | $this.trigger({ 67 | type: 'shown' 68 | , relatedTarget: previous 69 | }) 70 | }) 71 | } 72 | 73 | , activate: function ( element, container, callback) { 74 | var $active = container.find('> .active') 75 | , transition = callback 76 | && $.support.transition 77 | && $active.hasClass('fade') 78 | 79 | function next() { 80 | $active 81 | .removeClass('active') 82 | .find('> .dropdown-menu > .active') 83 | .removeClass('active') 84 | 85 | element.addClass('active') 86 | 87 | if (transition) { 88 | element[0].offsetWidth // reflow for transition 89 | element.addClass('in') 90 | } else { 91 | element.removeClass('fade') 92 | } 93 | 94 | if ( element.parent('.dropdown-menu') ) { 95 | element.closest('li.dropdown').addClass('active') 96 | } 97 | 98 | callback && callback() 99 | } 100 | 101 | transition ? 102 | $active.one($.support.transition.end, next) : 103 | next() 104 | 105 | $active.removeClass('in') 106 | } 107 | } 108 | 109 | 110 | /* TAB PLUGIN DEFINITION 111 | * ===================== */ 112 | 113 | var old = $.fn.tab 114 | 115 | $.fn.tab = function ( option ) { 116 | return this.each(function () { 117 | var $this = $(this) 118 | , data = $this.data('tab') 119 | if (!data) $this.data('tab', (data = new Tab(this))) 120 | if (typeof option == 'string') data[option]() 121 | }) 122 | } 123 | 124 | $.fn.tab.Constructor = Tab 125 | 126 | 127 | /* TAB NO CONFLICT 128 | * =============== */ 129 | 130 | $.fn.tab.noConflict = function () { 131 | $.fn.tab = old 132 | return this 133 | } 134 | 135 | 136 | /* TAB DATA-API 137 | * ============ */ 138 | 139 | $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { 140 | e.preventDefault() 141 | $(this).tab('show') 142 | }) 143 | 144 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-dropdown.js: -------------------------------------------------------------------------------- 1 | /* ============================================================ 2 | * bootstrap-dropdown.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns 4 | * ============================================================ 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* DROPDOWN CLASS DEFINITION 27 | * ========================= */ 28 | 29 | var toggle = '[data-toggle=dropdown]' 30 | , Dropdown = function (element) { 31 | var $el = $(element).on('click.dropdown.data-api', this.toggle) 32 | $('html').on('click.dropdown.data-api', function () { 33 | $el.parent().removeClass('open') 34 | }) 35 | } 36 | 37 | Dropdown.prototype = { 38 | 39 | constructor: Dropdown 40 | 41 | , toggle: function (e) { 42 | var $this = $(this) 43 | , $parent 44 | , isActive 45 | 46 | if ($this.is('.disabled, :disabled')) return 47 | 48 | $parent = getParent($this) 49 | 50 | isActive = $parent.hasClass('open') 51 | 52 | clearMenus() 53 | 54 | if (!isActive) { 55 | $parent.toggleClass('open') 56 | } 57 | 58 | $this.focus() 59 | 60 | return false 61 | } 62 | 63 | , keydown: function (e) { 64 | var $this 65 | , $items 66 | , $active 67 | , $parent 68 | , isActive 69 | , index 70 | 71 | if (!/(38|40|27)/.test(e.keyCode)) return 72 | 73 | $this = $(this) 74 | 75 | e.preventDefault() 76 | e.stopPropagation() 77 | 78 | if ($this.is('.disabled, :disabled')) return 79 | 80 | $parent = getParent($this) 81 | 82 | isActive = $parent.hasClass('open') 83 | 84 | if (!isActive || (isActive && e.keyCode == 27)) return $this.click() 85 | 86 | $items = $('[role=menu] li:not(.divider):visible a', $parent) 87 | 88 | if (!$items.length) return 89 | 90 | index = $items.index($items.filter(':focus')) 91 | 92 | if (e.keyCode == 38 && index > 0) index-- // up 93 | if (e.keyCode == 40 && index < $items.length - 1) index++ // down 94 | if (!~index) index = 0 95 | 96 | $items 97 | .eq(index) 98 | .focus() 99 | } 100 | 101 | } 102 | 103 | function clearMenus() { 104 | $(toggle).each(function () { 105 | getParent($(this)).removeClass('open') 106 | }) 107 | } 108 | 109 | function getParent($this) { 110 | var selector = $this.attr('data-target') 111 | , $parent 112 | 113 | if (!selector) { 114 | selector = $this.attr('href') 115 | selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 116 | } 117 | 118 | $parent = $(selector) 119 | $parent.length || ($parent = $this.parent()) 120 | 121 | return $parent 122 | } 123 | 124 | 125 | /* DROPDOWN PLUGIN DEFINITION 126 | * ========================== */ 127 | 128 | var old = $.fn.dropdown 129 | 130 | $.fn.dropdown = function (option) { 131 | return this.each(function () { 132 | var $this = $(this) 133 | , data = $this.data('dropdown') 134 | if (!data) $this.data('dropdown', (data = new Dropdown(this))) 135 | if (typeof option == 'string') data[option].call($this) 136 | }) 137 | } 138 | 139 | $.fn.dropdown.Constructor = Dropdown 140 | 141 | 142 | /* DROPDOWN NO CONFLICT 143 | * ==================== */ 144 | 145 | $.fn.dropdown.noConflict = function () { 146 | $.fn.dropdown = old 147 | return this 148 | } 149 | 150 | 151 | /* APPLY TO STANDARD DROPDOWN ELEMENTS 152 | * =================================== */ 153 | 154 | $(document) 155 | .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) 156 | .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) 157 | .on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) { e.stopPropagation() }) 158 | .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) 159 | .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) 160 | 161 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-scrollspy.js: -------------------------------------------------------------------------------- 1 | /* ============================================================= 2 | * bootstrap-scrollspy.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy 4 | * ============================================================= 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* SCROLLSPY CLASS DEFINITION 27 | * ========================== */ 28 | 29 | function ScrollSpy(element, options) { 30 | var process = $.proxy(this.process, this) 31 | , $element = $(element).is('body') ? $(window) : $(element) 32 | , href 33 | this.options = $.extend({}, $.fn.scrollspy.defaults, options) 34 | this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) 35 | this.selector = (this.options.target 36 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 37 | || '') + ' .nav li > a' 38 | this.$body = $('body') 39 | this.refresh() 40 | this.process() 41 | } 42 | 43 | ScrollSpy.prototype = { 44 | 45 | constructor: ScrollSpy 46 | 47 | , refresh: function () { 48 | var self = this 49 | , $targets 50 | 51 | this.offsets = $([]) 52 | this.targets = $([]) 53 | 54 | $targets = this.$body 55 | .find(this.selector) 56 | .map(function () { 57 | var $el = $(this) 58 | , href = $el.data('target') || $el.attr('href') 59 | , $href = /^#\w/.test(href) && $(href) 60 | return ( $href 61 | && $href.length 62 | && [[ $href.position().top + self.$scrollElement.scrollTop(), href ]] ) || null 63 | }) 64 | .sort(function (a, b) { return a[0] - b[0] }) 65 | .each(function () { 66 | self.offsets.push(this[0]) 67 | self.targets.push(this[1]) 68 | }) 69 | } 70 | 71 | , process: function () { 72 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 73 | , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight 74 | , maxScroll = scrollHeight - this.$scrollElement.height() 75 | , offsets = this.offsets 76 | , targets = this.targets 77 | , activeTarget = this.activeTarget 78 | , i 79 | 80 | if (scrollTop >= maxScroll) { 81 | return activeTarget != (i = targets.last()[0]) 82 | && this.activate ( i ) 83 | } 84 | 85 | for (i = offsets.length; i--;) { 86 | activeTarget != targets[i] 87 | && scrollTop >= offsets[i] 88 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) 89 | && this.activate( targets[i] ) 90 | } 91 | } 92 | 93 | , activate: function (target) { 94 | var active 95 | , selector 96 | 97 | this.activeTarget = target 98 | 99 | $(this.selector) 100 | .parent('.active') 101 | .removeClass('active') 102 | 103 | selector = this.selector 104 | + '[data-target="' + target + '"],' 105 | + this.selector + '[href="' + target + '"]' 106 | 107 | active = $(selector) 108 | .parent('li') 109 | .addClass('active') 110 | 111 | if (active.parent('.dropdown-menu').length) { 112 | active = active.closest('li.dropdown').addClass('active') 113 | } 114 | 115 | active.trigger('activate') 116 | } 117 | 118 | } 119 | 120 | 121 | /* SCROLLSPY PLUGIN DEFINITION 122 | * =========================== */ 123 | 124 | var old = $.fn.scrollspy 125 | 126 | $.fn.scrollspy = function (option) { 127 | return this.each(function () { 128 | var $this = $(this) 129 | , data = $this.data('scrollspy') 130 | , options = typeof option == 'object' && option 131 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) 132 | if (typeof option == 'string') data[option]() 133 | }) 134 | } 135 | 136 | $.fn.scrollspy.Constructor = ScrollSpy 137 | 138 | $.fn.scrollspy.defaults = { 139 | offset: 10 140 | } 141 | 142 | 143 | /* SCROLLSPY NO CONFLICT 144 | * ===================== */ 145 | 146 | $.fn.scrollspy.noConflict = function () { 147 | $.fn.scrollspy = old 148 | return this 149 | } 150 | 151 | 152 | /* SCROLLSPY DATA-API 153 | * ================== */ 154 | 155 | $(window).on('load', function () { 156 | $('[data-spy="scroll"]').each(function () { 157 | var $spy = $(this) 158 | $spy.scrollspy($spy.data()) 159 | }) 160 | }) 161 | 162 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-collapse.js: -------------------------------------------------------------------------------- 1 | /* ============================================================= 2 | * bootstrap-collapse.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#collapse 4 | * ============================================================= 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* COLLAPSE PUBLIC CLASS DEFINITION 27 | * ================================ */ 28 | 29 | var Collapse = function (element, options) { 30 | this.$element = $(element) 31 | this.options = $.extend({}, $.fn.collapse.defaults, options) 32 | 33 | if (this.options.parent) { 34 | this.$parent = $(this.options.parent) 35 | } 36 | 37 | this.options.toggle && this.toggle() 38 | } 39 | 40 | Collapse.prototype = { 41 | 42 | constructor: Collapse 43 | 44 | , dimension: function () { 45 | var hasWidth = this.$element.hasClass('width') 46 | return hasWidth ? 'width' : 'height' 47 | } 48 | 49 | , show: function () { 50 | var dimension 51 | , scroll 52 | , actives 53 | , hasData 54 | 55 | if (this.transitioning) return 56 | 57 | dimension = this.dimension() 58 | scroll = $.camelCase(['scroll', dimension].join('-')) 59 | actives = this.$parent && this.$parent.find('> .accordion-group > .in') 60 | 61 | if (actives && actives.length) { 62 | hasData = actives.data('collapse') 63 | if (hasData && hasData.transitioning) return 64 | actives.collapse('hide') 65 | hasData || actives.data('collapse', null) 66 | } 67 | 68 | this.$element[dimension](0) 69 | this.transition('addClass', $.Event('show'), 'shown') 70 | $.support.transition && this.$element[dimension](this.$element[0][scroll]) 71 | } 72 | 73 | , hide: function () { 74 | var dimension 75 | if (this.transitioning) return 76 | dimension = this.dimension() 77 | this.reset(this.$element[dimension]()) 78 | this.transition('removeClass', $.Event('hide'), 'hidden') 79 | this.$element[dimension](0) 80 | } 81 | 82 | , reset: function (size) { 83 | var dimension = this.dimension() 84 | 85 | this.$element 86 | .removeClass('collapse') 87 | [dimension](size || 'auto') 88 | [0].offsetWidth 89 | 90 | this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') 91 | 92 | return this 93 | } 94 | 95 | , transition: function (method, startEvent, completeEvent) { 96 | var that = this 97 | , complete = function () { 98 | if (startEvent.type == 'show') that.reset() 99 | that.transitioning = 0 100 | that.$element.trigger(completeEvent) 101 | } 102 | 103 | this.$element.trigger(startEvent) 104 | 105 | if (startEvent.isDefaultPrevented()) return 106 | 107 | this.transitioning = 1 108 | 109 | this.$element[method]('in') 110 | 111 | $.support.transition && this.$element.hasClass('collapse') ? 112 | this.$element.one($.support.transition.end, complete) : 113 | complete() 114 | } 115 | 116 | , toggle: function () { 117 | this[this.$element.hasClass('in') ? 'hide' : 'show']() 118 | } 119 | 120 | } 121 | 122 | 123 | /* COLLAPSE PLUGIN DEFINITION 124 | * ========================== */ 125 | 126 | var old = $.fn.collapse 127 | 128 | $.fn.collapse = function (option) { 129 | return this.each(function () { 130 | var $this = $(this) 131 | , data = $this.data('collapse') 132 | , options = typeof option == 'object' && option 133 | if (!data) $this.data('collapse', (data = new Collapse(this, options))) 134 | if (typeof option == 'string') data[option]() 135 | }) 136 | } 137 | 138 | $.fn.collapse.defaults = { 139 | toggle: true 140 | } 141 | 142 | $.fn.collapse.Constructor = Collapse 143 | 144 | 145 | /* COLLAPSE NO CONFLICT 146 | * ==================== */ 147 | 148 | $.fn.collapse.noConflict = function () { 149 | $.fn.collapse = old 150 | return this 151 | } 152 | 153 | 154 | /* COLLAPSE DATA-API 155 | * ================= */ 156 | 157 | $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { 158 | var $this = $(this), href 159 | , target = $this.attr('data-target') 160 | || e.preventDefault() 161 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 162 | , option = $(target).data('collapse') ? 'toggle' : $this.data() 163 | $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 164 | $(target).collapse(option) 165 | }) 166 | 167 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-carousel.js: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * bootstrap-carousel.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#carousel 4 | * ========================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* CAROUSEL CLASS DEFINITION 27 | * ========================= */ 28 | 29 | var Carousel = function (element, options) { 30 | this.$element = $(element) 31 | this.options = options 32 | this.options.pause == 'hover' && this.$element 33 | .on('mouseenter', $.proxy(this.pause, this)) 34 | .on('mouseleave', $.proxy(this.cycle, this)) 35 | } 36 | 37 | Carousel.prototype = { 38 | 39 | cycle: function (e) { 40 | if (!e) this.paused = false 41 | this.options.interval 42 | && !this.paused 43 | && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) 44 | return this 45 | } 46 | 47 | , to: function (pos) { 48 | var $active = this.$element.find('.item.active') 49 | , children = $active.parent().children() 50 | , activePos = children.index($active) 51 | , that = this 52 | 53 | if (pos > (children.length - 1) || pos < 0) return 54 | 55 | if (this.sliding) { 56 | return this.$element.one('slid', function () { 57 | that.to(pos) 58 | }) 59 | } 60 | 61 | if (activePos == pos) { 62 | return this.pause().cycle() 63 | } 64 | 65 | return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) 66 | } 67 | 68 | , pause: function (e) { 69 | if (!e) this.paused = true 70 | if (this.$element.find('.next, .prev').length && $.support.transition.end) { 71 | this.$element.trigger($.support.transition.end) 72 | this.cycle() 73 | } 74 | clearInterval(this.interval) 75 | this.interval = null 76 | return this 77 | } 78 | 79 | , next: function () { 80 | if (this.sliding) return 81 | return this.slide('next') 82 | } 83 | 84 | , prev: function () { 85 | if (this.sliding) return 86 | return this.slide('prev') 87 | } 88 | 89 | , slide: function (type, next) { 90 | var $active = this.$element.find('.item.active') 91 | , $next = next || $active[type]() 92 | , isCycling = this.interval 93 | , direction = type == 'next' ? 'left' : 'right' 94 | , fallback = type == 'next' ? 'first' : 'last' 95 | , that = this 96 | , e 97 | 98 | this.sliding = true 99 | 100 | isCycling && this.pause() 101 | 102 | $next = $next.length ? $next : this.$element.find('.item')[fallback]() 103 | 104 | e = $.Event('slide', { 105 | relatedTarget: $next[0] 106 | }) 107 | 108 | if ($next.hasClass('active')) return 109 | 110 | if ($.support.transition && this.$element.hasClass('slide')) { 111 | this.$element.trigger(e) 112 | if (e.isDefaultPrevented()) return 113 | $next.addClass(type) 114 | $next[0].offsetWidth // force reflow 115 | $active.addClass(direction) 116 | $next.addClass(direction) 117 | this.$element.one($.support.transition.end, function () { 118 | $next.removeClass([type, direction].join(' ')).addClass('active') 119 | $active.removeClass(['active', direction].join(' ')) 120 | that.sliding = false 121 | setTimeout(function () { that.$element.trigger('slid') }, 0) 122 | }) 123 | } else { 124 | this.$element.trigger(e) 125 | if (e.isDefaultPrevented()) return 126 | $active.removeClass('active') 127 | $next.addClass('active') 128 | this.sliding = false 129 | this.$element.trigger('slid') 130 | } 131 | 132 | isCycling && this.cycle() 133 | 134 | return this 135 | } 136 | 137 | } 138 | 139 | 140 | /* CAROUSEL PLUGIN DEFINITION 141 | * ========================== */ 142 | 143 | var old = $.fn.carousel 144 | 145 | $.fn.carousel = function (option) { 146 | return this.each(function () { 147 | var $this = $(this) 148 | , data = $this.data('carousel') 149 | , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) 150 | , action = typeof option == 'string' ? option : options.slide 151 | if (!data) $this.data('carousel', (data = new Carousel(this, options))) 152 | if (typeof option == 'number') data.to(option) 153 | else if (action) data[action]() 154 | else if (options.interval) data.cycle() 155 | }) 156 | } 157 | 158 | $.fn.carousel.defaults = { 159 | interval: 5000 160 | , pause: 'hover' 161 | } 162 | 163 | $.fn.carousel.Constructor = Carousel 164 | 165 | 166 | /* CAROUSEL NO CONFLICT 167 | * ==================== */ 168 | 169 | $.fn.carousel.noConflict = function () { 170 | $.fn.carousel = old 171 | return this 172 | } 173 | 174 | /* CAROUSEL DATA-API 175 | * ================= */ 176 | 177 | $(document).on('click.carousel.data-api', '[data-slide]', function (e) { 178 | var $this = $(this), href 179 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 180 | , options = $.extend({}, $target.data(), $this.data()) 181 | $target.carousel(options) 182 | e.preventDefault() 183 | }) 184 | 185 | }(window.jQuery); -------------------------------------------------------------------------------- /static/js/bootstrap-modal.js: -------------------------------------------------------------------------------- 1 | /* ========================================================= 2 | * bootstrap-modal.js v2.2.2 3 | * http://twitter.github.com/bootstrap/javascript.html#modals 4 | * ========================================================= 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================= */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* MODAL CLASS DEFINITION 27 | * ====================== */ 28 | 29 | var Modal = function (element, options) { 30 | this.options = options 31 | this.$element = $(element) 32 | .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) 33 | this.options.remote && this.$element.find('.modal-body').load(this.options.remote) 34 | } 35 | 36 | Modal.prototype = { 37 | 38 | constructor: Modal 39 | 40 | , toggle: function () { 41 | return this[!this.isShown ? 'show' : 'hide']() 42 | } 43 | 44 | , show: function () { 45 | var that = this 46 | , e = $.Event('show') 47 | 48 | this.$element.trigger(e) 49 | 50 | if (this.isShown || e.isDefaultPrevented()) return 51 | 52 | this.isShown = true 53 | 54 | this.escape() 55 | 56 | this.backdrop(function () { 57 | var transition = $.support.transition && that.$element.hasClass('fade') 58 | 59 | if (!that.$element.parent().length) { 60 | that.$element.appendTo(document.body) //don't move modals dom position 61 | } 62 | 63 | that.$element 64 | .show() 65 | 66 | if (transition) { 67 | that.$element[0].offsetWidth // force reflow 68 | } 69 | 70 | that.$element 71 | .addClass('in') 72 | .attr('aria-hidden', false) 73 | 74 | that.enforceFocus() 75 | 76 | transition ? 77 | that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : 78 | that.$element.focus().trigger('shown') 79 | 80 | }) 81 | } 82 | 83 | , hide: function (e) { 84 | e && e.preventDefault() 85 | 86 | var that = this 87 | 88 | e = $.Event('hide') 89 | 90 | this.$element.trigger(e) 91 | 92 | if (!this.isShown || e.isDefaultPrevented()) return 93 | 94 | this.isShown = false 95 | 96 | this.escape() 97 | 98 | $(document).off('focusin.modal') 99 | 100 | this.$element 101 | .removeClass('in') 102 | .attr('aria-hidden', true) 103 | 104 | $.support.transition && this.$element.hasClass('fade') ? 105 | this.hideWithTransition() : 106 | this.hideModal() 107 | } 108 | 109 | , enforceFocus: function () { 110 | var that = this 111 | $(document).on('focusin.modal', function (e) { 112 | if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { 113 | that.$element.focus() 114 | } 115 | }) 116 | } 117 | 118 | , escape: function () { 119 | var that = this 120 | if (this.isShown && this.options.keyboard) { 121 | this.$element.on('keyup.dismiss.modal', function ( e ) { 122 | e.which == 27 && that.hide() 123 | }) 124 | } else if (!this.isShown) { 125 | this.$element.off('keyup.dismiss.modal') 126 | } 127 | } 128 | 129 | , hideWithTransition: function () { 130 | var that = this 131 | , timeout = setTimeout(function () { 132 | that.$element.off($.support.transition.end) 133 | that.hideModal() 134 | }, 500) 135 | 136 | this.$element.one($.support.transition.end, function () { 137 | clearTimeout(timeout) 138 | that.hideModal() 139 | }) 140 | } 141 | 142 | , hideModal: function (that) { 143 | this.$element 144 | .hide() 145 | .trigger('hidden') 146 | 147 | this.backdrop() 148 | } 149 | 150 | , removeBackdrop: function () { 151 | this.$backdrop.remove() 152 | this.$backdrop = null 153 | } 154 | 155 | , backdrop: function (callback) { 156 | var that = this 157 | , animate = this.$element.hasClass('fade') ? 'fade' : '' 158 | 159 | if (this.isShown && this.options.backdrop) { 160 | var doAnimate = $.support.transition && animate 161 | 162 | this.$backdrop = $('