css polish

This commit is contained in:
Leon van Kammen 2026-08-18 22:21:48 +02:00
parent c81f37d2c3
commit c4d5060e32
11 changed files with 149 additions and 26 deletions

View file

@ -68,6 +68,7 @@ app.plugin.manyfold = app.addPlugin('plugin/manyfold')
app.plugin.peertube = app.addPlugin('plugin/peertube') app.plugin.peertube = app.addPlugin('plugin/peertube')
app.plugin.git = app.addPlugin('plugin/git') app.plugin.git = app.addPlugin('plugin/git')
app.plugin.webhook = app.addPlugin('plugin/webhook') app.plugin.webhook = app.addPlugin('plugin/webhook')
app.plugin.archive = app.addPlugin('plugin/archive')
app.plugin.staticwebgen = app.addPlugin('plugin/staticwebgen') -- should always be last app.plugin.staticwebgen = app.addPlugin('plugin/staticwebgen') -- should always be last
app.runcmd(app) -- run clicmds app.runcmd(app) -- run clicmds
@ -121,3 +122,4 @@ end
OnServerStart = function() OnServerStart = function()
app.init() -- this triggers init event app.init() -- this triggers init event
end end

View file

@ -173,6 +173,8 @@ sb = {
useDefaults = function(app) useDefaults = function(app)
app.use( function(req,res,next) app.use( function(req,res,next)
app.host = GetHost()
app.scheme = GetScheme()
app.pub(req.url,{req=req,res=res}) app.pub(req.url,{req=req,res=res})
next() next()
end) end)
@ -283,6 +285,9 @@ sb = {
init = function(app) init = function(app)
end, end,
destroy = function(app)
end,
runcmd = function(app) runcmd = function(app)
for k,v in pairs(argv) do for k,v in pairs(argv) do
app.opts[ v:gsub("=.*","") ] = v:gsub(".*=","") app.opts[ v:gsub("=.*","") ] = v:gsub(".*=","")

View file

@ -184,10 +184,21 @@ h1{
.sym{ font-size:100px; color:#000; } .sym{ font-size:100px; color:#000; }
table.header tr td {
vertical-align:top;
}
.header td a{ .header td a{
border:none; border:none;
} }
.btn.XR{
line-height:10px;
display: inline-block;
position: absolute;
top: 20px;
right: 2px;
}
/* logo */ /* logo */
.logo *{ .logo *{
font-size:15px; font-size:15px;

View file

@ -24,6 +24,12 @@ body{
background-color:#2230; background-color:#2230;
} }
@media (max-width: 470px){
.menu a:nth-child(2){
display:none;
}
}
@media (max-width: 890px){ @media (max-width: 890px){
.grid .tile { .grid .tile {
width:47%; width:47%;
@ -39,10 +45,6 @@ body{
form table tr > td:nth-child(3) { form table tr > td:nth-child(3) {
display:none; display:none;
} }
.menu{
position:absolute;
right:20px;
}
.menu a{ .menu a{
padding-right:20px !important; padding-right:20px !important;
} }

View file

@ -48,9 +48,9 @@ return {
if not isroot then if not isroot then
res.items[ v.parent.id ] = { res.items[ v.parent.id ] = {
view2D = false, view2D = false,
url = v.parent.url, url = v.parent.parent.url,
title = "parent world", title = app.opts.plugin_janusxr_portal_up,
name = "parent world", name = app.opts.plugin_janusxr_portal_up,
thumbnail = '', thumbnail = '',
} }
end end

View file

@ -41,11 +41,13 @@
</tr> </tr>
</table> </table>
<!-- JanusXR portalroom, see https://janusxr.org for markup -->
${janusxr}
</body> </body>
</html> </html>
<!-- JanusXR portalroom, see https://janusxr.org for markup -->
${janusxr}
<!-- C-code <!-- C-code

View file

@ -38,7 +38,7 @@
print( app.opts.plugin_global_topmenu_html:gsub("\n","&nbsp;") ) print( app.opts.plugin_global_topmenu_html:gsub("\n","&nbsp;") )
end} end}
{if template == "page/dir.html" then {if template == "page/dir.html" then
print([[<div class="btn"><a class="border secondary" href="${urlpath}?view=3D">3D</a></div>&nbsp;]]) print([[<div class="btn XR"><a class="border secondary" href="${urlpath}?view=3D">3D</a></div>&nbsp;]])
end} end}
{if template == "page/index.html" then {if template == "page/index.html" then
local sharedata = { local sharedata = {

View file

@ -1,23 +1,29 @@
{if true then {if true then
showfediportals = app.opts.plugin_federation_strategy == 'always' or showfediportals = app.opts.plugin_federation_strategy == 'always' or
(app.opts.plugin_federation_strategy == 'homepage' and urlpath == '/') (app.opts.plugin_federation_strategy == 'homepage' and urlpath == '/')
-- optimize janus resource URLs for archive.org
app.plugin.archive.flush()
function URL(url)
app.plugin.archive.add(url)
return url
end
end} end}
<fireboxroom> <fireboxroom>
<assets> <assets>
<assetshader id="xrforgeportal" src="${opts.baseurl}shader/xrforgeportal.shadertoy.frag" shadertype="shadertoy"></assetshader>
{if items and #items > 0 then {if items and #items > 0 then
for i,v in pairs(items) do for i,v in pairs(items) do
if #v.thumbnail > 0 then if #v.thumbnail > 0 then
print('\t<assetimage src="' .. v.thumbnail .. '" id="img' .. i .. '"/>') print('\t<assetimage src="' .. URL(v.thumbnail) .. '" id="img' .. i .. '"/>')
end end
end end
end} end}
{if itemsremote and #itemsremote > 0 then {if itemsremote and #itemsremote > 0 then
for i,v in pairs(itemsremote) do for i,v in pairs(itemsremote) do
if #v.thumbnail > 0 then if #v.thumbnail > 0 then
print('\t<assetimage src="' .. v.thumbnail .. '" id="imgremote' .. i .. '"/>') print('\t<assetimage src="' .. URL(v.thumbnail) .. '" id="imgremote' .. i .. '"/>')
end end
end end
end} end}
@ -27,7 +33,7 @@ end}
if #urls > 0 then if #urls > 0 then
local fediurl = urls:gsub(' .*','') local fediurl = urls:gsub(' .*','')
local thumburl = urls:gsub('.* ','') local thumburl = urls:gsub('.* ','')
print('\t<assetimage src="' .. thumburl .. '" id="federated' .. i .. '"/>') print('\t<assetimage src="' .. URL(thumburl) .. '" id="federated' .. i .. '"/>')
end end
end end
end} end}
@ -47,13 +53,16 @@ end}
end} end}
<light js_id="dan9-janus:light/light_cone_angle=0-6" pos="0 3 2" collision_trigger="false" /> <light js_id="dan9-janus:light/light_cone_angle=0-6" pos="0 3 2" collision_trigger="false" />
{if true then {if true then
function addPortal(id,x,v,url,i,z,thumb,rotation,scale,item) function addPortal(id,x,v,url,i,z,thumb,rotation,scale)
local title = v.title
local maxchar = 20
if #title > maxchar then title = title:sub(0,maxchar) .. '..' end
print('\t<object js_id="' .. id .. '_' .. i .. '" pos="' .. x .. ' 0 ' .. z .. '" rotation="' .. rotation .. '">') print('\t<object js_id="' .. id .. '_' .. i .. '" pos="' .. x .. ' 0 ' .. z .. '" rotation="' .. rotation .. '">')
print('\t <link url="' .. url .. '" ' .. thumb .. ' title_col="0.4 0.37 0.4" pos="0 0 0.001" draw_glow="' .. (thumb:match("shader") and 'false' or 'true') .. '" scale="3 3 0.1" />') print('\t <link url="' .. url .. '" ' .. thumb .. ' title_col="0.4 0.37 0.4" pos="0 0 0.001" draw_glow="' .. (thumb:match("shader") and 'false' or 'true') .. '" scale="3 3 0.1" />')
print('\t <text text="' .. v.title .. '" pos="0 3.4 0" col="1 1 1" font_scale="false" scale="' .. scale .. '" />') print('\t <text text="' .. title .. '" pos="0 3.4 0" col="1 1 1" font_scale="false" scale="' .. scale .. '" />')
--TODO: fix janusweb paragraph for markdown urls --TODO: fix janusweb paragraph for markdown urls
--if item.README ~= nil then --if v.README ~= nil then
-- print('\t <paragraph js_id="README" url="' .. item.README .. '" width="600" height="900" pos="0 1 2" transparent="true"/>') -- print('\t <paragraph js_id="README" url="' .. v.README .. '" width="600" height="900" pos="0 1 2" transparent="true"/>')
--end --end
print('\t</object>') print('\t</object>')
end end
@ -70,21 +79,21 @@ end}
end end
if v.dir then url = url .. "/" end if v.dir then url = url .. "/" end
if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr
addPortal('dir',center, v, url,i, -4, thumb, '0 0 0', '0.2 0.2 0.2', v) addPortal('dir',center, v, url,i, -4, thumb, '0 0 0', '0.2 0.2 0.2')
end end
end} end}
{if not item and itemsremote and #itemsremote > 0 then {if not item and itemsremote and #itemsremote > 0 then
for i,v in pairs(itemsremote) do for i,v in pairs(itemsremote) do
local width = 3.2 local width = 3.2
local center = -((#itemsremote*width)/1.3) + (i*width) local center = -((#itemsremote*width)/1.3) + (i*width)
local url = v.url local url = v.url
local thumb = ' shader_id="defaultportal"' local thumb = ' shader_id="defaultportal"'
if #v.thumbnail > 0 then if #v.thumbnail > 0 then
thumb = ' thumb_id="imgremote' .. i .. '" ' thumb = ' thumb_id="imgremote' .. i .. '" '
end end
if v.dir then url = url .. "/" end if v.dir then url = url .. "/" end
if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr
addPortal('remote',center, v, url,i, 4, thumb, '0 180 0', '0.2 0.2 0.2',v) addPortal('remote',center, v, url,i, 4, thumb, '0 180 0', '0.2 0.2 0.2')
end end
print([[ print([[
<text js_id="locationremote" pos="0 6 5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${opts.plugin_global_remote_title}" emissive="0 0 0" roughness="0.3" metalness="0" /> <text js_id="locationremote" pos="0 6 5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${opts.plugin_global_remote_title}" emissive="0 0 0" roughness="0.3" metalness="0" />
@ -96,3 +105,12 @@ end}
${opts.plugin_janusxr_jml} ${opts.plugin_janusxr_jml}
</room> </room>
</fireboxroom> </fireboxroom>
{if #app.plugin.archive.url > 0 then
print('<!-- this is purely to optimize JanusXR resource-URLs to (archive.org) scrapers -->')
print("<div style='display:none'>")
for k,url in pairs(app.plugin.archive.url) do
print(' <a href="' .. url .. '"></a>')
end
print("</div>")
end}

75
src/plugin/archive.lua Normal file
View file

@ -0,0 +1,75 @@
local util = require('util')
app.on('scan_experience', function(exp)
--print_r(exp)
end)
app.on('scan_experience_file', function(exp)
end)
app.on('set', function(k,v)
end)
app.on('init', function()
local me = app.plugin.archive
if arg[1] == 'server' then
local code, pid = unix.fork()
-- kill thread when main app gets CTRL-c
unix.sigaction(unix.SIGINT, function()
unix.exit()
end)
function notify()
app.plugin.archive.notify()
--notify() -- loop forever
end
if assert( code) == 0 then notify() end -- go!
end
end)
-- this registers the plugin UI
local plugin = {
name = "<img src='img/drive.svg' class='icon invert'/> Archive.org",
info = 'Notify archive.org to archive experiences.<br><b>NOTE</b>: this only works in server mode. For static website generator-users: see <a href="https://web.archive.org/" target="_blank">Save Page Now</a>',
opts = {
{
key='app.opts.plugin_archive_frequency',
title='Archive frequency',
info='when should archive.org check this xrforge?',
default = "wip beta -v[0-9] customerX",
values={boot="On XRForge start"}
},
{
key='app.opts.plugin_archive_url',
title='Startingpoint URL',
info='absolute URL which archive.org should start with',
default = "https://localhost:8080/myverse",
placeholder = "http://my.org/myverse",
values=''
}
},
notify = function()
if #app.opts.plugin_archive_url > 0
and not app.opts.plugin_archive_url:match("localhost")
then
print("notifying archive.org")
local ok, headers, body = Fetch('https://web.archive.org/save/'.. app.opts.plugin_archive_url )
else
print(" skip notifying archive.org")
end
unix.exit()
end,
url = {},
flush = function()
app.plugin.archive.url = {}
end,
add = function(url)
table.insert( app.plugin.archive.url, url )
end
}
return plugin

View file

@ -73,7 +73,7 @@ local plugin = {
key='app.opts.plugin_global_homepage', key='app.opts.plugin_global_homepage',
title='Homepage', title='Homepage',
info='Display 3D or 2D experiences on homepage', info='Display 3D or 2D experiences on homepage',
default = "3D", default = "2D",
values={ ['3D'] = '3D', ['2D'] = '2D' }, values={ ['3D'] = '3D', ['2D'] = '2D' },
}, },
{ {
@ -113,7 +113,7 @@ local plugin = {
}, },
middleware = { middleware = {
homepage_2D_or_3D = function(req,res,next) homepage_2D_or_3D = function(req,res,next)
if (req.url == '/' or req.url == '/index.html' and app.opts.plugin_global_homepage == '3D') or (req.param.view == '3D') or (req.param.url) then if ( (req.url == '/' or req.url == '/index.html') and app.opts.plugin_global_homepage == '3D') or (req.param.view == '3D') or (req.param.url) then
res.template = 'page/index.html' res.template = 'page/index.html'
else else
res.template = 'page/dir.html' res.template = 'page/dir.html'

View file

@ -126,12 +126,20 @@ local plugin = {
default="room_plane", default="room_plane",
values={random="random room",room_plane="wirefloor",room1="room1",room2="room2",room3="room3",room4="room4",room5="room5",room6="room6",room7="room7"} values={random="random room",room_plane="wirefloor",room1="room1",room2="room2",room3="room3",room4="room4",room5="room5",room6="room6",room7="room7"}
}, },
{
key='app.opts.plugin_janusxr_portal_up',
title='Parent directory portal',
info='Title for the "directory up" 3D portal',
default="../ outer world",
placeholder="../ outer world",
values="",
},
{ {
key='app.opts.plugin_janusxr_random_objects', key='app.opts.plugin_janusxr_random_objects',
title='Random objects', title='Random objects',
info="Random object id's in portal rooms", info="Random object id's in portal rooms",
default="capsule cone cube cylinder pyramid sphere torus", default="capsule cone cube cylinder pyramid sphere torus",
placeholder="capsule cone cube cylinder pipe pyramid sphere torus", placeholder="capsule cone cylinder pyramid sphere torus",
values="", values="",
}, },
{ {