1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-26 01:18:21 +01: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;
}
div.doc-toc {
width: 300px;
/* font-size: 11px; */
max-width: 80%;
padding-right: 10px;
background-color: #e3e3e3;
color: #2c2c2c;
overflow: auto;
@ -127,7 +127,16 @@ div.doc-toc {
bottom: 30px;
border-right: 1px solid #c9c9c9;
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 {
text-decoration: none;
color: #2c2c2c;
@ -178,7 +187,7 @@ div.doc-toc a.highlight {
div.doc-content {
display: block;
width: calc(100% - 300px);
width: calc(100% - 30px);
float: right;
padding-left: 10px;
}

View File

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

View File

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

View File

@ -156,14 +156,14 @@ end
vfs.checkperm = function(path, right)
local osfile = vfs.ospath(path)
local perm = vfs.perm(osfile)
print(osfile)
--print(osfile)
if not ulib.exists(osfile) then
return false,"Resource does not exist"
end
-- check if user own the file
if perm ~= nil then
if perm[right] == true then
print("Permission granted")
--print("Permission granted")
return true,osfile
else
print("Permission denie")
@ -182,13 +182,13 @@ vfs.perm = function(file)
if uid ~= nil and st ~= nil and st.perm ~= nil then
--print(JSON.encode({uid, st}))
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
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
else
print("User belong to other")
--print("User belong to other")
return st.perm.other
end
else