Permalink
Browse files

Allow multiple levels of blur

  • Loading branch information...
NEMS Linux
NEMS Linux committed Dec 28, 2018
1 parent c363ae3 commit 05e45152ac24c52ca54a91c10f492c2ead219864
Showing with 21 additions and 7 deletions.
  1. +5 −3 config/index.php
  2. +16 −4 inc/wallpaper.php
@@ -112,7 +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['backgroundBlur'] = intval($_POST['backgroundBlur']) ?: 1;
$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).
@@ -250,8 +250,10 @@ function sanitize($string) {
<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>
<option value="1"<?php if (!isset($nemsconf['backgroundBlur']) || $nemsconf['backgroundBlur'] == 1) echo ' SELECTED'; ?>>Disabled</option>
<option value="2"<?php if (isset($nemsconf['backgroundBlur']) && $nemsconf['backgroundBlur'] == 2) echo ' SELECTED'; ?>>Enabled, Slight Blur</option>
<option value="3"<?php if (isset($nemsconf['backgroundBlur']) && $nemsconf['backgroundBlur'] == 3) echo ' SELECTED'; ?>>Enabled, Medium Blur</option>
<option value="4"<?php if (isset($nemsconf['backgroundBlur']) && $nemsconf['backgroundBlur'] == 4) echo ' SELECTED'; ?>>Enabled, Heavy Blur</option>
</select>
<i></i>
</label>
@@ -8,7 +8,7 @@
// defaults
$background=5;
$backgroundBlur=2; // 2 = disabled, 1 = enabled
$backgroundBlur=1; // 1 = disabled, 2 = slight, 3 = medium, 4 = heavy
$conftmp = file('/usr/local/share/nems/nems.conf');
if (is_array($conftmp) && count($conftmp) > 0) {
@@ -69,8 +69,20 @@
}
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>";
if ($backgroundBlur > 1) {
switch ($backgroundBlur) {
case 4:
$bluramt = 80;
break;
case 3:
$bluramt = 30;
break;
case 2:
default:
$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*3) . "px; }</style>";
}
?>

0 comments on commit 05e4515

Please sign in to comment.