forked from Gerold55/MineBrowse-Sites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser_page_test_app.lua.txt
38 lines (36 loc) · 1.62 KB
/
browser_page_test_app.lua.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- Navigation bar - Shown on each page - needs to be included to each page
function laptop.browser_api.header_formspec_func(app, mtos)
local currentpage = ""
if app.browser_page then
currentpage = app.name
end
local formspec = "field[.2,.5;13,1;input_field;;"..currentpage.."]field_close_on_enter[input_field;false]"..
mtos.theme:get_image_button('12.9,.3;.8,.8', 'toolbar', 'go_button', 'laptop_go_web.png', '', 'Go') ..
mtos.theme:get_image_button('13.6,.3;.8,.8', 'toolbar', 'home_button', 'laptop_home_web.png', '', 'Home') ..
mtos.theme:get_image_button('14.3,.3;.8,.8', 'toolbar', 'settings_button', 'laptop_settings_web.png', '', 'Settings')
return formspec
end
-- Page header / Navigation bar buttons processing. Needs to be included to each page
function laptop.browser_api.header_receive_fields_func(app, mtos, sender, fields)
if (fields.key_enter and fields.key_enter_field == "input_field") or fields.go_button then
laptop.browser_api.navigate(app, mtos, fields.input_field)
elseif fields.home_button then
mtos:set_app("browser")
elseif fields.settings_button then
mtos:set_app("browser:settings")
elseif fields.page_link then
laptop.browser_api.navigate(app, mtos, fields.page_link)
end
end
laptop.register_view("test.official", {
app_info = "In-Game Test",
browser_page = true,
formspec_func = function(app, mtos)
local formspec = laptop.browser_api.header_formspec_func(app, mtos) ..
mtos.theme:get_label('.3,1.1','Hello submitted World!')
return formspec
end,
receive_fields_func = function(app, mtos, sender, fields)
laptop.browser_api.header_receive_fields_func(app, mtos, sender, fields)
end
})