MCPcopy Create free account
hub / github.com/TruthHun/BookStack / Plugin

Function Plugin

static/bootstrap-select-1.13.18/js/bootstrap-select.js:3106–3205  ·  view source on GitHub ↗
(option)

Source from the content-addressed store, hash-verified

3104 // SELECTPICKER PLUGIN DEFINITION
3105 // ==============================
3106 function Plugin (option) {
3107 // get the args of the outer function..
3108 var args = arguments;
3109 // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them
3110 // to get lost/corrupted in android 2.3 and IE9 #715 #775
3111 var _option = option;
3112
3113 [].shift.apply(args);
3114
3115 // if the version was not set successfully
3116 if (!version.success) {
3117 // try to retreive it again
3118 try {
3119 version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.');
3120 } catch (err) {
3121 // fall back to use BootstrapVersion if set
3122 if (Selectpicker.BootstrapVersion) {
3123 version.full = Selectpicker.BootstrapVersion.split(' ')[0].split('.');
3124 } else {
3125 version.full = [version.major, '0', '0'];
3126
3127 console.warn(
3128 'There was an issue retrieving Bootstrap\'s version. ' +
3129 'Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. ' +
3130 'If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.',
3131 err
3132 );
3133 }
3134 }
3135
3136 version.major = version.full[0];
3137 version.success = true;
3138 }
3139
3140 if (version.major === '4') {
3141 // some defaults need to be changed if using Bootstrap 4
3142 // check to see if they have already been manually changed before forcing them to update
3143 var toUpdate = [];
3144
3145 if (Selectpicker.DEFAULTS.style === classNames.BUTTONCLASS) toUpdate.push({ name: 'style', className: 'BUTTONCLASS' });
3146 if (Selectpicker.DEFAULTS.iconBase === classNames.ICONBASE) toUpdate.push({ name: 'iconBase', className: 'ICONBASE' });
3147 if (Selectpicker.DEFAULTS.tickIcon === classNames.TICKICON) toUpdate.push({ name: 'tickIcon', className: 'TICKICON' });
3148
3149 classNames.DIVIDER = 'dropdown-divider';
3150 classNames.SHOW = 'show';
3151 classNames.BUTTONCLASS = 'btn-light';
3152 classNames.POPOVERHEADER = 'popover-header';
3153 classNames.ICONBASE = '';
3154 classNames.TICKICON = 'bs-ok-default';
3155
3156 for (var i = 0; i < toUpdate.length; i++) {
3157 var option = toUpdate[i];
3158 Selectpicker.DEFAULTS[option.name] = classNames[option.className];
3159 }
3160 }
3161
3162 var value;
3163 var chain = this.each(function () {

Callers

nothing calls this directly

Calls 2

extendMethod · 0.80
$Function · 0.50

Tested by

no test coverage detected