mirror of
https://github.com/unraid/webgui.git
synced 2026-01-05 17:20:04 -06:00
GUI search: minor code refactoring
This commit is contained in:
@@ -88,7 +88,7 @@ function setupGUIsearch() {
|
||||
function gui_search() {
|
||||
if (typeof Awesomplete == 'function') {
|
||||
<?if ($themes1):?>
|
||||
languageVisible = $(".LanguageButton").is(":visible");
|
||||
languageVisible = $(".nav-item.LanguageButton").is(":visible");
|
||||
$(".nav-tile.right").prepend("<?=$guiSearchBoxSpan?>").css("overflow","visible");
|
||||
$(".nav-item.util,.nav-user.show").hide();
|
||||
<?else:?>
|
||||
@@ -125,26 +125,18 @@ function closeSearchBox() {
|
||||
|
||||
function guiSearch() {
|
||||
event.stopPropagation();
|
||||
|
||||
var searchInfo = $("#guiSearchBox").val().split("**");
|
||||
var separator = (browserName == "Chrome" || browserName == "Edge") ? "#:~:text=" : "#";
|
||||
var scrollText = (typeof searchInfo[1] != 'undefined') ? separator+searchInfo[1].replace(" ","%20").replace("-","%2d") : "";
|
||||
var newPage = "<?=$currentUnraidPage?>/Settings/Tools".replace(searchInfo[0]+"/","");
|
||||
|
||||
var separator = "#";
|
||||
if (browserName == "Chrome" || browserName == "Edge") separator = "#:~:text=";
|
||||
|
||||
if (typeof searchInfo[1] !== 'undefined')
|
||||
var scrollText = separator+searchInfo[1].replace(" ","%20").replace("-","%2d");
|
||||
else
|
||||
var scrollText = "";
|
||||
|
||||
var newPage = "<?=$currentUnraidPage?>/Settings/Tools";
|
||||
newPage = newPage.replace(searchInfo[0]+"/","");
|
||||
if (newPage == "Dashboard/Settings/Tools") newPage = "Settings";
|
||||
|
||||
location.replace("/"+newPage+"/"+searchInfo[0]+scrollText);
|
||||
closeSearchBox();
|
||||
}
|
||||
|
||||
if (browserName !== "Chrome" && browserName !== "Edge") {
|
||||
if (browserName != "Chrome" && browserName != "Edge") {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var script = document.createElement('script');
|
||||
script.type = "text/javascript";
|
||||
|
||||
Reference in New Issue
Block a user