add search engine - ringle

This commit is contained in:
Face
2025-08-27 20:23:05 +03:00
parent 1cf81bbfee
commit 347b40ed71
47 changed files with 7214 additions and 493 deletions

View File

@@ -278,7 +278,7 @@ static func update_div_hover_styles(dom_node: Control, element: HTMLParser.HTMLE
if dom_node.mouse_entered.is_connected(BackgroundUtils._on_panel_mouse_entered):
dom_node.mouse_entered.disconnect(BackgroundUtils._on_panel_mouse_entered)
if dom_node.mouse_exited.is_connected(BackgroundUtils._on_panel_mouse_exited):
dom_node.mouse_exited.disconnect(BackgroundUtils._on_panel_mouse_exited)
if dom_node.mouse_exited.is_connected(BackgroundUtils._on_panel_mouse_exited_with_delay):
dom_node.mouse_exited.disconnect(BackgroundUtils._on_panel_mouse_exited_with_delay)
update_element_text_content(dom_node, element, dom_parser)

View File

@@ -640,6 +640,12 @@ static func add_element_methods(vm: LuauVM, lua_api: LuaAPI) -> void:
vm.lua_pushcallable(LuaDOMUtils._element_hide_wrapper, "element.hide")
vm.lua_setfield(-2, "hide")
vm.lua_pushcallable(LuaDOMUtils._element_focus_wrapper, "element.focus")
vm.lua_setfield(-2, "focus")
vm.lua_pushcallable(LuaDOMUtils._element_unfocus_wrapper, "element.unfocus")
vm.lua_setfield(-2, "unfocus")
_add_classlist_support(vm, lua_api)
vm.lua_newtable()
@@ -1420,6 +1426,48 @@ static func _element_hide_wrapper(vm: LuauVM) -> int:
return 0
static func _element_focus_wrapper(vm: LuauVM) -> int:
var lua_api = vm.get_meta("lua_api") as LuaAPI
if not lua_api:
vm.lua_pushboolean(false)
return 1
vm.luaL_checktype(1, vm.LUA_TTABLE)
vm.lua_getfield(1, "_element_id")
var element_id: String = vm.lua_tostring(-1)
vm.lua_pop(1)
var operation = {
"type": "focus_element",
"element_id": element_id
}
emit_dom_operation(lua_api, operation)
vm.lua_pushboolean(true)
return 1
static func _element_unfocus_wrapper(vm: LuauVM) -> int:
var lua_api = vm.get_meta("lua_api") as LuaAPI
if not lua_api:
vm.lua_pushboolean(false)
return 1
vm.luaL_checktype(1, vm.LUA_TTABLE)
vm.lua_getfield(1, "_element_id")
var element_id: String = vm.lua_tostring(-1)
vm.lua_pop(1)
var operation = {
"type": "unfocus_element",
"element_id": element_id
}
emit_dom_operation(lua_api, operation)
vm.lua_pushboolean(true)
return 1
static func _element_create_tween_wrapper(vm: LuauVM) -> int:
var lua_api = vm.get_meta("lua_api") as LuaAPI
if not lua_api:

View File

@@ -118,6 +118,12 @@ static func string_replace_all_handler(vm: LuauVM) -> int:
return 1
static func string_trim_handler(vm: LuauVM) -> int:
var subject: String = vm.luaL_checkstring(1)
var trimmed = subject.strip_edges()
vm.lua_pushstring(trimmed)
return 1
static func setup_regex_api(vm: LuauVM) -> void:
vm.lua_newtable()
@@ -139,4 +145,7 @@ static func setup_regex_api(vm: LuauVM) -> void:
vm.lua_pushcallable(string_replace_all_handler, "string.replaceAll")
vm.lua_setfield(-2, "replaceAll")
vm.lua_pushcallable(string_trim_handler, "string.trim")
vm.lua_setfield(-2, "trim")
vm.lua_pop(1)

View File

@@ -53,6 +53,7 @@ func stop_lua_thread():
while lua_thread.is_alive() and (Time.get_ticks_msec() - timeout_start) < 500:
OS.delay_msec(10)
lua_thread.wait_to_finish()
lua_thread = null
func execute_script_async(script_code: String):
@@ -356,6 +357,7 @@ func _setup_additional_lua_apis():
LuaAudioUtils.setup_audio_api(lua_vm)
LuaCrumbsUtils.setup_crumbs_api(lua_vm)
LuaRegexUtils.setup_regex_api(lua_vm)
LuaURLUtils.setup_url_api(lua_vm)
func _table_tostring_handler(vm: LuauVM) -> int:
vm.luaL_checktype(1, vm.LUA_TTABLE)

View File

@@ -0,0 +1,21 @@
class_name LuaURLUtils
extends RefCounted
static func url_encode_handler(vm: LuauVM) -> int:
var input: String = vm.luaL_checkstring(1)
var encoded = input.uri_encode()
vm.lua_pushstring(encoded)
return 1
static func url_decode_handler(vm: LuauVM) -> int:
var input: String = vm.luaL_checkstring(1)
var decoded = input.uri_decode()
vm.lua_pushstring(decoded)
return 1
static func setup_url_api(vm: LuauVM) -> void:
vm.lua_pushcallable(url_encode_handler, "urlEncode")
vm.lua_setglobal("urlEncode")
vm.lua_pushcallable(url_decode_handler, "urlDecode")
vm.lua_setglobal("urlDecode")

View File

@@ -0,0 +1 @@
uid://bjiiw0qfqg2he