Skip to content

Commit

Permalink
Add background blur
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Dec 28, 2018
1 parent f594568 commit c363ae3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
9 changes: 9 additions & 0 deletions config/index.php
Expand Up @@ -112,6 +112,7 @@
$nemsconf['alias'] = preg_replace("/&#?[a-z0-9]{2,8};/i","",sanitize($_POST['alias']));
$nemsconf['allowupdate'] = intval($_POST['allowupdate']) ?: 5;
$nemsconf['background'] = intval($_POST['background']) ?: 5;
$nemsconf['backgroundBlur'] = intval($_POST['backgroundBlur']) ?: 2;
$nemsconf['checkin.enabled'] = intval($_POST['checkin_enabled']) ?: 0;
$nemsconf['checkin.email'] = filter_var(trim($_POST['checkin_email']), FILTER_VALIDATE_EMAIL) ?: '';
$nemsconf['checkin.interval'] = intval($_POST['checkin_interval']) ?: 8; // how many 15 minute cycles before notifying. Default 8 (2 hours).
Expand Down Expand Up @@ -246,6 +247,14 @@ function sanitize($string) {
</select>
<i></i>
</label>
<label class="label">Blur Background</label>
<label class="select">
<select name="backgroundBlur">
<option value="2"<?php if (!isset($nemsconf['backgroundBlur']) || $nemsconf['backgroundBlur'] == 2) echo ' SELECTED'; ?>>Disabled</option>
<option value="1"<?php if (isset($nemsconf['backgroundBlur']) && $nemsconf['backgroundBlur'] == 1) echo ' SELECTED'; ?>>Enabled</option>
</select>
<i></i>
</label>
</section>
<?php } ?>
<?php
Expand Down
14 changes: 11 additions & 3 deletions inc/wallpaper.php
Expand Up @@ -5,15 +5,19 @@
7 = color picker
8 = user uploaded
*/

// defaults
$background=5;
$backgroundBlur=2; // 2 = disabled, 1 = enabled

$conftmp = file('/usr/local/share/nems/nems.conf');
if (is_array($conftmp) && count($conftmp) > 0) {
foreach ($conftmp as $line) {
$tmp = explode('=',$line);
if (trim($tmp[0]) == 'background') {
$background=trim($tmp[1]);
break;
} else {
$background=5;
} elseif (trim($tmp[0]) == 'backgroundBlur') {
$backgroundBlur=trim($tmp[1]);
}
}
}
Expand Down Expand Up @@ -65,4 +69,8 @@

}
echo $output;
if ($backgroundBlur == 1) {
$bluramt = 15;
echo "<style>div.backstretch { -webkit-filter: blur(" . $bluramt . "px); -moz-filter: blur(" . $bluramt . "px); -o-filter: blur(" . $bluramt . "px); -ms-filter: blur(" . $bluramt . "px); filter: blur(" . $bluramt . "px); margin: -" . ($bluramt*2) . "px; }</style>";
}
?>

0 comments on commit c363ae3

Please sign in to comment.