var msBeautify = msBeautify || {}; (function ($) { msBeautify = { version: {msDropdown:'3.2'}, author: "Marghoob Suleman", counter: 20, debug: function (v) { if (v !== false) { $(".ddOutOfVision").css({height: 'auto', position: 'relative'}); } else { $(".ddOutOfVision").css({height: '0px', position: 'absolute'}); } }, oldDiv: '', create: function (id, settings, type) { type = type || "dropdown"; var data; switch (type.toLowerCase()) { case "dropdown": case "select": data = $(id).msDropdown(settings).data("dd"); break; } return data; } }; $.msDropDown = {}; $.msDropdown = {}; $.extend(true, $.msDropDown, msBeautify); $.extend(true, $.msDropdown, msBeautify); // make compatibiliy with old and new jquery if ($.fn.prop === undefined) {$.fn.prop = $.fn.attr;} if ($.fn.on === undefined) {$.fn.on = $.fn.bind;$.fn.off = $.fn.unbind;} if (typeof $.expr.createPseudo === 'function') { //jQuery 1.8 or greater $.expr[':'].Contains = $.expr.createPseudo(function (arg) {return function (elem) { return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0; }; }); } else { //lower version $.expr[':'].Contains = function (a, i, m) {return $(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0; }; } //dropdown class function dd(element, settings) { var _settings = $.extend(true,{byJson: {data: null, selectedIndex: 0, name: null, size: 0, multiple: false, width: 250}, mainCSS: 'dd', height: 120, //not using currently visibleRows: 6, rowHeight: 0, showIcon: true, zIndex: 9998, useSprite: false, // no slidedown animation for us animStyle: 'none', // animStyle: 'slideDown', event:'click', openDirection: 'auto', //auto || alwaysUp jsonTitle: true, style: '', disabledOpacity: 0.7, disabledOptionEvents: true, childWidth:0, enableCheckbox:false, //this needs to multiple or it will set element to multiple checkboxNameSuffix:'_mscheck', append:'', prepend:'', //enableFilterbox:true, isTitleFixed:false, // When false, the title will not be changing with the current selected option. on: {create: null,open: null,close: null,add: null,remove: null,change: null,blur: null,click: null,dblclick: null,mousemove: null,mouseover: null,mouseout: null,focus: null,mousedown: null,mouseup: null} }, settings); var _this = this; //this class var _holderId = {postElementHolder: '_msddHolder', postID: '_msdd', postTitleContainerID: '_titleContainer', postTitleID: '_title',postDefaultTitleID: '_defaultTitle',postTitleTextID: '_titleText', postChildID: '_child'}; var _styles = {dd:_settings.mainCSS, errorCSS: 'hpui-error', ddTitle: 'ddTitle', arrow: 'arrow arrowoff', arrowTDCSS: 'arrowTD', ddChild: 'ddChild', ddTitleText: 'ddTitleText',disabled: 'disabled', enabled: 'enabled', ddOutOfVision: 'ddOutOfVision', borderTop: 'borderTop', noBorderTop: 'noBorderTop', selected: 'selected', divider: 'divider', optgroup: "optgroup", optgroupTitle: "optgroupTitle", /*description: "description",*/ label: "ddlabel",hover: 'hover',disabledAll: 'disabledAll',screenReaderCSS:'hpui-screenreader-text'}; var _styles_i = {li: '_msddli_',borderRadiusTp: 'borderRadiusTp1',ddChildMore: 'border shadow',fnone: "fnone"}; var _isList = false, _isMultiple=false,_isDisabled=false, _cacheElement = {}, _element, _orginial; var _isOpenFlag=false; //whether the dropdown is expanded or collasped var _isFilterBoxOpen=false; //whether the filterbox is open or close var _isScrollDown=false; //whether scroll down or scroll up accroding to the space var DOWN_ARROW = 40, UP_ARROW = 38, LEFT_ARROW=37, RIGHT_ARROW=39, ESCAPE = 27, ENTER = 13, ALPHABETS_START = 47, SHIFT=16 , CONTROL = 17 , TAB = 9; var _shiftHolded=false, _controlHolded=false,_lastTarget=null,_forcedTrigger=false, _oldSelected, _isCreated = false; var _doc = document; var _currentOption=null; //when pressing character key to select an option, this represents the current selected one. var menuTitleScreenReadingSpan=null; //the entry anchor element for menu type dropdowns var visibleRowsContainerHeight = 0; //store the height of of visible rows' container' (i.e. the