Ensure menu expanded in screenshots
This commit is contained in:
@@ -273,37 +273,32 @@ def take_screenshot_for_account(
|
||||
index_url = config.ZSGL_INDEX_URL or f"{base}/admin/index.aspx"
|
||||
run_script = (
|
||||
"(function(){"
|
||||
"var f=document.getElementById('mainframe');"
|
||||
"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;}"
|
||||
"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.onload=function(){setTimeout(fit,500);};"
|
||||
"setTimeout(fit,4000);"
|
||||
"f.onload=function(){ensureNav();expandMenu();setTimeout(check,300);};"
|
||||
"setTimeout(check,5000);"
|
||||
"})();"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user