Handle raw display of huge transactions in explorer
This commit is contained in:
parent
211aeff22d
commit
0f23f10fe0
@ -344,7 +344,7 @@ func (s *PublicServer) newTemplateData(r *http.Request) *TemplateData {
|
|||||||
TOSLink: api.Text.TOSLink,
|
TOSLink: api.Text.TOSLink,
|
||||||
}
|
}
|
||||||
if !s.debug {
|
if !s.debug {
|
||||||
t.Minified = ".min.1"
|
t.Minified = ".min.2"
|
||||||
}
|
}
|
||||||
if s.is.HasFiatRates {
|
if s.is.HasFiatRates {
|
||||||
// get the secondary coin and if it should be shown either from query parameters "secondary" and "use_secondary"
|
// get the secondary coin and if it should be shown either from query parameters "secondary" and "use_secondary"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -4,6 +4,9 @@ function syntaxHighlight(json) {
|
|||||||
.replace(/&/g, "&")
|
.replace(/&/g, "&")
|
||||||
.replace(/</g, "<")
|
.replace(/</g, "<")
|
||||||
.replace(/>/g, ">");
|
.replace(/>/g, ">");
|
||||||
|
if (json.length > 1000000) {
|
||||||
|
return `<span class="key">${json}</span>`;
|
||||||
|
}
|
||||||
return json.replace(
|
return json.replace(
|
||||||
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,
|
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,
|
||||||
(match) => {
|
(match) => {
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
function syntaxHighlight(t){return(t=(t=JSON.stringify(t,void 0,2)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,t=>{let e="number";return/^"/.test(t)?e=/:$/.test(t)?"key":"string":/true|false/.test(t)?e="boolean":/null/.test(t)&&(e="null"),`<span class="${e}">${t}</span>`})}function getCoinCookie(){return document.cookie.split("; ").find(t=>t.startsWith("secondary_coin="))?.split("=")}function changeCSSStyle(t,e,l){let a=document.all?"rules":"cssRules";for(i=0,len=document.styleSheets[1][a].length;i<len;i++)if(document.styleSheets[1][a][i].selectorText===t){document.styleSheets[1][a][i].style[e]=l;return}}function amountTooltip(){let t=this.querySelector(".prim-amt"),e=this.querySelector(".sec-amt"),l=this.querySelector(".csec-amt"),a=this.querySelector(".base-amt"),r=this.querySelector(".cbase-amt"),s=`${t.outerHTML}<br>`;if(a){let n=a.getAttribute("tm");n||(n="now"),s+=`<span class="amt-time">${n}</span>${a.outerHTML}<br>`}if(r&&(s+=`<span class="amt-time">now</span>${r.outerHTML}<br>`),e){let o=e.getAttribute("tm");o||(o="now"),s+=`<span class="amt-time">${o}</span>${e.outerHTML}<br>`}return l&&(s+=`<span class="amt-time">now</span>${l.outerHTML}<br>`),`<span class="l-tooltip">${s}</span>`}function addressAliasTooltip(){let t=this.getAttribute("alias-type"),e=this.getAttribute("cc");return`<span class="l-tooltip">${t}<br>${e}</span>`}window.addEventListener("DOMContentLoaded",()=>{let t=getCoinCookie();t?.length===3&&("true"===t[2]&&(changeCSSStyle(".prim-amt","display","none"),changeCSSStyle(".sec-amt","display","initial")),document.querySelectorAll(".amt").forEach(t=>new bootstrap.Tooltip(t,{title:amountTooltip,html:!0}))),document.querySelectorAll("[alias-type]").forEach(t=>new bootstrap.Tooltip(t,{title:addressAliasTooltip,html:!0})),document.querySelectorAll("[tt]").forEach(t=>new bootstrap.Tooltip(t,{title:t.getAttribute("tt")})),document.querySelectorAll("#header .bb-group>.btn-check").forEach(t=>t.addEventListener("click",t=>{let e=getCoinCookie(),l="secondary-coin"===t.target.id;e?.length===3&&"true"===e[2]!==l&&(document.cookie=`${e[0]}=${e[1]}=${l}; Path=/`,changeCSSStyle(".prim-amt","display",l?"none":"initial"),changeCSSStyle(".sec-amt","display",l?"initial":"none"))})),document.querySelectorAll(".copyable").forEach(t=>t.addEventListener("click",t=>{if(t.clientX<t.target.getBoundingClientRect().x){let e=t.target.getAttribute("cc");e||(e=t.target.innerText),navigator.clipboard.writeText(e),t.target.className=t.target.className.replace("copyable","copied"),setTimeout(()=>t.target.className=t.target.className.replace("copied","copyable"),1e3),t.preventDefault()}}))});
|
|
||||||
1
static/js/main.min.2.js
Normal file
1
static/js/main.min.2.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
function syntaxHighlight(t){return(t=(t=JSON.stringify(t,void 0,2)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")).length>1e6?`<span class="key">${t}</span>`:t.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,t=>{let e="number";return/^"/.test(t)?e=/:$/.test(t)?"key":"string":/true|false/.test(t)?e="boolean":/null/.test(t)&&(e="null"),`<span class="${e}">${t}</span>`})}function getCoinCookie(){return document.cookie.split("; ").find(t=>t.startsWith("secondary_coin="))?.split("=")}function changeCSSStyle(t,e,l){let a=document.all?"rules":"cssRules";for(i=0,len=document.styleSheets[1][a].length;i<len;i++)if(document.styleSheets[1][a][i].selectorText===t){document.styleSheets[1][a][i].style[e]=l;return}}function amountTooltip(){let t=this.querySelector(".prim-amt"),e=this.querySelector(".sec-amt"),l=this.querySelector(".csec-amt"),a=this.querySelector(".base-amt"),s=this.querySelector(".cbase-amt"),r=`${t.outerHTML}<br>`;if(a){let n=a.getAttribute("tm");n||(n="now"),r+=`<span class="amt-time">${n}</span>${a.outerHTML}<br>`}if(s&&(r+=`<span class="amt-time">now</span>${s.outerHTML}<br>`),e){let o=e.getAttribute("tm");o||(o="now"),r+=`<span class="amt-time">${o}</span>${e.outerHTML}<br>`}return l&&(r+=`<span class="amt-time">now</span>${l.outerHTML}<br>`),`<span class="l-tooltip">${r}</span>`}function addressAliasTooltip(){let t=this.getAttribute("alias-type"),e=this.getAttribute("cc");return`<span class="l-tooltip">${t}<br>${e}</span>`}window.addEventListener("DOMContentLoaded",()=>{let t=getCoinCookie();t?.length===3&&("true"===t[2]&&(changeCSSStyle(".prim-amt","display","none"),changeCSSStyle(".sec-amt","display","initial")),document.querySelectorAll(".amt").forEach(t=>new bootstrap.Tooltip(t,{title:amountTooltip,html:!0}))),document.querySelectorAll("[alias-type]").forEach(t=>new bootstrap.Tooltip(t,{title:addressAliasTooltip,html:!0})),document.querySelectorAll("[tt]").forEach(t=>new bootstrap.Tooltip(t,{title:t.getAttribute("tt")})),document.querySelectorAll("#header .bb-group>.btn-check").forEach(t=>t.addEventListener("click",t=>{let e=getCoinCookie(),l="secondary-coin"===t.target.id;e?.length===3&&"true"===e[2]!==l&&(document.cookie=`${e[0]}=${e[1]}=${l}; Path=/`,changeCSSStyle(".prim-amt","display",l?"none":"initial"),changeCSSStyle(".sec-amt","display",l?"initial":"none"))})),document.querySelectorAll(".copyable").forEach(t=>t.addEventListener("click",t=>{if(t.clientX<t.target.getBoundingClientRect().x){let e=t.target.getAttribute("cc");e||(e=t.target.innerText),navigator.clipboard.writeText(e),t.target.className=t.target.className.replace("copyable","copied"),setTimeout(()=>t.target.className=t.target.className.replace("copied","copyable"),1e3),t.preventDefault()}}))});
|
||||||
Loading…
Reference in New Issue
Block a user