miner.php 10% highlight subtle, colour scheme, buttons position
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
diff --git a/miner.php b/miner.php
index e151d60..842da86 100644
--- a/miner.php
+++ b/miner.php
@@ -5,6 +5,8 @@ global $miner, $port, $readonly, $notify, $rigs, $socktimeoutsec;
global $checklastshare, $hidefields;
global $ignorerefresh, $changerefresh, $autorefresh;
global $allowcustompages, $customsummarypages;
+global $miner_font_family, $miner_font_size;
+global $colouroverride, $placebuttons;
#
# Don't touch these 2 - see $rigs below
$miner = null;
@@ -96,11 +98,17 @@ $warnfont = '<font color=red><b>';
$warnoff = '</b></font>';
$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_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
# so you don't need to update miner.php with your preferred settings
# every time a new version is released
@@ -109,6 +117,32 @@ $miner_font_size = '13pt';
if (file_exists('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
global $showndate;
$showndate = false;
@@ -117,6 +151,28 @@ $showndate = false;
global $rigerror;
$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)
{
global $miner_font_family, $miner_font_size;
@@ -152,17 +208,17 @@ function htmlhead($checkapi, $rig, $pg = null)
echo "<html><head>$refreshmeta
<title>Mine</title>
<style type='text/css'>
-td { color:blue; $miner_font }
-td.h { color:blue; $miner_font background:#d0ffff }
-td.err { color:black; $miner_font background:#ff3050 }
-td.warn { color:black; $miner_font background:#ffb050 }
-td.sta { color:green; $miner_font }
-td.tot { color:blue; $miner_font background:#fff8f2 }
-td.lst { color:blue; $miner_font background:#ffffdd }
-td.hi { color:blue; $miner_font background:#99ff99 }
-td.lo { color:blue; $miner_font background:#ff9999 }
+td { $miner_font ".getcss('td')."}
+td.h { $miner_font ".getcss('td.h')."}
+td.err { $miner_font ".getcss('td.err')."}
+td.warn { $miner_font ".getcss('td.warn')."}
+td.sta { $miner_font ".getcss('td.sta')."}
+td.tot { $miner_font ".getcss('td.tot')."}
+td.lst { $miner_font ".getcss('td.lst')."}
+td.hi { $miner_font ".getcss('td.hi')."}
+td.lo { $miner_font ".getcss('td.lo')."}
</style>
-</head><body bgcolor=#ecffff>
+</head><body".getcss('body',true).">
<script type='text/javascript'>
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 $warnfont, $warnoff;
+ $count = count($cmds);
foreach ($cmds as $cmd => $des)
{
$process = api($cmd);
@@ -808,7 +865,11 @@ function process($cmds, $rig)
else
{
details($cmd, $process, $rig);
- echo '<tr><td><br><br></td></tr>';
+
+ # Not after the last one
+ if (--$count > 0)
+ echo '<tr><td><br><br></td></tr>';
+
if ($cmd == 'devs')
$devs = $process;
}
@@ -1006,7 +1067,7 @@ function refreshbuttons()
}
}
#
-function pagetop($rig, $pg)
+function pagebuttons($rig, $pg)
{
global $readonly, $rigs;
global $allowcustompages, $customsummarypages;
@@ -1046,10 +1107,12 @@ function pagetop($rig, $pg)
function doOne($rig, $preprocess)
{
global $haderror, $readonly, $notify, $rigs;
+ global $placebuttons;
htmlhead(true, $rig);
- pagetop($rig, null);
+ if ($placebuttons == 'top' || $placebuttons == 'both')
+ pagebuttons($rig, null);
if ($preprocess != null)
process(array($preprocess => $preprocess), $rig);
@@ -1067,6 +1130,9 @@ function doOne($rig, $preprocess)
if ($haderror == false && $readonly === false)
processgpus($rig);
+
+ if ($placebuttons == 'bot' || $placebuttons == 'both')
+ pagebuttons($rig, null);
}
#
global $sectionmap;
@@ -1247,10 +1313,12 @@ function processcustompage($pagename, $sections, $sum)
function showcustompage($pagename)
{
global $customsummarypages;
+ global $placebuttons;
htmlhead(false, null, $pagename);
- pagetop(null, $pagename);
+ if ($placebuttons == 'top' || $placebuttons == 'both')
+ pagebuttons(null, $pagename);
if (!isset($customsummarypages[$pagename]))
{
@@ -1276,6 +1344,9 @@ function showcustompage($pagename)
}
processcustompage($pagename, $page, $sum);
+
+ if ($placebuttons == 'bot' || $placebuttons == 'both')
+ pagebuttons(null, $pagename);
}
#
function display()
@@ -1285,6 +1356,7 @@ function display()
global $readonly, $notify, $rigs;
global $ignorerefresh, $autorefresh;
global $allowcustompages;
+ global $placebuttons;
if ($ignorerefresh == false)
{
@@ -1372,7 +1444,8 @@ function display()
htmlhead(false, null);
- pagetop(null, null);
+ if ($placebuttons == 'top' || $placebuttons == 'both')
+ pagebuttons(null, null);
if ($preprocess != null)
process(array($preprocess => $preprocess), $rig);
@@ -1390,6 +1463,9 @@ function display()
echo $tablebegin;
doforeach('pools', 'pool list', $sum, array(''=>''), false);
echo $tableend;
+
+ if ($placebuttons == 'bot' || $placebuttons == 'both')
+ pagebuttons(null, null);
}
#
display();