Skip to content

Commit

Permalink
Store group name instead of index as cookie
Browse files Browse the repository at this point in the history
Storing the name is more robust as the list of items is dependent on the
content that is parsed which may change over time.
  • Loading branch information
doxygen committed Oct 28, 2023
1 parent 797a241 commit 390499d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions templates/html/search.js
Expand Up @@ -242,6 +242,25 @@ function SearchBox(name, resultsPath, extension)
return count;
}

this.GetSelectionIdByName = function(name)
{
var i=0,j=0;
var win=this.DOMSearchSelectWindow();
for (i=0;i<win.childNodes.length;i++)
{
var child = win.childNodes[i];
if (child.className=='SelectItem')
{
if (child.childNodes[1].nodeValue==name)
{
return j;
}
j++;
}
}
return 0;
}

this.SelectItemSet = function(id)
{
var i,j=0;
Expand All @@ -255,7 +274,7 @@ function SearchBox(name, resultsPath, extension)
if (j==id)
{
node.innerHTML='&#8226;';
writeSetting(cookie_name, id)
writeSetting(cookie_name, child.childNodes[1].nodeValue)
}
else
{
Expand Down Expand Up @@ -875,7 +894,8 @@ function init_search()
}
}
});
var id = readSetting(cookie_name);
var name = readSetting(cookie_name);
var id = searchBox.GetSelectionIdByName(name);
searchBox.OnSelectItem(id);
}
/* @license-end */

0 comments on commit 390499d

Please sign in to comment.