Ensure menu expanded in screenshots
This commit is contained in:
@@ -46,7 +46,7 @@ services:
|
|||||||
- API_DIAGNOSTIC_LOG=0
|
- API_DIAGNOSTIC_LOG=0
|
||||||
- API_DIAGNOSTIC_SLOW_MS=0
|
- API_DIAGNOSTIC_SLOW_MS=0
|
||||||
# wkhtmltoimage 截图配置
|
# wkhtmltoimage 截图配置
|
||||||
- WKHTMLTOIMAGE_FULL_PAGE=1
|
- WKHTMLTOIMAGE_FULL_PAGE=0
|
||||||
# 知识管理平台配置
|
# 知识管理平台配置
|
||||||
- ZSGL_LOGIN_URL=https://postoa.aidunsoft.com/admin/login.aspx
|
- ZSGL_LOGIN_URL=https://postoa.aidunsoft.com/admin/login.aspx
|
||||||
- ZSGL_INDEX_URL_PATTERN=index.aspx
|
- ZSGL_INDEX_URL_PATTERN=index.aspx
|
||||||
|
|||||||
@@ -273,37 +273,32 @@ def take_screenshot_for_account(
|
|||||||
index_url = config.ZSGL_INDEX_URL or f"{base}/admin/index.aspx"
|
index_url = config.ZSGL_INDEX_URL or f"{base}/admin/index.aspx"
|
||||||
run_script = (
|
run_script = (
|
||||||
"(function(){"
|
"(function(){"
|
||||||
"var f=document.getElementById('mainframe');"
|
|
||||||
"function done(){window.status='ready';}"
|
"function done(){window.status='ready';}"
|
||||||
"function fit(){"
|
"function ensureNav(){try{if(typeof loadMenuTree==='function'){loadMenuTree(true);}}catch(e){}}"
|
||||||
|
"function expandMenu(){"
|
||||||
|
"try{var body=document.body;if(body&&body.classList.contains('lay-mini')){body.classList.remove('lay-mini');}}catch(e){}"
|
||||||
|
"try{if(typeof mainPageResize==='function'){mainPageResize();}}catch(e){}"
|
||||||
|
"try{if(typeof toggleMainMenu==='function' && document.body && document.body.classList.contains('lay-mini')){toggleMainMenu();}}catch(e){}"
|
||||||
|
"try{var navRight=document.querySelector('.nav-right');if(navRight){navRight.style.display='block';}}catch(e){}"
|
||||||
|
"try{var mainNav=document.getElementById('main-nav');if(mainNav){mainNav.style.display='block';}}catch(e){}"
|
||||||
|
"}"
|
||||||
|
"function navReady(){"
|
||||||
|
"try{var nav=document.getElementById('sidebar-nav');return nav && nav.querySelectorAll('a').length>0;}catch(e){return false;}"
|
||||||
|
"}"
|
||||||
|
"function frameReady(){"
|
||||||
|
"try{var f=document.getElementById('mainframe');return f && f.contentDocument && f.contentDocument.readyState==='complete';}catch(e){return false;}"
|
||||||
|
"}"
|
||||||
|
"function check(){"
|
||||||
|
"if(navReady() && frameReady()){done();return;}"
|
||||||
|
"setTimeout(check,300);"
|
||||||
|
"}"
|
||||||
|
"var f=document.getElementById('mainframe');"
|
||||||
|
"ensureNav();"
|
||||||
|
"expandMenu();"
|
||||||
"if(!f){done();return;}"
|
"if(!f){done();return;}"
|
||||||
"try{"
|
|
||||||
"var doc=f.contentDocument||f.contentWindow.document;"
|
|
||||||
"if(doc&&doc.body&&doc.documentElement){"
|
|
||||||
"doc.body.style.height='auto';"
|
|
||||||
"doc.documentElement.style.height='auto';"
|
|
||||||
"doc.body.style.overflow='visible';"
|
|
||||||
"doc.documentElement.style.overflow='visible';"
|
|
||||||
"var h=Math.max(doc.body.scrollHeight,doc.documentElement.scrollHeight);"
|
|
||||||
"if(h&&h>0){"
|
|
||||||
"f.style.height=h+'px';"
|
|
||||||
"var extra=0;"
|
|
||||||
"var topBar=document.querySelector('.main-top');"
|
|
||||||
"if(topBar){extra+=topBar.offsetHeight||0;}"
|
|
||||||
"var container=document.querySelector('.main-container');"
|
|
||||||
"if(container){extra+=container.offsetTop||0;}"
|
|
||||||
"var total=h+extra+20;"
|
|
||||||
"document.body.style.height=total+'px';"
|
|
||||||
"document.documentElement.style.height=total+'px';"
|
|
||||||
"}"
|
|
||||||
"}"
|
|
||||||
"}catch(e){}"
|
|
||||||
"done();"
|
|
||||||
"}"
|
|
||||||
"if(!f){fit();return;}"
|
|
||||||
f"f.src='{target_url}';"
|
f"f.src='{target_url}';"
|
||||||
"f.onload=function(){setTimeout(fit,500);};"
|
"f.onload=function(){ensureNav();expandMenu();setTimeout(check,300);};"
|
||||||
"setTimeout(fit,4000);"
|
"setTimeout(check,5000);"
|
||||||
"})();"
|
"})();"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user