From 9526cf0093bb11e32ddb853efebd46d3a21007a2 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 11 Jan 2014 18:37:55 +0100 Subject: [PATCH] [IMPROVED] Show static nav hashrate if live off Fixes #1362 once merged. --- public/templates/mpos/global/navigation.tpl | 8 ++-- .../mpos/global/{navjs.tpl => navjs_api.tpl} | 11 ----- public/templates/mpos/global/navjs_static.tpl | 42 +++++++++++++++++++ 3 files changed, 47 insertions(+), 14 deletions(-) rename public/templates/mpos/global/{navjs.tpl => navjs_api.tpl} (75%) create mode 100644 public/templates/mpos/global/navjs_static.tpl diff --git a/public/templates/mpos/global/navigation.tpl b/public/templates/mpos/global/navigation.tpl index b18a1a83..3f10dbdf 100644 --- a/public/templates/mpos/global/navigation.tpl +++ b/public/templates/mpos/global/navigation.tpl @@ -92,7 +92,6 @@ {if $smarty.session.AUTHENTICATED|default:"0" == 1}
{else} - {if !$GLOBAL.website.api.disabled && !$GLOBAL.config.disable_navbar && !$GLOBAL.config.disable_navbar_api} -
- {include file="global/navjs.tpl"} +
+ {if !$GLOBAL.website.api.disabled && !$GLOBAL.config.disable_navbar && !$GLOBAL.config.disable_navbar_api} + {include file="global/navjs_api.tpl"} + {else} + {include file="global/navjs_static.tpl"} {/if} {/if} diff --git a/public/templates/mpos/global/navjs.tpl b/public/templates/mpos/global/navjs_api.tpl similarity index 75% rename from public/templates/mpos/global/navjs.tpl rename to public/templates/mpos/global/navjs_api.tpl index 2d352c13..391e9c20 100644 --- a/public/templates/mpos/global/navjs.tpl +++ b/public/templates/mpos/global/navjs_api.tpl @@ -6,10 +6,6 @@ $(document).ready(function(){ // Ajax API URL var url = "{/literal}{$smarty.server.PHP_SELF}?page=api&action=getnavbardata{literal}"; - // Store our data globally - var storedHashrate=[]; - var storedWorkers=[]; - g1 = new JustGage({ id: "mr", value: parseFloat({/literal}{$GLOBAL.workers}{literal}).toFixed(0), @@ -46,16 +42,10 @@ $(document).ready(function(){ shadowVerticalOffset : 10 }); - {/literal}{if $GLOBAL.config.disable_navbar|default:"0" != 1 && $GLOBAL.config.disable_navbar_api|default:"0" != 1}{literal} // Helper to refresh graphs function refreshInformation(data) { g1.refresh(parseFloat(data.getnavbardata.data.pool.workers).toFixed(0)); g2.refresh(parseFloat(data.getnavbardata.data.pool.hashrate).toFixed(2)); - if (storedWorkers.length > 20) { storedWorkers.shift(); } - if (storedHashrate.length > 20) { storedHashrate.shift(); } - timeNow = new Date().getTime(); - storedWorkers[storedWorkers.length] = [timeNow, data.getnavbardata.data.raw.pool.workers]; - storedHashrate[storedHashrate.length] = [timeNow, data.getnavbardata.data.raw.pool.hashrate]; } // Our worker process to keep gauges and graph updated @@ -70,7 +60,6 @@ $(document).ready(function(){ setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"1000"}{literal}) } }); - {/literal}{/if}{literal} })(); }); {/literal} diff --git a/public/templates/mpos/global/navjs_static.tpl b/public/templates/mpos/global/navjs_static.tpl new file mode 100644 index 00000000..d81ad578 --- /dev/null +++ b/public/templates/mpos/global/navjs_static.tpl @@ -0,0 +1,42 @@ +