Skip to content

Commit

Permalink
Merge pull request #85 from mrjones-plip/83-temp-layouts
Browse files Browse the repository at this point in the history
Better temp layout
  • Loading branch information
mrjones-plip authored Jul 20, 2020
2 parents 67fa42e + 519bb84 commit 4dbb163
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 33 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ PRs and Issues welcome!
## Version History
* 0.9.9 - Jul 20,2020
* Add user configurable font sizes #80
* Better temp layouts #83
* 0.9.8 - May 11,2020
* Organize files into directories, update readme accordingly #73
* 0.9.7 - May 10, 2020
Expand Down
7 changes: 7 additions & 0 deletions html/get_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,30 @@ function configIsValid($validateApi = false)
$valid['valid'] = false;
$valid['reason'] .= 'Longitude is invalid. ';
}
if (!isset($YANPIWS['temp_count'])){
error_log('temp_count is unset! Defaulting to "1"');
$YANPIWS['temp_count'] = 1;
}

// for these font sizes ones, lets default to a sane size
// and then write and error to the error log. Will make
// a much safer upgrade path for Manny ;)
if (!isset($YANPIWS['font_time_date_wind'])){
error_log('font_time_date_wind is unset! Defaulting to "35"');
$YANPIWS['font_time_date_wind'] = 35;
} elseif (!validateFontSize($YANPIWS['font_time_date_wind'])){
$valid['valid'] = false;
$valid['reason'] .= 'Font size for time/date/wind is invalid. ';
}
if (!isset($YANPIWS['font_temp'])){
error_log('font_temp is unset! Defaulting to "50"');
$YANPIWS['font_temp'] = 50;
} elseif (!validateFontSize($YANPIWS['font_temp'])){
$valid['valid'] = false;
$valid['reason'] .= 'Font size for temp is invalid. ';
}
if (!isset($YANPIWS['font_temp_label'])){
error_log('font_temp_label is unset! Defaulting to "25"');
$YANPIWS['font_temp_label'] = 25;
} elseif (!validateFontSize($YANPIWS['font_temp_label'])){
$valid['valid'] = false;
Expand Down
10 changes: 5 additions & 5 deletions html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<script src='skycons/skycons.js?<?php echo $YANPIWS['cache_bust'] ?>'></script>
<script src='skycons/skycons.js?<?= $YANPIWS['cache_bust'] ?>'></script>
<script>var skycons = new Skycons({'color': 'white'});</script>
</head>
<body>
<link rel="stylesheet" type="text/css" href="styles.php?<?php echo $YANPIWS['cache_bust'] ?>" />
<link rel="stylesheet" type="text/css" href="styles.css.php?<?= $YANPIWS['cache_bust'] ?>" />

<?php

Expand All @@ -25,12 +25,12 @@
}
?>
<div class="col">
<div class="row">
<div class="row temp-row">
<a href="/temps.php">
<?php
$count = 1;
foreach ($YANPIWS['labels'] as $id => $label){
echo "\t<div class='temp temp{$count}' id='temp{$count}'></div>\n";
echo "\t\t\t<div class='temp temp{$count}' id='temp{$count}'></div>\n";
$count++;
if ($count > $YANPIWS['temp_count']){
break;
Expand Down Expand Up @@ -76,4 +76,4 @@ function refreshAll() {
</script>
<span id="dev_null"></span>
</body>
</html>
</html>
21 changes: 9 additions & 12 deletions html/stats.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
</head>
<body>
<link rel="stylesheet" type="text/css" href="styles.php" />
<?php
require_once "get_data.php";
getConfig();
Expand All @@ -23,16 +16,20 @@
}

$darkskytime= getCacheAge();

?>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
</head>
<body>
<link rel="stylesheet" type="text/css" href="styles.css.php?<?= $YANPIWS['cache_bust'] ?>" />
<div class="col">
<div class="row">
<p>
<a href="/" class="homeLink"><- Weather</a>
<!-- <br />-->
<!-- <a href="./config.php" class="homeLink">Config</a>-->
</p>
<a href="https://github.com/Ths2-9Y-LqJt6/YANPIWS">YANPIS 0.9.9</a> - Released Jul 19, 2020<br />
<a href="https://github.com/mrjones-plip/YANPIWS">YANPIS 0.9.9</a> - Released Jul 20, 2020<br />
<a href="https://darksky.net/poweredby/">Powered by Dark Sky</a><br />
<?php echo $currentTempHtml ?>
Dark Sky Cache Age: <?php echo $darkskytime ?><br/>
Expand All @@ -41,4 +38,4 @@
</div>

</body>
</html>
</html>
20 changes: 6 additions & 14 deletions html/styles.php → html/styles.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require_once 'get_data.php';
getConfig();
configIsValid();
$tempWidth = round(100/$YANPIWS['temp_count']);
header("Content-type: text/css");
?>

Expand Down Expand Up @@ -50,24 +51,15 @@
padding-bottom:10px;
font-size: <?= $YANPIWS['font_temp']?>pt;
float: left;
text-align: center;
width: <?= $tempWidth ?>%;
}

.temp:last-child {
float: right;
text-align: right;
}
.temp:first-child {
padding-right: 11%;
}

/*two temps */
.temp:first-child:nth-last-child(2),
.temp:first-child:nth-last-child(2) ~ .temp {

}
/*three temps */
.temp:first-child:nth-last-child(3),
.temp:first-child:nth-last-child(3) ~ .temp {

text-align: left;
}

.degrees {
Expand Down Expand Up @@ -164,4 +156,4 @@
width:50px;
height:50px;
}
}
}
4 changes: 2 additions & 2 deletions html/temps.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="styles.php" />
<link rel="stylesheet" type="text/css" href="styles.css.php" />
<script src="jquery.3.2.1.slim.min.js" ></script>
<script src="jquery.jqplot.min.js" ></script>
<link rel="stylesheet" href="HappyHistogram.min.css">
Expand Down Expand Up @@ -102,4 +102,4 @@
</script>

</body>
</html>
</html>

0 comments on commit 4dbb163

Please sign in to comment.