Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 |
/* * jQuery UI Autocomplete @VERSION * * Copyright (c) 2007, 2008 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI/Autocomplete * * * Modified to work with ui 1.6rc4 * * Depends: * ui.core.js */ function$ $widget"ui.autocomplete" $extendthisoptions delay: thisoptionsdelay != undefined ? thisoptionsdelay : thisoptionsurl? thisoptionsajaxDelay : thisoptionslocalDelay max: thisoptionsmax != undefined ? thisoptionsmax : thisoptionsscroll? thisoptionsscrollMax : thisoptionsnoScrollMax highlight: thisoptionshighlight || functionvalue return value; // if highlight is set to false, replace it with a do-nothing function formatMatch: thisoptionsformatMatch || thisoptionsformatItem // if the formatMatch option is not specified, then use formatItem for backwards compatibility ; var input = thiselement0 options = thisoptions // Create $ object for input element $input = $inputattr"autocomplete""off"addClassoptionsinputClass KEY = $uikeyCode previousValue = "" cache = $uiautocompletecacheoptions hasFocus = 0 config = mouseDownOnSelect: false timeout blockSubmit lastKeyPressCode select = $uiautocompleteselectoptionsinputselectCurrentconfig; ifoptionsresult $inputbind'result.autocomplete'optionsresult; // prevent form submit in opera when selecting with return key $browseropera && $inputformbind"submit.autocomplete"function if blockSubmit blockSubmit = false; return false; ; // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all $inputbind$browseropera ? "keypress" : "keydown" + ".autocomplete"functionevent // track last key pressed lastKeyPressCode = eventkeyCode; switcheventkeyCode case KEYUP: eventpreventDefault; if selectvisible selectprev; else onChange0true; break; case KEYDOWN: eventpreventDefault; if selectvisible selectnext; else onChange0true; break; case KEYPAGE_UP: eventpreventDefault; if selectvisible selectpageUp; else onChange0true; break; case KEYPAGE_DOWN: eventpreventDefault; if selectvisible selectpageDown; else onChange0true; break; // matches also semicolon case optionsmultiple && $trimoptionsmultipleSeparator == "," && KEYCOMMA: case KEYTAB: case KEYENTER: if selectCurrent // stop default to prevent a form submit, Opera needs special handling eventpreventDefault; blockSubmit = true; return false; break; case KEYESCAPE: selecthide; break; default: clearTimeouttimeout; timeout = setTimeoutonChangeoptionsdelay; break; focusfunction // track whether the field has focus, we shouldn't process any // results if the field no longer has focus hasFocus++; blurfunction hasFocus = 0; if !configmouseDownOnSelect hideResults; clickfunction // show select when clicking in a focused field if hasFocus++ > 1 && !selectvisible onChange0true; bind"search"function // TODO why not just specifying both arguments? var fn = argumentslength > 1 ? arguments1 : null; var result; if data && datalength for var i=0; i < datalength; i++ if datairesulttoLowerCase == qtoLowerCase result = datai; break; if typeof fn == "function" fnresult; else $inputtrigger"result"result && resultdataresultvalue; $eachtrimWords$inputvalfunctionivalue requestvaluefindValueCallbackfindValueCallback; ; bind"flushCache"function cacheflush; bind"setOptions"function $extendoptionsarguments1; // if we've updated the data, repopulate if "data" in arguments1 cachepopulate; bind"unautocomplete"function selectunbind; $inputunbind; $inputformunbind".autocomplete"; ; // Private methods var selected = selectselected; if !selected return false; var v = selectedresult; previousValue = v; if optionsmultiple var words = trimWords$inputval; if wordslength > 1 v = wordsslice0wordslength - 1join optionsmultipleSeparator + optionsmultipleSeparator + v; v += optionsmultipleSeparator; $inputvalv; hideResultsNow; $inputtrigger"result"selecteddataselectedvalue; return true; ; if lastKeyPressCode == $uikeyCodeDELETE selecthide; return; var currentValue = $inputval; if !skipPrevCheck && currentValue == previousValue return; previousValue = currentValue; currentValue = lastWordcurrentValue; if currentValuelength >= optionsminChars $inputaddClassoptionsloadingClass; if !optionsmatchCase currentValue = currentValuetoLowerCase; requestcurrentValuereceiveDatahideResultsNow; else stopLoading; selecthide; ; if !value return ""; if !optionsmultiple return value; var words = valuesplit optionsmultipleSeparator ; var result = ; $eachwordsfunctionivalue if $trimvalue resulti = $trimvalue; ; return result; ; var words = trimWordsvalue; return wordswordslength - 1; ; // fills in the input box w/the first match (assumed to be the best match) // q: the term entered // sValue: the first matching result // autofill in the complete box w/the first match as long as the user hasn't entered in more data // if the last user key pressed was backspace, don't autofill if optionsautoFill && lastWord$inputvaltoLowerCase == qtoLowerCase && lastKeyPressCode != $uikeyCodeBACKSPACE // fill in the value (keep the case the user has typed) $inputval$inputval + sValuesubstringlastWordpreviousValuelength; // select the portion of the value not typed by the user (so the next character will erase) $uiautocompleteselectioninputpreviousValuelengthpreviousValuelength + sValuelength; ; clearTimeouttimeout; timeout = setTimeouthideResultsNow200; ; var wasVisible = selectvisible; selecthide; clearTimeouttimeout; stopLoading; if optionsmustMatch // call search and run callback $inputautocomplete"search" // if no value found, clear the input box if !result if optionsmultiple var words = trimWords$inputvalslice0-1; $inputval wordsjoinoptionsmultipleSeparator + wordslength ? optionsmultipleSeparator : "" ; else $inputval "" ; ; if wasVisible // position cursor at end of input field $uiautocompleteselectioninputinputvaluelengthinputvaluelength; ; if data && datalength && hasFocus stopLoading; selectdisplaydataq; autoFillqdata0value; selectshow; else hideResultsNow; ; if !optionsmatchCase term = termtoLowerCase; var data = cacheloadterm; // recieve the cached data if data && datalength successtermdata; // if an AJAX url has been supplied, try loading the data now else if typeof optionsurl == "string" && optionsurllength > 0 var extraParams = timestamp: + ; $eachoptionsextraParamsfunctionkeyparam extraParamskey = typeof param == "function" ? paramterm : param; ; $ajax // try to leverage ajaxQueue plugin to abort previous requests mode: "abort" // limit abortion to this input port: "autocomplete" + inputname dataType: optionsdataType url: optionsurl data: $extend q: lastWordterm limit: optionsmax extraParams var parsed = optionsparse && optionsparsedata || parsedata; cacheaddtermparsed; successtermparsed; ; else if optionssource && typeof optionssource == 'function' var resultData = optionssourceterm; var parsed = optionsparse ? optionsparseresultData : resultData; cacheaddtermparsed; successtermparsed; else // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match selectemptyList; failureterm; ; var parsed = ; var rows = datasplit"\n"; for var i=0; i < rowslength; i++ var row = $trimrowsi; if row row = rowsplit"|"; parsedparsedlength = data: row value: row0 result: optionsformatResult && optionsformatResultrowrow0 || row0 ; return parsed; ; $inputremoveClassoptionsloadingClass; ; $uiplugincallthisneventthisui; return thiselementtriggerHandlern == 'autocomplete' ? n : 'autocomplete'+neventthisuithisoptionsn; // Public methods return options: thisoptions element: thiselement ; return thiselementbind"result"handler; return thiselementtrigger"search"handler; return thiselementtrigger"flushCache"; return thiselementtrigger"setOptions" key: value ; thiselement removeAttr'disabled' removeClass'ui-autocomplete-input'; return thiselementtrigger"unautocomplete"; thiselement removeAttr'disabled' removeClass'ui-autocomplete-disabled'; thisdisabled = false; thiselement attr'disabled'true addClass'ui-autocomplete-disabled'; thisdisabled = true; ; $extend$uiautocomplete defaults: inputClass: "ui-autocomplete-input" resultsClass: "ui-autocomplete-results" loadingClass: "ui-autocomplete-loading" minChars: 1 ajaxDelay: 400 localDelay: 10 matchCase: false matchSubset: true matchContains: false cacheLength: 10 scrollMax: 150 noScrollMax: 10 mustMatch: false extraParams: selectFirst: true return row0; formatMatch: null autoFill: false width: 0 multiple: false multipleSeparator: ", " return valuereplace"(?![^&;]+;)(?!<[^<>]*)(" + termreplace/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi"\\$1" + ")(?![^<>]*>)(?![^&;]+;)""gi""<strong>$1</strong>"; scroll: true scrollHeight: 180 ; var data = ; var length = 0; if !optionsmatchCase s = stoLowerCase; var i = sindexOfsub; if i == -1 return false; return i == 0 || optionsmatchContains; ; if length > optionscacheLength flush; if !dataq length++; dataq = value; if !optionsdata return false; // track the matches var stMatchSets = nullData = 0; // no url was specified, we need to adjust the cache length to make sure it fits the local data store if !optionsurl optionscacheLength = 1; // track all options for minChars = 0 stMatchSets"" = ; // loop through the array and create a lookup structure for var i = 0ol = optionsdatalength; i < ol; i++ var rawValue = optionsdatai; // if rawValue is a string, make an array otherwise just reference the array rawValue = typeof rawValue == "string" ? rawValue : rawValue; var value = optionsformatMatchrawValuei+1optionsdatalength; if value === false continue; var firstChar = valuecharAt0toLowerCase; // if no lookup array for this character exists, look it up now if !stMatchSetsfirstChar stMatchSetsfirstChar = ; // if the match is a string var row = value: value data: rawValue result: optionsformatResult && optionsformatResultrawValue || value ; // push the current match into the set list stMatchSetsfirstCharpushrow; // keep track of minChars zero items if nullData++ < optionsmax stMatchSets""pushrow; ; // add the data items to the cache $eachstMatchSetsfunctionivalue // increase the cache size optionscacheLength++; // add to the cache addivalue; ; // populate any existing data setTimeoutpopulate25; data = ; length = 0; return flush: flush add: add populate: populate if !optionscacheLength || !length return null; /* * if dealing w/local data and matchContains than we must make sure * to loop through all the data collections looking for matches */ if !optionsurl && optionsmatchContains // track all matches var csub = ; // loop through all the data grids for matches for var k in data // don't search through the stMatchSets[""] (minChars: 0) cache // this prevents duplicates if klength > 0 var c = datak; $eachcfunctionix // if we've got a match, add it to the array if matchSubsetxvalueq csubpushx; ; return csub; else // if the exact item exists, use it if dataq return dataq; else if optionsmatchSubset for var i = qlength - 1; i >= optionsminChars; i-- var c = dataqsubstr0i; if c var csub = ; $eachcfunctionix if matchSubsetxvalueq csubcsublength = x; ; return csub; return null; ; ; var CLASSES = ACTIVE: "ui-autocomplete-over" ; var listItems active = -1 data term = "" needsInit = true element list; // Create results if !needsInit return; element = $"<div/>" hide addClassoptionsresultsClass css"position""absolute" appendTodocumentbody; list = $"<ul/>"appendToelementmouseover functionevent iftargeteventnodeName && targeteventnodeNametoUpperCase == 'LI' active = $"li"listremoveClassCLASSESACTIVEindextargetevent; $targeteventaddClassCLASSESACTIVE; clickfunctionevent $targeteventaddClassCLASSESACTIVE; select; // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus inputfocus; return false; mousedownfunction configmouseDownOnSelect = true; mouseupfunction configmouseDownOnSelect = false; ; if optionswidth > 0 elementcss"width"optionswidth; needsInit = false; var element = eventtarget; whileelement && elementtagName != "LI" element = elementparentNode; // more fun with IE, sometimes event.target is empty, just ignore it then if!element return ; return element; listItemssliceactiveactive + 1removeClassCLASSESACTIVE; movePositionstep; var activeItem = listItemssliceactiveactive + 1addClassCLASSESACTIVE; ifoptionsscroll var offset = 0; listItemsslice0activeeachfunction offset += thisoffsetHeight; ; ifoffset + activeItem0offsetHeight - listscrollTop > list0clientHeight listscrollTopoffset + activeItem0offsetHeight - listinnerHeight; else ifoffset < listscrollTop listscrollTopoffset; ; active += step; if active < 0 active = listItemssize - 1; else if active >= listItemssize active = 0; return optionsmax && optionsmax < available ? optionsmax : available; listempty; var max = limitNumberOfItemsdatalength; for var i=0; i < max; i++ if !datai continue; var formatted = optionsformatItemdataidatai+1maxdataivalueterm; if formatted === false continue; var li = $"<li/>"html optionshighlightformattedterm addClassi%2 == 0 ? "ui-autocomplete-even" : "ui-autocomplete-odd"appendTolist0; $datali"ui-autocomplete-data"datai; listItems = listfind"li"; if optionsselectFirst listItemsslice01addClassCLASSESACTIVE; active = 0; // apply bgiframe if available if $fnbgiframe listbgiframe; return init; data = d; term = q; fillList; moveSelect1; moveSelect-1; if active != 0 && active - 8 < 0 moveSelect -active ; else moveSelect-8; if active != listItemssize - 1 && active + 8 > listItemssize moveSelect listItemssize - 1 - active ; else moveSelect8; element && elementhide; listItems && listItemsremoveClassCLASSESACTIVE active = -1; $inputtriggerHandler"autocompletehide" options: options options"hide"; return element && elementis":visible"; return thisvisible && listItemsfilter"." + CLASSESACTIVE0 || optionsselectFirst && listItems0; var offset = $inputoffset; elementcss width: typeof optionswidth == "string" || optionswidth > 0 ? optionswidth : $inputwidth top: offsettop + inputoffsetHeight left: offsetleft show; ifoptionsscroll listscrollTop0; listcss maxHeight: optionsscrollHeight overflow: 'auto' ; if$browsermsie && typeof documentbodystylemaxHeight === "undefined" var listHeight = 0; listItemseachfunction listHeight += thisoffsetHeight; ; var scrollbarsVisible = listHeight > optionsscrollHeight; listcss'height'scrollbarsVisible ? optionsscrollHeight : listHeight ; if !scrollbarsVisible // IE doesn't recalculate width when scrollbar disappears listItemswidth listwidth - parseIntlistItemscss"padding-left" - parseIntlistItemscss"padding-right" ; $inputtriggerHandler"autocompleteshow" options: options options"show"; var selected = listItems && listItemsfilter"." + CLASSESACTIVEremoveClassCLASSESACTIVE; return selected && selectedlength && $dataselected0"ui-autocomplete-data"; list && listempty; element && elementremove; ; ; if fieldcreateTextRange var selRange = fieldcreateTextRange; selRangecollapsetrue; selRangemoveStart"character"start; selRangemoveEnd"character"end; selRangeselect; else if fieldsetSelectionRange fieldsetSelectionRangestartend; else if fieldselectionStart fieldselectionStart = start; fieldselectionEnd = end; fieldfocus; ; jQuery; |