trace, console

This commit is contained in:
Face
2025-09-01 17:08:47 +03:00
parent f973bb55f6
commit a6e96328ae
34 changed files with 1353 additions and 65 deletions

View File

@@ -19,7 +19,7 @@
local list = gurt.select('#item-list')
local counter = 1
gurt.log('List manipulation script started.')
trace.log('List manipulation script started.')
add_button:on('click', function()
local new_item = gurt.create('li', {

View File

@@ -32,7 +32,7 @@
local infoBox = gurt.select('#info-box')
local clickCounter = gurt.select('#click-counter')
gurt.log('Button attribute demo script started.')
trace.log('Button attribute demo script started.')
local clickCount = 0
@@ -64,7 +64,7 @@
targetButton:on('click', function()
clickCount = clickCount + 1
clickCounter.text = 'Button clicked ' .. clickCount .. ' times!'
gurt.log('Target button clicked! Count:', clickCount)
trace.log('Target button clicked! Count:', clickCount)
updateStatus()
end)
@@ -72,7 +72,7 @@
enableBtn:on('click', function()
targetButton:setAttribute('disabled', '') -- Remove disabled attribute
targetButton:setAttribute('data-value', 'enabled')
gurt.log('Target button enabled via setAttribute')
trace.log('Target button enabled via setAttribute')
updateStatus()
end)
@@ -80,7 +80,7 @@
disableBtn:on('click', function()
targetButton:setAttribute('disabled', 'true')
targetButton:setAttribute('data-value', 'disabled')
gurt.log('Target button disabled via setAttribute')
trace.log('Target button disabled via setAttribute')
updateStatus()
end)
@@ -92,12 +92,12 @@
-- Currently disabled, so enable it
targetButton:setAttribute('disabled', '')
targetButton:setAttribute('data-value', 'toggled-enabled')
gurt.log('Target button toggled to enabled state')
trace.log('Target button toggled to enabled state')
else
-- Currently enabled, so disable it
targetButton:setAttribute('disabled', 'true')
targetButton:setAttribute('data-value', 'toggled-disabled')
gurt.log('Target button toggled to disabled state')
trace.log('Target button toggled to disabled state')
end
updateStatus()
@@ -109,12 +109,12 @@
local type = targetButton:getAttribute('type')
local dataValue = targetButton:getAttribute('data-value')
gurt.log('=== BUTTON STATUS CHECK ===')
gurt.log('Disabled attribute:', disabled or 'not set')
gurt.log('Type attribute:', type or 'not set')
gurt.log('Data-value attribute:', dataValue or 'not set')
gurt.log('Click count:', clickCount)
gurt.log('===========================')
trace.log('=== BUTTON STATUS CHECK ===')
trace.log('Disabled attribute:', disabled or 'not set')
trace.log('Type attribute:', type or 'not set')
trace.log('Data-value attribute:', dataValue or 'not set')
trace.log('Click count:', clickCount)
trace.log('===========================')
-- Demonstrate style setAttribute
local randomColors = {'bg-red-500', 'bg-green-500', 'bg-purple-500', 'bg-orange-500', 'bg-pink-500'}

View File

@@ -18,7 +18,7 @@
</style>
<script>
gurt.log('Starting comprehensive Canvas API test...')
trace.log('Starting comprehensive Canvas API test...')
-- Test 1: Basic Rectangle and Circle Drawing
local basicCanvas = gurt.select("#basic-canvas")
@@ -282,7 +282,7 @@
}
]])
gurt.log('Canvas API test completed successfully!')
trace.log('Canvas API test completed successfully!')
</script>
</head>

View File

@@ -17,12 +17,12 @@
<postprocess preset="chrome" />
<script>
gurt.log('Script started!')
trace.log('Script started!')
local copyBtn = gurt.select('#copy-text-btn')
copyBtn:on('click', function()
gurt.log('Copy button clicked!')
trace.log('Copy button clicked!')
Clipboard.write('Hello from GURT!')
end)
</script>

View File

@@ -26,7 +26,7 @@
local loadImageBtn = gurt.select('#load-image-btn')
local imageContainer = gurt.select('#image-container')
gurt.log('setInterval & Network Image demo script started.')
trace.log('setInterval & Network Image demo script started.')
local logMessages = {}
local counter = 0

View File

@@ -17,7 +17,7 @@
local mouse = gurt.select('#mouse')
local btnmouse = gurt.select('#btnmouse')
gurt.log('Starting Lua script execution...')
trace.log('Starting Lua script execution...')
gurt.body:on('keypress', function(el)
typing.text = table.tostring(el)
@@ -68,13 +68,13 @@
subscription:unsubscribe()
end)
gurt.log('Event listener attached to button with subscription ID')
trace.log('Event listener attached to button with subscription ID')
else
gurt.log('Could not find button or event log element')
trace.log('Could not find button or event log element')
end
-- DOM Manipulation Demo
gurt.log('Testing DOM manipulation...')
trace.log('Testing DOM manipulation...')
-- Create a new div with styling
local new_div = gurt.create('div', { style = 'bg-red-500 p-4 rounded-lg mb-4' })

View File

@@ -28,7 +28,7 @@
local urlInput = gurt.select('#url-input')
local jsonInput = gurt.select('#json-input')
gurt.log('Network & JSON API demo script started.')
trace.log('Network & JSON API demo script started.')
local logMessages = {}

View File

@@ -38,7 +38,7 @@
local fireDataBtn = gurt.select('#fire-data-btn')
local clearLogBtn = gurt.select('#clear-log-btn')
gurt.log('Signal API demo script started.')
trace.log('Signal API demo script started.')
local logMessages = {}
local connectionCount = 0

View File

@@ -201,7 +201,7 @@
math.randomseed(Time.now())
render()
gurt.log('Snake game initialized!')
trace.log('Snake game initialized!')
</script>
</head>

View File

@@ -53,7 +53,7 @@
local moveBox = gurt.select('#move-box')
local comboBox = gurt.select('#combo-box')
gurt.log('Tween animation demo started!')
trace.log('Tween animation demo started!')
-- Fade Animation
gurt.select('#fade-btn'):on('click', function()
@@ -143,7 +143,7 @@
-- Callback example
gurt.select('#callback-btn'):on('click', function()
fadeBox:createTween():to('opacity', 0.3):duration(1.0):easing('inout'):callback(function()
gurt.log('Fade animation completed!')
trace.log('Fade animation completed!')
end):play()
end)

View File

@@ -33,7 +33,7 @@
local urlInput = gurt.select('#url-input')
local messageInput = gurt.select('#message-input')
gurt.log('WebSocket API demo script started.')
trace.log('WebSocket API demo script started.')
local logMessages = {}
local socket = nil