Browse Source

miner.php 10% highlight subtle, colour scheme, buttons position

nfactor-troky
Kano 12 years ago
parent
commit
19087fda6a
  1. 108
      miner.php

108
miner.php

@ -5,6 +5,8 @@ global $miner, $port, $readonly, $notify, $rigs, $socktimeoutsec;
global $checklastshare, $hidefields; global $checklastshare, $hidefields;
global $ignorerefresh, $changerefresh, $autorefresh; global $ignorerefresh, $changerefresh, $autorefresh;
global $allowcustompages, $customsummarypages; global $allowcustompages, $customsummarypages;
global $miner_font_family, $miner_font_size;
global $colouroverride, $placebuttons;
# #
# Don't touch these 2 - see $rigs below # Don't touch these 2 - see $rigs below
$miner = null; $miner = null;
@ -96,11 +98,17 @@ $warnfont = '<font color=red><b>';
$warnoff = '</b></font>'; $warnoff = '</b></font>';
$dfmt = 'H:i:s j-M-Y \U\T\CP'; $dfmt = 'H:i:s j-M-Y \U\T\CP';
# #
global $miner_font_family, $miner_font_size;
#
$miner_font_family = 'verdana,arial,sans'; $miner_font_family = 'verdana,arial,sans';
$miner_font_size = '13pt'; $miner_font_size = '13pt';
# #
# Edit this or redefine it in myminer.php to change the colour scheme
# See $colourtable below for the list of names
$colouroverride = array();
#
# Where to place the buttons: 'top' 'bot' 'both'
# anything else means don't show them - case sensitive
$placebuttons = 'top';
#
# This below allows you to put your own settings into a seperate file # This below allows you to put your own settings into a seperate file
# so you don't need to update miner.php with your preferred settings # so you don't need to update miner.php with your preferred settings
# every time a new version is released # every time a new version is released
@ -109,6 +117,32 @@ $miner_font_size = '13pt';
if (file_exists('myminer.php')) if (file_exists('myminer.php'))
include_once('myminer.php'); include_once('myminer.php');
# #
# This is the system default that must always contain all necessary
# colours so it must be a constant
# You can override these values with $colouroverride
# The only one missing is in $warnfont
# - which you can override directly anyway
global $colourtable;
$colourtable = array(
'body bgcolor' => '#ecffff',
'td color' => 'blue',
'td.h color' => 'blue',
'td.h background' => '#c4ffff',
'td.err color' => 'black',
'td.err background' => '#ff3050',
'td.warn color' => 'black',
'td.warn background' => '#ffb050',
'td.sta color' => 'green',
'td.tot color' => 'blue',
'td.tot background' => '#fff8f2',
'td.lst color' => 'blue',
'td.lst background' => '#ffffdd',
'td.hi color' => 'blue',
'td.hi background' => '#f6ffff',
'td.lo color' => 'blue',
'td.lo background' => '#deffff'
);
#
# Ensure it is only ever shown once # Ensure it is only ever shown once
global $showndate; global $showndate;
$showndate = false; $showndate = false;
@ -117,6 +151,28 @@ $showndate = false;
global $rigerror; global $rigerror;
$rigerror = array(); $rigerror = array();
# #
function getcss($cssname, $dom = false)
{
global $colourtable, $colouroverride;
$css = '';
foreach ($colourtable as $cssdata => $colour)
{
$cssobj = split(' ', $cssdata, 2);
if ($cssobj[0] == $cssname)
{
if (isset($colouroverride[$cssdata]))
$color = $colouroverride[$cssdata];
if ($dom == true)
$css .= ' '.$cssobj[1].'='.$colour;
else
$css .= $cssobj[1].':'.$colour.'; ';
}
}
return $css;
}
#
function htmlhead($checkapi, $rig, $pg = null) function htmlhead($checkapi, $rig, $pg = null)
{ {
global $miner_font_family, $miner_font_size; global $miner_font_family, $miner_font_size;
@ -152,17 +208,17 @@ function htmlhead($checkapi, $rig, $pg = null)
echo "<html><head>$refreshmeta echo "<html><head>$refreshmeta
<title>Mine</title> <title>Mine</title>
<style type='text/css'> <style type='text/css'>
td { color:blue; $miner_font } td { $miner_font ".getcss('td')."}
td.h { color:blue; $miner_font background:#d0ffff } td.h { $miner_font ".getcss('td.h')."}
td.err { color:black; $miner_font background:#ff3050 } td.err { $miner_font ".getcss('td.err')."}
td.warn { color:black; $miner_font background:#ffb050 } td.warn { $miner_font ".getcss('td.warn')."}
td.sta { color:green; $miner_font } td.sta { $miner_font ".getcss('td.sta')."}
td.tot { color:blue; $miner_font background:#fff8f2 } td.tot { $miner_font ".getcss('td.tot')."}
td.lst { color:blue; $miner_font background:#ffffdd } td.lst { $miner_font ".getcss('td.lst')."}
td.hi { color:blue; $miner_font background:#99ff99 } td.hi { $miner_font ".getcss('td.hi')."}
td.lo { color:blue; $miner_font background:#ff9999 } td.lo { $miner_font ".getcss('td.lo')."}
</style> </style>
</head><body bgcolor=#ecffff> </head><body".getcss('body',true).">
<script type='text/javascript'> <script type='text/javascript'>
function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location='$here?ref=$autorefresh'+a}\n"; function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location='$here?ref=$autorefresh'+a}\n";
@ -795,6 +851,7 @@ function process($cmds, $rig)
global $error, $devs; global $error, $devs;
global $warnfont, $warnoff; global $warnfont, $warnoff;
$count = count($cmds);
foreach ($cmds as $cmd => $des) foreach ($cmds as $cmd => $des)
{ {
$process = api($cmd); $process = api($cmd);
@ -808,7 +865,11 @@ function process($cmds, $rig)
else else
{ {
details($cmd, $process, $rig); details($cmd, $process, $rig);
# Not after the last one
if (--$count > 0)
echo '<tr><td><br><br></td></tr>'; echo '<tr><td><br><br></td></tr>';
if ($cmd == 'devs') if ($cmd == 'devs')
$devs = $process; $devs = $process;
} }
@ -1006,7 +1067,7 @@ function refreshbuttons()
} }
} }
# #
function pagetop($rig, $pg) function pagebuttons($rig, $pg)
{ {
global $readonly, $rigs; global $readonly, $rigs;
global $allowcustompages, $customsummarypages; global $allowcustompages, $customsummarypages;
@ -1046,10 +1107,12 @@ function pagetop($rig, $pg)
function doOne($rig, $preprocess) function doOne($rig, $preprocess)
{ {
global $haderror, $readonly, $notify, $rigs; global $haderror, $readonly, $notify, $rigs;
global $placebuttons;
htmlhead(true, $rig); htmlhead(true, $rig);
pagetop($rig, null); if ($placebuttons == 'top' || $placebuttons == 'both')
pagebuttons($rig, null);
if ($preprocess != null) if ($preprocess != null)
process(array($preprocess => $preprocess), $rig); process(array($preprocess => $preprocess), $rig);
@ -1067,6 +1130,9 @@ function doOne($rig, $preprocess)
if ($haderror == false && $readonly === false) if ($haderror == false && $readonly === false)
processgpus($rig); processgpus($rig);
if ($placebuttons == 'bot' || $placebuttons == 'both')
pagebuttons($rig, null);
} }
# #
global $sectionmap; global $sectionmap;
@ -1247,10 +1313,12 @@ function processcustompage($pagename, $sections, $sum)
function showcustompage($pagename) function showcustompage($pagename)
{ {
global $customsummarypages; global $customsummarypages;
global $placebuttons;
htmlhead(false, null, $pagename); htmlhead(false, null, $pagename);
pagetop(null, $pagename); if ($placebuttons == 'top' || $placebuttons == 'both')
pagebuttons(null, $pagename);
if (!isset($customsummarypages[$pagename])) if (!isset($customsummarypages[$pagename]))
{ {
@ -1276,6 +1344,9 @@ function showcustompage($pagename)
} }
processcustompage($pagename, $page, $sum); processcustompage($pagename, $page, $sum);
if ($placebuttons == 'bot' || $placebuttons == 'both')
pagebuttons(null, $pagename);
} }
# #
function display() function display()
@ -1285,6 +1356,7 @@ function display()
global $readonly, $notify, $rigs; global $readonly, $notify, $rigs;
global $ignorerefresh, $autorefresh; global $ignorerefresh, $autorefresh;
global $allowcustompages; global $allowcustompages;
global $placebuttons;
if ($ignorerefresh == false) if ($ignorerefresh == false)
{ {
@ -1372,7 +1444,8 @@ function display()
htmlhead(false, null); htmlhead(false, null);
pagetop(null, null); if ($placebuttons == 'top' || $placebuttons == 'both')
pagebuttons(null, null);
if ($preprocess != null) if ($preprocess != null)
process(array($preprocess => $preprocess), $rig); process(array($preprocess => $preprocess), $rig);
@ -1390,6 +1463,9 @@ function display()
echo $tablebegin; echo $tablebegin;
doforeach('pools', 'pool list', $sum, array(''=>''), false); doforeach('pools', 'pool list', $sum, array(''=>''), false);
echo $tableend; echo $tableend;
if ($placebuttons == 'bot' || $placebuttons == 'both')
pagebuttons(null, null);
} }
# #
display(); display();

Loading…
Cancel
Save