try_api 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/try_api/application.css.sass +0 -2
  3. data/app/views/layouts/try_api/application.html.erb +2 -0
  4. data/app/views/try_api/pages/index.html +1 -1
  5. data/lib/try_api/version.rb +1 -1
  6. metadata +2 -121
  7. data/app/assets/javascripts/try_api/bower_components/bootstrap/CHANGELOG.md +0 -5
  8. data/app/assets/javascripts/try_api/bower_components/bootstrap/Gruntfile.js +0 -511
  9. data/app/assets/javascripts/try_api/bower_components/bootstrap/ISSUE_TEMPLATE.md +0 -22
  10. data/app/assets/javascripts/try_api/bower_components/bootstrap/LICENSE.txt +0 -21
  11. data/app/assets/javascripts/try_api/bower_components/bootstrap/README.md +0 -142
  12. data/app/assets/javascripts/try_api/bower_components/bootstrap/bower.json +0 -34
  13. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/css/bootstrap-theme.css +0 -587
  14. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/css/bootstrap-theme.min.css +0 -6
  15. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/css/bootstrap.css +0 -6757
  16. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/css/bootstrap.min.css +0 -6
  17. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  18. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +0 -288
  19. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  20. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  21. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
  22. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/js/bootstrap.js +0 -2377
  23. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/js/bootstrap.min.js +0 -7
  24. data/app/assets/javascripts/try_api/bower_components/bootstrap/dist/js/npm.js +0 -13
  25. data/app/assets/javascripts/try_api/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  26. data/app/assets/javascripts/try_api/bower_components/bootstrap/fonts/glyphicons-halflings-regular.svg +0 -288
  27. data/app/assets/javascripts/try_api/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  28. data/app/assets/javascripts/try_api/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  29. data/app/assets/javascripts/try_api/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  30. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/bs-commonjs-generator.js +0 -30
  31. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/bs-glyphicons-data-generator.js +0 -42
  32. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/bs-lessdoc-parser.js +0 -237
  33. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/bs-raw-files-generator.js +0 -44
  34. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/change-version.js +0 -109
  35. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/configBridge.json +0 -46
  36. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/npm-shrinkwrap.json +0 -2679
  37. data/app/assets/javascripts/try_api/bower_components/bootstrap/grunt/sauce_browsers.yml +0 -82
  38. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/affix.js +0 -162
  39. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/alert.js +0 -94
  40. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/button.js +0 -125
  41. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/carousel.js +0 -237
  42. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/collapse.js +0 -212
  43. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/dropdown.js +0 -165
  44. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/modal.js +0 -339
  45. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/popover.js +0 -108
  46. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/scrollspy.js +0 -172
  47. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/tab.js +0 -155
  48. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/tooltip.js +0 -520
  49. data/app/assets/javascripts/try_api/bower_components/bootstrap/js/transition.js +0 -59
  50. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/alerts.less +0 -73
  51. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/badges.less +0 -66
  52. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/bootstrap.less +0 -56
  53. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/breadcrumbs.less +0 -26
  54. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/button-groups.less +0 -244
  55. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/buttons.less +0 -166
  56. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/carousel.less +0 -270
  57. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/close.less +0 -34
  58. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/code.less +0 -69
  59. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/component-animations.less +0 -33
  60. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/dropdowns.less +0 -216
  61. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/forms.less +0 -613
  62. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/glyphicons.less +0 -305
  63. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/grid.less +0 -84
  64. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/input-groups.less +0 -171
  65. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/jumbotron.less +0 -54
  66. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/labels.less +0 -64
  67. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/list-group.less +0 -130
  68. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/media.less +0 -66
  69. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins.less +0 -40
  70. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/alerts.less +0 -14
  71. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/background-variant.less +0 -9
  72. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/border-radius.less +0 -18
  73. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/buttons.less +0 -65
  74. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/center-block.less +0 -7
  75. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/clearfix.less +0 -22
  76. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/forms.less +0 -85
  77. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/gradients.less +0 -59
  78. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/grid-framework.less +0 -91
  79. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/grid.less +0 -122
  80. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/hide-text.less +0 -21
  81. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/image.less +0 -33
  82. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/labels.less +0 -12
  83. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/list-group.less +0 -30
  84. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/nav-divider.less +0 -10
  85. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/nav-vertical-align.less +0 -9
  86. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/opacity.less +0 -8
  87. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/pagination.less +0 -24
  88. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/panels.less +0 -24
  89. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/progress-bar.less +0 -10
  90. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/reset-filter.less +0 -8
  91. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/reset-text.less +0 -18
  92. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/resize.less +0 -6
  93. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/responsive-visibility.less +0 -15
  94. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/size.less +0 -10
  95. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/tab-focus.less +0 -9
  96. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/table-row.less +0 -28
  97. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/text-emphasis.less +0 -9
  98. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/text-overflow.less +0 -8
  99. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/mixins/vendor-prefixes.less +0 -227
  100. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/modals.less +0 -150
  101. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/navbar.less +0 -660
  102. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/navs.less +0 -242
  103. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/normalize.less +0 -424
  104. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/pager.less +0 -54
  105. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/pagination.less +0 -89
  106. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/panels.less +0 -271
  107. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/popovers.less +0 -131
  108. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/print.less +0 -101
  109. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/progress-bars.less +0 -87
  110. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/responsive-embed.less +0 -35
  111. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/responsive-utilities.less +0 -194
  112. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/scaffolding.less +0 -161
  113. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/tables.less +0 -234
  114. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/theme.less +0 -291
  115. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/thumbnails.less +0 -36
  116. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/tooltip.less +0 -101
  117. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/type.less +0 -302
  118. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/utilities.less +0 -55
  119. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/variables.less +0 -869
  120. data/app/assets/javascripts/try_api/bower_components/bootstrap/less/wells.less +0 -29
  121. data/app/assets/javascripts/try_api/bower_components/bootstrap/nuget/MyGet.ps1 +0 -8
  122. data/app/assets/javascripts/try_api/bower_components/bootstrap/nuget/bootstrap.less.nuspec +0 -28
  123. data/app/assets/javascripts/try_api/bower_components/bootstrap/nuget/bootstrap.nuspec +0 -28
  124. data/app/assets/javascripts/try_api/bower_components/bootstrap/package.js +0 -32
  125. data/app/assets/javascripts/try_api/bower_components/bootstrap/package.json +0 -89
@@ -1,82 +0,0 @@
1
- [
2
- # Docs: https://saucelabs.com/docs/platforms/webdriver
3
-
4
- {
5
- browserName: "safari",
6
- platform: "OS X 10.10"
7
- },
8
- {
9
- browserName: "chrome",
10
- platform: "OS X 10.10"
11
- },
12
- {
13
- browserName: "firefox",
14
- platform: "OS X 10.10"
15
- },
16
-
17
- # Mac Opera not currently supported by Sauce Labs
18
-
19
- {
20
- browserName: "internet explorer",
21
- version: "11",
22
- platform: "Windows 8.1"
23
- },
24
- {
25
- browserName: "internet explorer",
26
- version: "10",
27
- platform: "Windows 8"
28
- },
29
- {
30
- browserName: "internet explorer",
31
- version: "9",
32
- platform: "Windows 7"
33
- },
34
- {
35
- browserName: "internet explorer",
36
- version: "8",
37
- platform: "Windows 7"
38
- },
39
-
40
- # { # Unofficial
41
- # browserName: "internet explorer",
42
- # version: "7",
43
- # platform: "Windows XP"
44
- # },
45
-
46
- {
47
- browserName: "chrome",
48
- platform: "Windows 8.1"
49
- },
50
- {
51
- browserName: "firefox",
52
- platform: "Windows 8.1"
53
- },
54
-
55
- # Win Opera 15+ not currently supported by Sauce Labs
56
-
57
- {
58
- browserName: "iphone",
59
- platform: "OS X 10.10",
60
- version: "9.2"
61
- },
62
-
63
- # iOS Chrome not currently supported by Sauce Labs
64
-
65
- # Linux (unofficial)
66
- {
67
- browserName: "chrome",
68
- platform: "Linux"
69
- },
70
- {
71
- browserName: "firefox",
72
- platform: "Linux"
73
- }
74
-
75
- # Android Chrome not currently supported by Sauce Labs
76
-
77
- # { # Android Browser (super-unofficial)
78
- # browserName: "android",
79
- # version: "4.0",
80
- # platform: "Linux"
81
- # }
82
- ]
@@ -1,162 +0,0 @@
1
- /* ========================================================================
2
- * Bootstrap: affix.js v3.3.7
3
- * http://getbootstrap.com/javascript/#affix
4
- * ========================================================================
5
- * Copyright 2011-2016 Twitter, Inc.
6
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
- * ======================================================================== */
8
-
9
-
10
- +function ($) {
11
- 'use strict';
12
-
13
- // AFFIX CLASS DEFINITION
14
- // ======================
15
-
16
- var Affix = function (element, options) {
17
- this.options = $.extend({}, Affix.DEFAULTS, options)
18
-
19
- this.$target = $(this.options.target)
20
- .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
21
- .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
22
-
23
- this.$element = $(element)
24
- this.affixed = null
25
- this.unpin = null
26
- this.pinnedOffset = null
27
-
28
- this.checkPosition()
29
- }
30
-
31
- Affix.VERSION = '3.3.7'
32
-
33
- Affix.RESET = 'affix affix-top affix-bottom'
34
-
35
- Affix.DEFAULTS = {
36
- offset: 0,
37
- target: window
38
- }
39
-
40
- Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
41
- var scrollTop = this.$target.scrollTop()
42
- var position = this.$element.offset()
43
- var targetHeight = this.$target.height()
44
-
45
- if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
46
-
47
- if (this.affixed == 'bottom') {
48
- if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
49
- return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
50
- }
51
-
52
- var initializing = this.affixed == null
53
- var colliderTop = initializing ? scrollTop : position.top
54
- var colliderHeight = initializing ? targetHeight : height
55
-
56
- if (offsetTop != null && scrollTop <= offsetTop) return 'top'
57
- if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
58
-
59
- return false
60
- }
61
-
62
- Affix.prototype.getPinnedOffset = function () {
63
- if (this.pinnedOffset) return this.pinnedOffset
64
- this.$element.removeClass(Affix.RESET).addClass('affix')
65
- var scrollTop = this.$target.scrollTop()
66
- var position = this.$element.offset()
67
- return (this.pinnedOffset = position.top - scrollTop)
68
- }
69
-
70
- Affix.prototype.checkPositionWithEventLoop = function () {
71
- setTimeout($.proxy(this.checkPosition, this), 1)
72
- }
73
-
74
- Affix.prototype.checkPosition = function () {
75
- if (!this.$element.is(':visible')) return
76
-
77
- var height = this.$element.height()
78
- var offset = this.options.offset
79
- var offsetTop = offset.top
80
- var offsetBottom = offset.bottom
81
- var scrollHeight = Math.max($(document).height(), $(document.body).height())
82
-
83
- if (typeof offset != 'object') offsetBottom = offsetTop = offset
84
- if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
85
- if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
86
-
87
- var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
88
-
89
- if (this.affixed != affix) {
90
- if (this.unpin != null) this.$element.css('top', '')
91
-
92
- var affixType = 'affix' + (affix ? '-' + affix : '')
93
- var e = $.Event(affixType + '.bs.affix')
94
-
95
- this.$element.trigger(e)
96
-
97
- if (e.isDefaultPrevented()) return
98
-
99
- this.affixed = affix
100
- this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
101
-
102
- this.$element
103
- .removeClass(Affix.RESET)
104
- .addClass(affixType)
105
- .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
106
- }
107
-
108
- if (affix == 'bottom') {
109
- this.$element.offset({
110
- top: scrollHeight - height - offsetBottom
111
- })
112
- }
113
- }
114
-
115
-
116
- // AFFIX PLUGIN DEFINITION
117
- // =======================
118
-
119
- function Plugin(option) {
120
- return this.each(function () {
121
- var $this = $(this)
122
- var data = $this.data('bs.affix')
123
- var options = typeof option == 'object' && option
124
-
125
- if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
126
- if (typeof option == 'string') data[option]()
127
- })
128
- }
129
-
130
- var old = $.fn.affix
131
-
132
- $.fn.affix = Plugin
133
- $.fn.affix.Constructor = Affix
134
-
135
-
136
- // AFFIX NO CONFLICT
137
- // =================
138
-
139
- $.fn.affix.noConflict = function () {
140
- $.fn.affix = old
141
- return this
142
- }
143
-
144
-
145
- // AFFIX DATA-API
146
- // ==============
147
-
148
- $(window).on('load', function () {
149
- $('[data-spy="affix"]').each(function () {
150
- var $spy = $(this)
151
- var data = $spy.data()
152
-
153
- data.offset = data.offset || {}
154
-
155
- if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
156
- if (data.offsetTop != null) data.offset.top = data.offsetTop
157
-
158
- Plugin.call($spy, data)
159
- })
160
- })
161
-
162
- }(jQuery);
@@ -1,94 +0,0 @@
1
- /* ========================================================================
2
- * Bootstrap: alert.js v3.3.7
3
- * http://getbootstrap.com/javascript/#alerts
4
- * ========================================================================
5
- * Copyright 2011-2016 Twitter, Inc.
6
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
- * ======================================================================== */
8
-
9
-
10
- +function ($) {
11
- 'use strict';
12
-
13
- // ALERT CLASS DEFINITION
14
- // ======================
15
-
16
- var dismiss = '[data-dismiss="alert"]'
17
- var Alert = function (el) {
18
- $(el).on('click', dismiss, this.close)
19
- }
20
-
21
- Alert.VERSION = '3.3.7'
22
-
23
- Alert.TRANSITION_DURATION = 150
24
-
25
- Alert.prototype.close = function (e) {
26
- var $this = $(this)
27
- var selector = $this.attr('data-target')
28
-
29
- if (!selector) {
30
- selector = $this.attr('href')
31
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
32
- }
33
-
34
- var $parent = $(selector === '#' ? [] : selector)
35
-
36
- if (e) e.preventDefault()
37
-
38
- if (!$parent.length) {
39
- $parent = $this.closest('.alert')
40
- }
41
-
42
- $parent.trigger(e = $.Event('close.bs.alert'))
43
-
44
- if (e.isDefaultPrevented()) return
45
-
46
- $parent.removeClass('in')
47
-
48
- function removeElement() {
49
- // detach from parent, fire event then clean up data
50
- $parent.detach().trigger('closed.bs.alert').remove()
51
- }
52
-
53
- $.support.transition && $parent.hasClass('fade') ?
54
- $parent
55
- .one('bsTransitionEnd', removeElement)
56
- .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
57
- removeElement()
58
- }
59
-
60
-
61
- // ALERT PLUGIN DEFINITION
62
- // =======================
63
-
64
- function Plugin(option) {
65
- return this.each(function () {
66
- var $this = $(this)
67
- var data = $this.data('bs.alert')
68
-
69
- if (!data) $this.data('bs.alert', (data = new Alert(this)))
70
- if (typeof option == 'string') data[option].call($this)
71
- })
72
- }
73
-
74
- var old = $.fn.alert
75
-
76
- $.fn.alert = Plugin
77
- $.fn.alert.Constructor = Alert
78
-
79
-
80
- // ALERT NO CONFLICT
81
- // =================
82
-
83
- $.fn.alert.noConflict = function () {
84
- $.fn.alert = old
85
- return this
86
- }
87
-
88
-
89
- // ALERT DATA-API
90
- // ==============
91
-
92
- $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
93
-
94
- }(jQuery);
@@ -1,125 +0,0 @@
1
- /* ========================================================================
2
- * Bootstrap: button.js v3.3.7
3
- * http://getbootstrap.com/javascript/#buttons
4
- * ========================================================================
5
- * Copyright 2011-2016 Twitter, Inc.
6
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
- * ======================================================================== */
8
-
9
-
10
- +function ($) {
11
- 'use strict';
12
-
13
- // BUTTON PUBLIC CLASS DEFINITION
14
- // ==============================
15
-
16
- var Button = function (element, options) {
17
- this.$element = $(element)
18
- this.options = $.extend({}, Button.DEFAULTS, options)
19
- this.isLoading = false
20
- }
21
-
22
- Button.VERSION = '3.3.7'
23
-
24
- Button.DEFAULTS = {
25
- loadingText: 'loading...'
26
- }
27
-
28
- Button.prototype.setState = function (state) {
29
- var d = 'disabled'
30
- var $el = this.$element
31
- var val = $el.is('input') ? 'val' : 'html'
32
- var data = $el.data()
33
-
34
- state += 'Text'
35
-
36
- if (data.resetText == null) $el.data('resetText', $el[val]())
37
-
38
- // push to event loop to allow forms to submit
39
- setTimeout($.proxy(function () {
40
- $el[val](data[state] == null ? this.options[state] : data[state])
41
-
42
- if (state == 'loadingText') {
43
- this.isLoading = true
44
- $el.addClass(d).attr(d, d).prop(d, true)
45
- } else if (this.isLoading) {
46
- this.isLoading = false
47
- $el.removeClass(d).removeAttr(d).prop(d, false)
48
- }
49
- }, this), 0)
50
- }
51
-
52
- Button.prototype.toggle = function () {
53
- var changed = true
54
- var $parent = this.$element.closest('[data-toggle="buttons"]')
55
-
56
- if ($parent.length) {
57
- var $input = this.$element.find('input')
58
- if ($input.prop('type') == 'radio') {
59
- if ($input.prop('checked')) changed = false
60
- $parent.find('.active').removeClass('active')
61
- this.$element.addClass('active')
62
- } else if ($input.prop('type') == 'checkbox') {
63
- if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
64
- this.$element.toggleClass('active')
65
- }
66
- $input.prop('checked', this.$element.hasClass('active'))
67
- if (changed) $input.trigger('change')
68
- } else {
69
- this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
70
- this.$element.toggleClass('active')
71
- }
72
- }
73
-
74
-
75
- // BUTTON PLUGIN DEFINITION
76
- // ========================
77
-
78
- function Plugin(option) {
79
- return this.each(function () {
80
- var $this = $(this)
81
- var data = $this.data('bs.button')
82
- var options = typeof option == 'object' && option
83
-
84
- if (!data) $this.data('bs.button', (data = new Button(this, options)))
85
-
86
- if (option == 'toggle') data.toggle()
87
- else if (option) data.setState(option)
88
- })
89
- }
90
-
91
- var old = $.fn.button
92
-
93
- $.fn.button = Plugin
94
- $.fn.button.Constructor = Button
95
-
96
-
97
- // BUTTON NO CONFLICT
98
- // ==================
99
-
100
- $.fn.button.noConflict = function () {
101
- $.fn.button = old
102
- return this
103
- }
104
-
105
-
106
- // BUTTON DATA-API
107
- // ===============
108
-
109
- $(document)
110
- .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
111
- var $btn = $(e.target).closest('.btn')
112
- Plugin.call($btn, 'toggle')
113
- if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
114
- // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
115
- e.preventDefault()
116
- // The target component still receive the focus
117
- if ($btn.is('input,button')) $btn.trigger('focus')
118
- else $btn.find('input:visible,button:visible').first().trigger('focus')
119
- }
120
- })
121
- .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
122
- $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
123
- })
124
-
125
- }(jQuery);