orcaslicer/resources/web/guide/6/6.js
lane.wei e9e4d75877 Update the codes to 01.01.00.10 for the formal release
1. first formal version of macos
2. add the bambu networking plugin install logic
3. auto compute the wipe volume when filament change
4. add the logic of wiping into support
5. refine the GUI layout and icons, improve the gui apperance in lots of
   small places
6. serveral improve to support
7. support AMS auto-mapping
8. disable lots of unstable features: such as params table, media file download, HMS
9. fix serveral kinds of bugs
10. update the document of building
11. ...
2022-07-22 20:35:34 +08:00

167 lines
2.8 KiB
JavaScript

function OnInit()
{
//let strInput=JSON.stringify(cData);
//HandleStudio(strInput);
// let tVal={};
// tVal['status']=3;
// tVal['percent']=30;
//
// HandStatusPercent(tVal);
TranslatePage();
SendDownloadCmd();
}
function SendDownloadCmd()
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="Begin_Download_network_plugin";
SendWXMessage( JSON.stringify(tSend) );
}
function HandleStudio( pVal )
{
let strCmd=pVal['command'];
//alert(strCmd);
if(strCmd=='ShowStatusPercent')
{
HandStatusPercent(pVal['data']);
}
}
function HandStatusPercent( pVal )
{
let nStatus=pVal['status']*1;
let nPercent=pVal['percent'];
if(nStatus==0)
{
//正常下载
$('#DownStepText').attr("tid","t71");
$('#RetryBtn').hide();
$('#PercentTip').css("width",nPercent+'%');
}
else if(nStatus==1)
{
//下载失败 或 解压缩补丁包失败
$('#DownStepText').attr("tid","t72");
$('#PercentTip').css("width",0+'%');
$('#RetryBtn').show();
}
else if(nStatus==2)
{
//下载完成
$('#PercentTip').css("width",100+'%');
setTimeout("SendInstallPluginCmd()",100);
}
else if(nStatus==3)
{
//解压缩补丁包失败
$('#DownArea').hide();
$("#InstallFailedTip").show();
$('#CancelBtn').hide();
$('#RestartBtn').hide();
$('#CloseBtn').show();
}
else if(nStatus==4)
{
//安装补丁包完成
$('#DownArea').hide();
$('#DownSuccessTip').show();
$('#CancelBtn').hide();
$('#CloseBtn').hide();
$('#RestartBtn').show();
//pTimer=setInterval("RunInverse()",1000);
}
TranslatePage();
}
var nCount=3;
var pTimer=null;
function RunInverse()
{
$('#CountNumber').text(nCount+'');
nCount--;
if(nCount==-1)
{
RestartBambuStudio();
}
}
function RetryDownload()
{
$('#DownStepText').attr("tid","t71");
$('#PercentTip').css("width",0+'%');
SendDownloadCmd();
}
function CancelDownload()
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="netplugin_download_cancel";
SendWXMessage( JSON.stringify(tSend) );
}
function SendInstallPluginCmd()
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="begin_install_plugin";
SendWXMessage( JSON.stringify(tSend) );
}
function RestartBambuStudio()
{
if( pTimer!=null )
{
clearInterval(pTimer);
pTimer=null;
}
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="restart_studio";
SendWXMessage( JSON.stringify(tSend) );
}
function CloseDownDialog()
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="close_download_dialog";
SendWXMessage( JSON.stringify(tSend) );
}
function OpenPluginFolder()
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="open_plugin_folder";
SendWXMessage( JSON.stringify(tSend) );
}