Skip to content

Commit

Permalink
#154 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 14, 2024
1 parent 894b61d commit 99625fe
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
35 changes: 35 additions & 0 deletions js/outdated.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* MIT License
*
* Copyright (c) 2024 Zerocracy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to who_namem the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

$(function() {
const dob = Date.parse($("time[itemprop='datePublished']").attr("datetime"));
const hours = parseInt((new Date() - dob) / (1000 * 60 * 60));
if (hours > 24) {
$("article").prepend(
"<p class='warning'><span>" +
"This page was generated " + hours + " hours ago. " +
"The information is most probably outdated.</span></p>"
);
}
});
11 changes: 11 additions & 0 deletions sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ header {
}
}

.warning {
text-align: center;

span {
background: darkred;
color: white;
padding: .5em 1em;
border-radius: .3em;
}
}

.ff {
font-family: monospace;
}
4 changes: 3 additions & 1 deletion xsl/vitals.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ SOFTWARE.
<xsl:value-of select="$version"/>
</span>
<xsl:text>) on </xsl:text>
<xsl:value-of select="current-dateTime()"/>
<time itemprop="datePublished" datetime="{current-dateTime()}">
<xsl:value-of select="current-dateTime()"/>
</time>
<xsl:text>.</xsl:text>
<br/>
<a href="https://github.com/yegor256/factbase">
Expand Down

1 comment on commit 99625fe

@0crat
Copy link

@0crat 0crat commented on 99625fe Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yegor256 It is not a good idea to push directly to the default branch master. You've earned -16 points. Next time, create a new branch, push your changes over there, then make a pull request and merge it. Even if you are flying solo, contributing via pull requests is a good practice. Your running balance is -156.

Please sign in to comment.