$(function() { $('.bar[wb_analysis_object_id]').on("mouseover", function() { $(this).closest('.validation_div').find('.overlay_image[wb_analysis_object_id='+$(this).attr('wb_analysis_object_id')+']').addClass('show_band_overlay'); }).on("mouseout", function() { $(this).closest('.validation_div').find('.overlay_image[wb_analysis_object_id='+$(this).attr('wb_analysis_object_id')+']').removeClass('show_band_overlay'); }); $('.targetWeight').on("mouseover", function() { $(this).closest('.validation_div').find($('.'+$(this).attr('name')+' path')).addClass('targetHover'); }).on("mouseout", function() { $(this).closest('.validation_div').find($('.'+$(this).attr('name')+' path')).removeClass('targetHover'); }); }); $(window).on('load', function() { const targetNode = document.getElementsByClassName("antigen_view")[0]; // Options for the observer (which mutations to observe) const config = { attributes: true, childList: true, subtree: true }; // Callback function to execute when mutations are observed const callback = (mutationList) => { for (const mutation of mutationList) { if (mutation.type === "attributes" && mutation.target.classList.contains('tab_content') && !mutation.target.classList.contains('hidden')) { if (!mutation.target.querySelector('svg.transcript')) { let objectElem = mutation.target.querySelector('iframe.transcript_svg'); load_object_to_svg_antibody(objectElem); } } } }; // Create an observer instance linked to the callback function const observer = new MutationObserver(callback); // Start observing the target node for configured mutations observer.observe(targetNode, config); $('.transcript_svg').each(function() { load_object_to_svg_antibody(this); }); $('.sequence_svg').each(function() { load_object_to_svg_seq(this); }); }); function load_object_to_svg_antibody(objectElem) { var svg = $(objectElem.contentDocument).find('svg'); svg.attr('id', $(objectElem).attr('id')+'_svg'); svg.attr('data-transcript', $(objectElem).attr('data-transcript')); svg.prependTo($(objectElem).parent()); if (svg.length) { $(objectElem).hide(); objectElem.parentNode.removeChild(objectElem); } } function load_object_to_svg_seq(objectElem) { var svg = $(objectElem.contentDocument).find('svg'); svg.attr('id', $(objectElem).attr('id')+'_svg').css({width:'100%'}); svg.prependTo($(objectElem).parent()); if (svg.length) { $(objectElem).hide(); objectElem.parentNode.removeChild(objectElem); } }