1function getQueryVariable(variable){ 2 var query = window.location.search.substring(1); 3 var vars = query.split("&"); 4 for (var i=0;i<vars.length;i++) { 5 var pair = vars[i].split("="); 6 if(pair[0] == variable){return pair[1];} 7 } 8 return(false); 9} 10 11 function resetLinkFilters(){ 12 $('a').filter(function() { 13 return this.hostname && this.hostname !== location.hostname; 14 }).each(function(){ 15 if(!$(this).hasClass('cta_external_link') && !$(this).hasClass('haspdf')){ 16 $(this).addClass('cta_external_link').attr('target', '_BLANK').click(function (e) { 17 18 var href = $(this).attr('href'); 19 var linktext = $(this).text(); 20 21 var leavingtext = 'You are about to proceed to an offsite link. Click OK to proceed.'; 22 if(href.includes('tickets.indianahistory.org')){ 23 24 leavingtext = 'You are about to visit our ticketing site. Click OK to proceed.'; 25 26 }else if(href.includes('shop.indianahistory.org')){ 27 28 leavingtext = 'You are about to visit our online store. Click OK to proceed.'; 29 30 }else if(href.includes('indianahistorylibrary.on.worldcat.org')){ 31 32 leavingtext = 'You are about to visit our library catalog. Click OK to proceed.'; 33 34 }else if(href.includes('images.indianahistory.org')){ 35 36 leavingtext = 'You are about to visit our digital collections. Click OK to proceed.'; 37 38 }else if(href.includes('destination-indiana.com')){ 39 40 leavingtext = 'You are about to open another IHS website. Click OK to proceed.'; 41 42 } 43 44 e.preventDefault(); 45 swal({ 46 title: "Are you sure?", 47 text: leavingtext, 48 type: "warning", 49 showCancelButton: true, 50 closeOnConfirm: true, 51 confirmButtonText: "OK!", 52 confirmButtonColor: "#f39f0b" 53 }, function(){ 54 ga('send', 'event', 'External CTA Link Clicks', linktext, href); 55 window.open(href, '_blank'); 56 return false; 57 }); 58 }); 59 } 60 61 }); 62 } 63 var completed = 0; 64 function checkIfSearchComplete(){ 65 66 completed++; 67 if(completed >= 3){ 68// alert("completed"); 69 $('.searchBarButtonPage').text("GO"); 70 71 } 72 } 73 74 75 function processSearch(manualtrack){ 76 if($('.searchBarButtonPage').text() == "Searching"){ 77 return; 78 } 79 80 $('.searchBarButtonPage').text("Searching"); 81 var searchterm = $('.searchBarPage').val(); 82 if(searchterm.length < 1){ 83 alert("Please enter a value to search for!"); 84 return; 85 } 86 87 if(manualtrack){ 88 ga('send', 'pageview', '/search/?search='+encodeURI(searchterm)); 89 console.log("Tracking Google Code Here"); 90 } 91 92 $('.pagesRowLazyLoad').each(function(){ 93 $(this).remove(); 94 }); 95 $('.eventRowLazyLoad').each(function(){ 96 $(this).remove(); 97 }); 98 $('.storiesRowLazyLoad').each(function(){ 99 $(this).remove(); 100 }); 101 $('.blogRowLazyLoad').each(function(){ 102 $(this).remove(); 103 }); 104 $('.exhibitsRowLazyLoad').each(function(){ 105 $(this).remove(); 106 }); 107 $('.collectionsguidesRowLazyLoad').each(function(){ 108 $(this).remove(); 109 }); 110 $('.journeysRowLazyLoad').each(function(){ 111 $(this).remove(); 112 }); 113 $('.collectionsarchivesRowLazyLoad').each(function(){ 114 $(this).remove(); 115 }); 116 $('.collectionsimagesRowLazyLoad').each(function(){ 117 $(this).remove(); 118 }); 119 120 $('.loadMoreButton').each(function(){ 121 $(this).attr('data-num', 0); 122 $(this).css('display', 'none'); 123 }); 124 125 $('.resultsCount').each(function(){ 126 $(this).text("(Pending)"); 127 }); 128 129 //alert("Attempting Search"); 130 completed = 0; 131 $.post('/wp-content/themes/ihs/ajax/get_search_results.php', { search_term: searchterm }, function(data){ 132 console.log("Continuing"); 133 console.log(data); 134 var json = $.parseJSON(data); 135 136 137 $.each(json, function(k, v){ 138 //console.log(k + ' is ' + v); 139 switch(k){ 140 case "Exhibits": 141 displayExhibits(v); 142 break; 143 144 case "Events": 145 displayEvents(v); 146 break; 147 case "Blog": 148 displayBlog(v); 149 break; 150 case "Stories": 151 displayStories(v); 152 break; 153 case "Pages": 154 displayPages(v); 155 break; 156 case "CollectionsGuides": 157 displayCollectionsGuides(v); 158 159 var found = false;
160 $('.searchSection').each(function(){ 161 $(this).children('.sectionHeader').each(function(){ 162 163 $(this).addClass('closed'); 164 }); 165 $(this).children('.slideUpWrap').each(function(){ 166 $(this).css('display', 'none'); 167 }); 168 169 $(this).children('.sectionHeader').each(function(){ 170 $(this).children('.resultsCount').each(function(){ 171 var text = $(this).text(); 172 173 if(!found){ 174 if(text !== '(0)'){ 175 found = true; 176 $(this).parent().click(); 177 } 178 } 179 }); 180 }); 181 }); 182 break; 183 } 184 185 }); 186 187 $.post( "https://destination-indiana.com/api/search/findAll/"+searchterm, function( data ) { 188 didata = data; 189 190 displayJourneys(data); 191 checkIfSearchComplete(); 192 }); 193 194 $.post('https://indianahistory.org/services/worldcat2025.php?keywords='+searchterm+'&type=archv,vis&subtype=book-digital', function(data){ 195 //$.post('https://indianahistory.org/services/worldcat.php?keywords='+searchterm+'&type=image', function(data){ 196 //alert(data); 197 //var json = $.parseJSON(data); 198 199 console.log("Received Image Data"); 200 console.log(data); 201 displayCollectionsImages(data); 202 203 204 resetLinkFilters(); 205 206 checkIfSearchComplete(); 207 208 209 }); 210 $.post('https://indianahistory.org/services/worldcat2025.php?keywords='+searchterm+' NOT x4:digital', function(data){ 211 //$.post('https://indianahistory.org/services/worldcat2025.php?keywords='+searchterm+'&type=book,object,archv', function(data){ 212 //$.post('https://indianahistory.org/services/worldcat.php?keywords='+searchterm+'&type=text', function(data){ 213 //alert(data); 214 //var json = $.parseJSON(data); 215 216 console.log("Received Text Data"); 217 console.log(data); 218 displayCollectionsArchives(data); 219 220 resetLinkFilters(); 221 checkIfSearchComplete(); 222 223 }); 224 225 return; 226 }); 227 } 228 229 function displayJourneys(didata){ 230 var rownum = 0; 231 var colnum = 0; 232 var totalnum = 0; 233 var rowcountnum = 0; 234 var html = ''; 235 236 html += '<div class="journeysRowLazyLoad" data-row="0">'; 237 238 for(var i = 0; i < didata['journeys'].length; i++){ 239 var journey = didata['journeys'][i]; 240 var id= journey['id']; 241 var title = journey['title']; 242 var thumb = journey['images'][0]['thumb_url']; 243 var url = "https://destination-indiana.com/#sort=popular&journey="+id+"|0"; 244 245 colnum++; 246 totalnum++; 247 rowcountnum++; 248 249 if(colnum == 1){ 250 if(rowcountnum == 5){ 251 rownum++; 252 html += '</div><div class="journeysRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 253 rowcountnum = 1; 254 } 255 256 html += '<div class="layoutFourRow collectionsImagesLayoutFourRow"><div class="layoutFourLeft">'; 257 }else{ 258 html += '<div class="layoutFourRight collectionsImagesLayoutFourRight">'; 259 } 260 261 html += '<a href="'+url+'" target="_BLANK" aria-label="This links to the Destination Indiana Journey for '+title+'">'+ 262 ' <div class="layoutFourThumb">'+ 263 '<img src="'+thumb+'" alt="">'+ 264 '</div>'+ 265 '<div class="layoutFourCopy">'+ 266 '<h4 class="layoutFourTitle">'+title+'</h4>'+ 267 '<span class="learnMore">Learn more <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 268 '</div>'+ 269 '</a>'; 270 271 272 html += '</div>'; 273 if(colnum === 2){ 274 html += '</div>'; 275 colnum = 0; 276 } 277 } 278 if(rownum > 0){ 279 $('div[data-class="journeysRowLazyLoad"]').css('display', 'block'); 280 }else{ 281 $('div[data-class="journeysRowLazyLoad"]').css('display', 'none'); 282 } 283 html += '</div>'; 284 $('.searchJourneys .sectionHeader .resultsCount').html('('+totalnum+')'); 285 $('.searchJourneys .slideUpWrap').prepend(html); 286 } 287 288 289 function displayExhibits(object){ 290 var rownum = 0; 291 var colnum = 0; 292 var totalnum = 0; 293 var html = ''; 294 var first = true; 295 html += '<div class="exhibitsRowLazyLoad" data-row="0">'; 296 297 for(var i = 0; i < object.length; i++){ 298 var exhibit = object[i]; 299 var title = exhibit['title']; 300 var content = exhibit['content']; 301 var permalink = exhibit['permalink']; 302 var image = exhibit['image']; 303 304 colnum++; 305 totalnum++; 306 307 if(colnum == 1){ 308 if(!first){ 309 html += '</div>'; 310 } 311 312 html += '<div class="searchExhibitsRow"><div class="exhibitsRowColumn exhibitsRowLeft">'; 313 314 first = false;
315 }else{ 316 html += '<div class="exhibitsRowColumn exhibitsRowRight">'; 317 } 318 319 html += '<a href="'+permalink+'" aria-label="Links to the '+title+' exhibit page">'+ 320 '<div class="exhibitSearchThumb">'+ 321 '<img src="'+image+'" alt="">'+ 322 '</div>'+ 323 '<div class="exhibitSearchCopy">'+ 324 '<h4 class="exhibitSearchTitle">'+title+'</h4>'+content+ 325 '<span class="learnMore">Learn more <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 326 '</div>'+ 327 '</a>'; 328 329 html += '</div>'; 330 if(colnum === 2){ 331 //html += '</div>'; 332 colnum = 0; 333 } 334 335 //console.log(title); 336 //console.log(content); 337 //console.log(permalink); 338 //console.log(image); 339 } 340 html += '</div>'; 341 html += '</div>'; 342 $('.searchExhibits .sectionHeader .resultsCount').html('('+totalnum+')'); 343 $('.searchExhibits .slideUpWrap').prepend(html); 344 } 345 346 function compare(a,b) { 347 if (a.timestamp < b.timestamp) 348 return -1; 349 if (a.timestamp > b.timestamp) 350 return 1; 351 return 0; 352 } 353 354 355 function displayEvents(object){ 356 357 if(object.length) 358 object.sort(compare); 359 console.log("events log"); 360 //console.log(object); 361 362 var rownum = 0; 363 var colnum = 0; 364 var totalnum = 0; 365 var rowcountnum = 0; 366 var html = ''; 367 368 html += '<div class="eventRowLazyLoad" data-row="0">'; 369 370 for(var i = 0; i < object.length; i++){ 371 var exhibit = object[i]; 372 var title = exhibit['title']; 373 var content = exhibit['content']; 374 var permalink = exhibit['permalink']; 375 var image = exhibit['image']; 376 377 colnum++; 378 totalnum++; 379 rowcountnum++; 380 381 if(colnum == 1){ 382 if(rowcountnum == 5){ 383 rownum++; 384 html += '</div><div class="eventRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 385 rowcountnum = 1; 386 } 387 388 html += '<div class="layoutTwoRow"><a href="'+permalink+'" class="layoutTwoLeft">'; 389 }else{ 390 html += '<a href="'+permalink+'" class="layoutTwoRight">'; 391 } 392 393 html += '<div class="layoutTwoInner">'+ 394 '<h4 class="layoutTwoTitle">'+title+'</h4>'+ 395 '<span class="layoutTwoDate">'+content+ 396 '</div>'+ 397 '<div class="rightBlock"></div>'; 398 399 400 html += '</a>'; 401 if(colnum === 2){ 402 html += '</div>'; 403 colnum = 0; 404 } 405 } 406 if(rownum > 0){ 407 $('div[data-class="eventRowLazyLoad"]').css('display', 'block'); 408 }else{ 409 $('div[data-class="eventRowLazyLoad"]').css('display', 'none'); 410 } 411 html += '</div>'; 412 $('.searchEventsPrograms .sectionHeader .resultsCount').html('('+totalnum+')'); 413 $('.searchEventsPrograms .slideUpWrap').prepend(html); 414 } 415 416 function displayBlog(object){ 417 418 var rownum = 0; 419 var colnum = 0; 420 var totalnum = 0; 421 var rowcountnum = 0; 422 var html = ''; 423 424 html += '<div class="blogRowLazyLoad" data-row="0">'; 425 426 for(var i = 0; i < object.length; i++){ 427 var exhibit = object[i]; 428 var title = exhibit['title']; 429 var content = exhibit['content']; 430 var year = exhibit['year']; 431 var permalink = exhibit['permalink']; 432 var image = exhibit['image']; 433 434 colnum++; 435 totalnum++; 436 rowcountnum++; 437 438 if(colnum == 1){ 439 if(rowcountnum == 5){ 440 rownum++; 441 html += '</div><div class="blogRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 442 rowcountnum = 1; 443 } 444 445 html += '<div class="layoutFourRow"><div class="layoutFourLeft">'; 446 }else{ 447 html += '<div class="layoutFourRight">'; 448 } 449 450 html += '<a href="'+permalink+'" aria-label="Links to the '+title+' blog post">'+ 451 ' <div class="layoutFourThumb">'+ 452 '<img src="'+image+'" alt="">'+ 453 '</div>'+ 454 '<div class="layoutFourCopy">'+ 455 '<h4 class="layoutFourTitle">'+title+'</h4>'+ 456 '<span class="layoutFourSubTitle">Year: '+year+'</span>'+ 457 '<p>'+content+'</p>'+ 458 '<span class="learnMore">Learn more <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 459 '</div>'+ 460 '</a>'; 461 462 463 html += '</div>'; 464 if(colnum === 2){ 465 html += '</div>'; 466 colnum = 0; 467 } 468 469 } 470 if(rownum > 0){ 471 $('div[data-class="blogRowLazyLoad"]').css('display', 'block'); 472 }else{ 473 $('div[data-class="blogRowLazyLoad"]').css('display', 'none'); 474 } 475 html += '</div>'; 476 $('.searchBlog .sectionHeader .resultsCount').html('('+totalnum+')'); 477 $('.searchBlog .slideUpWrap').prepend(html); 478 } 479 480 function displayStories(object){ 481 var rownum = 0; 482 var colnum = 0; 483 var totalnum = 0; 484 var rowcountnum = 0; 485 var html = ''; 486 487 html += '<div class="storiesRowLazyLoad" data-row="0">'; 488 489 for(var i = 0; i < object.length; i++){ 490 var exhibit = object[i]; 491 var title = exhibit['title']; 492 var content = exhibit['content']; 493 var year = exhibit['year']; 494 var permalink = exhibit['permalink']; 495 var image = exhibit['image']; 496 497 colnum++; 498 totalnum++; 499 rowcountnum++; 500 501 if(colnum == 1){ 502 if(rowcountnum == 5){ 503 rownum++; 504 html += '</div><div class="storiesRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 505 rowcountnum = 1; 506 } 507 508 html += '<div class="layoutFourRow"><div class="layoutFourLeft">'; 509 }else{ 510 html += '<div class="layoutFourRight">'; 511 } 512 513 html += '<a href="'+permalink+'" aria-label="Links to the '+title+' story">'+ 514 ' <div class="layoutFourThumb">'+ 515 '<img src="'+image+'" alt="">'+ 516 '</div>'+ 517 '<div class="layoutFourCopy">'+ 518 '<h4 class="layoutFourTitle">'+title+'</h4>'+ 519 '<span class="layoutFourSubTitle">Year: '+year+'</span>'+ 520 '<p>'+content+'</p>'+ 521 '<span class="learnMore">Learn more <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 522 '</div>'+ 523 '</a>'; 524 525 526 html += '</div>'; 527 if(colnum === 2){ 528 html += '</div>'; 529 colnum = 0; 530 } 531 532 } 533 if(rownum > 0){ 534 $('div[data-class="storiesRowLazyLoad"]').css('display', 'block'); 535 }else{ 536 $('div[data-class="storiesRowLazyLoad"]').css('display', 'none'); 537 } 538 html += '</div>'; 539 $('.searchStories .sectionHeader .resultsCount').html('('+totalnum+')'); 540 $('.searchStories .slideUpWrap').prepend(html); 541 } 542 543 function displayPages(object){ 544 var rownum = 0; 545 var colnum = 0; 546 var totalnum = 0; 547 var rowcountnum = 0; 548 var html = ''; 549 550 html += '<div class="pagesRowLazyLoad" data-row="0">'; 551 552 for(var i = 0; i < object.length; i++){ 553 var exhibit = object[i]; 554 var title = exhibit['title']; 555 var content = exhibit['content']; 556 var permalink = exhibit['permalink']; 557 var image = exhibit['image']; 558 559 colnum++; 560 totalnum++; 561 rowcountnum++; 562 563 if(colnum == 1){ 564 if(rowcountnum == 7){ 565 rownum++; 566 html += '</div><div class="pagesRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 567 rowcountnum = 1; 568 } 569 570 html += '<div class="layoutFiveRow"><div class="layoutFiveBlock">'; 571 }else if(colnum < 3){ 572 html += '<div class="layoutFiveBlock">'; 573 }else{ 574 html += '<div class="layoutFiveBlock fiveBlockLast">'; 575 576 } 577 578 html += '<a href="'+permalink+'" aria-label="Links to the '+title+' page">'+ 579 '<div class="layoutFiveSideBar"></div>'+ 580 '<div class="layoutFiveCopy">'+ 581 '<h4 class="layoutFiveTitle">'+title+'</h4>'+ 582 content+ 583 '<span class="learnMore">See details <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 584 '</div>'+ 585 '</a>'; 586 587 588 html += '</div>'; 589 if(colnum === 3){ 590 html += '</div>'; 591 colnum = 0; 592 } 593 } 594 if(rownum > 0){ 595 $('div[data-class="pagesRowLazyLoad"]').css('display', 'block'); 596 }else{ 597 $('div[data-class="pagesRowLazyLoad"]').css('display', 'none'); 598 } 599 html += '</div>'; 600 $('.searchWebPages .sectionHeader .resultsCount').html('('+totalnum+')'); 601 $('.searchWebPages .slideUpWrap').prepend(html); 602 } 603 604 function displayCollectionsGuides(object){ 605 606 var rownum = 0; 607 var colnum = 0; 608 var totalnum = 0; 609 var rowcountnum = 0; 610 var html = ''; 611 612 html += '<div class="collectionsguidesRowLazyLoad" data-row="0">'; 613 for(var i = 0; i < object.length; i++){ 614 var exhibit = object[i]; 615 //console.log("Logging search collections guide"); 616 //console.log(exhibit); 617 var title = exhibit['title']; 618 //var content = exhibit['content']; 619 var content = ""; 620 var permalink = exhibit['permalink']; 621 var image = exhibit['image']; 622 623 colnum++; 624 totalnum++; 625 rowcountnum++; 626 627 if(colnum == 1){ 628 if(rowcountnum == 7){ 629 rownum++; 630 html += '</div><div class="collectionsguidesRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 631 rowcountnum = 1; 632 } 633 634 html += '<div class="layoutFiveRow"><div class="layoutFiveBlock">'; 635 }else if(colnum < 3){ 636 html += '<div class="layoutFiveBlock">'; 637 }else{ 638 html += '<div class="layoutFiveBlock fiveBlockLast">'; 639 } 640 641 html += '<a href="'+permalink+'" aria-label="This will open a pdf for '+title+'">'+ 642 '<div class="layoutFiveSideBar"></div>'+ 643 '<div class="layoutFiveCopy">'+ 644 '<h4 class="layoutFiveTitle">'+title+'</h4>'+ 645 content+ 646 '<span class="learnMore">See details <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 647 '</div>'+ 648 '</a>'; 649 650 html += '</div>'; 651 if(colnum === 3){ 652 html += '</div>'; 653 colnum = 0; 654 } 655 } 656 if(rownum > 0){ 657 $('div[data-class="collectionsguidesRowLazyLoad"]').css('display', 'block'); 658 }else{ 659 $('div[data-class="collectionsguidesRowLazyLoad"]').css('display', 'none'); 660 } 661 html += '</div>'; 662 $('.searchCollectionGuides .sectionHeader .resultsCount').html('('+totalnum+')'); 663 $('.searchCollectionGuides .slideUpWrap').prepend(html); 664 } 665 666 function displayCollectionsImages(object){ 667 //object = object["results"]; 668 var rownum = 0; 669 var colnum = 0; 670 var totalnum = 0; 671 var rowcountnum = 0; 672 var html = ''; 673 var alerted = false;
674 html += '<div class="collectionsimagesRowLazyLoad" data-row="0">'; 675 object = JSON.parse(object); 676 677 for(var i = 0; i < object.length; i++){ 678 var exhibit = object[i]; 679 //console.log(exhibit); 680 var title = exhibit['title']['mainTitles'][0]['text']; 681 console.log(title); 682 console.log(exhibit['digitalAccessAndLocations']); 683 if(exhibit['format']['specificFormat'] == 'Digital'){ 684 685 if(title){ 686 var title = exhibit['title']['mainTitles'][0]['text']; 687 var content = exhibit['description']['physicalDescription']; 688 var uniqueid = exhibit['identifier']['oclcNumber']; 689 var relation = ""; 690 if(exhibit['format']['specificFormat'] == 'Digital'){ 691 relation = exhibit['digitalAccessAndLocations'][1]['uri']; 692 } 693 var image = "/wp-content/themes/ihs/image-nf.jpg"; 694 if(relation.includes('thumbnail')){ 695 image = relation; 696 } 697 var description = ""; 698 699 if(content){ 700 if(typeof content === 'object'){ 701 for(var j = 0; j < content.length; j++){ 702 if(j != 0){ 703 description += " "; 704 } 705 description += content[j]; 706 } 707 }else{ 708 description = content; 709 } 710 } 711 712 if(title){ 713 if(typeof title === 'object'){ 714 title = title[0]; 715 } 716 } 717 content = description; 718 content = content.substring(0, 20); 719 720 //console.log(title); 721 //console.log(description); 722 723 var permalinkfilter = title.replace(' ', '-'); 724 permalinkfilter = permalinkfilter.replace(':', ''); 725 var permalink = ''; 726 727 //console.log(uniqueid); 728 729 if(uniqueid){ 730 if(Array.isArray(uniqueid)){ 731 uniqueid = uniqueid[uniqueid.length -1]; 732 } 733 permalink = "http://indianahistorylibrary.on.worldcat.org/oclc/"+uniqueid; 734 }else{ 735 permalink = "http://indianahistorylibrary.on.worldcat.org/title/"+permalinkfilter; 736 } 737 colnum++; 738 totalnum++; 739 rowcountnum++; 740 741 742 743 if(colnum == 1){ 744 if(rowcountnum == 5){ 745 rownum++; 746 html += '</div><div class="collectionsimagesRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 747 rowcountnum = 1; 748 } 749 750 html += '<div class="layoutFourRow collectionsImagesLayoutFourRow"><div class="layoutFourLeft">'; 751 }else{ 752 html += '<div class="layoutFourRight collectionsImagesLayoutFourRight">'; 753 } 754 755 html += '<a href="'+permalink+'" aria-label="This links to the Worldcat page for '+title+'">'+ 756 ' <div class="layoutFourThumb">'+ 757 '<img src="'+image+'" alt="">'+ 758 '</div>'+ 759 '<div class="layoutFourCopy">'+ 760 '<h4 class="layoutFourTitle">'+title+'</h4>'+ 761 '<p>'+content+'</p>'+ 762 '<span class="learnMore">Learn more <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 763 '</div>'+ 764 '</a>'; 765 766 767 768 html += '</div>'; 769 if(colnum === 2){ 770 html += '</div>'; 771 colnum = 0; 772 } 773 } 774 } 775 776 } 777 778 if(totalnum > 50){ 779 totalnum = 50+'+'; 780 } 781 if(rownum > 0){ 782 $('div[data-class="collectionsimagesRowLazyLoad"]').css('display', 'block'); 783 }else{ 784 $('div[data-class="collectionsimagesRowLazyLoad"]').css('display', 'none'); 785 } 786 787 html += '</div>'; 788 $('.searchCollectionImages .sectionHeader .resultsCount').html('('+totalnum+')'); 789 $('.searchCollectionImages .slideUpWrap').prepend(html); 790 } 791 792 function displayCollectionsArchives(object){ 793 //object = object["results"]; 794 var rownum = 0; 795 var colnum = 0; 796 var totalnum = 0; 797 var rowcountnum = 0; 798 var html = ''; 799 800 html += '<div class="collectionsarchivesRowLazyLoad" data-row="0">'; 801 //console.log("Logging stuff"); 802 //console.log(object); 803 object = JSON.parse(object); 804 805 for(var i = 0; i < object.length; i++){ 806 var exhibit = object[i]; 807 808 809 810 if(exhibit['title']){ 811 //console.log(exhibit); 812 var title = exhibit['title']['mainTitles'][0]['text']; 813 //console.log(title); 814 var content = exhibit['description']['physicalDescription']; 815 var uniqueid = exhibit['identifier']['oclcNumber']; 816 817 var description = ""; 818 819 if(content){ 820 if(typeof content === 'object'){ 821 for(var j = 0; j < content.length; j++){ 822 if(j != 0){ 823 description += " "; 824 } 825 description += content[j]; 826 } 827 }else{ 828 description = content; 829 } 830 } 831 832 if(title){ 833 if(typeof title === 'object'){ 834 title = title[0]; 835 } 836 } 837 content = description; 838 content = content.substring(0, 20); 839 840 //console.log(title); 841 //console.log(description); 842 843 844 var permalinkfilter = title.replace(' ', '-'); 845 permalinkfilter = permalinkfilter.replace(':', ''); 846 var permalink = ''; 847 if(uniqueid){ 848 if(Array.isArray(uniqueid)){ 849 uniqueid = uniqueid[uniqueid.length -1]; 850 } 851 permalink = "https://indianahistorylibrary.on.worldcat.org/oclc/"+uniqueid; 852 }else{ 853 permalink = "https://indianahistorylibrary.on.worldcat.org/title/"+permalinkfilter; 854 } 855 856 colnum++; 857 totalnum++; 858 rowcountnum++; 859 860 861 if(colnum == 1){ 862 if(rowcountnum == 7){ 863 rownum++; 864 html += '</div><div class="collectionsarchivesRowLazyLoad" data-row="'+rownum+'" style="display: none;">'; 865 rowcountnum = 1; 866 } 867 868 html += '<div class="layoutFiveRow"><div class="layoutFiveBlock">'; 869 }else if(colnum < 3){ 870 html += '<div class="layoutFiveBlock">'; 871 }else{ 872 html += '<div class="layoutFiveBlock fiveBlockLast">'; 873 874 } 875 876 html += '<a href="'+permalink+'" aria-label="This links to the Worldcat page for '+title+'">'+ 877 '<div class="layoutFiveSideBar"></div>'+ 878 '<div class="layoutFiveCopy">'+ 879 '<h4 class="layoutFiveTitle">'+title+'</h4><p>'+ 880 content+ 881 '</p><span class="learnMore">See details <img src="/wp-content/themes/ihs/images/learnMoreIcon.png"></span>'+ 882 '</div>'+ 883 '</a>'; 884 885 886 887 html += '</div>'; 888 if(colnum === 3){ 889 html += '</div>'; 890 colnum = 0; 891 } 892 893 } 894 895 } 896 if(totalnum > 50){ 897 totalnum = 50+'+'; 898 } 899 900 if(rownum > 0){ 901 $('div[data-class="collectionsarchivesRowLazyLoad"]').css('display', 'block'); 902 }else{ 903 $('div[data-class="collectionsarchivesRowLazyLoad"]').css('display', 'none'); 904 } 905 html += '</div>'; 906 $('.collectionsArchives .sectionHeader .resultsCount').html('('+totalnum+')'); 907 $('.collectionsArchives .slideUpWrap').prepend(html); 908 } 909 910 function processSearchFilters(){ 911 var filters = []; 912 $('.searchFilterBtn').each(function(){ 913 if($(this).hasClass('selected')){ 914 var filter = $(this).attr('data-section'); 915 filters.push(filter); 916 } 917 }); 918 919 $('.searchSectionFilter').each(function(){ 920 $(this).removeClass('show').addClass('hide'); 921 }); 922 923 for(var i = 0; i < filters.length; i++){ 924 $('.searchSectionFilter[data-section="'+filters[i]+'"]').addClass('show').removeClass('hide'); 925 } 926 } 927 928$(document).ready(function(){ 929 $('.searchBarPage').on('keydown', function(e) { 930 if (e.which == 13) { 931 processSearch(true); 932 e.preventDefault(); 933 } 934 }); 935 936 $('.searchBarButtonPage').click(function(){ 937 processSearch(true); 938 }); 939 940 $('.searchBarGlobal').on('keydown', function(e) { 941 if (e.which == 13) { 942 var searchterm = $('.searchBarGlobal').val(); 943 location.href = '/search/?search='+searchterm; 944 e.preventDefault(); 945 } 946 }); 947 948 $('.searchBarButtonGlobal').click(function(){ 949 var searchterm = $('.searchBarGlobal').val(); 950 location.href = '/search/?search='+searchterm; 951 //location.href = '/search/'; 952 }); 953 954 $('.applySearchFilter').click(function(){ 955 processSearchFilters(); 956 }); 957 958 $('.clearSearchFilter').click(function(){ 959 $('.searchFilterBtn').each(function(){ 960 if(!$(this).hasClass('selected')){ 961 $(this).addClass('selected'); 962 } 963 }); 964 965 processSearchFilters(); 966 }); 967 968 $('.loadMoreButton').click(function(){ 969 var aclass = $(this).attr('data-class'); 970 var num = $(this).attr('data-num'); 971 num++; 972 $(this).attr('data-num', num); 973 var removebutton = false;
974 975 $('.'+aclass).each(function(){ 976 removebutton = false; 977 var row = $(this).attr('data-row'); 978 if(row == num){ 979 removebutton = true; 980 $(this).css('display', 'block'); 981 } 982 }); 983 if(removebutton){ 984 $(this).css('display', 'none'); 985 } 986 }); 987 988});
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.