gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 6988821c2ccb0fa86e98726ececa8ce516032858 parent 95e576c80777d3d481c59f3c8166a4f27813a31a Author: bbbbbr <bbbbbr@users.noreply.github.com> Date: Tue, 28 Feb 2023 01:03:27 -0800 Merge pull request #483 from bbbbbr/docs_4_2_0_doxy_search_improve Docs: 4.2.0 doxy search improve Diffstat:
| M | Makefile | 9 | +++++++++ |
| M | docs/config/github-markdown-theme/doxygen_extra.css | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | docs/doxygen_search_combined.html | 37 | +++++++++++++++++++++++++++++++++++++ |
| A | docs/doxygen_search_override.js | 173 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 files changed, 275 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile @@ -335,6 +335,15 @@ endif cp $(GBDKDOCSDIR)/latex/refman.pdf $(GBDKDOCSDIR)/gbdk_manual.pdf;\ fi rm -rf $(GBDKDOCSDIR)/latex +# Patch in improved text search for Doxygen +# +# Create a combined array of all js search terms instead of the default arrays partitioned by first-letter index + echo "var searchData = [" > $(GBDKDOCSDIR)/api/search/combined.js + cat $(GBDKDOCSDIR)/api/search/all*.js | sed -e "s/var.*searchData.*//" | sed -e "s/^\[//" | sed -e "s/^\]\;//" | sed -e "s/\]\]\].*/\]\]\],/" >> $(GBDKDOCSDIR)/api/search/combined.js + echo "];" >> $(GBDKDOCSDIR)/api/search/combined.js +# Override JS search functions to default doxygen search + cat $(GBDKDOCSDIR)/doxygen_search_override.js >> $(GBDKDOCSDIR)/api/search/search.js + cp $(GBDKDOCSDIR)/doxygen_search_combined.html $(GBDKDOCSDIR)/api/search/combined.html # Turn on Latex -> PDF conversion to run run at end of regular docs build # (which includes latex output but deletes it at the end). diff --git a/docs/config/github-markdown-theme/doxygen_extra.css b/docs/config/github-markdown-theme/doxygen_extra.css @@ -411,6 +411,11 @@ img { background-color: #404448 !important; border-radius: 6px; margin-right:20px !important; + + /* Required in 1.9.1 to fix incorrect search box position and page width */ + float: none !important; + right: 0px !important; + box-shadow: unset !important; } /* Hide search icon */ @@ -420,6 +425,10 @@ img { background-image:unset !important; border:2px red solid !important; background:red !important; + + /* Required in 1.9.1 to fix incorrect search box position and page width */ + /* Just hide it completely */ + display:none !important; } /* And override it with a hamburger menu character */ #MSearchBox span.left::after { @@ -427,12 +436,24 @@ img { color:rgb(255,255,255,0.75) !important; font-size:15px !important; content:"\2630"; + + /* Just hide it completely since combined.js search breaks the filtering */ + display:none !important; } /* Center it's text */ #MSearchBox span.left { margin-top:4px; background:unset !important; + + /* Required in 1.9.1 to fix incorrect search box position and page width */ + display:block !important; + position:absolute !important; + left:10px; + width:20px; + height:19px; + vertical-align: unset !important; + height: unset !important; } /* Increase font size */ @@ -441,7 +462,24 @@ img { background:unset !important; height:unset !important; width:unset !important; + + /* Required in 1.9.1 to fix incorrect search box position and page width */ + display:block !important; + position:absolute !important; + margin-left:20px !important; + margin-top:unset !important;; + margin-right:unset !important;; + margin-bottom:unset !important;; + padding-left:4px !important; + + vertical-align:unset !important; + line-height: unset !important;; } + +#FSearchBox #MSearchField { + margin-left:15px; +} + /* Change text color when it's being typed in */ .MSearchBoxActive #MSearchField { color:rgb(255,255,255,0.75) !important; @@ -452,10 +490,28 @@ img { #MSearchBox span.right { top:5px !important; background:unset !important; + /* Required in 1.9.1 to fix incorrect search box position and page width */ + display:block !important; + position:absolute !important; + right:10px; + top:8px; + width:20px; + height:19px; + vertical-align: unset !important; + width: unset !important; + height: unset !important; } #MSearchClose { opacity:0.0; + /* Required in 1.9.1 to fix incorrect search box position and page width */ + position: absolute !important; + margin: 0px 4px 0px 0px !important; + padding: 0px 0px !important; } +.left #MSearchClose { + left: 6px; +} + #MSearchBox span.right::after { font-weight:bold !important; color:rgb(255,255,255,0.30) !important; diff --git a/docs/doxygen_search_combined.html b/docs/doxygen_search_combined.html @@ -0,0 +1,37 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head><title></title> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta name="generator" content="Doxygen 1.9.1"/> +<link rel="stylesheet" type="text/css" href="search.css"/> +<script type="text/javascript" src="combined.js"></script> +<script type="text/javascript" src="search.js"></script> +</head> +<body class="SRPage"> +<div id="SRIndex"> +<div class="SRStatus" id="Loading">Loading...</div> +<div id="SRResults"></div> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +createResults(); +/* @license-end */ +</script> +<div class="SRStatus" id="Searching">Searching...</div> +<div class="SRStatus" id="NoMatches">No Matches</div> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +document.getElementById("Loading").style.display="none"; +document.getElementById("NoMatches").style.display="none"; +var searchResults = new SearchResults("searchResults"); +searchResults.Search(); +window.addEventListener("message", function(event) { + if (event.data == "take_focus") { + var elem = searchResults.NavNext(0); + if (elem) elem.focus(); + } +}); +/* @license-end */ +</script> +</div> +</body> +</html> diff --git a/docs/doxygen_search_override.js b/docs/doxygen_search_override.js @@ -0,0 +1,173 @@ + + +// This file gets appended to the doxygen search.js to override and improve the search functions + + +// ////////////////// + +// Replacing a function in an existing object (function) + +// var oldClass = mynamespace.myclass; // Copy original before overwriting +// mynamespace.myclass = function () { +// // Apply the original constructor on this object +// oldClass.apply(this, arguments); +// // Now overwrite the target function after construction +// this.myfunction = function () { alert("Overwritten"); }; +// }; +// mynamespace.prototype = oldClass.prototype; // Same prototype + +// ////////////////// + + +var oldSearchBox = SearchBox; // Copy original before overwriting +SearchBox = function () { + // Apply the original constructor on this object + oldSearchBox.apply(this, arguments); + + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + // var code = searchValue.toLowerCase().charCodeAt(0); + // var idxChar = searchValue.substr(0, 1).toLowerCase(); + // if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair + // { + // idxChar = searchValue.substr(0, 2); + // } + + // var resultsPage; + // var resultsPageWithSearch; + // var hasResultsPage; + + // var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); + // if (idx!=-1) + // { + // var hexCode=idx.toString(16); + // resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + this.extension; + // resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + // hasResultsPage = true; + // } + // else // nothing available for this search term + // { + // resultsPage = this.resultsPath + '/nomatches' + this.extension; + // resultsPageWithSearch = resultsPage; + // hasResultsPage = false; + // } + // CHANGED START + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + resultsPage = this.resultsPath + '/' + 'combined.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + // CHANGED END + + window.frames.MSearchResults.location = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline-block'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } +}; +SearchBox.prototype = oldSearchBox.prototype; // Same prototype + + + +var oldSearchResults = SearchResults; // Copy original before overwriting +SearchResults = function () { + // Apply the original constructor on this object + oldSearchResults.apply(this, arguments); + + + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + // search = convertToId(search); + // Commented out above (CHANGED START & END) + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + // rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + // if (search.length<=rowMatchName.length && + // rowMatchName.substr(0, search.length)==search) + // { + // CHANGED START + rowMatchName = rowMatchName.replace(/^[sr\d_]*5f_/, ''); // strip 'sr123_5f' + rowMatchName = rowMatchName.replace(/5f/, ''); // strip '5f' chars + // rowMatchName = rowMatchName.replace(/_/, ' '); // underscores to spaces + + if (rowMatchName.includes(search)) + { + // CHANGED END + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } +}; +SearchResults.prototype = oldSearchResults.prototype; // Same prototype +
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.