FAbrowser/scripts/SearchBar.gd
2024-07-22 11:06:25 -04:00

39 lines
952 B
GDScript

extends HFlowContainer
func _on_OptionButton_item_selected(index):
match index:
0: # watch list
$SearchQuery.editable = false
1,2,3,4:
$SearchQuery.editable = true
$SearchQuery.placeholder_text = "Username"
5:
$SearchQuery.editable = true
$SearchQuery.placeholder_text = "Query"
6:
$SearchQuery.editable = true
$SearchQuery.placeholder_text = "Submission ID"
func _on_GoButton_pressed():
var userurl:String = $SearchQuery.text.replace("_","").to_lower()
match $Mode.selected:
0:
owner._ready()
1:
owner.gather(["/gallery/%s"%[userurl]])
2:
owner.gather(["/scraps/%s"%[userurl]])
3:
owner.gather(["/gallery/%s"%[userurl],"/scraps/%s"%[userurl]])
4:
owner.gather(["/favorites/%s"%[userurl]])
5:
owner.gather(["/search/?q=%s&order-by=date"%[$SearchQuery.text]])
6:
owner.open_preview($SearchQuery.text.to_int())
func _on_SearchQuery_text_entered(_new_text):
_on_GoButton_pressed()