css polish
This commit is contained in:
parent
c81f37d2c3
commit
c4d5060e32
11 changed files with 149 additions and 26 deletions
|
|
@ -68,6 +68,7 @@ app.plugin.manyfold = app.addPlugin('plugin/manyfold')
|
|||
app.plugin.peertube = app.addPlugin('plugin/peertube')
|
||||
app.plugin.git = app.addPlugin('plugin/git')
|
||||
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.runcmd(app) -- run clicmds
|
||||
|
|
@ -121,3 +122,4 @@ end
|
|||
OnServerStart = function()
|
||||
app.init() -- this triggers init event
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ sb = {
|
|||
|
||||
useDefaults = function(app)
|
||||
app.use( function(req,res,next)
|
||||
app.host = GetHost()
|
||||
app.scheme = GetScheme()
|
||||
app.pub(req.url,{req=req,res=res})
|
||||
next()
|
||||
end)
|
||||
|
|
@ -283,6 +285,9 @@ sb = {
|
|||
init = function(app)
|
||||
end,
|
||||
|
||||
destroy = function(app)
|
||||
end,
|
||||
|
||||
runcmd = function(app)
|
||||
for k,v in pairs(argv) do
|
||||
app.opts[ v:gsub("=.*","") ] = v:gsub(".*=","")
|
||||
|
|
|
|||
|
|
@ -184,10 +184,21 @@ h1{
|
|||
.sym{ font-size:100px; color:#000; }
|
||||
|
||||
|
||||
table.header tr td {
|
||||
vertical-align:top;
|
||||
}
|
||||
.header td a{
|
||||
border:none;
|
||||
}
|
||||
|
||||
.btn.XR{
|
||||
line-height:10px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 2px;
|
||||
}
|
||||
|
||||
/* logo */
|
||||
.logo *{
|
||||
font-size:15px;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,12 @@ body{
|
|||
background-color:#2230;
|
||||
}
|
||||
|
||||
@media (max-width: 470px){
|
||||
.menu a:nth-child(2){
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 890px){
|
||||
.grid .tile {
|
||||
width:47%;
|
||||
|
|
@ -39,10 +45,6 @@ body{
|
|||
form table tr > td:nth-child(3) {
|
||||
display:none;
|
||||
}
|
||||
.menu{
|
||||
position:absolute;
|
||||
right:20px;
|
||||
}
|
||||
.menu a{
|
||||
padding-right:20px !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ return {
|
|||
if not isroot then
|
||||
res.items[ v.parent.id ] = {
|
||||
view2D = false,
|
||||
url = v.parent.url,
|
||||
title = "parent world",
|
||||
name = "parent world",
|
||||
url = v.parent.parent.url,
|
||||
title = app.opts.plugin_janusxr_portal_up,
|
||||
name = app.opts.plugin_janusxr_portal_up,
|
||||
thumbnail = '',
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -41,11 +41,13 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- JanusXR portalroom, see https://janusxr.org for markup -->
|
||||
${janusxr}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- JanusXR portalroom, see https://janusxr.org for markup -->
|
||||
${janusxr}
|
||||
|
||||
|
||||
<!-- C-code
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
print( app.opts.plugin_global_topmenu_html:gsub("\n"," ") )
|
||||
end}
|
||||
{if template == "page/dir.html" then
|
||||
print([[<div class="btn"><a class="border secondary" href="${urlpath}?view=3D">3D</a></div> ]])
|
||||
print([[<div class="btn XR"><a class="border secondary" href="${urlpath}?view=3D">3D</a></div> ]])
|
||||
end}
|
||||
{if template == "page/index.html" then
|
||||
local sharedata = {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,29 @@
|
|||
{if true then
|
||||
showfediportals = app.opts.plugin_federation_strategy == 'always' or
|
||||
(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}
|
||||
|
||||
|
||||
<fireboxroom>
|
||||
<assets>
|
||||
<assetshader id="xrforgeportal" src="${opts.baseurl}shader/xrforgeportal.shadertoy.frag" shadertype="shadertoy"></assetshader>
|
||||
{if items and #items > 0 then
|
||||
for i,v in pairs(items) do
|
||||
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}
|
||||
{if itemsremote and #itemsremote > 0 then
|
||||
for i,v in pairs(itemsremote) do
|
||||
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}
|
||||
|
|
@ -27,7 +33,7 @@ end}
|
|||
if #urls > 0 then
|
||||
local fediurl = 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}
|
||||
|
|
@ -47,13 +53,16 @@ end}
|
|||
end}
|
||||
<light js_id="dan9-janus:light/light_cone_angle=0-6" pos="0 3 2" collision_trigger="false" />
|
||||
{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 <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
|
||||
--if item.README ~= nil then
|
||||
-- print('\t <paragraph js_id="README" url="' .. item.README .. '" width="600" height="900" pos="0 1 2" transparent="true"/>')
|
||||
--if v.README ~= nil then
|
||||
-- print('\t <paragraph js_id="README" url="' .. v.README .. '" width="600" height="900" pos="0 1 2" transparent="true"/>')
|
||||
--end
|
||||
print('\t</object>')
|
||||
end
|
||||
|
|
@ -70,21 +79,21 @@ end}
|
|||
end
|
||||
if v.dir then url = url .. "/" end
|
||||
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}
|
||||
{if not item and itemsremote and #itemsremote > 0 then
|
||||
for i,v in pairs(itemsremote) do
|
||||
local width = 3.2
|
||||
local center = -((#itemsremote*width)/1.3) + (i*width)
|
||||
local url = v.url
|
||||
local width = 3.2
|
||||
local center = -((#itemsremote*width)/1.3) + (i*width)
|
||||
local url = v.url
|
||||
local thumb = ' shader_id="defaultportal"'
|
||||
if #v.thumbnail > 0 then
|
||||
thumb = ' thumb_id="imgremote' .. i .. '" '
|
||||
end
|
||||
if v.dir then url = url .. "/" end
|
||||
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
|
||||
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" />
|
||||
|
|
@ -96,3 +105,12 @@ end}
|
|||
${opts.plugin_janusxr_jml}
|
||||
</room>
|
||||
</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
75
src/plugin/archive.lua
Normal 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
|
||||
|
|
@ -73,7 +73,7 @@ local plugin = {
|
|||
key='app.opts.plugin_global_homepage',
|
||||
title='Homepage',
|
||||
info='Display 3D or 2D experiences on homepage',
|
||||
default = "3D",
|
||||
default = "2D",
|
||||
values={ ['3D'] = '3D', ['2D'] = '2D' },
|
||||
},
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ local plugin = {
|
|||
},
|
||||
middleware = {
|
||||
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'
|
||||
else
|
||||
res.template = 'page/dir.html'
|
||||
|
|
|
|||
|
|
@ -126,12 +126,20 @@ local plugin = {
|
|||
default="room_plane",
|
||||
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',
|
||||
title='Random objects',
|
||||
info="Random object id's in portal rooms",
|
||||
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="",
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue