Searched defs:internalScrollWrapper (Results 1 - 2 of 2) sorted by relevance

/opengrok/web/js/
H A Dsearchable-option-list-2.0.2.js247 this.internalScrollWrapper = function () { function
1130 this.config.scrollTarget.bind('scroll', this.internalScrollWrapper).trigger('scroll');
1131 $(window).on('resize', this.internalScrollWrapper);
1145 this.config.scrollTarget.unbind('scroll', this.internalScrollWrapper);
H A Dsearchable-option-list-2.0.2.min.js16 (function(d,c,a){var b=function(e,f){this.$originalElement=e;this.options=f;this.metadata=this.$originalElement.data("sol-options")};b.prototype={SOL_OPTION_FORMAT:{type:"option",value:undefined,selected:false,disabled:false,label:undefined,tooltip:undefined,cssClass:""},SOL_OPTIONGROUP_FORMAT:{type:"optiongroup",label:undefined,tooltip:undefined,disabled:false,children:undefined},DATA_KEY:"sol-element",WINDOW_EVENTS_KEY:"sol-window-events",defaults:{data:undefined,name:undefined,texts:{noItemsAvailable:"No entries found",selectAll:"Select all",selectNone:"Select none",quickDelete:"&times;",searchplaceholder:"Click here to search",loadingData:"Still loading data...",itemsSelected:"{$a} more items selected"},events:{onInitialized:undefined,onRendered:undefined,onOpen:undefined,onClose:undefined,onChange:undefined,onScroll:function(){var g=this.$input.offset().top-this.config.scrollTarget.scrollTop()+this.$input.outerHeight(false),h=this.$selectionContainer.outerHeight(false),i=g+h,j=this.config.displayContainerAboveInput||a.documentElement.clientHeight-this.config.scrollTarget.scrollTop()<i,e=this.$innerContainer.outerWidth(false)-parseInt(this.$selectionContainer.css("border-left-width"),10)-parseInt(this.$selectionContainer.css("border-right-width"),10);if(j){g=this.$input.offset().top-h-this.config.scrollTarget.scrollTop()+parseInt(this.$selectionContainer.css("border-bottom-width"),10);this.$container.removeClass("sol-selection-bottom").addClass("sol-selection-top")}else{this.$container.removeClass("sol-selection-top").addClass("sol-selection-bottom")}if(this.$innerContainer.css("display")!=="block"){e=e*1.2}else{var f=j?"border-bottom-right-radius":"border-top-right-radius";this.$selectionContainer.css(f,"initial");if(this.$actionButtons){this.$actionButtons.css(f,"initial")}}this.$selectionContainer.css("top",Math.floor(g)).css("left",Math.floor(this.$container.offset().left)).css("width",e);this.config.displayContainerAboveInput=j}},selectAllMaxItemsThreshold:30,showSelectAll:function(){return this.config.multiple&&this.config.selectAllMaxItemsThreshold&&this.items&&this.items.length<=this.config.selectAllMaxItemsThreshold},useBracketParameters:false,multiple:undefined,resultsContainer:undefined,closeOnClick:false,showSelectionBelowList:false,allowNullSelection:false,scrollTarget:undefined,maxHeight:undefined,converter:undefined,asyncBatchSize:300,searchTimeout:300,maxShow:0},init:function(){this.config=d.extend(true,{},this.defaults,this.options,this.metadata);var e=this._getNameAttribute(),f=this;if(!e){this._showErrorLabel("name attribute is required");return}if(typeof String.prototype.trim!=="function"){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}this.config.multiple=this.config.multiple||this.$originalElement.attr("multiple");if(!this.config.scrollTarget){this.config.scrollTarget=d(c)}this._registerWindowEventsIfNeccessary();this._initializeUiElements();this._initializeInputEvents();setTimeout(function(){f._initializeData();f.$originalElement.data(f.DATA_KEY,f).removeAttr("name").data("sol-name",e)},0);this.$originalElement.hide();this.$container.css("visibility","initial").show();return this},_getNameAttribute:function(){return this.config.name||this.$originalElement.data("sol-name")||this.$originalElement.attr("name")},_showErrorLabel:function(f){var e=d('<div style="color: red; font-weight: bold;" />').html(f);if(!this.$container){e.insertAfter(this.$originalElement)}else{this.$container.append(e)}},_registerWindowEventsIfNeccessary:function(){if(!c[this.WINDOW_EVENTS_KEY]){d(a).click(function(h){var i=d(h.target),g=i.closest(".sol-selection-container"),f=i.closest(".sol-inner-container"),e;if(f.length){e=f.first().parent(".sol-container")}else{if(g.length){e=g.first().parent(".sol-container")}}d(".sol-active").not(e).each(function(j,k){d(k).data(b.prototype.DATA_KEY).close()})});c[this.WINDOW_EVENTS_KEY]=true}},_initializeUiElements:function(){var m=this;this.internalScrollWrapper=function(){if(d.isFunction(m.config.events.onScroll)){m.config.events.onScroll.call(m)}};this.$input=d('<input type="text"/>').attr("placeholder",this.config.texts.searchplaceholder);this.$noResultsItem=d('<div class="sol-no-results"/>').html(this.config.texts.noItemsAvailable).hide();this.$loadingData=d('<div class="sol-loading-data"/>').html(this.config.texts.loadingData);this.$xItemsSelected=d('<div class="sol-results-count"/>');this.$caret=d('<div class="sol-caret-container"><b class="sol-caret"/></div>').click(function(i){m.toggle();i.preventDefault();return false});var k=d('<div class="sol-input-container"/>').append(this.$input);this.$innerContainer=d('<div class="sol-inner-container"/>').append(k).append(this.$caret);this.$selection=d('<div class="sol-selection"/>');this.$selectionContainer=d('<div class="sol-selection-container"/>').append(this.$noResultsItem).append(this.$loadingData).append(this.$selection);this.$container=d('<div class="sol-container"/>').hide().keydown(function(p){if(p.keyCode==13){var o="";d("#sbox #qtbl input[type='text']").each(function(){o+=d.trim(d(this).val())});if(p.keyCode==13&&o===""){if(m.$input.val()!==""){c.location=a.xrefPath+"/"+m.$input.val();return false}var i=d(".keyboard-selection").first().find(".sol-checkbox");if(i.length&&i.data("sol-item")&&i.data("sol-item").label){c.location=a.xrefPath+"/"+i.data("sol-item").label;return false}i=d(".sol-selected-display-item").first();if(i.length&&i.data("label")){c.location=a.xrefPath+"/"+i.data("label");return false}return false}return true}}).data(this.DATA_KEY,this).append(this.$selectionContainer).append(this.$innerContainer).insertBefore(this.$originalElement);this.$showSelectionContainer=d('<div class="sol-current-selection"/>');var n=this.config.resultsContainer||this.$innerContainer;if(this.config.resultsContainer){this.$showSelectionContainer.appendTo(n)}else{if(this.config.showSelectionBelowList){this.$showSelectionContainer.insertAfter(n)}else{this.$showSelectionContainer.insertBefore(n)}}if(this.config.maxHeight){this.$selection.css("max-height",this.config.maxHeight)}var l=this.$originalElement.attr("class"),h=this.$originalElement.attr("style"),e=[],f=[];if(l&&l.length>0){e=l.split(/\s+/);for(var g=0;g<e.length;g++){this.$container.addClass(e[g])}}if(h&&h.length>0){f=h.split(/\;/);for(var g=0;g<f.length;g++){var j=f[g].split(/\s*\:\s*/g);if(j.length===2){if(j[0].toLowerCase().indexOf("height")>=0){this.$innerContainer.css(j[0].trim(),j[1].trim())}else{this.$container.css(j[0].trim(),j[1].trim())}}}}if(this.$originalElement.css("display")!=="block"){this.$container.css("width",this._getActualCssPropertyValue(this.$originalElement,"width"))}if(d.isFunction(this.config.events.onRendered)){this.config.events.onRendered.call(this,this)}},_getActualCssPropertyValue:function(e,f){var h=e.get(0),g=e.css("display");e.css("display","none");if(h.currentStyle){return h.currentStyle[f]}else{if(c.getComputedStyle){return a.defaultView.getComputedStyle(h,null).getPropertyValue(f)}}e.css("display",g);return e.css(f)},_initializeInputEvents:function(){var f=this,e=this.$input.parents("form").first();if(e&&e.length===1&&!e.data(this.WINDOW_EVENTS_KEY)){var g=function(){var h=[];e.find(".sol-option input").each(function(k,l){var j=d(l),i=j.data("sol-item").selected;if(j.prop("checked")!==i){j.prop("checked",i).trigger("sol-change",true);h.push(j)}});if(h.length>0&&d.isFunction(f.config.events.onChange)){f.config.events.onChange.call(f,f,h)}};e.on("reset",function(h){g.call(f);setTimeout(function(){g.call(f)},100)});e.data(this.WINDOW_EVENTS_KEY,true)}this.$input.focus(function(){f.open()}).on("propertychange input",function(i){var h=true;if(i.type=="propertychange"){h=i.originalEvent.propertyName.toLowerCase()=="value"}if(h){if(d(this).data("timeout")){clearTimeout(d(this).data("timeout"))}d(this).data("timeout",setTimeout(function(){f._applySearchTermFilter()},f.config.searchTimeout))}});this.$container.on("keydown",function(m){var l=m.keyCode;if(!f.$noResultsItem.is(":visible")){var n,j,k,i=false,o=f.$selection.find(".sol-option:visible");if(l===40||l===38){f._setKeyBoardNavigationMode(true);n=f.$selection.find(".sol-option.keyboard-selection");n.find("input[type='checkbox']").blur();k=(l===38)?-1:1;var h=o.index(n)+k;if(h<0){h=o.length-1}else{if(h>=o.length){h=0}}n.removeClass("keyboard-selection");j=d(o[h]).addClass("keyboard-selection");j.find("input[type='checkbox']").focus();i=true}else{if(f.keyboardNavigationMode===true&&l===32){n=f.$selection.find(".sol-option.keyboard-selection input");n.trigger("change");i=true}}if(i){m.preventDefault();return false}}}).on("keyup",function(i){var h=i.keyCode;if(h===27){if(f.keyboardNavigationMode===true){f._setKeyBoardNavigationMode(false)}else{if(f.$input.val()===""){f.$caret.trigger("click");f.$input.trigger("blur")}else{f.$input.val("").trigger("input")}}}else{if(h===16||h===17||h===18||h===20){return}}})},_setKeyBoardNavigationMode:function(e){if(e){this.keyboardNavigationMode=true;this.$selection.addClass("sol-keyboard-navigation")}else{this.keyboardNavigationMode=false;this.$selection.find(".sol-option.keyboard-selection");this.$selection.removeClass("sol-keyboard-navigation");this.$selectionContainer.find(".sol-option.keyboard-selection").removeClass("keyboard-selection");this.$selection.scrollTop(0)}},_applySearchTermFilter:function(){if(!this.items||this.items.length===0){return}var e=this.$input.val(),f=(e||"").toLowerCase();this.$selectionContainer.find(".sol-filtered-search").removeClass("sol-filtered-search");this._setNoResultsItemVisible(false);if(f.trim().length>0){this._findTerms(this.items,f)}if(d.isFunction(this.config.events.onScroll)){this.config.events.onScroll.call(this)}},_findTerms:function(l,g){if(!l||!d.isArray(l)||l.length===0){return}var o=this,j=l.length;this._setKeyBoardNavigationMode(false);for(var e=0;e<l.length;e++){var n=l[e];if(n.type==="option"){var m=n.displayElement,k=(n.label+" "+n.tooltip).trim().toLowerCase();if(k.indexOf(g)===-1){m.addClass("sol-filtered-search");j--}}else{var i=n.children.length;for(var h=0;h<n.children.length;h++){var f=n.children[h];if(f.type==="option"){var m=f.displayElement,k=(f.label+" "+f.tooltip).trim().toLowerCase();if(k.indexOf(g)===-1){m.addClass("sol-filtered-search");i--}}}if(i===0){n.displayElement.addClass("sol-filtered-search");j--}}}this._setNoResultsItemVisible(j===0)},_initializeData:function(){if(!this.config.data){this.items=this._detectDataFromOriginalElement()}else{if(d.isFunction(this.config.data)){this.items=this._fetchDataFromFunction(this.config.data)}else{if(d.isArray(this.config.data)){this.items=this._fetchDataFromArray(this.config.data)}else{if(typeof this.config.data===(typeof"a string")){this._loadItemsFromUrl(this.config.data)}else{this._showErrorLabel("Unknown data type")}}}}if(this.items){this._processDataItems(this.items)}},_detectDataFromOriginalElement:function(){if(this.$originalElement.prop("tagName").toLowerCase()==="select"){var f=this,e=[];d.each(this.$originalElement.children(),function(i,k){var h=d(k),j=h.prop("tagName").toLowerCase(),l;if(j==="option"){l=f._processSelectOption(h);if(l){e.push(l)}}else{if(j==="optgroup"){l=f._processSelectOptgroup(h);if(l){e.push(l)}}else{f._showErrorLabel("Invalid element found in select: "+j+". Only option and optgroup are allowed")}}});return this._invokeConverterIfNeccessary(e)}else{if(this.$originalElement.data("sol-data")){var g=this.$originalElement.data("sol-data");return this._invokeConverterIfNeccessary(g)}else{this._showErrorLabel('Could not determine data from original element. Must be a select or data must be provided as data-sol-data="" attribute')}}},_processSelectOption:function(e){return d.extend({},this.SOL_OPTION_FORMAT,{value:e.val(),selected:e.prop("selected"),disabled:e.prop("disabled"),cssClass:e.attr("class"),label:e.html(),tooltip:e.attr("title"),element:e})},_processSelectOptgroup:function(f){var h=this,g=d.extend({},this.SOL_OPTIONGROUP_FORMAT,{label:f.attr("label"),tooltip:f.attr("title"),disabled:f.prop("disabled"),children:[]}),e=f.children("option");d.each(e,function(j,k){var l=d(k),i=h._processSelectOption(l);if(g.disabled){i.disabled=true}g.children.push(i)});return g},_fetchDataFromFunction:function(e){return this._invokeConverterIfNeccessary(e(this))},_fetchDataFromArray:function(e){return this._invokeConverterIfNeccessary(e)},_loadItemsFromUrl:function(f){var e=this;d.ajax(f,{success:function(g){e.items=e._invokeConverterIfNeccessary(g);if(e.items){e._processDataItems(e.items)}},error:function(i,g,h){e._showErrorLabel("Error loading from url "+f+": "+h)},dataType:"json"})},_invokeConverterIfNeccessary:function(e){if(d.isFunction(this.config.converter)){return this.config.converter.call(this,this,e)}return e},_processDataItems:function(i){if(!i){this._showErrorLabel("Data items not present. Maybe the converter did not return any values");return}if(i.length===0){this._setNoResultsItemVisible(true);this.$loadingData.remove();return}var g=this,f=0,e=function(){this.$loadingData.remove();this._initializeSelectAll();if(d.isFunction(this.config.events.onInitialized)){this.config.events.onInitialized.call(this,this,i)}},h=function(){var j=0,k;while(j++<g.config.asyncBatchSize&&f<i.length){k=i[f++];if(k.type===g.SOL_OPTION_FORMAT.type){g._renderOption(k)}else{if(k.type===g.SOL_OPTIONGROUP_FORMAT.type){g._renderOptiongroup(k)}else{g._showErrorLabel("Invalid item type found "+k.type);return}}}if(f>=i.length){e.call(g)}else{setTimeout(h,0)}};h.call(this)},_renderOption:function(f,l){var n=this,g=l||this.$selection,m,e=d('<div class="sol-label-text"/>').html(f.label.trim().length===0?"&nbsp;":f.label).addClass(f.cssClass),k,j,i=this._getNameAttribute();var h=d(f.element).data("messages");if(h&&h.length){e.append(d("<span>").addClass("pull-right important-note important-note-rounded").data("messages",h).attr("data-messages","").text("!"))}if(this.config.multiple){m=d('<input type="checkbox" class="sol-checkbox"/>');if(this.config.useBracketParameters){i+="[]"}}else{m=d('<input type="radio" class="sol-radio"/>').on("change",function(){n.$selectionContainer.find('input[type="radio"][name="'+i+'"]').not(d(this)).trigger("sol-deselect")}).on("sol-deselect",function(){n._removeSelectionDisplayItem(d(this))})}m.on("change",function(p,o){d(this).trigger("sol-change",o)}).on("sol-change",function(q,o){var p=d(this).closest(".sol-option");n._setKeyBoardNavigationMode(true);n.$selection.find(".sol-option.keyboard-selection").removeClass("keyboard-selection");p.addClass("keyboard-selection");n._selectionChange(d(this),o)}).data("sol-item",f).prop("checked",f.selected).prop("disabled",f.disabled).attr("name",i).val(f.value);k=d('<label class="sol-label"/>').attr("title",f.tooltip).append(m).append(e);j=d('<div class="sol-option"/>').dblclick(function(p){var o=d(this).find(".sol-checkbox");if(o.length&&o.data("sol-item")&&o.data("sol-item").label){c.location=a.xrefPath+"/"+d(this).find(".sol-checkbox").data("sol-item").label}}).append(k);m.data("messages-available",h&&h.length);f.displayElement=j;g.append(j);if(f.selected){this._addSelectionDisplayItem(m)}},_renderOptiongroup:function(g){var f=this,e=d('<div class="sol-optiongroup-label"/>').attr("title",g.tooltip).html(g.label),h=d('<div class="sol-optiongroup"/>').append(e);if(g.disabled){h.addClass("disabled")}e.dblclick(function(i){if(f.config.multiple){if(!i.ctrlKey){f.deselectAll()}f.selectAll(d(this).text());f.$selection.scrollTop(f.$selection.scrollTop()+d(this).position().top)}});this.$selection.append(h);if(d.isArray(g.children)){d.each(g.children,function(i,j){f._renderOption(j,h)})}g.displayElement=h},_initializeSelectAll:function(){if(this.config.showSelectAll===true||(d.isFunction(this.config.showSelectAll)&&this.config.showSelectAll.call(this))){var e=this,g=d('<a href="#" class="sol-deselect-all"/>').html(this.config.texts.selectNone).click(function(h){e.deselectAll();h.preventDefault();return false}),f=d('<a href="#" class="sol-select-all"/>').html(this.config.texts.selectAll).click(function(h){e.selectAll();h.preventDefault();return false});this.$actionButtons=d('<div class="sol-action-buttons"/>').append(f).append(g).append('<div class="sol-clearfix"/>');this.$selectionContainer.prepend(this.$actionButtons)}},_selectionChange:function(g,f){if(this.$originalElement&&this.$originalElement.prop("tagName").toLowerCase()==="select"){var e=this;this.$originalElement.find("option").each(function(h,j){var i=d(j);if(i.val()===g.val()){i.prop("selected",g.prop("checked"));e.$originalElement.trigger("change");return}})}if(g.prop("checked")){this._addSelectionDisplayItem(g)}else{this._removeSelectionDisplayItem(g)}if(this.config.multiple){this.config.scrollTarget.trigger("scroll")}else{this.close()}if(!f&&d.isFunction(this.config.events.onChange)){this.config.events.onChange.call(this,this,g)}},_addSelectionDisplayItem:function(i){var k=i.data("sol-item"),g=k.displaySelectionItem,j;if(!g){var h=this.$showSelectionContainer.children(".sol-selected-display-item");var f=k.label;if(i.data("messages-available")){f+=' <span class="important-note important-note-rounded" ';f+='title="Some message is important in this project.';f+=' Find more info in the project list below.">!</span>'}j=d('<span class="sol-selected-display-item-text" />').html(f);g=d('<div class="sol-selected-display-item"/>').append(j).attr("title",k.tooltip).data("label",k.label).appendTo(this.$showSelectionContainer);if((this.config.multiple||this.config.allowNullSelection)&&!i.prop("disabled")){d('<span class="sol-quick-delete"/>').html(this.config.texts.quickDelete).click(function(){i.prop("checked",false).trigger("change")}).prependTo(g)}if(this.config.maxShow!=0&&h.length+1>this.config.maxShow){var e=this.config.texts.itemsSelected.replace("{$a}",h.length+1-this.config.maxShow);this.$xItemsSelected.html('<div class="sol-selected-display-item-text">'+e+"<div>");this.$showSelectionContainer.append(this.$xItemsSelected);this.$xItemsSelected.show();g.hide()}k.displaySelectionItem=g}},_removeSelectionDisplayItem:function(h){var i=h.data("sol-item"),e=i.displaySelectionItem;if(e){var g=this.$showSelectionContainer.children(".sol-selected-display-item");if(this.config.maxShow!=0&&g.length-1>this.config.maxShow){var f=this.config.texts.itemsSelected.replace("{$a}",g.length-1-this.config.maxShow);this.$xItemsSelected.html('<div class="sol-selected-display-item-text">'+f+"<div>");this.$showSelectionContainer.append(this.$xItemsSelected);this.$xItemsSelected.show()}else{this.$xItemsSelected.hide()}if(e.is(":visible")){e.siblings(".sol-selected-display-item").not(":visible").not(this.$xItemsSelected).first().show()}e.remove();i.displaySelectionItem=undefined}},_setNoResultsItemVisible:function(e){if(e){this.$noResultsItem.show();this.$selection.hide();if(this.$actionButtons){this.$actionButtons.hide()}}else{this.$noResultsItem.hide();this.$selection.show();if(this.$actionButtons){this.$actionButtons.show()}}},isOpen:function(){return this.$container.hasClass("sol-active")},isClosed:function(){return !this.isOpen()},toggle:function(){if(this.isOpen()){this.close()}else{this.open()}},open:function(){if(this.isClosed()){this.$container.addClass("sol-active");this.config.scrollTarget.bind("scroll",this.internalScrollWrapper).trigger("scroll");d(c).on("resize",this.internalScrollWrapper);if(d.isFunction(this.config.events.onOpen)){this.config.events.onOpen.call(this,this)}}},close:function(){if(this.isOpen()){this._setKeyBoardNavigationMode(false);this.$container.removeClass("sol-active");this.config.scrollTarget.unbind("scroll",this.internalScrollWrapper);d(c).off("resize");this.$input.val("");this._applySearchTermFilter();this.config.displayContainer (…) function

Completed in 13 milliseconds