summaryrefslogtreecommitdiff
path: root/templates/assets/bootstrap/js/dist/button.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-03-25 13:13:28 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-03-25 13:13:28 +0100
commitca88c377f918a9178c56e206b7bb13baefd30c91 (patch)
treee4ee2a5fda2ed378e9d103c627e9cb2a40f47310 /templates/assets/bootstrap/js/dist/button.js
parentb1bbeb2e2db4a287e7ccf627c2dc450cf5a53b62 (diff)
downloadminionlivesmatter-ca88c377f918a9178c56e206b7bb13baefd30c91.tar.gz
minionlivesmatter-ca88c377f918a9178c56e206b7bb13baefd30c91.zip
accidentally committed minionlivesmatter changes to meta
Diffstat (limited to 'templates/assets/bootstrap/js/dist/button.js')
-rw-r--r--templates/assets/bootstrap/js/dist/button.js167
1 files changed, 167 insertions, 0 deletions
diff --git a/templates/assets/bootstrap/js/dist/button.js b/templates/assets/bootstrap/js/dist/button.js
new file mode 100644
index 0000000..6eb6dd5
--- /dev/null
+++ b/templates/assets/bootstrap/js/dist/button.js
@@ -0,0 +1,167 @@
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+/**
+ * --------------------------------------------------------------------------
+ * Bootstrap (v4.0.0-alpha.6): button.js
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * --------------------------------------------------------------------------
+ */
+
+var Button = function ($) {
+
+ /**
+ * ------------------------------------------------------------------------
+ * Constants
+ * ------------------------------------------------------------------------
+ */
+
+ var NAME = 'button';
+ var VERSION = '4.0.0-alpha.6';
+ var DATA_KEY = 'bs.button';
+ var EVENT_KEY = '.' + DATA_KEY;
+ var DATA_API_KEY = '.data-api';
+ var JQUERY_NO_CONFLICT = $.fn[NAME];
+
+ var ClassName = {
+ ACTIVE: 'active',
+ BUTTON: 'btn',
+ FOCUS: 'focus'
+ };
+
+ var Selector = {
+ DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
+ DATA_TOGGLE: '[data-toggle="buttons"]',
+ INPUT: 'input',
+ ACTIVE: '.active',
+ BUTTON: '.btn'
+ };
+
+ var Event = {
+ CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
+ FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
+ };
+
+ /**
+ * ------------------------------------------------------------------------
+ * Class Definition
+ * ------------------------------------------------------------------------
+ */
+
+ var Button = function () {
+ function Button(element) {
+ _classCallCheck(this, Button);
+
+ this._element = element;
+ }
+
+ // getters
+
+ // public
+
+ Button.prototype.toggle = function toggle() {
+ var triggerChangeEvent = true;
+ var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
+
+ if (rootElement) {
+ var input = $(this._element).find(Selector.INPUT)[0];
+
+ if (input) {
+ if (input.type === 'radio') {
+ if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
+ triggerChangeEvent = false;
+ } else {
+ var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
+
+ if (activeElement) {
+ $(activeElement).removeClass(ClassName.ACTIVE);
+ }
+ }
+ }
+
+ if (triggerChangeEvent) {
+ input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
+ $(input).trigger('change');
+ }
+
+ input.focus();
+ }
+ }
+
+ this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
+
+ if (triggerChangeEvent) {
+ $(this._element).toggleClass(ClassName.ACTIVE);
+ }
+ };
+
+ Button.prototype.dispose = function dispose() {
+ $.removeData(this._element, DATA_KEY);
+ this._element = null;
+ };
+
+ // static
+
+ Button._jQueryInterface = function _jQueryInterface(config) {
+ return this.each(function () {
+ var data = $(this).data(DATA_KEY);
+
+ if (!data) {
+ data = new Button(this);
+ $(this).data(DATA_KEY, data);
+ }
+
+ if (config === 'toggle') {
+ data[config]();
+ }
+ });
+ };
+
+ _createClass(Button, null, [{
+ key: 'VERSION',
+ get: function get() {
+ return VERSION;
+ }
+ }]);
+
+ return Button;
+ }();
+
+ /**
+ * ------------------------------------------------------------------------
+ * Data Api implementation
+ * ------------------------------------------------------------------------
+ */
+
+ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
+ event.preventDefault();
+
+ var button = event.target;
+
+ if (!$(button).hasClass(ClassName.BUTTON)) {
+ button = $(button).closest(Selector.BUTTON);
+ }
+
+ Button._jQueryInterface.call($(button), 'toggle');
+ }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
+ var button = $(event.target).closest(Selector.BUTTON)[0];
+ $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
+ });
+
+ /**
+ * ------------------------------------------------------------------------
+ * jQuery
+ * ------------------------------------------------------------------------
+ */
+
+ $.fn[NAME] = Button._jQueryInterface;
+ $.fn[NAME].Constructor = Button;
+ $.fn[NAME].noConflict = function () {
+ $.fn[NAME] = JQUERY_NO_CONFLICT;
+ return Button._jQueryInterface;
+ };
+
+ return Button;
+}(jQuery);
+//# sourceMappingURL=button.js.map