1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-04-19 01:56:44 +02:00

enable mobile compatibility

This commit is contained in:
lxsang 2021-02-07 11:35:26 +01:00
parent 0c6d81ef93
commit 3f1530cfe8
4 changed files with 27 additions and 11 deletions

View File

@ -117,8 +117,8 @@ div.search-icon {
width: 35px; width: 35px;
} }
div.doc-toc { div.doc-toc {
width: 300px; max-width: 80%;
/* font-size: 11px; */ padding-right: 10px;
background-color: #e3e3e3; background-color: #e3e3e3;
color: #2c2c2c; color: #2c2c2c;
overflow: auto; overflow: auto;
@ -127,7 +127,16 @@ div.doc-toc {
bottom: 30px; bottom: 30px;
border-right: 1px solid #c9c9c9; border-right: 1px solid #c9c9c9;
padding-top: 10px; padding-top: 10px;
box-shadow: 2px 0px 7px #878887;
z-index: 20;
} }
button#btn_toc {
width: 33px;
height: 33px;
position: fixed;
border: 1px solid #dadddd;
}
div.doc-toc a { div.doc-toc a {
text-decoration: none; text-decoration: none;
color: #2c2c2c; color: #2c2c2c;
@ -178,7 +187,7 @@ div.doc-toc a.highlight {
div.doc-content { div.doc-content {
display: block; display: block;
width: calc(100% - 300px); width: calc(100% - 30px);
float: right; float: right;
padding-left: 10px; padding-left: 10px;
} }

View File

@ -13,7 +13,7 @@ local pre_process_md = function(str, obj)
"%%-") "%%-")
if apath then if apath then
apath = apath:gsub(" ", "%%%%20") apath = apath:gsub(" ", "%%%%20")
print(apath) --print(apath)
content = content:gsub(pattern, "![](" .. HTTP_ROOT .. "/" .. content = content:gsub(pattern, "![](" .. HTTP_ROOT .. "/" ..
obj.name .. "/asset/" .. apath .. ")") obj.name .. "/asset/" .. apath .. ")")
end end

View File

@ -111,7 +111,8 @@ local url = __main__:get("url")
<?lua <?lua
if tocdata then if tocdata then
?> ?>
<div class = "doc-toc"> <button id="btn_toc" class="fa fa-bars"></button>
<div id="doc_toc" class = "doc-toc">
<?lua <?lua
if toc then if toc then
toc:set("data", tocdata) toc:set("data", tocdata)
@ -119,7 +120,7 @@ local url = __main__:get("url")
end end
?> ?>
</div> </div>
<div class="doc-content markdown-body"> <div class="doc-content markdown-body" id="doc_content">
<?lua <?lua
if __main__ then if __main__ then
__main__:render() __main__:render()
@ -145,6 +146,12 @@ local url = __main__:get("url")
</div> </div>
<script> <script>
window.addEventListener('load', (event) => { window.addEventListener('load', (event) => {
$("#btn_toc").click(function(){
$("#doc_toc").toggle();
});
$("#doc_content").click(function(){
$("#doc_toc").hide();
});
// tree view events // tree view events
var toggler = document.getElementsByClassName("caret"); var toggler = document.getElementsByClassName("caret");
var i; var i;

View File

@ -156,14 +156,14 @@ end
vfs.checkperm = function(path, right) vfs.checkperm = function(path, right)
local osfile = vfs.ospath(path) local osfile = vfs.ospath(path)
local perm = vfs.perm(osfile) local perm = vfs.perm(osfile)
print(osfile) --print(osfile)
if not ulib.exists(osfile) then if not ulib.exists(osfile) then
return false,"Resource does not exist" return false,"Resource does not exist"
end end
-- check if user own the file -- check if user own the file
if perm ~= nil then if perm ~= nil then
if perm[right] == true then if perm[right] == true then
print("Permission granted") --print("Permission granted")
return true,osfile return true,osfile
else else
print("Permission denie") print("Permission denie")
@ -182,13 +182,13 @@ vfs.perm = function(file)
if uid ~= nil and st ~= nil and st.perm ~= nil then if uid ~= nil and st ~= nil and st.perm ~= nil then
--print(JSON.encode({uid, st})) --print(JSON.encode({uid, st}))
if(uid.id == st.uid) then -- the user owned the file if(uid.id == st.uid) then -- the user owned the file
print("file belong to user") --print("file belong to user")
return st.perm.owner return st.perm.owner
elseif uid.groups and uid.groups[st.gid] then elseif uid.groups and uid.groups[st.gid] then
print("User belong to this group") --print("User belong to this group")
return st.perm.group return st.perm.group
else else
print("User belong to other") --print("User belong to other")
return st.perm.other return st.perm.other
end end
else else