mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-31 23:25:54 -04:00
add license, move folders
This commit is contained in:
parent
185cc74060
commit
271c4a46a1
132 changed files with 21 additions and 0 deletions
52
app/scripts/ui/menu/history.gd
Normal file
52
app/scripts/ui/menu/history.gd
Normal file
|
@ -0,0 +1,52 @@
|
|||
extends Resource
|
||||
class_name History
|
||||
|
||||
var history: Array[String]
|
||||
var index := -1
|
||||
|
||||
|
||||
func get_current() -> String:
|
||||
if index == -1: return ""
|
||||
return history[index]
|
||||
|
||||
|
||||
func can_forw() -> bool:
|
||||
return index + 1 < history.size()
|
||||
|
||||
|
||||
func can_back() -> bool:
|
||||
return index > -1
|
||||
|
||||
|
||||
func add(url: String) -> void:
|
||||
if url == get_current(): return
|
||||
|
||||
index += 1
|
||||
history.resize(index)
|
||||
history.push_back(url)
|
||||
print_history()
|
||||
|
||||
|
||||
func forw() -> String:
|
||||
index += 1
|
||||
print_history()
|
||||
return history[index]
|
||||
|
||||
|
||||
func back() -> String:
|
||||
index -= 1
|
||||
print_history()
|
||||
if index == -1:
|
||||
return ""
|
||||
return history[index]
|
||||
|
||||
|
||||
func clear() -> void:
|
||||
index = -1
|
||||
history.clear()
|
||||
print_history()
|
||||
|
||||
|
||||
func print_history() -> void:
|
||||
# Debug.logclr("History: " + str(history) + " Current: " + str(index), Color.DIM_GRAY)
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue