feat: change title

change title when changing nodes or applications
This commit is contained in:
Frank.R.Wu 2021-08-09 21:08:23 +08:00
parent fe13a53e19
commit d0dc3f4e0b

View File

@ -313,6 +313,7 @@ function displayOutput(obj) {
function initWSocket() { function initWSocket() {
let host = $("#urlInput")[0].value; let host = $("#urlInput")[0].value;
document.title = `数瑞浏览器(${host}`
if (!host.startsWith("ws")) { if (!host.startsWith("ws")) {
if (location.href.startsWith("https")) { if (location.href.startsWith("https")) {
host = "wss://" + host; host = "wss://" + host;
@ -375,6 +376,7 @@ function changeApp() {
return; return;
} }
console.log(global.currentContract); console.log(global.currentContract);
document.title = `数瑞浏览器(${global.currentContract} - ${$("#urlInput")[0].value}`
changeAppInternal(needRender(global.currentContract)); changeAppInternal(needRender(global.currentContract));
} }
@ -474,21 +476,21 @@ function triggerExecuteCurrentContract() {
console.log(funNode); console.log(funNode);
const argInput = $("#argInput"); const argInput = $("#argInput");
var contract = global.currentContract; var contract = global.currentContract;
var gas = $("#gasInput")[0].value/1; var gas = $("#gasInput")[0].value / 1;
executeContractWithGas(contract.id, funNode.functionName, argInput[0].value,gas, executeContractWithGas(contract.id, funNode.functionName, argInput[0].value, gas,
fillResultInternal, executeContractAsDebug.checked); fillResultInternal, executeContractAsDebug.checked);
var iHtml = "/SCIDE/SCManager?action=executeContract&contractID=" var iHtml = "/SCIDE/SCManager?action=executeContract&contractID="
+ global.currentContract.name + "&operation=" + global.currentContract.name + "&operation="
+ funNode.functionName + "&arg=" + argInput[0].value; + funNode.functionName + "&arg=" + argInput[0].value;
var toSign = global.currentContract.name + "|" + funNode.functionName + "|" var toSign = global.currentContract.name + "|" + funNode.functionName + "|"
+ argInput[0].value ; + argInput[0].value;
if (gas>0){ if (gas > 0) {
toSign+="|"+gas; toSign += "|" + gas;
iHtml+="&gasLimit="+gas; iHtml += "&gasLimit=" + gas;
} }
iHtml+= "&pubkey=" + global.sm2Key.publicKey + "&signature="; iHtml += "&pubkey=" + global.sm2Key.publicKey + "&signature=";
toSign+= "|" + global.sm2Key.publicKey; toSign += "|" + global.sm2Key.publicKey;
const signature = sm2.doSignature(toSign, global.sm2Key.privateKey, {hash: true, der: true}); const signature = sm2.doSignature(toSign, global.sm2Key.privateKey, {hash: true, der: true});
let urlPre = $("#urlInput")[0].value; let urlPre = $("#urlInput")[0].value;
if (urlPre.startsWith("ws")) { if (urlPre.startsWith("ws")) {
@ -528,8 +530,8 @@ function fillResultInternal(result, data) {
global.responseCollector[data.responseID].push(data); global.responseCollector[data.responseID].push(data);
$("#statusSpan")[0].innerHTML = result.status; $("#statusSpan")[0].innerHTML = result.status;
$("#timeSpan")[0].innerHTML = "调用耗时:" + data.executeTime + "(ms)"; $("#timeSpan")[0].innerHTML = "调用耗时:" + data.executeTime + "(ms)";
if (data.executionGas !=undefined && data.executionGas>0) if (data.executionGas != undefined && data.executionGas > 0)
$("#timeSpan")[0].innerHTML+="<br> "+data.executionGas+"(gas)"; $("#timeSpan")[0].innerHTML += "<br> " + data.executionGas + "(gas)";
$("#timeSpan")[0].innerHTML $("#timeSpan")[0].innerHTML
if (result.result instanceof Object) { if (result.result instanceof Object) {
$("#responseArea")[0].value = JSON.stringify(result.result); $("#responseArea")[0].value = JSON.stringify(result.result);