Skip to content

Fix bootstrap error #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,32 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var $;
if (typeof window !== 'undefined' && window && window.jQuery) {
$ = window.jQuery;
if (typeof window !== 'undefined' && window) {
if (window.jQuery) {
$ = window.jQuery;
} else {
$ = require('jquery');
window.jQuery = $;
}
} else {
$ = require('jquery');
window.jQuery = $;
}

var BS = require('bootstrap');
var React = require('react');
var objectAssign = require('object-assign');
var getOptions = require('./get-options.js');
var bsMultiselect = require('./bootstrap-multiselect.js');
var bsDropdown;

// make it play nice when we already have bootstrap dropdown loaded.
if (typeof BS === 'undefined' || typeof BS.dropdown === 'undefined') {
try {
var BS = require('bootstrap');
if (typeof BS.dropdown !== 'undefined') {
bsDropdown = BS.dropdown;
}
} catch (e) {}
if (!bsDropdown) {
bsDropdown = require('./bootstrap-dropdown.js');
} else {
bsDropdown = BS.dropdown;
}

$ = bsDropdown.init($);
Expand Down
15 changes: 9 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ if (typeof window !== 'undefined' && window) {
if (window.jQuery) {
$ = window.jQuery;
} else {
$ = require('jquery')
$ = require('jquery');
window.jQuery = $;
}
} else {
$ = require('jquery');
}

var BS = require('bootstrap');
var React = require('react');
var objectAssign = require('object-assign');
var getOptions = require('./get-options.js');
var bsMultiselect = require('./bootstrap-multiselect.js');
var bsDropdown;

// make it play nice when we already have bootstrap dropdown loaded.
if (typeof BS === 'undefined' || typeof BS.dropdown === 'undefined') {
bsDropdown = require('./bootstrap-dropdown.js');
try {
var BS = require('bootstrap');
if (typeof BS.dropdown !== 'undefined') {
bsDropdown = BS.dropdown;
}
} catch (e) {
}
else {
bsDropdown = BS.dropdown;
if (!bsDropdown) {
bsDropdown = require('./bootstrap-dropdown.js');
}

$ = bsDropdown.init($);
Expand Down