PageSourceSearch

https://medlineplus.gov/jslib/mplus-frontend-controls-new.js

js medlineplus.gov collected 2026-10-01 07:28:21 UTC 29,337 bytes, 696 lines download raw bytes

1//Any needed global variables that the module may need to interact with
2var _pid='';
3
4var mplus_lang='';
5try {
6  mplus_lang=document.getElementsByTagName('HTML')[0].getAttribute('lang').toUpperCase();
7} catch (error) {
8  mplus_lang='EN'
9}
10
11//Main Module
12(function ($) {
13    //JS enabled, so show and hide special JS areas
14    $(".nojs").removeClass("nojs");
15
16
17    var lang = 'en';
18    if($("html").hasClass("esm")) {
19        lang = 'es';
20    }
21
22    // get the page type id
23    _pid = $("html").attr('id');
24    _root = $("html").data('root');
25
26
27	var messages = {
28		'en' : {
29            'search' : "The site search",
30            'clear-search' : "Clear search",
31            'menu' : "The navigation menu",
32            'collapse' : "has been collapsed.",
33            'expand' : "has been expanded.",
34            'moreless' : "Additional information in this section",
35            'slide' : "The slideshow has changed to slide number ",
36            'play' : "Play Slideshow",
37            'pause' : "Pause Slideshow",
38            'section-expand': "Expand Section",
39            'section-collapse': "Collapse Section",
40            'show': "Show",
41            'hide': "Hide",
42            'show-references': "Show references",
43            'hide-references': "Hide references"
44		},
45		'es' : {
46            'search' : "El cuadro de búsqueda",
47            'clear-search' : "Borrar búsqueda",
48            'menu' : "El menú de navegación",
49            'collapse' : "ha sido ocultado.",
50            'expand' : "ha sido extendido.",
51            'moreless' : "Información adicional en esta sección",
52            'slide' : "La presentación ha cambiado a la diapositiva número ",
53            'play' : "Empezar diapositivas",
54            'pause' : "Detener las diapositivas",
55            'section-expand': "Expanda sección",
56            'section-collapse': "Colapse sección",
57            'show': "Mostrar el campo de",
58            'hide': "Ocultar el campo de",
59            'show-references': "Mostrar referencias",
60            'hide-references': "Ocultar referencias"
61		}
62	}
63
64	/* Initalization Functions */
65	initButtons();
66	initMobileMenu();
67  initMobileSections();
68  initMobileSectionsPM();
69  initReferenceSections();
70  initReferenceSectionsPM();
71  initMoreListPM();
72
73  initSideMore();
74 	initListBreak();
75  initCategoryNavArea();
76  initReturnToTop();
77  initSearchClear();
78  initPlaceholderFix(); //Fix for IE8-9 only
79	initDictionaryFix(); //Fix for iOS7
80  if ($("link[rel='canonical']").attr("href").indexOf('coronavirus') === -1) {
81    initPageFeedback();
82  }
83  initGovDSubmit();
84  initVideoJumpLinks();
85  initImageModals();
86  initRSSHealthTopics();
87
88	/* Functions */
89    function initMobileMenu() {
90        $("#mplus-nav .navmenu-btn .hide-offscreen").text(messages[lang]['show']+" ");
91    	$("#mplus-nav .navmenu-btn").click(function (event) {
92    		var button = $(this);
93    		var Options = {
94    			"sm-menu-btn" : "menu",
95    			"sm-search-btn" : "search",
96    		}
97    		//Expand
98    		if(!button.hasClass("expanded")){
99	        	//Get expand accesibility message
100	        	var msg = messages[lang][Options[button.attr('id')]]+" "+messages[lang]['expand'];
101	           //Check another option is currently expanded, if so collapse it
102	           $("#mplus-nav .navmenu-btn.expanded").each(function(index) {
103	           		var other = $(this);
104	           		//Hide unselected option
105		       		$("#"+other.attr('id')+", "+"#"+other.attr('aria-controls')).removeClass("expanded");
106		       		//Add the unselected option's collapse accesibility message
107	                msg = messages[lang][Options[other.attr('id')]]+" "+messages[lang]['collapse']+" " + msg;
108		            //Fix the button's acessibility pressed/expanded area
109		            $("#"+other.attr('id')).attr('aria-pressed', 'false');
110		            $("#"+other.attr('aria-controls')).removeAttr('aria-expanded');
111                    //Update Button Text
112                    $(other).children(".hide-offscreen").text(messages[lang]['show']+" ");
113	           });
114	            //Show the selected area
115	           	$("#"+button.attr('id')+", "+"#"+button.attr('aria-controls')).addClass("expanded");
116                //Update Button Text
117                $(button).children(".hide-offscreen").text(messages[lang]['hide']+" ");
118	            //Update the live accesibility message
119	            $("#mplus-nav .sm-live-area").html(msg);
120	            //Update the button's acessibility expanded
121	            $("#"+button.attr('aria-controls')).attr('aria-expanded', 'true');
122
123    		}
124    		//Collapse
125    		else {
126		        //Hide the selected area
127		       	$("#"+button.attr('id')+", "+"#"+button.attr('aria-controls')).removeClass("expanded");
128                //Update Button Text
129                $(button).children(".hide-offscreen").text(messages[lang]['show']+" ");
130				//Update the live accesibility message
131				$("#mplus-nav .sm-live-area").html(messages[lang][Options[button.attr('id')]]+" "+messages[lang]['collapse']);
132	            //Update the button's acessibility expanded
133	            $("#"+button.attr('aria-controls')).removeAttr('aria-expanded');
134    		}
135    	});
136 	}
137 	function initButtons (){
138 		$('[role="button"]').attr('aria-pressed', 'false');
139 		$('[role="button"]').attr('tabindex', '0');
140 		$('[role="button"]').click(function (event) {
141 			var button = $(this);
142 			(button.attr('aria-pressed') == 'true') ? button.attr('aria-pressed', 'false') : button.attr('aria-pressed', 'true');
143 		});
144 	}
145
146  function initReferenceSections (){
147    if(_pid == "lab_test") {
148      $(".references").hide();
149      $(".references").after('<a id="ref-more" href="javascript:void(0);">'+messages[lang]['show-references']+'</a>');
150      $("#ref-more").css({"display": "inline-block", "font-weight": "bold", "margin-bottom": "1em" })
151      $("#ref-more").click(function () {
152        if ($(this).hasClass("expanded")) {
153          $(this).removeClass("expanded");
154          $(this).text(messages[lang]['show-references']);
155          $(".references").hide();
156        } else {
157          $(this).addClass("expanded");
158          $(this).text(messages[lang]['hide-references']);
159          $(".references").show();
160        }
161      })
162    }
163  }
164  function initReferenceSectionsPM (){
165    $(".mp-refs").hide();
166    $('.mp-refs').each(function(id) {
167      $(this).attr('id', 'refs-'+id);
168      $(".mp-refs").after('<a id="refs-btn-'+id+'" class="refs-btn" href="javascript:void(0);">'+messages[lang]['show-references']+'</a>');
169      $("#refs-btn-"+id).css({"display": "inline-block", "font-weight": "bold", "margin-bottom": "1em" })
170      $("#refs-btn-"+id).click(function () {
171        if ($(this).hasClass("expanded")) {
172          $(this).removeClass("expanded");
173          $(this).text(messages[lang]['show-references']);
174          $("#refs-"+id).hide();
175        } else {
176          $(this).addClass("expanded");
177          $(this).text(messages[lang]['hide-references']);
178          $("#refs-"+id).show();
179        }
180      })
181    });
182  }
183  function initMoreListPM() {
184      // Add button after each list to control it
185      // $(".mp-refs").hide();
186      $('.mp-more-list').each(function(id) {
187        $(this).attr('id', 'more-list-'+id);
188        $(this).after('<button id="more-btn-'+id+'" class="more-btn">Show More</button>');
189        $(this).find("li:gt(2)").hide();
190        // $("#refs-btn-"+id).css({"display": "inline-block", "font-weight": "bold", "margin-bottom": "1em" })
191        $("#more-btn-"+id).click(function () {
192          if ($(this).hasClass("expanded")) {
193            $(this).removeClass("expanded");
194            $("#more-list-"+id).find("li:gt(2)").hide();
195            $(this).text("Show More");
196          } else {
197            $(this).addClass("expanded");
198            $("#more-list-"+id).find("li:gt(2)").show();
199            $(this).text("Show Less");
200          }
201        })
202      });
203  }
204  function initMobileSectionsPM (){
205    // get first h2 or h3 in div
206    $('.mp-exp').each(function(id) {
207      var header = $(this).find(">
207h2:first-child");
208      if (header.length == 0) {
209        header = $(this).find(">h3:first-child");
210      }
211      if (header.length) {
212        $(this).attr('id', 'exp-'+id);
213        var expclass = "";
214        var exptext = "section-expand";
215        var exppressed = "false";
216        var bookmark = $(this).data("bookmark");
217        var bookmark_text = "";
218        if (bookmark) {
219          bookmark_text = 'id="'+bookmark+'" ';
220        }
221        if(id == 0) { // expand first
222          expclass = " expanded";
223          exptext = "section-collapse";
224          exppressed = "true";
225        }
226        var body = $(this).children().not(":header:first").wrapAll('<div class="exp-body'+expclass+'"></div>');
227        $("#exp-"+id+" .exp-body").attr('id', 'exp-body'+id);
228        header.wrap("<div class='exp-header"+expclass+"'></div>");
229        header.wrap("<div class='exp-title'></div>");
230        $("#exp-"+id+" .exp-header").append(
231          '<div class="exp-button">'
232          +'<button '+bookmark_text+'title="'+messages[lang][exptext]+'" role="button" aria-controls="exp-body'+id+'" aria-pressed="'+exppressed+'" type="submit">'
233          +'<span class="icon icon-section-action"></span><span class="hide-offscreen">'+messages[lang][exptext]+'</span>'
234          +'</button></div>'
235        );
236        $("#exp-"+id+" .exp-header").append('<div aria-live="polite" class="sm-live-area hide-offscreen"></div>');
237      }
238    });
239
240    $(".mp-exp .exp-header").click(function () {
241        //toggle section
242        if ($(this).children(".exp-button").css('display') != 'none') {
243            var head = $(this);
244            var button = $(head).children(".exp-button").children("button");
245            if($(head).children(".exp-title").children(":header:first").length) {
246                var title =  $(head).children(".exp-title").children(":header:first").text();
247                var bookmark =  $(head).parent().data("bookmark");
248                //Collapse
249                if ($(head).hasClass("expanded")) {
250                    if (bookmark) {
251                      history.replaceState("", document.title, window.location.pathname+window.location.search);
252                      $("#"+bookmark).focus();
253                    }
254                    $(head).removeClass("expanded");
255                    $(head).parent().children(".exp-body").removeClass("expanded");
256                    $(head).children(".sm-live-area").text(title+" "+messages[lang]['collapse']);
257                    $("#"+button.attr('aria-controls')).removeAttr('aria-expanded');
258                    $(button).attr('title', messages[lang]['section-expand']);
259                    $(button).children(".hide-offscreen").text(messages[lang]['section-expand']);
260                //Expand
261                } else {
262                    if (bookmark) {
263                      history.replaceState("", document.title, window.location.pathname+window.location.search+"#"+bookmark);
264                      $("#"+bookmark).focus();
265                    }
266                    $(head).addClass("expanded");
267                    $(head).parent().children(".exp-body").addClass("expanded");
268                    $(head).children(".sm-live-area").text(title+" "+messages[lang]['expand']);
269                    $("#"+button.attr('aria-controls')).attr('aria-expanded', 'true');
270                    $(button).attr('title', messages[lang]['section-collapse']);
271                    $(button).children(".hide-offscreen").text(messages[lang]['section-collapse']);
272                }
273            }
274        }
275    });
276
277    $(".expand-all").click(function () {
278        if ($(".mp-exp .exp-header").length) {
279            var header = $(".mp-exp .exp-header");
280            if ($(header).children(".exp-button").css('display') != 'none') {
281                if ($(header).children(".exp-title").children(":header").length) {
282                    var title = $(header).children(".exp-title").children(":header");
283                    var i;
284                    for (i = 0; i < title.length; i++) {
285                        $(header).addClass("expanded");
286                        $(header).parent().children(".exp-body").addClass("expanded");
287                    }
288                }
289            }
290        }
291    });
292    $(".collapse-all").click(function () {
293        if ($(".mp-exp .exp-header").length) {
294            var header = $(".mp-exp .exp-header");
295            if ($(header).children(".exp-button").css('display') != 'none') {
296                if ($(header).children(".exp-title").children(":header").length) {
297                    var title = $(header).children(".exp-title").children(":header");
298                    var i;
299                    for (i = 0; i < title.length; i++) {
300                        $(header).removeClass("expanded");
301                        $(header).parent().children(".exp-body").removeClass("expanded");
302                    }
303                }
304            }
305        }
306    });
307
308    // check for bookmark and focus to it if site_type_view
309	try {
310		var bookmarked_id = window.location.hash.replace(/^#!?/, '');
311		if (bookmarked_id && $('[data-bookmark='+bookmarked_id+']').length) {
312		  var bookmark_url = location.href;
313		  location.href = "#"+bookmarked_id;
314		  history.replaceState(null,null,bookmark_url);
315		  $("#"+bookmarked_id).click();
316		}
317	}
318	catch(e) {
319		;
320	}
321  }
322    function initMobileSections() {
323
324        //Insert default expand messages in button for collapsed sections
325        $(".section .section-header .section-button button").attr('title', messages[lang]['section-expand']);
326        $(".section .section-header .section-button button").append('<span class="hide-offscreen">'+messages[lang]['section-expand']+'</span>');
327        //Insert default expand messages in button for expanded sections
328        $(".section .section-header.expanded .section-button button").attr('title', messages[lang]['section-collapse']);
329        $(".section .section-header.expanded .section-button button .hide-offscreen").text(messages[lang]['section-collapse']);
330
331
332        $(".section .section-header").click(function () {
333            //toggle section
334            if ($(this).children(".section-button").css('display') != 'none') {
335
336                var head = $(this);
337                var button = $(head).children(".section-button").children("button");
338
339                if($(head).children(".section-title").children("h2").length) {
340                    var title =  $(head).children(".section-title").children("h2").text();
341                }
342                else {
343                    var title =  $(head).children(".section-title").children(".blue-label").text();
344                }
345
346                //Collapse
347                if ($(head).hasClass("expanded")) {
348                    //Remove expanded from section header
349                    $(head).removeClass("expanded");
350                    //Remove expanded from section body
351                    $(head).parent().children(".section-body").removeClass("expanded");
352                    //Update the live accesibility message
353                    $(head).children(".sm-live-area").text(title+" "+messages[lang]['collapse']);
354                    //Update the button's acessibility expanded
355                    $("#"+button.attr('aria-controls')).removeAttr('aria-expanded');
356                    //Update button's title and alt attributes
357                    $(button).attr('title', messages[lang]['section-expand']);
358                    $(button).children(".hide-offscreen").text(messages[lang]['section-expand']);
359
360                //Expand
361                } else {
362                    //Add expanded to section header
363                    $(head).addClass("expanded");
364                    //Add expanded to section body
365                    $(head).parent().children(".section-body").addClass("expanded");
366                    //Update the live accesibility message
367                    $(head).children(".sm-live-area").text(title+" "+messages[lang]['expand']);
368                    //Update the button's acessibility expanded
369                    $("#"+button.attr('aria-controls')).attr('aria-expanded', 'true');
370                    //Update button's title and alt attributes
371                    $(button).attr('title', messages[lang]['section-collapse']);
372                    $(button).children(".hide-offscreen").text(messages[lang]['section-collapse']);
373                }
374            }
375        });
376    }
377    function initSideMore() {
378        /** Show/hide buttons in side sections **/
379        $(".side-section button").click(function () {
380            var button = $(this);
381            //Collapse
382            if (button.hasClass("expanded")) {
383                //Remove expanded from Button
384                button.removeClass("expanded");
385                //Remove expanded from Area
386                button.parent().children(".more-links").slideUp("fast", function () {
387                    // Animation complete.
388                    $(this).removeClass("expanded"); //This = more-links
389                    //Update the live accesibility message
390                    $(this).parent().children(".live-area").text(messages[lang]['moreless']+" "+messages[lang]['collapse']);
391                    //Update the button's acessibility expanded
392                    $("#"+button.attr('aria-controls')).removeAttr('aria-expanded');
393                });
394            //Expand
395            } else {
396                //Add expanded to Button
397                button.addClass("expanded");
398                //Add expanded to Area
399                button.parent().children(".more-links").slideDown("fast", function () {
400                    // Animation complete.
401                    $(this).addClass("expanded"); //This = more-links
402                    //Update the live accesibility message
403                    $(this).parent().children(".live-area").text(messages[lang]['moreless']+" "+messages[lang]['expand']);
404                    //Update the button's acessibility expanded
405                    $("#"+button.attr('aria-controls')).attr('aria-expanded', 'true');
406                });
407            }
408        });
409    }
410    function initListBreak() {
411         // Handle line break for every 5th li(s) on the following pages:
412
413          switch (_pid) {
414          case "topic_byalpha":
415          case "topic_all":
416          case "flang_landing":
417          case "flang_topiclist":
418          case "organization":
419          case "orgtopic":
420          case "directory":
421          case "drug-index":
422          case "ency-video-index":
423          case "ency-index":
424          case "tpgp":
425          case "health_topics_by_letter":
426          case "multiple_languages_landing":
427          case "multiple_languages_by_topic":
428          case "organizations":
429          case "organizations_by_topic":
430          case "directories":
431          case "drug-index":
432          case "ency-video-index":
433          case "ency-index":
434          case "health_topics_by_group":
435               $("ul li:nth-child(5n)").addClass("break");
436          }
437    }
438    function initCategoryNavArea() {
439        $(".main-icon-area").click(function() {
440            var navurl = $(this).find("a.category-nav-link").attr('href');
441            if (typeof navurl !="undefined") location.assign(navurl);
442        });
443    }
444    function initReturnToTop() {
445        $(window).scroll(function() {
446            $(this).scrollTop() ? $(".return-top").fadeIn() : $(".return-top").fadeOut()
447        });
448    }
449    function initSearchClear (){
450        var reset = '<button class="search-reset "type="button" alt="'+messages[lang]['clear-search']+'" title="'+messages[lang]['clear-search']+'">&#10005;</button>';
451
452        $(window).on('load',function(){
453            if ($("#searchtext_primary").val().length !=0) {
454                addSearchReset();
455            }
456        });
457        $("#searchtext_primary").keyup(function() {
458            if ($("#searchtext_primary").val().length !=0) {
459                addSearchReset();
460            } else {
461                removeSearchReset();
462            }
463        });
464        $('#searchtext_primary').keydown(function(e){
465            if (e.keyCode == 27) {
466                removeSearchReset();
467                $(this).val("");
468            }
469        });
470        function addSearchReset(){
471            if($("#mplus-search .search-reset").length == 0) {
472                $("#searchtext_primary").after(reset);
473                $(".search-reset").click(function(event) {
474                    $(".search-reset").remove();
475                    $("#searchtext_primary").val("");
476                });
477            }
478        }
479        function removeSearchReset(){
480            $(".search-reset").remove();
481        }
482    }
483    function initPlaceholderFix() {
484        $(window).on('load',function(){
485            try {
486                $('input, textarea').placeholder();
487            }
488            catch (err) {
489                //Browser is not IE8 or IE9
490                //console.log(err);
491            }
492        });
493    }
494    function initDictionaryFix() {
495        $('#dictionary-form input').keypress(function(e) {
496                if (e.which == 13) {
497                    e.preventDefault();
498                    e.stopPropagation();
499                    $('#dictionary-form').submit();
500                }
501        });
502    }
503    function initPageFeedback() {
504        if (_pid != 'home') {
505          $('#mplus-content').append('<div id="page-feedback"></div>');
506        }
507    }
508    function initSurveryDisclaimer() {
509        if (typeof display_survey_disclaimer !== 'undefined' && display_survey_disclaimer) {
510          if (_pid == "article" || _pid == "carepoint") {
511              $('#mplus-footer').before('<div class="survey-disclaimer"></div>')
512          }
513          else {
514              $('#mplus-content').append('<div class="survey-disclaimer"></div>')
515          }
516          $('.survey-disclaimer').append(
517              '<h2>Page Survey</h2>'
518              +'<span>OMB Control Number: 0925-0648. Expiration Date: March 31, 2018</span>'
519              +'<p>Public reporting burden for this collection of information is '
520              +'estimated to average 1 minute per response, including the time '
521              +'for reviewing instructions, searching existing data sources, '
522              +'gathering and maintaining the data needed, and completing and '
523              +'reviewing the collection of information. An agency may not '
524              +'conduct or sponsor, and a person is not required to respond '
525              +'to, a collection of information unless it displays a currently '
526              +'valid OMB control number. Send comments regarding this burde
526n '
527              +'estimate or any other aspect of this collection of '
528              +'information, including suggestions for reducing this burden, '
529              +'to: NIH, Project Clearance Branch, 6705 Rockledge Drive, MSC '
530              +'7974, Bethesda, MD 20892-7974, ATTN: PRA (0925-0648). Do not '
531              +'return the completed form to this address.</p>'
532          );
533        }
534    }
535    function initGovDSubmit() {
536      $(".gov-delivery").append('<input type="hidden" name="subscription_type" value="email"/>');
537      $(".gov-delivery").append('<input type="hidden" name="phone" value=""/>');
538      $(".gov-delivery").submit(function(e){
539        var email_input = $(this).find("input[name='email']").val();
540        $(this).find("input[name='phone']").val(email_input);
541        // if email input is a phone number, set sub type to phone
542        if (/^[0-9\- \)\(\+\/\.]+$/.test(email_input)) {
543          $(this).find("input[name='subscription_type']").val("phone");
544        } else {
545          $(this).find("input[name='subscription_type']").val("email");
546        }
547     });
548    }
549    function initVideoJumpLinks() {
550      var videojs_video = $('.video-container div').attr('id');
551      if (videojs_video) {
552        // Check for initial time hash
553        try {
554          var timeParam = window.location.hash.split('#')[1].split('=');
555          timeParam.shift();
556        } catch(err) {}
557
558        // init jump links
559        $("a[href^='#t=']").click(function() {
560            $('video')[0].play();
561     	   $('video')[0].currentTime = $(this).attr('href').substr(3);
562     	   document.getElementById("mplusPlayer").scrollIntoView();
563     	   document.getElementById("mplusPlayer").focus();
564
565        });
566      }
567    }
568
569    function initImageModals() {
570      // Control functions
571      function modalClose(anchor, modal) {
572        $('#mplus-wrap :focusable, #'+modal.attr('id')+' :focusable').removeAttr('tabindex');
573        $('[role="button"]').attr('tabindex', '0');
574        modal.hide();
575        $(anchor).focus();
576        $("body").removeClass("modal-open");
577      }
578      function modalOpen(anchor, modal) {
579        modal.show();
580        $(".modal-background").click(function(e) {
581          modalClose(anchor, modal);
582        });
583        $(".modal-close").focus();
584        $('#'+modal.attr('id')+' :focusable').attr('tabindex', '1');
585        $('#mplus-wrap :focusable').attr('tabindex', '-1');
586        $( document ).on( 'keydown', function ( e ) {
587          if ( e.keyCode === 27 ) { // ESC
588            modalClose(anchor, modal);
589          }
590        });
591        $("body").addClass("modal-open");
592      }
593
594      // Prepare modals for each anchor element with class 'image-modal'
595      $('.image-modal').each(function( index ) {
596        var file_path = _root + $(this).data('filepath');
597        // console.log('fp', file_path);
598        var caption = $(this).data('caption');
599        if (caption.length > 0) {
600          caption = '<p class="modal-card-caption">' + caption + '</p>'
601        }
602        var credit = $(this).data('credit');
603        var sourceurl = $(this).data('sourceurl');
604        if (credit.length > 0) {
605          var credit_label = '';
606          if (lang == 'es'){
607            credit_label = 'Crédito';
608          } else {
609            credit_label = 'Credit';
610          }
611          if (sourceurl.length > 0) {
612            credit = '<p style="margin:0;">'+credit_label+': <a href="'+sourceurl+'" target="_blank">'+credit+'</a></p>'
613          } else {
614            credit = '<p style="margin:0;">'+credit_label+': '+credit+'</p>'
615          }
616        }
617        var image_id = $(this).attr('id');
618        var title = $(this).data('title')
619        if (title.length < 1) {
620          title = $(this).html()
621          var title_array = title.split('<');
622          title_array = title_array[0].split(' ');
623          // console.log(title_array)
624          title = '';
625          for(var i = 0; i < title_array.length; i++) {
626            title += title_array[i].charAt(0).toUpperCase() + title_array[i].slice(1) + ' ';
627          }
628          
629        }
630        var alt = $(this).data('alt');
631        if (alt.length < 1) {
632          alt = 'An image depicting ' + title
633        }
634        var terms_of_use = '';
635        var tou_link = '';
636        if (lang == 'es') {
637          terms_of_use = 'Uso de ilustraciones y otros contenidos';
638          tou_link = 'https://medlineplus.gov/spanish/acercade/uso/usodecontenido/'
639        } else {
640          terms_of_use = 'Use of illustrations and other content';
641          tou_link = 'https://medlineplus.gov/about/using/usingcontent/'
642        }
643        $('body').append(
644          '<div id="image-modal-'+image_id+'" class="modal">' +
645            // '<div id="modal-background-'+image_id+'" class="modal-background"></div>' +
646            '<div class="modal-card">' +
647              '<header class="modal-card-head">' +
648                '<button id="modal-close-'+image_id+'" class="modal-close" role="button" title="Close Image" aria-label="Close Image"><span aria-hidden="true">X</span></button>' +
649                '<p class="modal-card-title">'+title+'</p>' +
650              '</header>' +
651              '<section class="modal-card-body">' +
652                '<img class="modal-card-img" src="'+file_path+'" alt="'+alt+'">' +
653                ''+caption+'' +
654              '</section>' +
655              '<section class="modal-card-foot">' +
656                ''+credit+'' +
657                '<p style="margin:0;"><a href="'+tou_link+'" target="_blank">'+terms_of_use+'</a></p>' +
658              '</section>' +
659            '</div>' +
660          '</div>'
661        );
662        var anchor = $(this)
663        var modal = $('#image-modal-'+image_id);
664        var close_btn = $('#modal-close-'+image_id);
665        close_btn.click(function(e) {
666          modalClose(anchor, modal);
667          e.preventDefault();
668        });
669        modal.click(function(e) {
670          // console.log('event target: ', e.target.id, modal.attr('id'));
671          if (e.target.id == modal.attr('id')) {
672            modalClose(anchor, modal);
673            e.preventDefault();
674          }
675        });
676        $(this).click(function(e) {
677          modalOpen(anchor, modal);
678          e.preventDefault();
679        });
680      });
681    }
682
683  function initRSSHealthTopics(){
684    $(".tpgroup .btn-ec").click(function () {
685      var tg = $(this);
686      if ($(tg).parent().children('ul').attr('class') == "hide") {
687        $(tg).parent().children('ul').attr('class', 'display');
688        $(tg).parent().children('.btn-ec').attr('class', 'btn-ec contract');
689      }
690      else {
691        $(tg).parent().children('ul').attr('class', 'hide');
692        $(tg).parent().children('.btn-ec').attr('class', 'btn-ec expand');
693      }
694    });
695  }
696})(jQuery);

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.