diff --git a/project/scripts/ui/menu/menu_navigation.gd b/project/scripts/ui/menu/menu_navigation.gd index e5ec027..59cb513 100644 --- a/project/scripts/ui/menu/menu_navigation.gd +++ b/project/scripts/ui/menu/menu_navigation.gd @@ -33,7 +33,7 @@ func on_go_back() -> void: enable([go_forw]) if history.can_back(): - gate_events.open_gate_emit(location) + open(location) else: disable([go_back, reload, home]) gate_events.exit_gate_emit() @@ -46,11 +46,11 @@ func on_go_forw() -> void: if not history.can_forw(): disable([go_forw]) - gate_events.open_gate_emit(location) + open(location) func on_reload() -> void: - gate_events.open_gate_emit(history.get_current()) + open(history.get_current()) func on_home() -> void: @@ -59,6 +59,13 @@ func on_home() -> void: gate_events.exit_gate_emit() +func open(location: String) -> void: + if Url.is_valid(location): + gate_events.open_gate_emit(location) + else: + gate_events.search_emit(location) + + func disable(buttons: Array[BaseButton]) -> void: for button in buttons: button.disabled = true diff --git a/project/scripts/ui/search.gd b/project/scripts/ui/search.gd index 796473f..eb4bc97 100644 --- a/project/scripts/ui/search.gd +++ b/project/scripts/ui/search.gd @@ -7,6 +7,7 @@ var url: String func _ready() -> void: gate_events.open_gate.connect(set_current_url) + gate_events.search.connect(set_current_url) gate_events.exit_gate.connect(set_current_url.bind(""))