/* Copyright 2013-2018 The MathWorks, Inc. */ function queryByClassName(className, elem) { if (!elem) elem = document.body; if (typeof elem.querySelectorAll === "function") { return elem.querySelectorAll("."+className); } else { return elem.getElementsByClass(className); } } function nav_token_usage_details(direction) { var els = queryByClassName("token_usage_details_tabrow"); var selectedIdx = 0; var selectedClassName = "selected"; for (selectedIdx; selectedIdx < els.length; selectedIdx++) { if (els[selectedIdx].classList.contains(selectedClassName)) { break; } } var nextIdx = selectedIdx; if (direction === -1 && selectedIdx > 0) { nextIdx = selectedIdx-1; } else if (direction === 1 && selectedIdx < els.length - 1) { nextIdx = selectedIdx + 1; } if (nextIdx !== selectedIdx) { els[selectedIdx].classList.remove(selectedClassName); els[nextIdx].classList.add(selectedClassName); els[nextIdx].scrollIntoView(alignWithTop=false); } return false; } function tabrowClicked(event) { } function popupOnload() { var els = queryByClassName("token_usage_details_tabrow"); for (var i=0; i" + top.rtwGetFileName(link2Src) + ""; var bodyNode = document.body; bodyNode.insertBefore(link, bodyNode.firstElementChild); } top.updateHyperlinks(); // update fileSelector frame if (top.fileSelector) { var o = top.fileSelector.document.getElementById('fileSelector'); if (o) { o.value = filename; } } // add links to line numbers var hasLineFlag = null; if (top.TraceInfoLineFlag && top.TraceInfoLineFlag.instance) { hasLineFlag = true; } else { hasLineFlag = false; } if(hasLineFlag) { var lines = queryByClassName("ln", codeElement); var lineTraceFlag = top.TraceInfoLineFlag.instance.lineTraceFlag; var lineNo = null; for (var i=0; i= 0; --i) { var childNode = trNode.childNodes[i]; if (childNode.tagName.toUpperCase() === "TD") { return childNode.childNodes; } } return null; } // see g1225075 function fixBoxStyleFnHeaderLineWidths() { // Match strings like "/**********/" which is the top line of // a box-style function comment header var reBoxHeader = /\/\*+\//; // Match strings like "' */" which is the contents of the text // element originally generated in the report to pad the width of // the line. var rePadding = /'\s*\*\//; // All block identifier elements in the report page blkLineElts = queryByClassName("blk"); for (var i = 0; i < blkLineElts.length; ++i) { var origPadding = blkLineElts[i].nextSibling; if (origPadding.textContent.match(rePadding)) { var spanElt = findParent(blkLineElts[i], { tagName: "span", className: "ct" }); if (!spanElt) { continue; } // The numbered line in the report containing block identifier "i" var tableRowElt = findParent(spanElt, { tagName: "tr" }); if (!tableRowElt) { continue; } // Loop backward through table rows (i.e., report lines) looking // for the "/***************/" start of the header. When found save // its pixel width. Not actually the width of the itself but // the span inside its last . This is will determine the real // padding that is needed for proper alignment regardless of font // or CKJ characters. var targetWidth = 0; var sanity = Number.MAX_VALUE; var node = tableRowElt.previousSibling; while (node && (sanity-- > 0)) { var lastCellContents = getLastTableCellContents(node); if (lastCellContents) { if (lastCellContents.length === 0) { break; } if (lastCellContents[0].textContent.match(reBoxHeader)) { targetWidth = lastCellContents[0].offsetWidth; break; } } node = node.previousSibling; } // If applying a new padding (i.e., targetWidth > 0), replace // the original padding "' */' (a single text element) with // two text elements and a span in between. The span will be the // new pixel-accurate padding. if (targetWidth > 0) { var singleQuoteNode = document.createTextNode("'"); var spacerNode = document.createElement('span'); origPadding.textContent = "*/"; origPadding.parentNode.insertBefore(spacerNode, origPadding); origPadding.parentNode.insertBefore(singleQuoteNode, spacerNode); var padWidth = targetWidth - spanElt.offsetWidth; spacerNode.style.display = 'inline-block'; spacerNode.style.width = String(padWidth) + "px"; spacerNode.style.height = '1em'; // cursor won't work w/o some height spacerNode.style.cursor = 'text'; } } } } // the onload function for source file function srcFileOnload() { var codeElement = document.getElementById("codeTbl"); var insertFunction = getInsertFunction(codeElement); try { var els = codeElement.getElementsByTagName("tr"); for (var i = 0; i < els.length; i++) { registerDelayedOnMouseOver(els[i], lineOnMouseIn, lineOnMouseOut); } updateToken(codeElement); } catch (err) {}; insertFunction(); // add code to model hyperlinks for all tokens var filename = location.pathname.split(/\//); filename = filename[filename.length-1]; // highlight the filename in the TOC frame if (top.rtwreport_contents_frame && top.hiliteByFileName(top.rtwreport_document_frame.document.location.href)) { // remove the highlights in the TOC frame if filename is hilite successfully top.removeHiliteTOC(top.rtwreport_contents_frame); } // annotate code with code coverage data if (typeof rtwannotate === 'function') { rtwannotate(filename.replace(/.html$/,"_cov.xml")); } fixBoxStyleFnHeaderLineWidths(); // highlight token and row if (top.RTW_TraceInfo.instance && top.RTW_TraceArgs.instance) { var i; // find the highlight file name var fileIdx = top.RTW_TraceArgs.instance.getFileIdx(filename); var ids=[], rows=[]; if (typeof fileIdx !== "undefined") { ids = top.RTW_TraceArgs.instance.getIDs(fileIdx); rows = top.RTW_TraceArgs.instance.getRows(fileIdx); // highlight rows in file for (i=0; i 0) top.RTW_TraceInfo.instance.setInitLocation(filename,rows[0]); else { top.toggleNavSideBar("off"); return; } } // display navigation side bar if (top.rtwreport_nav_frame) top.rtwreport_nav_frame.location.reload(); if (rows.length>0) { top.toggleNavSideBar("on"); top.toggleNavToolBar("on"); } else { top.toggleNavSideBar("off"); } } top.scrollToLineBasedOnHash(document.location.hash); function getHash() { var loc; var aHash=""; var topDocObj = top.window.document; // get the hash value from location. loc = topDocObj.location; loc = loc.search || loc.hash; aHash = loc.substring(1); aHash = decodeURI(aHash); return aHash; } } function createPopup(filename, evt) { var anchorObj = evt.currentTarget; if (anchorObj.children.length > 0) return; var filename = location.pathname.split(/\//); filename = filename[filename.length-1]; var windowObj = top.getInspectWindow(); var propObj = top.getInspectData(filename, anchorObj); var navObj = top.getInspectLink(filename, location.pathname, anchorObj); if (propObj) { windowObj.appendChild(propObj); windowObj.style.left = "0px"; if (anchorObj.parentElement.nodeName === "TD" && anchorObj.parentElement.parentElement.nodeName === "TR") { anchorObj.parentElement.parentElement.lastChild.insertBefore(windowObj, anchorObj.parentElement.parentElement.lastChild.lastChild.nextSibling); var left = Math.min(evt.clientX , window.innerWidth - windowObj.scrollWidth - 30); left = Math.max(0, left); windowObj.style.left = "" + left + "px"; } } }; function destroyPopup(anchorObj) { var popWindow = document.getElementById("popup_window"); if (popWindow) { popWindow.parentElement.removeChild(popWindow); } };