1/*! 2 * JavaScript Custom Forms : Select Module 3 * 4 * Copyright 2014-2015 PSD2HTML - http://psd2html.com/jcf 5 * Released under the MIT license (LICENSE.txt) 6 * 7 * Version: 1.2.3 8 */ 9!(function (e) { 10 e.addModule(function (t, s) { 11 'use strict'; 12 function i(e) { 13 (this.options = t.extend( 14 { 15 wrapNative: !0, 16 wrapNativeOnMobile: !0, 17 fakeDropInBody: !0, 18 useCustomScroll: !0, 19 flipDropToFit: !0, 20 maxVisibleItems: 10, 21 fakeAreaStructure: 22 '<span class="jcf-select"><span class="jcf-select-text"></span><span class="jcf-select-opener"></span></span>', 23 fakeDropStructure: 24 '<div class="jcf-select-drop"><div class="jcf-select-drop-content"></div></div>', 25 optionClassPrefix: 'jcf-option-', 26 selectClassPrefix: 'jcf-select-', 27 dropContentSelector: '.jcf-select-drop-content', 28 selectTextSelector: '.jcf-select-text', 29 dropActiveClass: 'jcf-drop-active', 30 flipDropClass: 'jcf-drop-flipped', 31 }, 32 e 33 )), 34 this.init(); 35 } 36 function o(e) { 37 (this.options = t.extend( 38 { 39 wrapNative: !0, 40 useCustomScroll: !0, 41 fakeStructure: 42 '<span class="jcf-list-box"><span class="jcf-list-wrapper"></span></span>', 43 selectClassPrefix: 'jcf-select-', 44 listHolder: '.jcf-list-wrapper', 45 }, 46 e 47 )), 48 this.init(); 49 } 50 function n(e) { 51 (this.options = t.extend( 52 { 53 holder: null, 54 maxVisibleItems: 10, 55 selectOnClick: !0, 56 useHoverClass: !1, 57 useCustomScroll: !1, 58 handleResize: !0, 59 multipleSelectWithoutKey: !1, 60 alwaysPreventMouseWheel: !1, 61 indexAttribute: 'data-index', 62 cloneClassPrefix: 'jcf-option-', 63 containerStructure: 64 '<span class="jcf-list"><span class="jcf-list-content"></span></span>', 65 containerSelector: '.jcf-list-content', 66 captionClass: 'jcf-optgroup-caption', 67 disabledClass: 'jcf-disabled', 68 optionClass: 'jcf-option', 69 groupClass: 'jcf-optgroup', 70 hoverClass: 'jcf-hover', 71 selectedClass: 'jcf-selected', 72 scrollClass: 'jcf-scroll-active', 73 }, 74 e 75 )), 76 this.init(); 77 } 78 var l = { 79 name: 'Select', 80 selector: 'select', 81 options: { element: null, multipleCompactStyle: !1 }, 82 plugins: { ListBox: o, ComboBox: i, SelectList: n }, 83 matchElement: function (e) { 84 return e.is('select'); 85 }, 86 init: function () { 87 (this.element = t(this.options.element)), this.createInstance(); 88 }, 89 isListBox: function () { 90 return this.element.is('[size]:not([jcf-size]), [multiple]'); 91 }, 92 createInstance: function () { 93 this.instance && this.instance.destroy(), 94 this.isListBox() && !this.options.multipleCompactStyle 95 ? (this.instance = new o(this.options)) 96 : (this.instance = new i(this.options)); 97 }, 98 refresh: function () { 99 var e = 100 (this.isListBox() && this.instance instanceof i) || 101 (!this.isListBox() && this.instance instanceof o); 102 e ? this.createInstance() : this.instance.refresh(); 103 }, 104 destroy: function () { 105 this.instance.destroy(); 106 }, 107 }; 108 t.extend(i.prototype, { 109 init: function () { 110 this.initStructure(), 111 this.bindHandlers(), 112 this.attachEvents(), 113 this.refresh(); 114 }, 115 initStructure: function () { 116 (this.win = t(s)), 117 (this.doc = t(document)), 118 (this.realElement = t(this.options.element)), 119 (this.fakeElement = t( 120 this.options.fakeAreaStructure 121 ).insertAfter(this.realElement)), 122 (this.selectTextContainer = this.fakeElement.find( 123 this.options.selectTextSelector 124 )), 125 (this.selectText = t('<span></span>').appendTo( 126 this.selectTextContainer 127 )), 128 h(this.fakeElement), 129 this.fakeElement.addClass( 130 r( 131 this.realElement.prop('className'), 132 this.options.selectClassPrefix 133 ) 134 ), 135 this.realElement.prop('multiple') && 136 this.fakeElement.addClass('jcf-compact-multiple'), 137 this.options.isMobileDevice && 138 this.options.wrapNativeOnMobile && 139 !this.options.wrapNative && 140 (this.options.wrapNative = !0), 141 this.options.wrapNative 142 ? this.realElement 143 .prependTo(this.fakeElement) 144 .css({ 145 position: 'absolute', 146 height: '100%', 147 width: '100%', 148 }) 149 .addClass(this.options.resetAppearanceClass) 150 : (this.realElement.addClass(this.options.hiddenClass), 151 this.fakeElement.attr( 152 'title', 153 this.realElement.attr('title') 154 ), 155 (this.fakeDropTarget = this.options.fakeDropInBody 156 ? t('body') 157 : this.fakeElement)); 158 }, 159 attachEvents: function () { 160 var e = this; 161 (this.delayedRefresh = function () { 162 setTimeout(function () { 163 e.refresh(), 164 e.list && 165 (e.list.refresh(), 166 e.list.scrollToActiveOption()); 167 }, 1); 168 }), 169 this.options.wrapNative 170 ? this.realElement.on({ 171 focus: this.onFocus, 172 change: this.onChange, 173 click: this.onChange, 174 keydown: this.delayedRefresh, 175 }) 176 : (this.realElement.on({ 177 focus: this.onFocus, 178 change: this.onChange, 179 keydown: this.onKeyDown, 180 }), 181 this.fakeElement.on({ 182 'jcf-pointerdown': this.onSelectAreaPress, 183 })); 184 }, 185 onKeyDown: function (e) { 186 13 === e.which 187 ? this.toggleDropdown() 188 : this.dropActive && this.delayedRefresh(); 189 }, 190 onChange: function () { 191 this.refresh(); 192 }, 193 onFocus: function () { 194 (this.pressedFlag && this.focusedFlag) || 195 (this.fakeElement.addClass(this.options.focusClass), 196 this.realElement.on('blur', this.onBlur), 197 this.toggleListMode(!0), 198 (this.focusedFlag = !0)); 199 }, 200 onBlur: function () { 201 this.pressedFlag || 202 (this.fakeElement.removeClass(this.options.focusClass), 203 this.realElement.off('blur', this.onBlur), 204 this.toggleListMode(!1), 205 (this.focusedFlag = !1)); 206 }, 207 onResize: function () { 208 this.dropActive && this.hideDropdown(); 209 }, 210 onSelectDropPress: function () { 211 this.pressedFlag = !0; 212 }, 213 onSelectDropRelease: function (e, t) { 214 (this.pressedFlag = !1), 215 'mouse' === t.pointerType && this.realElement.focus(); 216 }, 217 onSelectAreaPress: function (e) { 218 var s = 219 !this.options.fakeDropInBody && 220 t(e.target).closest(this.dropdown).length; 221 s || 222 e.button > 1 || 223 this.realElement.is(':disabled') || 224 ((this.selectOpenedByEvent = e.pointerType), 225 this.toggleDropdown(), 226 this.focusedFlag ||
227 ('mouse' === e.pointerType 228 ? this.realElement.focus() 229 : this.onFocus(e)), 230 (this.pressedFlag = !0), 231 this.fakeElement.addClass(this.options.pressedClass), 232 this.doc.on('jcf-pointerup', this.onSelectAreaRelease)); 233 }, 234 onSelectAreaRelease: function (e) { 235 this.focusedFlag && 236 'mouse' === e.pointerType && 237 this.realElement.focus(), 238 (this.pressedFlag = !1), 239 this.fakeElement.removeClass(this.options.pressedClass), 240 this.doc.off('jcf-pointerup', this.onSelectAreaRelease); 241 }, 242 onOutsideClick: function (e) { 243 var s = t(e.target), 244 i = 245 s.closest(this.fakeElement).length || 246 s.closest(this.dropdown).length; 247 i || this.hideDropdown(); 248 }, 249 onSelect: function () { 250 this.refresh(), 251 this.realElement.prop('multiple') 252 ? this.repositionDropdown() 253 : this.hideDropdown(), 254 this.fireNativeEvent(this.realElement, 'change'); 255 }, 256 toggleListMode: function (e) { 257 this.options.wrapNative || 258 (e 259 ? this.realElement.attr({ size: 4, 'jcf-size': '' }) 260 : this.options.wrapNative || 261 this.realElement.removeAttr('size jcf-size')); 262 }, 263 createDropdown: function () { 264 this.dropdown && (this.list.destroy(), this.dropdown.remove()), 265 (this.dropdown = t(this.options.fakeDropStructure).appendTo( 266 this.fakeDropTarget 267 )), 268 this.dropdown.addClass( 269 r( 270 this.realElement.prop('className'), 271 this.options.selectClassPrefix 272 ) 273 ), 274 h(this.dropdown), 275 this.realElement.prop('multiple') && 276 this.dropdown.addClass('jcf-compact-multiple'), 277 this.options.fakeDropInBody && 278 this.dropdown.css({ position: 'absolute', top: -9999 }), 279 (this.list = new n({ 280 useHoverClass: !0, 281 handleResize: !1, 282 alwaysPreventMouseWheel: !0, 283 maxVisibleItems: this.options.maxVisibleItems, 284 useCustomScroll: this.options.useCustomScroll, 285 holder: this.dropdown.find( 286 this.options.dropContentSelector 287 ), 288 multipleSelectWithoutKey: 289 this.realElement.prop('multiple'), 290 element: this.realElement, 291 })), 292 t(this.list).on({ 293 select: this.onSelect, 294 press: this.onSelectDropPress, 295 release: this.onSelectDropRelease, 296 }); 297 }, 298 repositionDropdown: function () { 299 var e, 300 t, 301 s, 302 i = this.fakeElement.offset(), 303 o = this.fakeElement[0].getBoundingClientRect(), 304 n = o.width || o.right - o.left, 305 l = this.fakeElement.outerHeight(), 306 r = this.dropdown.css('width', n).outerHeight(), 307 h = this.win.scrollTop(), 308 a = this.win.height(), 309 c = !1; 310 i.top + l + r > h + a && i.top - r > h && (c = !0), 311 this.options.fakeDropInBody && 312 ((s = 313 'static' !== this.fakeDropTarget.css('position') 314 ? this.fakeDropTarget.offset().top 315 : 0), 316 this.options.flipDropToFit && c 317 ? ((t = i.left), (e = i.top - r - s)) 318 : ((t = i.left), (e = i.top + l - s)), 319 this.dropdown.css({ width: n, left: t, top: e })), 320 this.dropdown 321 .add(this.fakeElement) 322 .toggleClass( 323 this.options.flipDropClass, 324 this.options.flipDropToFit && c 325 ); 326 }, 327 showDropdown: function () { 328 this.realElement.prop('options').length && 329 (this.dropdown || this.createDropdown(), 330 (this.dropActive = !0), 331 this.dropdown.appendTo(this.fakeDropTarget), 332 this.fakeElement.addClass(this.options.dropActiveClass), 333 this.refreshSelectedText(), 334 this.repositionDropdown(), 335 this.list.setScrollTop(this.savedScrollTop), 336 this.list.refresh(), 337 this.win.on('resize', this.onResize), 338 this.doc.on('jcf-pointerdown', this.onOutsideClick)); 339 }, 340 hideDropdown: function () { 341 this.dropdown && 342 ((this.savedScrollTop = this.list.getScrollTop()), 343 this.fakeElement.removeClass( 344 this.options.dropActiveClass + 345 ' ' + 346 this.options.flipDropClass 347 ), 348 this.dropdown 349 .removeClass(this.options.flipDropClass) 350 .detach(), 351 this.doc.off('jcf-pointerdown', this.onOutsideClick), 352 this.win.off('resize', this.onResize), 353 (this.dropActive = !1), 354 'touch' === this.selectOpenedByEvent && this.onBlur()); 355 }, 356 toggleDropdown: function () { 357 this.dropActive ? this.hideDropdown() : this.showDropdown(); 358 }, 359 refreshSelectedText: function () { 360 var e, 361 s = this.realElement.prop('selectedIndex'), 362 i = this.realElement.prop('options')[s], 363 o = i ? i.getAttribute('data-image') : null, 364 n = '', 365 l = this; 366 this.realElement.prop('multiple') 367 ? (t.each( 368 this.realElement.prop('options'), 369 function (e, t) { 370 t.selected && 371 (n += (n ? ', ' : '') + t.innerHTML); 372 } 373 ), 374 n || (n = l.realElement.attr('placeholder') || ''), 375 this.selectText.removeAttr('class').html(n)) 376 : i 377 ? (this.currentSelectedText === i.innerHTML && 378 this.currentSelectedImage === o) || 379 ((e = r(i.className, this.options.optionClassPrefix)), 380 this.selectText.attr('class', e).html(i.innerHTML), 381 o 382 ? (this.selectImage || 383 (this.selectImage = t('<img>') 384 .prependTo(this.selectTextContainer) 385 .hide()), 386 this.selectImage.attr('src', o).show()) 387 : this.selectImage && this.selectImage.hide(), 388 (this.currentSelectedText = i.innerHTML), 389 (this.currentSelectedImage = o)) 390 : (this.selectImage && this.selectImage.hide(), 391 this.selectText.removeAttr('class').empty()); 392 }, 393 refresh: function () { 394 'none' === this.realElement.prop('style').display 395 ? this.fakeElement.hide() 396 : this.fakeElement.show(), 397 this.refreshSelectedText(), 398 this.fakeElement.toggleClass( 399 this.options.disabledClass, 400 this.realElement.is(':disabled') 401 ); 402 }, 403 destroy: function () { 404 this.options.wrapNative 405 ? this.realElement 406 .insertBefore(this.fakeElement) 407 .css({ position: '', height: '', width: '' }) 408 .removeClass(this.options.resetAppearanceClass) 409 : (this.realElement.removeClass(this.options.hiddenClass), 410 this.realElement.is('[jcf-size]') && 411 this.realElement.removeAttr('size jcf-size')), 412 this.fakeElement.remove(), 413 this.doc.off('jcf-pointerup', this.onSelectAreaRelease), 414 this.realElement.off({ focus: this.onFocus }); 415 }, 416 }), 417 t.extend(o.prototype, { 418 init: function () { 419 this.bindHandlers(), 420 this.initStructure(), 421 this.attachEvents(); 422 }, 423 initStructure: function () { 424 (this.realElement = t(this.options.element)), 425 (this.fakeElement = t( 426 this.options.fakeStructure 427 ).insertAfter(this.realElement)), 428 (this.listHolder = this.fakeElement.find( 429 this.options.listHolder 430 )), 431 h(this.fakeElement), 432 this.fakeElement.addClass( 433 r( 434 this.realElement.prop('className'), 435 this.options.selectClassPrefix 436 ) 437 ), 438 this.realElement.addClass(this.options.hiddenClass), 439 (this.list = new n({ 440 useCustomScroll: this.options.useCustomScroll, 441 holder: this.listHolder, 442 selectOnClick: !1, 443 element: this.realElement, 444 })); 445 }, 446 attachEvents: function () { 447 var e = this; 448 (this.delayedRefresh = function (t) { 449 (t && 450 (16 === t.which || 451 t.ctrlKey || 452 t.metaKey || 453 t.altKey)) || 454 (clearTimeout(e.refreshTimer), 455 (e.refreshTimer = setTimeout(function () { 456 e.refresh(), e.list.scrollToActiveOption(); 457 }, 1))); 458 }), 459 this.realElement.on({ 460 focus: this.onFocus, 461 click: this.delayedRefresh, 462 keydown: this.delayedRefresh, 463 }), 464 t(this.list).on({ 465 select: this.onSelect, 466 press: this.onFakeOptionsPress, 467 release: this.onFakeOptionsRelease, 468 }); 469 }, 470 onFakeOptionsPress: function (e, t) { 471 (this.pressedFlag = !0), 472 'mouse' === t.pointerType && this.realElement.focus(); 473 }, 474 onFakeOptionsRelease: function (e, t) { 475 (this.pressedFlag = !1), 476 'mouse' === t.pointerType && this.realElement.focus(); 477 }, 478 onSelect: function () { 479 this.fireNativeEvent(this.realElement, 'change'), 480 this.fireNativeEvent(this.realElement, 'click'); 481 }, 482 onFocus: function () { 483 (this.pressedFlag && this.focusedFlag) || 484 (this.fakeElement.addClass(this.options.focusClass), 485 this.realElement.on('blur', this.onBlur), 486 (this.focusedFlag = !0)); 487 }, 488 onBlur: function () { 489 this.pressedFlag || 490 (this.fakeElement.removeClass(this.options.focusClass), 491 this.realElement.off('blur', this.onBlur), 492 (this.focusedFlag = !1)); 493 }, 494 refresh: function () { 495 this.fakeElement.toggleClass( 496 this.options.disabledClass, 497 this.realElement.is(':disabled') 498 ), 499 this.list.refresh(); 500 }, 501 destroy: function () { 502 this.list.destroy(), 503 this.realElement 504 .insertBefore(this.fakeElement) 505 .removeClass(this.options.hiddenClass), 506 this.fakeElement.remove(); 507 }, 508 }), 509 t.extend(n.prototype, { 510 init: function () { 511 this.initStructure(), 512 this.refreshSelectedClass(), 513 this.attachEvents(); 514 }, 515 initStructure: function () { 516 (this.element = t(this.options.element)), 517 (this.indexSelector = 518 '[' + this.options.indexAttribute + ']'), 519 (this.container = t( 520 this.options.containerStructure 521 ).appendTo(this.options.holder)), 522 (this.listHolder = this.container.find( 523 this.options.containerSelector 524 )), 525 (this.lastClickedIndex = 526 this.element.prop('selectedIndex')), 527 this.rebuildList(), 528 this.element.prop('multiple') && 529 (this.previousSelection =
530 this.getSelectedOptionsIndexes()); 531 }, 532 attachEvents: function () { 533 this.bindHandlers(), 534 this.listHolder.on( 535 'jcf-pointerdown', 536 this.indexSelector, 537 this.onItemPress 538 ), 539 this.listHolder.on('jcf-pointerdown', this.onPress), 540 this.options.useHoverClass && 541 this.listHolder.on( 542 'jcf-pointerover', 543 this.indexSelector, 544 this.onHoverItem 545 ); 546 }, 547 onPress: function (e) { 548 t(this).trigger('press', e), 549 this.listHolder.on('jcf-pointerup', this.onRelease); 550 }, 551 onRelease: function (e) { 552 t(this).trigger('release', e), 553 this.listHolder.off('jcf-pointerup', this.onRelease); 554 }, 555 onHoverItem: function (e) { 556 var t = parseFloat( 557 e.currentTarget.getAttribute( 558 this.options.indexAttribute 559 ) 560 ); 561 this.fakeOptions 562 .removeClass(this.options.hoverClass) 563 .eq(t) 564 .addClass(this.options.hoverClass); 565 }, 566 onItemPress: function (e) { 567 'touch' === e.pointerType || this.options.selectOnClick 568 ? ((this.tmpListOffsetTop = this.list.offset().top), 569 this.listHolder.on( 570 'jcf-pointerup', 571 this.indexSelector, 572 this.onItemRelease 573 )) 574 : this.onSelectItem(e); 575 }, 576 onItemRelease: function (e) { 577 this.listHolder.off( 578 'jcf-pointerup', 579 this.indexSelector, 580 this.onItemRelease 581 ), 582 this.tmpListOffsetTop === this.list.offset().top && 583 this.listHolder.on( 584 'click', 585 this.indexSelector, 586 { savedPointerType: e.pointerType }, 587 this.onSelectItem 588 ), 589 delete this.tmpListOffsetTop; 590 }, 591 onSelectItem: function (e) { 592 var s, 593 i = parseFloat( 594 e.currentTarget.getAttribute( 595 this.options.indexAttribute 596 ) 597 ), 598 o = 599 (e.data && e.data.savedPointerType) || 600 e.pointerType || 601 'mouse'; 602 this.listHolder.off( 603 'click', 604 this.indexSelector, 605 this.onSelectItem 606 ), 607 e.button > 1 || 608 this.realOptions[i].disabled || 609 (this.element.prop('multiple') 610 ? e.metaKey || 611 e.ctrlKey || 612 'touch' === o || 613 this.options.multipleSelectWithoutKey 614 ? (this.realOptions[i].selected = 615 !this.realOptions[i].selected) 616 : e.shiftKey 617 ? ((s = [this.lastClickedIndex, i].sort( 618 function (e, t) { 619 return e - t; 620 } 621 )), 622 this.realOptions.each(function (e, t) { 623 t.selected = e >= s[0] && e <= s[1]; 624 })) 625 : this.element.prop('selectedIndex', i) 626 : this.element.prop('selectedIndex', i), 627 e.shiftKey || (this.lastClickedIndex = i), 628 this.refreshSelectedClass(), 629 'mouse' === o && this.scrollToActiveOption(), 630 t(this).trigger('select')); 631 }, 632 rebuildList: function () { 633 var s = this, 634 i = this.element[0]; 635 (this.storedSelectHTML = i.innerHTML), 636 (this.optionIndex = 0), 637 (this.list = t(this.createOptionsList(i))), 638 this.listHolder.empty().append(this.list), 639 (this.realOptions = this.element.find('option')), 640 (this.fakeOptions = this.list.find(this.indexSelector)), 641 (this.fakeListItems = this.list.find( 642 '.' + 643 this.options.captionClass + 644 ',' + 645 this.indexSelector 646 )), 647 delete this.optionIndex; 648 var o = this.options.maxVisibleItems, 649 n = this.element.prop('size'); 650 n > 1 && !this.element.is('[jcf-size]') && (o = n); 651 var l = this.fakeOptions.length > o; 652 return ( 653 this.container.toggleClass(this.options.scrollClass, l), 654 l && 655 (this.listHolder.css({ 656 maxHeight: this.getOverflowHeight(o), 657 overflow: 'auto', 658 }), 659 this.options.useCustomScroll && e.modules.Scrollable) 660 ? void e.replace(this.listHolder, 'Scrollable', { 661 handleResize: this.options.handleResize, 662 alwaysPreventMouseWheel: 663 this.options.alwaysPreventMouseWheel, 664 }) 665 : void ( 666 this.options.alwaysPreventMouseWheel && 667 ((this.preventWheelHandler = function (e) { 668 var t = s.listHolder.scrollTop(), 669 i = 670 s.listHolder.prop( 671 'scrollHeight'
672 ) - s.listHolder.innerHeight(); 673 ((0 >= t && e.deltaY < 0) || 674 (t >= i && e.deltaY > 0)) && 675 e.preventDefault(); 676 }), 677 this.listHolder.on( 678 'jcf-mousewheel', 679 this.preventWheelHandler 680 )) 681 ) 682 ); 683 }, 684 refreshSelectedClass: function () { 685 var e, 686 t = this, 687 s = this.element.prop('multiple'), 688 i = this.element.prop('selectedIndex'); 689 s 690 ? this.realOptions.each(function (e, s) { 691 t.fakeOptions 692 .eq(e) 693 .toggleClass( 694 t.options.selectedClass, 695 !!s.selected 696 ); 697 }) 698 : (this.fakeOptions.removeClass( 699 this.options.selectedClass + 700 ' ' + 701 this.options.hoverClass 702 ), 703 (e = this.fakeOptions 704 .eq(i) 705 .addClass(this.options.selectedClass)), 706 this.options.useHoverClass && 707 e.addClass(this.options.hoverClass)); 708 }, 709 scrollToActiveOption: function () { 710 var e = this.getActiveOptionOffset(); 711 'number' == typeof e && 712 this.listHolder.prop('scrollTop', e); 713 }, 714 getSelectedOptionsIndexes: function () { 715 var e = []; 716 return ( 717 this.realOptions.each(function (t, s) { 718 s.selected && e.push(t); 719 }), 720 e 721 ); 722 }, 723 getChangedSelectedIndex: function () { 724 var e = this.element.prop('selectedIndex'), 725 s = this, 726 i = !1, 727 o = null; 728 return this.element.prop('multiple') 729 ? ((this.currentSelection = 730 this.getSelectedOptionsIndexes()), 731 t.each(this.currentSelection, function (e, t) { 732 !i && 733 s.previousSelection.indexOf(t) < 0 && 734 (0 === e && (i = !0), (o = t)); 735 }), 736 (this.previousSelection = this.currentSelection), 737 o) 738 : e; 739 }, 740 getActiveOptionOffset: function () { 741 var e = this.getChangedSelectedIndex(); 742 if (null !== e) { 743 var t = this.listHolder.height(), 744 s = this.listHolder.prop('scrollTop'), 745 i = this.fakeOptions.eq(e), 746 o = i.offset().top - this.list.offset().top, 747 n = i.innerHeight(); 748 return o + n >= s + t ? o - t + n : s > o ? o : void 0; 749 } 750 }, 751 getOverflowHeight: function (e) { 752 var t = this.fakeListItems.eq(e - 1), 753 s = this.list.offset().top, 754 i = t.offset().top, 755 o = t.innerHeight(); 756 return i + o - s; 757 }, 758 getScrollTop: function () { 759 return this.listHolder.scrollTop(); 760 }, 761 setScrollTop: function (e) { 762 this.listHolder.scrollTop(e); 763 }, 764 createOption: function (e) { 765 var t = document.createElement('span'); 766 (t.className = this.options.optionClass), 767 (t.innerHTML = e.innerHTML), 768 t.setAttribute( 769 this.options.indexAttribute, 770 this.optionIndex++ 771 ); 772 var s, 773 i = e.getAttribute('data-image'); 774 return ( 775 i && 776 ((s = document.createElement('img')), 777 (s.src = i), 778 t.insertBefore(s, t.childNodes[0])), 779 e.disabled && 780 (t.className += ' ' + this.options.disabledClass), 781 e.className && 782 (t.className += 783 ' ' + 784 r(e.className, this.options.cloneClassPrefix)), 785 t 786 ); 787 }, 788 createOptGroup: function (e) { 789 var t, 790 s, 791 i = document.createElement('span'), 792 o = e.getAttribute('label'); 793 return ( 794 (t = document.createElement('span')), 795 (t.className = this.options.captionClass), 796 (t.innerHTML = o), 797 i.appendChild(t), 798 e.children.length && 799 ((s = this.createOptionsList(e)), i.appendChild(s)), 800 (i.className = this.options.groupClass), 801 i 802 ); 803 }, 804 createOptionContainer: function () { 805 var e = document.createElement('li'); 806 return e; 807 }, 808 createOptionsList: function (e) { 809 var s = this, 810 i = document.createElement('ul'); 811 return ( 812 t.each(e.children, function (e, t) { 813 var o, 814 n = s.createOptionContainer(t); 815 switch (t.tagName.toLowerCase()) { 816 case 'option': 817 o = s.createOption(t); 818 break; 819 case 'optgroup': 820 o = s.createOptGroup(t); 821 } 822 i.appendChild(n).appendChild(o); 823 }), 824 i 825 ); 826 }, 827 refresh: function () { 828 this.storedSelectHTML !== this.element.prop('innerHTML') && 829 this.rebuildList(); 830 var t = e.getInstance(this.listHolder); 831 t && t.refresh(), this.refreshSelectedClass(); 832 }, 833 destroy: function () { 834 this.listHolder.off( 835 'jcf-mousewheel', 836 this.preventWheelHandler 837 ), 838 this.listHolder.off( 839 'jcf-pointerdown', 840 this.indexSelector, 841 this.onSelectItem 842 ), 843 this.listHolder.off( 844 'jcf-pointerover', 845 this.indexSelector, 846 this.onHoverItem 847 ), 848 this.listHolder.off('jcf-pointerdown', this.onPress); 849 }, 850 }); 851 var r = function (e, t) { 852 return e ? e.replace(/[\s]*([\S]+)+[\s]*/gi, t + '$1 ') : ''; 853 }, 854 h = (function () { 855 function t(e) { 856 e.preventDefault(); 857 } 858 var s = e.getOptions().unselectableClass; 859 return function (e) { 860 e.addClass(s).on('selectstart', t); 861 }; 862 })(); 863 return l; 864 }); 865})(jcf);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.