1(function($) { 2 3 // JavaScript Document 4 $().ready(function() { 5 $('#modal-overlay .modal-wrapper button.close-modal').click(function(){ 6 $('#modal-overlay').fadeOut(500,function(){ 7 $('#modal-overlay .modal-wrapper .modal-content').html(''); 8 }); 9 10 }); 11 12 $('.openmodal').click(function(){ 13 event.preventDefault(); 14 var target = $(this).attr('href'); 15 $('#sitemodal').modal('show'); 16 if($(this).attr('title')){ 17 $('#sitemodal .modal-title').text($(this).attr('title')); 18 } 19 $('#sitemodal .modal-title').text($(this).attr('title')); 20 if(target.match(/\.mp4/)){ 21 var video_html = '<video controls autoplay><source src="' + target + '" type="video/mp4">Your browser does not support the video tag.</video>'; 22 $('#sitemodal').find('.modal-content .modal-body').html(video_html); 23 } 24 else if(target.match(/\.mp3/)){ 25 var audio_html = '<div style="display:flex;justify-content:center;"><audio controls autoplay><source src="' + target + '" type="audio/mpeg">Your browser does not support the audio tag.</audio></div>'; 26 $('#sitemodal').find('.modal-content .modal-body').html(audio_html); 27 } 28 else if(target.match(/\.pdf/)){ 29 var iframe_html = '<iframe src=>"' + target + '"></iframe>'; 30 $('#sitemodal').find('.modal-content .modal-body').html(iframe_html); 31 } 32 33 }); 34 35 $('#sitemodal').on('hidden.bs.modal', function (e) { 36 $('#sitemodal').find('.modal-content .modal-body').html(''); 37 }); 38 39 $('.countdown').each(function(){ 40 //console.log('herea************'); 41 var dt = $(this).html(); 42 var end = Date.parse($(this).text() + ' EST'); 43 var obj=$(this); 44 //console.log(dt); 45 46 var _second = 1000; 47 var _minute = _second * 60; 48 var _hour = _minute * 60; 49 var _day = _hour * 24; 50 var timer; 51 52 var theme_single_full = obj.hasClass('theme-single-full'); 53 54 if(obj.hasClass('days') || obj.hasClass('hours')||obj.hasClass('minutes')||obj.hasClass('seconds')){ 55 var showday=showhour=showminute=showsecond=0; 56 if(obj.hasClass('days')) 57 showday=true 58 if(obj.hasClass('hours')) 59 showhour=true 60 if(obj.hasClass('minutes')) 61 showminute=true 62 if(obj.hasClass('seconds')) 63 showsecond=true 64 } 65 else{ 66 var showday=showhour=showminute=showsecond=1; 67 } 68 69 function showRemaining() { 70 var now = new Date(); 71 var distance = end - now; 72 73 if (distance < 0) { 74 75 clearInterval(timer); 76 obj.html(dt); 77 78 return; 79 } 80 var days = zero_pad(Math.floor(distance / _day)); 81 var hours = zero_pad(Math.floor((distance % _day) / _hour)); 82 var minutes = zero_pad(Math.floor((distance % _hour) / _minute)); 83 var seconds = zero_pad(Math.floor((distance % _minute) / _second)); 84 85 var timerstr=''; 86 87 if(theme_single_full){ 88 if(showday) 89 timerstr +='<span class="counter"><span>' + days + '</span><span>DAYS</span></span>'; 90 else if(showhour) 91 timerstr += '<span class="counter"><span>' + hours + '</span><span>HOURS</span></span>'; 92 else if(showminute) 93 timerstr += '<span class="counter"><span>' + minutes + '</span><span>MINUTES</span></span>'; 94 else if(showsecond) 95 timerstr += '<span class="counter"><span>' + seconds + '</span><span>SECONDS</span></span>'; 96 } 97 else{ 98 if(showday) 99 timerstr +='<span class="days"><span>DAYS</span><span>' + days + '</span></span>'; 100 if(showhour) 101 timerstr += '<span class="hours"><span>HOURS</span><span>' + hours + '</span></span>'; 102 if(showminute) 103 timerstr += '<span class="minutes"><span>MINUTES</span><span>' + minutes + '</span></span>'; 104 if(showsecond) 105 timerstr += '<span class="seconds"><span>SECONDS</span><span>' + seconds + '</span></span>'; 106 107 } 108 109 110 //console.log(timerstr); 111 obj.html(timerstr); 112 //clearInterval(timer); 113 } 114 115 timer = setInterval(showRemaining, 1000); 116 }); 117 118 $("a[href$='.pdf'] img").parent().addClass('noDocIcon'); 119 $("a[href$='.doc'] img").parent().addClass('noDocIcon'); 120 121 // calcualte table column total 122 // ex. <span class='cal_column_total' data-total-column-id='calculate-total'></span> 123 // <th id='calculate-total'>Number of pages</th> 124 $('.cal_column_total').each(function(){ 125 column_id = $(this).attr('data-total-column-id'); 126 column_obj = $('th#' + column_id);; 127 table = column_obj.closest('table'); 128 if(table.length){ 129 values = table.find('tr td').filter(':nth-child('+ (column_obj[0].cellIndex + 1 ) + ')'); 130 var total=0; 131 values.each(function(){ 132 total += parseInt($(this).text()); 133 }); 134 $(this).text(total); 135 } 136 137 }); 138 139 toggleMegaFooter(); 140 themeAdjustments(); 141 $.fn.matchHeight._update('byRow'); 142 //console.log('executed scripts.js doc ready'); 143 144 $(".play-pause").click(function() { 145 var carousel = ($(this).attr('data-carousel')); 146 var status = ($('#' + carousel).attr('data-status')); 147 if (status == 'play') { 148 $('#' + carousel).carousel('pause'); 149 $('#' + carousel).attr('data-status', 'pause') 150 $(this).children('.fa-play').hide(); 151 $(this).children('.fa-pause').hide(); 152 $(this).children('.fa-play').show(); 153 } else { 154 $('#' + carousel).carousel('cycle'); 155 $('#' + carousel).attr('data-status', 'play') 156 $(this).children('.fa-pause').show(); 157 $(this).children('.fa-play').hide(); 158 159 } 160 161 }); 162 163 var url_ck = window.location.href.replace(/https?:\/\/.*?\//, "/"); 164 var pageLength_pre = 100; 165 166 167 $('.datatable').each(function(){ 168 var i=0; 169 var sort_arry=[]; 170 var nonsearchable_col=[]; 171 var searchplaceholder=$(this).attr('data-searchplaceholder'); 172 var searchlabel=$(this).attr('data-searchlabel'); 173 174 //set default lengthmenu 175 if($(this).attr('data-pagelength') != ''){ 176 pageLength_pre=parseInt($(this).attr('data-pagelength')); 177 } 178 179 if (url_ck == "/liaisons") { pageLength_pre = -1; } 180 181 182 var show_search = $(this).attr('data-showsearch') == 'false' ? false: true; 183 var show_lengthmenu = $(this).attr('data-showlengthmenu') == 'false' ? false: true; 184 var show_paginate = $(this).attr('data-showpaginate') == 'false' ? false: true; 185 186 if( $(this).attr('data-show-all') === 'true' ){ 187 var lengthMenu = [[-1, 10, 25, 50, 100,200], ["All", 10, 25, 50, 100,200]]; 188 } 189 else{ 190 var lengthMenu = [[10, 25, 50, 100,200,-1], [10, 25, 50, 100,200,"All"]]; 191 } 192 193 if(! searchlabel){ 194 searchlabel="Search"; 195 } 196 $(this).find('thead tr th').each(function(){ 197 sort = $(this).attr('data-sort'); 198 searchable = $(this).attr('data-searchable') 199 if(sort){ 200 sort_arry.push([i,sort]); 201 } 202 if(searchable=='false'){ 203 nonsearchable_col.push(i); 204 } 205 206 i++; 207 }); 208 209 config = { 210 "pageLength": pageLength_pre, 211 "lengthMenu": lengthMenu, 212 "order": sort_arry, 213 "searching": show_search, 214 "bLengthChange" : show_lengthmenu, 215 "bPaginate": show_paginate, 216 "columnDefs": [ 217 { "searchable": false, "targets": nonsearchable_col } 218 ], 219 language: { 220 searchPlaceholder: searchplaceholder, 221 search: searchlabel 222 } 223 }; 224 //config['iDisplayLength'] = -1; 225 226 if($(this).find('thead tr th.no-sort').length){ 227 config['columns']=[]; 228 $(this).find('thead tr th').each(function(){ 229 if($(this).hasClass('no-sort')){ 230 config['columns'].push({"sortable": false}); 231 } 232 else{ 233 config['columns'].push({"sortable": true}); 234 } 235 236 237 }); 238 } 239 240 241 $(this).DataTable(config); 242 }); 243 244 $('.rgtableview input.input-sm').after('<i class="fa fa-search searchIcon"></i>'); 245 246 //Set default contacting reason dropdown value 247 (function() { 248 url_path = window.location.href.replace(/https?:\/\/.*?\//, "/"); 249 ref_path = document.referrer.replace(/https?:\/\/.*?\//, "/"); 250 if (ref_path.match(/\/research\/catalog/)) { 251 $("#edit-submitted-your-inquiry-contact-reason").val('research').trigger('change'); 252 } else if (url_path == "/contact?web") { 253 $("#edit-submitted-your-inquiry-contact-reason").val('website').trigger('change'); 254 } 255 $("#edit-submitted-your-inquiry-referring-url").val(document.referrer); 256 $referring_url = $("input[name='submitted[your_inquiry][referring_url]'][type='hidden']"); 257 if ($referring_url.length !== 0) { 258 $referring_url.val(document.referrer); 259 } 260 }()); 261 262 //hide&show event dates 263 var msg_show_full="Show all event dates"; 264 var msg_show_recent="Show upcoming event dates"; 265 $moreevents = $("<a>",{"href":'#','class':'moreeventlink'}).text(msg_show_full); 266 $(".multiple_date_of_event .more-dates").after($moreevents); 267 $moreevents.click(function(event) { 268 event.preventDefault(); 269 $(".multiple_date_of_event .more-dates").toggle( "slow", function(event) { 270 // Animation complete. 271 var $mdates = $(".multiple_date_of_event .more-dates"); 272 if($mdates.is(":visible")){ 273 $('.moreeventlink').text(msg_show_recent); 274 } 275 else{ 276 $('.moreeventlink').text(msg_show_full); 277 278 } 279 }); 280 }); 281 }); 282 283 284 285 286 287 $(window).resize(function() { 288 toggleMegaFooter(); 289 }); 290 291 function toggleMegaFooter() { 292 var width = $(window).width(); 293 if (width <= 760) { 294 $('.mega-col .panel-collapse').addClass("collapse"); 295 $('.mega-col h2 a').attr('data-toggle', 'collapse'); 296 $('.mega-col h2 a').attr('data-parent', '#mega-footer'); 297 } 298 if (width > 760) { 299 $('.mega-col .panel-collapse').removeClass("collapse"); 300 $('.mega-col .panel-collapse').removeAttr("style"); 301 $('.mega-col h2 a').removeAttr('data-toggle'); 302 } 303 } 304 305 function themeAdjustments() { 306 307 // Activate pager for America's Founding Docs Photo Detail Pages 308 if ($('.section-founding-docs .pagination').length) { 309 jQuery('.pagination li a').click(function(event) { 310 event.preventDefault(); 311 var path = "/files/founding-docs/" + jQuery(this).attr('title'); 312 jQuery('.featured-image').attr('src', path); 313 }); 314 } 315 316 // Make .box elements equal height if wrapped by a .row with the make-eq class 317 $('.thumbnail-grid .img-wrap').each(function() { 318 var parent_id = $(this).parent().attr('id'); 319 $(this).attr('data-match-height', parent_id); 320 }); 321 if ($('#main-col .make-eq').length) { 322 $('#main-col .make-eq .box').matchHeight(); 323 $('#main-col .make-eq .title-box').matchHeight(); 324 $('#main-col .make-eq .boxed').matchHeight(); 325 $('#main-col .make-eq .traningresource').matchHeight(); 326 327 } 328 if ($('#main-col .make-eq .news-feature-text').length) { 329 $('#main-col .make-eq .news-feature-text').matchHeight(); 330 } 331 if ($('.panel .thumbnail-grid').length) { 332 $('.panel .thumbnail-grid .img-wrap').matchHeight(); 333 } 334 335 // Initialize social media tooltips 336 $("#social-media li").tooltip(); 337 var menu_to_use = '#main-nav'; 338 if ($('#sidebar-first #left-menu').length > 0) { 339 menu_to_use = '#sidebar-first #left-menu'; 340 } 341 // Initialize slide out menu for mobile devices 342 343 var jPM = $.jPanelMenu({ 344 menu: menu_to_use, 345 trigger: '#nav-toggle', 346 direction: 'right', 347 openPosition: '75%', 348 panelPosition: 'static', 349 excludedPanelContent: 'style, script, .modal' 350 }); 351 352 // Initialize responsize jQuery breaks 353 var jRes = jRespond([{ 354 label: 'small', 355 enter: 0, 356 exit: 767 357 }, { 358 label: 'large', 359 enter: 768, 360 exit: 10000 361 }]); 362 363 // Run functions that depend on viewport width 364 jRes.addFunc({ 365 366 breakpoint: 'small', 367 368 // Run these functions when the viewport is mobile sized 369 enter: function() { 370 371 // Turn on the slide-out menu 372 jPM.on(); 373 374 // Add classes to enable accordion-style mega footer menus 375 $('.mega-col .panel-collapse').addClass("collapse"); 376 //$('#toc').detach().prependTo('#block-system-main'); 377 $('#toc').detach().insertAfter('h1'); 378 379 $('.block-user-alert-holder').detach().prependTo('#block-system-main'); 380 //$('#block-system-main h1').detach().prependTo('#block-system-main'); 381 // $('.mega-col h2 a').attr('data-toggle','collapse'); 382 }, 383 384 // Run these functions when the viewport is larger than mobile 385 exit: function() { 386 387 // Turn off the slide-out menu 388 jPM.off(); 389 $('#toc').detach().prependTo('#toc-block'); 390 $('.block-user-alert-holder').detach().prependTo('#alert-block'); 391 392 // Remove classes to disable accordion-style mega footer menus 393 $('.mega-col .panel-collapse').removeClass("collapse"); 394 //$('.mega-col h2 a').removeAttr('data-toggle'); 395 } 396 }); 397 } 398 399 /* Scroll to Top */ 400 var offset = 100; 401 var duration = 500; 402 jQuery(window).scroll(function() { 403 if (jQuery(this).scrollTop() > offset) { 404 jQuery('.back-to-top').fadeIn(duration); 405 } else { 406 jQuery('.back-to-top').fadeOut(duration); 407 } 408 }); 409 410 jQuery('.back-to-top').click(function(event) { 411 event.preventDefault(); 412 jQuery('html, body').animate({ 413 scrollTop: 0 414 }, duration); 415 return false;
416 }); 417 418 // Activate fancybox lightbox 419 $(".enlarge").fancybox(); 420 421 $(".play-pause").click(function() { 422 alert($(this).attr('data-parent')); 423 $('#citizen-archivist-slideshow').carousel('pause'); 424 }); 425 426 $(window).on("load", function() { 427 $("div[title='Remembering 9/11']").find('.play-pause').click(); 428 }); 429 430 function zero_pad(num, size=2) { 431 num = num.toString(); 432 while (num.length < size) num = "0" + num; 433 return num; 434 } 435 436 437 438}(jQuery)); 439 440(function () { 441 // Remove the hash from the url bar after the timeline has been advanced - #OPLM-226 - SG 442 setTimeout(function(){ 443 if(document.getElementsByClassName("ntimeline").length){ 444 window.location.hash = ""; 445 history.pushState("", document.title, window.location.pathname); 446 } 447 }, 1000); 448}()); 449 450/* 451 452 * @name DoubleScroll 453 * @desc displays scroll bar on top and on the bottom of the div 454 * @requires jQuery 455 * 456 * @author Pawel Suwala - http://suwala.eu/ 457 * @author Antoine Vianey - http://www.astek.fr/ 458 * @version 0.5 (11-11-2015) 459 * 460 * Dual licensed under the MIT and GPL licenses: 461 * https://www.opensource.org/licenses/mit-license.php 462 * http://www.gnu.org/licenses/gpl.html 463 * 464 * Usage: 465 * https://github.com/avianey/jqDoubleScroll 466 467 */ 468(function( $ ) { 469 470 jQuery.fn.doubleScroll = function(userOptions) { 471 472 // Default options 473 var options = { 474 contentElement: undefined, // Widest element, if not specified first child element will be used 475 scrollCss: { 476 'overflow-x': 'auto', 477 'overflow-y': 'hidden' 478 }, 479 contentCss: { 480 'overflow-x': 'auto', 481 'overflow-y': 'hidden' 482 }, 483 onlyIfScroll: true, // top scrollbar is not shown if the bottom one is not present 484 resetOnWindowResize: false, // recompute the top ScrollBar requirements when the window is resized 485 timeToWaitForResize: 30 // wait for the last update event (usefull when browser fire resize event constantly during ressing) 486 }; 487 488 $.extend(true, options, userOptions); 489 490 // do not modify 491 // internal stuff 492 $.extend(options, { 493 topScrollBarMarkup: '<div class="doubleScroll-scroll-wrapper" style="height: 20px;"><div class="doubleScroll-scroll" style="height: 20px;"></div></div>', 494 topScrollBarWrapperSelector: '.doubleScroll-scroll-wrapper', 495 topScrollBarInnerSelector: '.doubleScroll-scroll' 496 }); 497 498 var _showScrollBar = function($self, options) { 499 500 if (options.onlyIfScroll && $self.get(0).scrollWidth <= $self.width()) { 501 // content doesn't scroll 502 // remove any existing occurrence... 503 $self.prev(options.topScrollBarWrapperSelector).remove(); 504 return; 505 } 506 507 // add div that will act as an upper scroll only if not already added to the DOM 508 var $topScrollBar = $self.prev(options.topScrollBarWrapperSelector); 509 510 if ($topScrollBar.length == 0) { 511 512 // creating the scrollbar 513 // added before in the DOM 514 $topScrollBar = $(options.topScrollBarMarkup); 515 $self.before($topScrollBar); 516 517 // apply the css 518 $topScrollBar.css(options.scrollCss); 519 $self.css(options.contentCss); 520 521 // bind upper scroll to bottom scroll 522 $topScrollBar.bind('scroll.doubleScroll', function() { 523 $self.scrollLeft($topScrollBar.scrollLeft()); 524 }); 525 526 // bind bottom scroll to upper scroll 527 var selfScrollHandler = function() { 528 $topScrollBar.scrollLeft($self.scrollLeft()); 529 }; 530 $self.bind('scroll.doubleScroll', selfScrollHandler); 531 } 532 533 // find the content element (should be the widest one) 534 var $contentElement; 535 536 if (options.contentElement !== undefined && $self.find(options.contentElement).length !== 0) { 537 $contentElement = $self.find(options.contentElement); 538 } else { 539 $contentElement = $self.find('>:first-child'); 540 } 541 542 // set the width of the wrappers 543 $(options.topScrollBarInnerSelector, $topScrollBar).width($contentElement.outerWidth()); 544 $topScrollBar.width($self.width()); 545 $topScrollBar.scrollLeft($self.scrollLeft()); 546 547 } 548 549 return this.each(function() { 550 551 var $self = $(this); 552 553 _showScrollBar($self, options); 554 555 // bind the resize handler 556 // do it once 557 if (options.resetOnWindowResize) { 558 559 var id; 560 var handler = function(e) { 561 _showScrollBar($self, options); 562 }; 563 564 $(window).bind('resize.doubleScroll', function() { 565 // adding/removing/replacing the scrollbar might resize the window 566 // so the resizing flag will avoid the infinite loop here... 567 clearTimeout(id); 568 id = setTimeout(handler, options.timeToWaitForResize); 569 }); 570 571 } 572 573 }); 574 575 } 576 577}( jQuery )); 578
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.