UNPKG

vpn.email

Version:
57 lines (44 loc) 1.26 kB
$.widget( "metro.select" , { version: "3.0.0", options: { }, _create: function () { var that = this, element = this.element, o = this.options; var func_options = [ 'templateResult', 'templateSelection', 'matcher', 'initSelection', 'query' ]; $.each(element.data(), function(key, value){ try { o[key] = $.parseJSON(value); } catch (e) { o[key] = value; } }); func_options.map(function(func, index){ if (o[func] !== undefined) { o[func] = window[o[func]]; } }); if (o.dropdownParent !== undefined) { o.dropdownParent = $(o.dropdownParent); } if($().select2) { try { element.find("select").select2(o); } catch (e) { } } else { console.log('You are trying to use support for Select2, but the plugin is not found!'); } element.data('select', this); }, _destroy: function () { }, _setOption: function ( key, value ) { this._super('_setOption', key, value); } });