1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

doc/search: do not hide search on mobile and make it work

move and resize results if they are not within the document-window

modify the search result display with some javascript patching
    (in page grease(tamper)monkey approach)
This commit is contained in:
Karl Fessel 2020-07-02 12:33:00 +02:00
parent 5e757b1a9c
commit e91dc15304
2 changed files with 15 additions and 3 deletions

View File

@ -39,6 +39,18 @@
document.getElementById('top').append(document.getElementById('MSearchResultsWindow'));
document.getElementById('doc-content').innerHTML=rhtml;
}
function modSearch(){
if(!searchBox.doxySearch){
searchBox.doxySearch=searchBox.Search
searchBox.Search= function(){this.doxySearch();
var r=document.getElementById('MSearchResultsWindow');console.log(r.style);
if(parseInt(r.style.left)<0)r.style.left=0;
var x=document.getElementById('MSearchResults');
if(x.scrollWidth>window.screen.width)x.style.width=window.screen.width-2+'px';
var f=document.getElementById('riot-searchform');
if(parseInt( r.style.top) < f.offsetTop+f.scrollHeight) r.style.top = f.offsetTop+f.scrollHeight+'px';}
}
}
</script>
</head>
<body>
@ -61,7 +73,7 @@
<p class="navbar-text navbar-left"><span id="projectbrief">$projectbrief</span></p>
<ul id="riot-navlist" class="nav navbar-nav"></ul>
<!--BEGIN SEARCHENGINE-->
<form id="riot-searchform" class="navbar-form navbar-left navbar-right hidden-sm hidden-xs"
<form id="riot-searchform" class="navbar-form navbar-left navbar-right"
onsubmit="try{
displaySR();
}finally{
@ -73,7 +85,7 @@
<div class="input-group-addon">
<span id="MSearchSelect" class="glyphicon glyphicon-search" aria-hidden="true" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"></span>
</div>
<input class="form-control" type="text" id="MSearchField" placeholder="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)">
<input class="form-control" type="text" id="MSearchField" placeholder="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event); modSearch();">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()">
<span id="search-reset" class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a>

View File

@ -39,7 +39,7 @@ function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
$('#FSearchBox').attr("method", "get");
$('#FSearchBox div.form-group').append('<div id="MSearchBox" class="MSearchBoxInactive"><div class="input-group"><div class="input-group-addon"><span id="MSearchSelect" class="glyphicon glyphicon-search" aria-hidden="true"></span></div><input class="form-control" type="text" id="MSearchField" name="query" placeholder="'+search+'" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div></div>');
} else {
$('#riot-searchform div.form-group').append('<div id="MSearchBox" class="MSearchBoxInactive"><div class="input-group"><div class="input-group-addon"><span id="MSearchSelect" class="glyphicon glyphicon-search" aria-hidden="true" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"></span></div><input class="form-control" type="text" id="MSearchField" placeholder="'+search+'" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><span id="search-reset" class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a></div></div>');
$('#riot-searchform div.form-group').append('<div id="MSearchBox" class="MSearchBoxInactive"><div class="input-group"><div class="input-group-addon"><span id="MSearchSelect" class="glyphicon glyphicon-search" aria-hidden="true" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"></span></div><input class="form-control" type="text" id="MSearchField" placeholder="'+search+'" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event); modSearch();"/><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><span id="search-reset" class="glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a></div></div>');
}
}
}