Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease resource usage of CSS animations #2021

Merged
merged 3 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions scripts/pi-hole/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,15 @@ function loadCacheInfo() {
var cachelivefreed = parseInt(data.cacheinfo["cache-live-freed"], 10);
$("#cache-live-freed").text(cachelivefreed);
if (cachelivefreed > 0) {
$("#cache-live-freed").parent("tr").addClass("lookatme");
$("#cache-live-freed").parent("tr").children("th").children("span").addClass("lookatme");
$("#cache-live-freed").parent("tr").children("td").addClass("lookatme");
$("#cache-live-freed")
.parent("tr")
.children("td")
.attr("lookatme-text", cachelivefreed.toString());
} else {
$("#cache-live-freed").parent("tr").removeClass("lookatme");
$("#cache-live-freed").parent("tr").children("th").children("span").removeClass("lookatme");
$("#cache-live-freed").parent("tr").children("td").removeClass("lookatme");
}

// Update cache info every 10 seconds
Expand Down
6 changes: 3 additions & 3 deletions scripts/pi-hole/php/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@
<li>
<strong>Pi-hole</strong>
<a href="<?php echo $coreReleasesUrl . "/" . $core_current; ?>" rel="noopener" target="_blank"><?php echo $core_current; ?></a>
<?php if ($core_update) { ?> &middot; <a class="lookatme" href="<?php echo $coreReleasesUrl . "/latest"; ?>" rel="noopener" target="_blank">Update available!</a><?php } ?>
<?php if ($core_update) { ?> &middot; <a class="lookatme" lookatme-text="Update available!" href="<?php echo $coreReleasesUrl . "/latest"; ?>" rel="noopener" target="_blank">Update available!</a><?php } ?>
</li>
<li>
<strong>FTL</strong>
<a href="<?php echo $ftlReleasesUrl . "/" . $FTL_current; ?>" rel="noopener" target="_blank"><?php echo $FTL_current; ?></a>
<?php if ($FTL_update) { ?> &middot; <a class="lookatme" href="<?php echo $ftlReleasesUrl . "/latest"; ?>" rel="noopener" target="_blank">Update available!</a><?php } ?>
<?php if ($FTL_update) { ?> &middot; <a class="lookatme" lookatme-text="Update available!" href="<?php echo $ftlReleasesUrl . "/latest"; ?>" rel="noopener" target="_blank">Update available!</a><?php } ?>
</li>
<li>
<strong>Web Interface</strong>
<a href="<?php echo $webReleasesUrl . "/" . $web_current; ?>" rel="noopener" target="_blank"><?php echo $web_current; ?></a>
<?php if ($web_update) { ?> &middot; <a class="lookatme" href="<?php echo $webReleasesUrl . "/latest"; ?>" rel="noopener" target="_blank">Update available!</a><?php } ?>
<?php if ($web_update) { ?> &middot; <a class="lookatme" lookatme-text="Update available!" href="<?php echo $webReleasesUrl . "/latest"; ?>" rel="noopener" target="_blank">Update available!</a><?php } ?>
</li>
</ul>
<?php if($core_update || $web_update || $FTL_update) { ?>
Expand Down
6 changes: 3 additions & 3 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function get_FTL_data($arg)
</tr>
<tr>
<th scope="row">
<span title="Number of cache entries that had to be removed although they are not expired (increase cache size to reduce this number)">DNS cache evictions:</span>
<span title="Number of cache entries that had to be removed although they are not expired (increase cache size to reduce this number)" lookatme-text="DNS cache evictions:">DNS cache evictions:</span>
</th>
<td id="cache-live-freed">&nbsp;</td>
</tr>
Expand Down Expand Up @@ -457,7 +457,7 @@ function get_FTL_data($arg)
<div class="row">
<div class="col-md-12">
<div><input type="checkbox" name="active" id="DHCPchk" <?php if ($DHCP){ ?>checked<?php } ?>><label for="DHCPchk"><strong>DHCP server enabled</strong></label></div><br>
<p id="dhcpnotice" <?php if (!$DHCP){ ?>hidden<?php } ?>>Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!</p>
<p id="dhcpnotice" lookatme-text="Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!" <?php if (!$DHCP){ ?>hidden<?php } ?>>Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!</p>
</div>
</div>
<div class="row">
Expand Down Expand Up @@ -1263,7 +1263,7 @@ function convertseconds($argument)
</div>
<p>The privacy level may be increased at any time without having to restart the DNS resolver. However, note that the DNS resolver needs to be restarted when lowering the privacy level. This restarting is automatically done when saving.</p>
<?php if($privacylevel > 0 && $piHoleLogging){ ?>
<p class="lookatme">Warning: Pi-hole's query logging is activated. Although the dashboard will hide the requested details, all queries are still fully logged to the pihole.log file.</p>
<p class="lookatme" lookatme-text="Warning: Pi-hole's query logging is activated. Although the dashboard will hide the requested details, all queries are still fully logged to the pihole.log file.">Warning: Pi-hole's query logging is activated. Although the dashboard will hide the requested details, all queries are still fully logged to the pihole.log file.</p>
<?php } ?>
</div>
</div>
Expand Down
53 changes: 39 additions & 14 deletions style/pi-hole.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,66 @@

@-webkit-keyframes Pulse {
from {
color: #630030;
text-shadow: 0 0 2px transparent;
opacity: 0;
}

50% {
color: #e33100;
text-shadow: 0 0 5px #e33100;
opacity: 1;
}

to {
color: #630030;
text-shadow: 0 0 2px transparent;
opacity: 0;
}
}

@keyframes Pulse {
from {
color: #630030;
text-shadow: 0 0 2px transparent;
opacity: 0;
}

50% {
color: #e33100;
text-shadow: 0 0 5px #e33100;
opacity: 1;
}

to {
color: #630030;
text-shadow: 0 0 2px transparent;
opacity: 0;
}
}

p#dhcpnotice[hidden] {
display: none;
}

.lookatme #dhcpnotice {
display: block;
}

td.lookatme {
display: table-cell;
}

.lookatme {
-webkit-animation: 2s infinite Pulse;
animation: 2s infinite Pulse;
color: #630030;
opacity: 1;
position: relative;
display: inline-block;
}

/* this pseudo element will be faded in and out in front /*
/* of the lookatme element to create an efficient animation. */
.lookatme:after {
color: #e33100;
text-shadow: 0 0 5px #e33100;
/* in the html, the lookatme-text attribute must */
/* contain the same text as the .lookatme element */
content: attr(lookatme-text);
padding: inherit;
position: absolute;
inset: 0 0 0 0;
z-index: 1;
/* 20 steps / 2 seconds = 10fps */
-webkit-animation: 2s infinite Pulse steps(20);
animation: 2s infinite Pulse steps(20);
}

.table-responsive {
Expand Down
83 changes: 59 additions & 24 deletions style/themes/lcars.css
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ label {
font-weight: bold !important;
}

div .panel-title,
p.login-box-msg,
.form-group.has-error label {
position: relative;
z-index: 1;
}

.form-control::placeholder {
color: #456;
}
Expand All @@ -329,24 +336,34 @@ label {

.form-group.has-error.login-box-msg::before {
content: "ACCESS DENIED";
display: block;
margin: -20px -20px 20px;
padding: calc(45px + 0.7em) 0 0;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 130px;
color: #d43;
inset: 0 0 0 0;
color: #630030;
font-size: 3.825em;
font-size: calc((100vw - var(--sidebar-width) - 60px) / 12);
line-height: 1;
animation: 3s infinite Pulse;
background: rgba(0, 0, 0, 0.88);
z-index: 0;
}

.layout-boxed .form-group.has-error.login-box-msg::before {
.form-group.has-error.login-box-msg::after {
content: "ACCESS DENIED";
margin: -20px -20px 20px;
padding: calc(45px + 0.7em) 0 0;
position: absolute;
inset: 0 0 0 0;
color: #e33100;
font-size: 3.825em;
font-size: calc((100vw - var(--sidebar-width) - 60px) / 12);
line-height: 1;
text-shadow: 0 0 5px #e33100;
animation: 3s infinite Pulse steps(30);
z-index: 1;
}

.layout-boxed .form-group.has-error.login-box-msg::before,
.layout-boxed .form-group.has-error.login-box-msg::after {
padding: calc(50% - 0.5em) 0 0;
}

Expand Down Expand Up @@ -1460,37 +1477,54 @@ table.dataTable {

@-webkit-keyframes warningPulse {
0% {
border-color: rgba(255, 153, 0, 0.4);
opacity: 0;
}
50% {
border-color: rgba(255, 150, 0, 1);
opacity: 1;
}
100% {
border-color: rgba(255, 153, 0, 0.4);
opacity: 0;
}
}

@keyframes warningPulse {
0% {
border-color: rgba(255, 153, 0, 0.4);
opacity: 0;
}
50% {
border-color: rgba(255, 150, 0, 1);
opacity: 1;
}
100% {
border-color: rgba(255, 153, 0, 0.4);
opacity: 0;
}
}

.box-warning {
animation: 3s infinite warningPulse;
.box.box-warning {
border-top-color: #71480a;
position: relative;
}

.box.box-warning:after {
content: "";
border-top: 3px solid #f89201;
border-radius: 12px;
position: absolute;
margin-top: -3px;
inset: 0 0 0 0;
z-index: -1;
animation: 3s infinite warningPulse steps(30);
}

.box.box-warning div {
z-index: 2;
}

/*** MEDIA QUERIES ***/

/*--- Media - max-width ---*/
@media (max-width: 991px) {
.form-group.has-error.login-box-msg::before {
.form-group.has-error.login-box-msg::before,
.form-group.has-error.login-box-msg::after {
font-size: calc((100vw - var(--sidebar-width) - 60px) / 9);
}
}
Expand Down Expand Up @@ -1581,7 +1615,8 @@ table.dataTable {
.main-footer {
margin-left: 0;
}
.form-group.has-error.login-box-msg::before {
.form-group.has-error.login-box-msg::before,
.form-group.has-error.login-box-msg::after {
font-size: calc((100vw - 60px) / 6);
}
}
Expand Down Expand Up @@ -1652,18 +1687,18 @@ table.dataTable {
}

@media (min-width: 1320px) {
.layout-boxed .form-group.has-error.login-box-msg::before {
.layout-boxed .form-group.has-error.login-box-msg::before,
.layout-boxed .form-group.has-error.login-box-msg::after {
font-size: calc((1320px - var(--sidebar-width) - 60px) / 12);
}
}

@media (min-width: 1920px) {
.layout-boxed .form-group.has-error.login-box-msg::before {
@media (min-width: 1960px) {
.layout-boxed .form-group.has-error.login-box-msg::before,
.layout-boxed .form-group.has-error.login-box-msg::after {
font-size: calc((1920px - var(--sidebar-width) - 60px) / 12);
}
}

@media (min-width: 1960px) {
.layout-boxed .wrapper {
box-shadow: none;
max-width: 1920px;
Expand Down