made particles more efficient, finished basic blocks feed
This commit is contained in:
parent
dafa4b6117
commit
34416c07fe
8 changed files with 132 additions and 38 deletions
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
apiOnline = true
|
||||
async function doPing(){
|
||||
if (document.hidden){
|
||||
return
|
||||
}
|
||||
out = setTimeout(function(){
|
||||
if (apiOnline){
|
||||
PNotify.notice('Connection lost with API server')
|
||||
|
|
|
@ -1538,4 +1538,16 @@ var pJS = function(tag_id, params){
|
|||
};
|
||||
xhr.send();
|
||||
|
||||
};
|
||||
};
|
||||
let toggleAnimation = function () {
|
||||
if (document.hidden) {
|
||||
cancelRequestAnimFrame(pJSDom[0].pJS.fn.checkAnimFrame);
|
||||
cancelRequestAnimFrame(pJSDom[0].pJS.fn.drawAnimFrame);
|
||||
pJSDom[0].pJS.fn.particlesEmpty();
|
||||
pJSDom[0].pJS.fn.canvasClear();
|
||||
return;
|
||||
}
|
||||
pJSDom[0].pJS.fn.vendors.start();
|
||||
}
|
||||
|
||||
document.addEventListener("visibilitychange", toggleAnimation, false);
|
|
@ -1,10 +1,51 @@
|
|||
var recentSource = new EventSourcePolyfill('/recentblocks', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
var getRecent = function(){
|
||||
var recentSource = new EventSourcePolyfill('/recentblocks', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
recentSource.onmessage = function(e){
|
||||
if (e.data == "none"){
|
||||
return
|
||||
}
|
||||
var existing = document.getElementsByClassName('recentBlockList')[0].innerText;
|
||||
let data = JSON.parse(e.data)
|
||||
Object.entries(data.blocks).forEach(([key, value]) => {
|
||||
if (existing.includes(key)){
|
||||
return
|
||||
}
|
||||
existing = key + " - " + value + "\n" + existing
|
||||
})
|
||||
document.getElementsByClassName('recentBlockList')[0].innerText = existing
|
||||
console.debug(data)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
recentSource.onmessage = function(e){
|
||||
console.debug(e)
|
||||
return recentSource
|
||||
}
|
||||
recentSource = getRecent()
|
||||
function toggleRecentStream() {
|
||||
if (document.hidden){
|
||||
console.debug("Stopped recent block stream")
|
||||
recentSource.close()
|
||||
return
|
||||
}
|
||||
if (document.getElementsByClassName('recentModal')[0].classList.contains('is-active')){
|
||||
recentSource.close()
|
||||
getRecent()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.getElementsByClassName('recentBlocksBtn')[0].onclick = function(){
|
||||
document.getElementsByClassName('recentModal')[0].classList.add('is-active')
|
||||
}
|
||||
|
||||
|
||||
document.getElementsByClassName('recentBlocksBtn')
|
||||
document.addEventListener("visibilitychange", toggleRecentStream, false);
|
||||
|
||||
document.getElementsByClassName('closeRecentModal')[0].onclick = function(){
|
||||
document.getElementsByClassName('recentBlockList')[0].innerText = ""
|
||||
document.getElementsByClassName('recentModal')[0].classList.remove('is-active')
|
||||
}
|
|
@ -146,7 +146,19 @@ getStats()
|
|||
setInterval(function(){getStats()}, 1000)
|
||||
|
||||
|
||||
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
|
||||
particlesJS.load('particles-js', '/shared/main/particles.json', function() {
|
||||
console.log('callback - particles.js config loaded');
|
||||
});
|
||||
|
||||
fetch('/config/get/ui.animated_background', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.text()) // Transform the data into text
|
||||
.then(function(resp) {
|
||||
if (resp == "false"){
|
||||
return
|
||||
}
|
||||
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
|
||||
particlesJS.load('particles-js', '/shared/main/particles.json', function() {
|
||||
console.debug('callback - particles.js config loaded')
|
||||
})
|
||||
}
|
||||
)
|
|
@ -5,7 +5,7 @@ fetch('/config/get/transports.tor', {
|
|||
.then((resp) => resp.text()) // Transform the data into text
|
||||
.then(function(resp) {
|
||||
var displays = document.getElementsByClassName('torInfo')
|
||||
if (resp == true){
|
||||
if (resp == "true"){
|
||||
var torSource = new EventSourcePolyfill('/torcircuits', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue