diff --git a/pkg/api/index.go b/pkg/api/index.go index 5b0c5df2c29..723f1bc74b1 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -61,9 +61,6 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) { }, }) - // data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{Text: "Playlists", Icon: "fa fa-fw fa-list", Url: setting.AppSubUrl + "/playlists"}) - // data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{Text: "Snapshots", Icon: "fa-fw icon-gf icon-gf-snapshot", Url: setting.AppSubUrl + "/dashboard/snapshots"}) - if c.OrgRole == m.ROLE_ADMIN { data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{ Text: "Data Sources", diff --git a/public/app/core/components/colorpicker/colorpicker.ts b/public/app/core/components/colorpicker/colorpicker.ts new file mode 100644 index 00000000000..9c879b867ff --- /dev/null +++ b/public/app/core/components/colorpicker/colorpicker.ts @@ -0,0 +1,81 @@ +/// + +import config from 'app/core/config'; +import _ from 'lodash'; +import $ from 'jquery'; +import coreModule from 'app/core/core_module'; + +var template = ` +
+ + + + +
+ + + +
+ +

+   +

+ +
+`; + +export class ColorPickerCtrl { + colors: any; + autoClose: boolean; + series: any; + showAxisControls: boolean; + + /** @ngInject */ + constructor(private $scope, private $rootScope) { + this.colors = $rootScope.colors; + this.autoClose = $scope.autoClose; + this.series = $scope.series; + } + + toggleAxis(yaxis) { + this.$scope.toggleAxis(); + + if (!this.$scope.autoClose) { + this.$scope.dismiss(); + } + } + + colorSelected(color) { + this.$scope.colorSelected(color); + if (!this.$scope.autoClose) { + this.$scope.dismiss(); + } + } + + close() { + this.$scope.dismiss(); + } +} + +export function colorPicker() { + return { + restrict: 'E', + controller: ColorPickerCtrl, + bindToController: true, + controllerAs: 'ctrl', + template: template, + }; +} + +coreModule.directive('gfColorPicker', colorPicker); diff --git a/public/app/core/core.ts b/public/app/core/core.ts index e9b5e3c71a3..c7c917378c7 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -25,6 +25,7 @@ import {grafanaAppDirective} from './components/grafana_app'; import {sideMenuDirective} from './components/sidemenu/sidemenu'; import {searchDirective} from './components/search/search'; import {popoverDirective} from './components/popover/popover'; +import {colorPicker} from './components/colorpicker/colorpicker'; import {navbarDirective} from './components/navbar/navbar'; import {arrayJoin} from './directives/array_join'; import 'app/core/controllers/all'; @@ -40,5 +41,6 @@ export { sideMenuDirective, navbarDirective, searchDirective, + colorPicker, popoverDirective }; diff --git a/public/app/core/services/popover_srv.ts b/public/app/core/services/popover_srv.ts index 64ff1b7af11..4711dc1b23c 100644 --- a/public/app/core/services/popover_srv.ts +++ b/public/app/core/services/popover_srv.ts @@ -4,45 +4,51 @@ import config from 'app/core/config'; import _ from 'lodash'; import $ from 'jquery'; import coreModule from 'app/core/core_module'; +import Drop from 'tether-drop'; /** @ngInject **/ -function popoverSrv($templateCache, $timeout, $q, $http, $compile) { - - this.getTemplate = function(url) { - return $q.when($templateCache.get(url) || $http.get(url, {cache: true})); - }; +function popoverSrv($compile, $rootScope) { this.show = function(options) { + var popoverScope = _.extend($rootScope.$new(true), options.model); + var drop; - options.scope.dismiss = function() { - var popover = options.element.data('popover'); - if (popover) { - popover.destroy(); - } - options.scope.$destroy(); + function destroyDrop() { + setTimeout(function() { + if (drop.tether) { + drop.destroy(); + } + }); + } + + popoverScope.dismiss = function() { + popoverScope.$destroy(); + destroyDrop(); }; - this.getTemplate(options.templateUrl).then(function(result) { - $timeout(function() { - var template = _.isString(result) ? result : result.data; + var contentElement = document.createElement('div'); + contentElement.innerHTML = options.template; + $compile(contentElement)(popoverScope); - options.element.popover({ - content: template, - placement: options.placement || 'bottom', - html: true - }); - - var popover = options.element.data('popover'); - popover.hasContent = function () { - return template; - }; - - popover.toggle(); - popover.scope = options.scope; - $compile(popover.$tip)(popover.scope); - }, 1); + drop = new Drop({ + target: options.element, + content: contentElement, + position: options.position, + classes: 'drop-popover', + openOn: options.openOn || 'hover', + hoverCloseDelay: 200, + tetherOptions: { + constraints: [{to: 'window', pin: true, attachment: "both"}] + } }); + + drop.on('close', () => { + popoverScope.dismiss({fromDropClose: true}); + destroyDrop(); + }); + + drop.open(); }; } diff --git a/public/app/features/datasources/partials/edit.html b/public/app/features/datasources/partials/edit.html index 7dff11ac1c2..c74ac22827f 100644 --- a/public/app/features/datasources/partials/edit.html +++ b/public/app/features/datasources/partials/edit.html @@ -15,11 +15,10 @@
Name - The name is used when you select the data source in panels. The Default data source is preselected in new - new panels. + panels. diff --git a/public/app/partials/colorpicker.html b/public/app/partials/colorpicker.html deleted file mode 100644 index f687b740bbf..00000000000 --- a/public/app/partials/colorpicker.html +++ /dev/null @@ -1,11 +0,0 @@ -
- × - -
-   -
- -
- diff --git a/public/app/partials/edit_json.html b/public/app/partials/edit_json.html index 8635174e5a6..b38e9d059f2 100644 --- a/public/app/partials/edit_json.html +++ b/public/app/partials/edit_json.html @@ -1,5 +1,4 @@
-
@@ -11,12 +10,13 @@
-
- -
-
+
+
+ +
- +
+ +
-
diff --git a/public/app/plugins/panel/graph/legend.js b/public/app/plugins/panel/graph/legend.js index fb2c590034d..8ff5d5dd83e 100644 --- a/public/app/plugins/panel/graph/legend.js +++ b/public/app/plugins/panel/graph/legend.js @@ -10,7 +10,7 @@ function (angular, _, $) { var module = angular.module('grafana.directives'); - module.directive('graphLegend', function(popoverSrv) { + module.directive('graphLegend', function(popoverSrv, $timeout) { return { link: function(scope, elem) { @@ -41,13 +41,24 @@ function (angular, _, $) { var el = $(e.currentTarget).find('.fa-minus'); var index = getSeriesIndexForElement(el); - var seriesInfo = seriesList[index]; - var popoverScope = scope.$new(); - popoverScope.series = seriesInfo; - popoverSrv.show({ - element: el, - templateUrl: 'public/app/plugins/panel/graph/legend.popover.html', - scope: popoverScope + var series = seriesList[index]; + + $timeout(function() { + popoverSrv.show({ + element: el[0], + position: 'bottom center', + template: '', + model: { + autoClose: true, + series: series, + toggleAxis: function() { + ctrl.toggleAxis(series); + }, + colorSelected: function(color) { + ctrl.changeSeriesColor(series, color); + } + }, + }); }); } diff --git a/public/app/plugins/panel/graph/legend.popover.html b/public/app/plugins/panel/graph/legend.popover.html deleted file mode 100644 index f9cf16a3e87..00000000000 --- a/public/app/plugins/panel/graph/legend.popover.html +++ /dev/null @@ -1,25 +0,0 @@ -
- × - -
- - - -
- -
-   -
-
- diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index b1d48d98649..1c022d460bb 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -261,13 +261,13 @@ class GraphCtrl extends MetricsPanelCtrl { } } - toggleYAxis(info) { - var override = _.findWhere(this.panel.seriesOverrides, { alias: info.alias }); + toggleAxis(info) { + var override = _.findWhere(this.panel.seriesOverrides, {alias: info.alias}); if (!override) { override = { alias: info.alias }; this.panel.seriesOverrides.push(override); } - override.yaxis = info.yaxis === 2 ? 1 : 2; + info.yaxis = override.yaxis = info.yaxis === 2 ? 1 : 2; this.render(); }; diff --git a/public/app/plugins/panel/graph/seriesOverridesCtrl.js b/public/app/plugins/panel/graph/seriesOverridesCtrl.js index ee3d6c00564..014c1f6abe7 100644 --- a/public/app/plugins/panel/graph/seriesOverridesCtrl.js +++ b/public/app/plugins/panel/graph/seriesOverridesCtrl.js @@ -53,22 +53,21 @@ define([ }; $scope.openColorSelector = function() { - var popoverScope = $scope.$new(); - popoverScope.colorSelected = $scope.colorSelected; - popoverScope.colors = $scope.ctrl.colors; - popoverSrv.show({ - element: $element.find(".dropdown"), - placement: 'top', - templateUrl: 'public/app/partials/colorpicker.html', - scope: popoverScope + element: $element.find(".dropdown")[0], + position: 'top center', + openOn: 'click', + template: '', + model: { + colorSelected: $scope.colorSelected, + } }); }; $scope.removeOverride = function(option) { delete $scope.override[option.propertyName]; $scope.updateCurrentOverrides(); - $scope.ctrl.render(); + $scope.ctrl.refresh(); }; $scope.getSeriesNames = function() { diff --git a/public/sass/_grafana.scss b/public/sass/_grafana.scss index 1d90ffaa97d..5cd9fdb35f2 100644 --- a/public/sass/_grafana.scss +++ b/public/sass/_grafana.scss @@ -56,7 +56,6 @@ @import "components/filter-table"; @import "components/scrollbar"; @import "components/old_stuff"; -@import "components/popovers"; @import "components/typeahead"; @import "components/modals"; @import "components/dropdown"; diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index eb2733206de..0b0315530ae 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -237,16 +237,10 @@ $tooltipArrowWidth: 5px; $tooltipArrowColor: $tooltipBackground; $tooltipLinkColor: $link-color; -$popoverBackground: $dropdownBackground; -$popoverArrowWidth: 10px; -$popoverArrowColor: $popoverBackground; -$popoverTitleBackground: $popoverBackground; - -// Special enhancement for popovers -$popoverArrowOuterWidth: $popoverArrowWidth + 1; -$popoverArrowOuterColor: rgba(0,0,0,.25); - // popover +$popover-bg: $dark-4; +$popover-color: $text-color; + $popover-help-bg: $btn-secondary-bg; $popover-help-color: $text-color; diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index 9b04bd7445a..9acc652df4e 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -264,16 +264,10 @@ $tooltipArrowWidth: 5px; $tooltipArrowColor: $tooltipBackground; $tooltipLinkColor: darken($white,11%); -$popoverBackground: $white; -$popoverArrowWidth: 15px; -$popoverArrowColor: $white; -$popoverTitleBackground: $white; - -// Special enhancement for popovers -$popoverArrowOuterWidth: $popoverArrowWidth + 1; -$popoverArrowOuterColor: rgba(0,0,0,.25); - // popover +$popover-bg: $dark-4; +$popover-color: $text-color; + $popover-help-bg: $blue-dark; $popover-help-color: $gray-6; diff --git a/public/sass/_variables.scss b/public/sass/_variables.scss index b259c3cd57a..31fde6e35a7 100644 --- a/public/sass/_variables.scss +++ b/public/sass/_variables.scss @@ -192,7 +192,6 @@ $form-icon-danger: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www // Used for a bird's eye view of components dependent on the z-axis // Try to avoid customizing these :) $zindex-dropdown: 1000; -$zindex-popover: 1010; $zindex-tooltip: 1020; $zindex-navbar-fixed: 1030; $zindex-modal-backdrop: 1040; diff --git a/public/sass/components/_dashboard.scss b/public/sass/components/_dashboard.scss index 293ac202318..b006bd8843b 100644 --- a/public/sass/components/_dashboard.scss +++ b/public/sass/components/_dashboard.scss @@ -286,3 +286,6 @@ div.flot-text { } } +.json-box-body { + min-height: 500px; +} diff --git a/public/sass/components/_drop.scss b/public/sass/components/_drop.scss index e6e507a72dc..44e8f8ebcfb 100644 --- a/public/sass/components/_drop.scss +++ b/public/sass/components/_drop.scss @@ -25,6 +25,16 @@ $easing: cubic-bezier(0, 0, 0.265, 1.00); box-sizing: border-box; } -@include drop-theme("help", $popover-help-bg, $popover-help-color); -@include drop-animation-scale("drop", "help", $attachmentOffset: $attachmentOffset, $easing: $easing); +.drop-popopver-close { + position: absolute; + top: -5px; + right: 0; + font-size: $font-size-lg; +} + +@include drop-theme("help", $popover-help-bg, $popover-help-color); +@include drop-theme("popover", $popover-bg, $popover-color); + +@include drop-animation-scale("drop", "help", $attachmentOffset: $attachmentOffset, $easing: $easing); +@include drop-animation-scale("drop", "popover", $attachmentOffset: $attachmentOffset, $easing: $easing); diff --git a/public/sass/components/_navbar.scss b/public/sass/components/_navbar.scss index 2e0388eae07..b642618e4cf 100644 --- a/public/sass/components/_navbar.scss +++ b/public/sass/components/_navbar.scss @@ -76,7 +76,7 @@ img { width: 30px; position: relative; - top: -2px; + top: -1px; } .navbar-brand-btn-background { diff --git a/public/sass/components/_panel_graph.scss b/public/sass/components/_panel_graph.scss index 2a85d9195ab..b51ac317043 100644 --- a/public/sass/components/_panel_graph.scss +++ b/public/sass/components/_panel_graph.scss @@ -22,7 +22,7 @@ } .graph-legend { - margin: 0 20px; + margin: 0 $spacer; text-align: center; .popover-content { @@ -181,7 +181,6 @@ .graph-legend-popover { width: 200px; - min-height: 100px; label { display: inline-block; } diff --git a/public/sass/components/_popovers.scss b/public/sass/components/_popovers.scss deleted file mode 100644 index e069fd8a78f..00000000000 --- a/public/sass/components/_popovers.scss +++ /dev/null @@ -1,128 +0,0 @@ -// -// Popovers -// -------------------------------------------------- - - -.popover { - position: absolute; - top: 0; - left: 0; - z-index: $zindex-popover; - display: none; - max-width: 480px; - padding: 1px; - text-align: left; // Reset given new insertion method - background-color: $popoverBackground; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0,0,0,.2); - @include box-shadow(0 5px 10px rgba(0,0,0,.2)); - - // Overrides for proper insertion - white-space: normal; - - // Offset the popover to account for the popover arrow - &.top { margin-top: -10px; } - &.right { margin-left: 10px; } - &.bottom { margin-top: 10px; } - &.left { margin-left: -10px; } -} - -.popover-title { - margin: 0; // reset heading margin - padding: 8px 14px; - font-size: 14px; - font-weight: normal; - line-height: 18px; - background-color: $popoverTitleBackground; - - &:empty { - display: none; - } -} - -.popover-content { - padding: 9px 14px; -} - -// Arrows -// -// .arrow is outer, .arrow:after is inner - -.popover .arrow, -.popover .arrow:after { - position: absolute; - display: block; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; -} -.popover .arrow { - border-width: $popoverArrowOuterWidth; -} -.popover .arrow:after { - border-width: $popoverArrowWidth; - content: ""; -} - -.popover { - &.top .arrow { - left: 50%; - margin-left: -$popoverArrowOuterWidth; - border-bottom-width: 0; - border-top-color: #999; // IE8 fallback - border-top-color: $popoverArrowOuterColor; - bottom: -$popoverArrowOuterWidth; - &:after { - bottom: 1px; - margin-left: -$popoverArrowWidth; - border-bottom-width: 0; - border-top-color: $popoverArrowColor; - } - } - &.right .arrow { - top: 50%; - left: -$popoverArrowOuterWidth; - margin-top: -$popoverArrowOuterWidth; - border-left-width: 0; - border-right-color: #999; // IE8 fallback - border-right-color: $popoverArrowOuterColor; - &:after { - left: 1px; - bottom: -$popoverArrowWidth; - border-left-width: 0; - border-right-color: $popoverArrowColor; - } - } - &.bottom .arrow { - left: 50%; - margin-left: -$popoverArrowOuterWidth; - border-top-width: 0; - border-bottom-color: #999; // IE8 fallback - border-bottom-color: $popoverArrowOuterColor; - top: -$popoverArrowOuterWidth; - &:after { - top: 1px; - margin-left: -$popoverArrowWidth; - border-top-width: 0; - border-bottom-color: $popoverArrowColor; - } - } - - &.left .arrow { - top: 50%; - right: -$popoverArrowOuterWidth; - margin-top: -$popoverArrowOuterWidth; - border-right-width: 0; - border-left-color: #999; // IE8 fallback - border-left-color: $popoverArrowOuterColor; - &:after { - right: 1px; - border-right-width: 0; - border-left-color: $popoverArrowColor; - bottom: -$popoverArrowWidth; - } - } -} - diff --git a/public/sass/components/_tightform.scss b/public/sass/components/_tightform.scss index 816ed5b4d75..8833e445372 100644 --- a/public/sass/components/_tightform.scss +++ b/public/sass/components/_tightform.scss @@ -17,6 +17,7 @@ display: inline; padding-right: 4px; margin-bottom: 0; + cursor: pointer; } } diff --git a/public/sass/mixins/_drop_element.scss b/public/sass/mixins/_drop_element.scss index 143574ad147..8f7a26594b8 100644 --- a/public/sass/mixins/_drop_element.scss +++ b/public/sass/mixins/_drop_element.scss @@ -10,7 +10,7 @@ font-family: inherit; background: $theme-bg; color: $theme-color; - padding: 1em; + padding: $spacer; font-size: $font-size-sm; max-width: 20rem; diff --git a/public/test/specs/seriesOverridesCtrl-specs.js b/public/test/specs/seriesOverridesCtrl-specs.js index f4daa0fa4e5..75030bea077 100644 --- a/public/test/specs/seriesOverridesCtrl-specs.js +++ b/public/test/specs/seriesOverridesCtrl-specs.js @@ -20,6 +20,7 @@ define([ // beforeEach(function() { ctx.scope = $rootScope.$new(); ctx.scope.ctrl = { + refresh: sinon.spy(), render: sinon.spy(), seriesList: [] }; diff --git a/public/vendor/bootstrap/bootstrap.js b/public/vendor/bootstrap/bootstrap.js index 2d9b83a4ba7..870ead5783d 100644 --- a/public/vendor/bootstrap/bootstrap.js +++ b/public/vendor/bootstrap/bootstrap.js @@ -81,557 +81,7 @@ "use strict"; // jshint ;_; - - /* ALERT CLASS DEFINITION - * ====================== */ - - var dismiss = '[data-dismiss="alert"]' - , Alert = function (el) { - $(el).on('click', dismiss, this.close) - } - - Alert.prototype.close = function (e) { - var $this = $(this) - , selector = $this.attr('data-target') - , $parent - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } - - $parent = $(selector) - - e && e.preventDefault() - - $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) - - $parent.trigger(e = $.Event('close')) - - if (e.isDefaultPrevented()) return - - $parent.removeClass('in') - - function removeElement() { - $parent - .trigger('closed') - .remove() - } - - $.support.transition && $parent.hasClass('fade') ? - $parent.on($.support.transition.end, removeElement) : - removeElement() - } - - - /* ALERT PLUGIN DEFINITION - * ======================= */ - - var old = $.fn.alert - - $.fn.alert = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('alert') - if (!data) $this.data('alert', (data = new Alert(this))) - if (typeof option == 'string') data[option].call($this) - }) - } - - $.fn.alert.Constructor = Alert - - - /* ALERT NO CONFLICT - * ================= */ - - $.fn.alert.noConflict = function () { - $.fn.alert = old - return this - } - - - /* ALERT DATA-API - * ============== */ - - $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) - -}(window.jQuery);/* ============================================================ - * bootstrap-button.js v2.3.2 - * http://getbootstrap.com/2.3.2/javascript.html#buttons - * ============================================================ - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* BUTTON PUBLIC CLASS DEFINITION - * ============================== */ - - var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, $.fn.button.defaults, options) - } - - Button.prototype.setState = function (state) { - var d = 'disabled' - , $el = this.$element - , data = $el.data() - , val = $el.is('input') ? 'val' : 'html' - - state = state + 'Text' - data.resetText || $el.data('resetText', $el[val]()) - - $el[val](data[state] || this.options[state]) - - // push to event loop to allow forms to submit - setTimeout(function () { - state == 'loadingText' ? - $el.addClass(d).attr(d, d) : - $el.removeClass(d).removeAttr(d) - }, 0) - } - - Button.prototype.toggle = function () { - var $parent = this.$element.closest('[data-toggle="buttons-radio"]') - - $parent && $parent - .find('.active') - .removeClass('active') - - this.$element.toggleClass('active') - } - - - /* BUTTON PLUGIN DEFINITION - * ======================== */ - - var old = $.fn.button - - $.fn.button = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('button') - , options = typeof option == 'object' && option - if (!data) $this.data('button', (data = new Button(this, options))) - if (option == 'toggle') data.toggle() - else if (option) data.setState(option) - }) - } - - $.fn.button.defaults = { - loadingText: 'loading...' - } - - $.fn.button.Constructor = Button - - - /* BUTTON NO CONFLICT - * ================== */ - - $.fn.button.noConflict = function () { - $.fn.button = old - return this - } - - - /* BUTTON DATA-API - * =============== */ - - $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { - var $btn = $(e.target) - if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') - $btn.button('toggle') - }) - -}(window.jQuery);/* ========================================================== - * bootstrap-carousel.js v2.3.2 - * http://getbootstrap.com/2.3.2/javascript.html#carousel - * ========================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* CAROUSEL CLASS DEFINITION - * ========================= */ - - var Carousel = function (element, options) { - this.$element = $(element) - this.$indicators = this.$element.find('.carousel-indicators') - this.options = options - this.options.pause == 'hover' && this.$element - .on('mouseenter', $.proxy(this.pause, this)) - .on('mouseleave', $.proxy(this.cycle, this)) - } - - Carousel.prototype = { - - cycle: function (e) { - if (!e) this.paused = false - if (this.interval) clearInterval(this.interval); - this.options.interval - && !this.paused - && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) - return this - } - - , getActiveIndex: function () { - this.$active = this.$element.find('.item.active') - this.$items = this.$active.parent().children() - return this.$items.index(this.$active) - } - - , to: function (pos) { - var activeIndex = this.getActiveIndex() - , that = this - - if (pos > (this.$items.length - 1) || pos < 0) return - - if (this.sliding) { - return this.$element.one('slid', function () { - that.to(pos) - }) - } - - if (activeIndex == pos) { - return this.pause().cycle() - } - - return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) - } - - , pause: function (e) { - if (!e) this.paused = true - if (this.$element.find('.next, .prev').length && $.support.transition.end) { - this.$element.trigger($.support.transition.end) - this.cycle(true) - } - clearInterval(this.interval) - this.interval = null - return this - } - - , next: function () { - if (this.sliding) return - return this.slide('next') - } - - , prev: function () { - if (this.sliding) return - return this.slide('prev') - } - - , slide: function (type, next) { - var $active = this.$element.find('.item.active') - , $next = next || $active[type]() - , isCycling = this.interval - , direction = type == 'next' ? 'left' : 'right' - , fallback = type == 'next' ? 'first' : 'last' - , that = this - , e - - this.sliding = true - - isCycling && this.pause() - - $next = $next.length ? $next : this.$element.find('.item')[fallback]() - - e = $.Event('slide', { - relatedTarget: $next[0] - , direction: direction - }) - - if ($next.hasClass('active')) return - - if (this.$indicators.length) { - this.$indicators.find('.active').removeClass('active') - this.$element.one('slid', function () { - var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) - $nextIndicator && $nextIndicator.addClass('active') - }) - } - - if ($.support.transition && this.$element.hasClass('slide')) { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return - $next.addClass(type) - $next[0].offsetWidth // force reflow - $active.addClass(direction) - $next.addClass(direction) - this.$element.one($.support.transition.end, function () { - $next.removeClass([type, direction].join(' ')).addClass('active') - $active.removeClass(['active', direction].join(' ')) - that.sliding = false - setTimeout(function () { that.$element.trigger('slid') }, 0) - }) - } else { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger('slid') - } - - isCycling && this.cycle() - - return this - } - - } - - - /* CAROUSEL PLUGIN DEFINITION - * ========================== */ - - var old = $.fn.carousel - - $.fn.carousel = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('carousel') - , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) - , action = typeof option == 'string' ? option : options.slide - if (!data) $this.data('carousel', (data = new Carousel(this, options))) - if (typeof option == 'number') data.to(option) - else if (action) data[action]() - else if (options.interval) data.pause().cycle() - }) - } - - $.fn.carousel.defaults = { - interval: 5000 - , pause: 'hover' - } - - $.fn.carousel.Constructor = Carousel - - - /* CAROUSEL NO CONFLICT - * ==================== */ - - $.fn.carousel.noConflict = function () { - $.fn.carousel = old - return this - } - - /* CAROUSEL DATA-API - * ================= */ - - $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , options = $.extend({}, $target.data(), $this.data()) - , slideIndex - - $target.carousel(options) - - if (slideIndex = $this.attr('data-slide-to')) { - $target.data('carousel').pause().to(slideIndex).cycle() - } - - e.preventDefault() - }) - -}(window.jQuery);/* ============================================================= - * bootstrap-collapse.js v2.3.2 - * http://getbootstrap.com/2.3.2/javascript.html#collapse - * ============================================================= - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* COLLAPSE PUBLIC CLASS DEFINITION - * ================================ */ - - var Collapse = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, $.fn.collapse.defaults, options) - - if (this.options.parent) { - this.$parent = $(this.options.parent) - } - - this.options.toggle && this.toggle() - } - - Collapse.prototype = { - - constructor: Collapse - - , dimension: function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } - - , show: function () { - var dimension - , scroll - , actives - , hasData - - if (this.transitioning || this.$element.hasClass('in')) return - - dimension = this.dimension() - scroll = $.camelCase(['scroll', dimension].join('-')) - actives = this.$parent && this.$parent.find('> .accordion-group > .in') - - if (actives && actives.length) { - hasData = actives.data('collapse') - if (hasData && hasData.transitioning) return - actives.collapse('hide') - hasData || actives.data('collapse', null) - } - - this.$element[dimension](0) - this.transition('addClass', $.Event('show'), 'shown') - $.support.transition && this.$element[dimension](this.$element[0][scroll]) - } - - , hide: function () { - var dimension - if (this.transitioning || !this.$element.hasClass('in')) return - dimension = this.dimension() - this.reset(this.$element[dimension]()) - this.transition('removeClass', $.Event('hide'), 'hidden') - this.$element[dimension](0) - } - - , reset: function (size) { - var dimension = this.dimension() - - this.$element - .removeClass('collapse') - [dimension](size || 'auto') - [0].offsetWidth - - this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') - - return this - } - - , transition: function (method, startEvent, completeEvent) { - var that = this - , complete = function () { - if (startEvent.type == 'show') that.reset() - that.transitioning = 0 - that.$element.trigger(completeEvent) - } - - this.$element.trigger(startEvent) - - if (startEvent.isDefaultPrevented()) return - - this.transitioning = 1 - - this.$element[method]('in') - - $.support.transition && this.$element.hasClass('collapse') ? - this.$element.one($.support.transition.end, complete) : - complete() - } - - , toggle: function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } - - } - - - /* COLLAPSE PLUGIN DEFINITION - * ========================== */ - - var old = $.fn.collapse - - $.fn.collapse = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('collapse') - , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) - if (!data) $this.data('collapse', (data = new Collapse(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - $.fn.collapse.defaults = { - toggle: true - } - - $.fn.collapse.Constructor = Collapse - - - /* 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') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 - , option = $(target).data('collapse') ? 'toggle' : $this.data() - $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') - $(target).collapse(option) - }) - -}(window.jQuery);/* ============================================================ +/* ============================================================ * bootstrap-dropdown.js v2.3.2 * http://getbootstrap.com/2.3.2/javascript.html#dropdowns * ============================================================ @@ -651,11 +101,6 @@ * ============================================================ */ -!function ($) { - - "use strict"; // jshint ;_; - - /* DROPDOWN CLASS DEFINITION * ========================= */ @@ -1443,282 +888,8 @@ } }(window.jQuery); -/* =========================================================== - * bootstrap-popover.js v2.3.2 - * http://getbootstrap.com/2.3.2/javascript.html#popovers - * =========================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * =========================================================== */ - -!function ($) { - - "use strict"; // jshint ;_; - - - /* POPOVER PUBLIC CLASS DEFINITION - * =============================== */ - - var Popover = function (element, options) { - this.init('popover', element, options) - } - - - /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js - ========================================== */ - - Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { - - constructor: Popover - - , setContent: function () { - var $tip = this.tip() - , title = this.getTitle() - , content = this.getContent() - - $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) - $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) - - $tip.removeClass('fade top bottom left right in') - } - - , hasContent: function () { - return this.getTitle() || this.getContent() - } - - , getContent: function () { - var content - , $e = this.$element - , o = this.options - - content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) - || $e.attr('data-content') - - return content - } - - , tip: function () { - if (!this.$tip) { - this.$tip = $(this.options.template) - } - return this.$tip - } - - , destroy: function () { - this.hide().$element.off('.' + this.type).removeData(this.type) - } - - }) - - - /* POPOVER PLUGIN DEFINITION - * ======================= */ - - var old = $.fn.popover - - $.fn.popover = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('popover') - , options = typeof option == 'object' && option - if (!data) $this.data('popover', (data = new Popover(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - $.fn.popover.Constructor = Popover - - $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { - placement: 'right' - , trigger: 'click' - , content: '' - , template: '

' - }) - - - /* POPOVER NO CONFLICT - * =================== */ - - $.fn.popover.noConflict = function () { - $.fn.popover = old - return this - } - -}(window.jQuery); -/* ============================================================= - * bootstrap-scrollspy.js v2.3.2 - * http://getbootstrap.com/2.3.2/javascript.html#scrollspy - * ============================================================= - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================== */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* SCROLLSPY CLASS DEFINITION - * ========================== */ - - function ScrollSpy(element, options) { - var process = $.proxy(this.process, this) - , $element = $(element).is('body') ? $(window) : $(element) - , href - this.options = $.extend({}, $.fn.scrollspy.defaults, options) - this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) - this.selector = (this.options.target - || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - || '') + ' .nav li > a' - this.$body = $('body') - this.refresh() - this.process() - } - - ScrollSpy.prototype = { - - constructor: ScrollSpy - - , refresh: function () { - var self = this - , $targets - - this.offsets = $([]) - this.targets = $([]) - - $targets = this.$body - .find(this.selector) - .map(function () { - var $el = $(this) - , href = $el.data('target') || $el.attr('href') - , $href = /^#\w/.test(href) && $(href) - return ( $href - && $href.length - && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null - }) - .sort(function (a, b) { return a[0] - b[0] }) - .each(function () { - self.offsets.push(this[0]) - self.targets.push(this[1]) - }) - } - - , process: function () { - var scrollTop = this.$scrollElement.scrollTop() + this.options.offset - , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight - , maxScroll = scrollHeight - this.$scrollElement.height() - , offsets = this.offsets - , targets = this.targets - , activeTarget = this.activeTarget - , i - - if (scrollTop >= maxScroll) { - return activeTarget != (i = targets.last()[0]) - && this.activate ( i ) - } - - for (i = offsets.length; i--;) { - activeTarget != targets[i] - && scrollTop >= offsets[i] - && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) - && this.activate( targets[i] ) - } - } - - , activate: function (target) { - var active - , selector - - this.activeTarget = target - - $(this.selector) - .parent('.active') - .removeClass('active') - - selector = this.selector - + '[data-target="' + target + '"],' - + this.selector + '[href="' + target + '"]' - - active = $(selector) - .parent('li') - .addClass('active') - - if (active.parent('.dropdown-menu').length) { - active = active.closest('li.dropdown').addClass('active') - } - - active.trigger('activate') - } - - } - - - /* SCROLLSPY PLUGIN DEFINITION - * =========================== */ - - var old = $.fn.scrollspy - - $.fn.scrollspy = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('scrollspy') - , options = typeof option == 'object' && option - if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - $.fn.scrollspy.Constructor = ScrollSpy - - $.fn.scrollspy.defaults = { - offset: 10 - } - - - /* SCROLLSPY NO CONFLICT - * ===================== */ - - $.fn.scrollspy.noConflict = function () { - $.fn.scrollspy = old - return this - } - - - /* SCROLLSPY DATA-API - * ================== */ - - $(window).on('load', function () { - $('[data-spy="scroll"]').each(function () { - var $spy = $(this) - $spy.scrollspy($spy.data()) - }) - }) - -}(window.jQuery);/* ======================================================== +/* ======================================================== * bootstrap-tab.js v2.3.2 * http://getbootstrap.com/2.3.2/javascript.html#tabs * ========================================================