mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-21 16:30:00 +00:00
Make blue info bubble dismissible, configurable (#526)
Infobubble text is now in a separate file, along with a timestamp in the main file, so that changes to it don't result in merge conflicts too often. We also add some JS to make the bubble dismissible, keeping track of the last timestamp that was dismissed in localstorage. A timestamp of 0 disables the infobubble altogether.
This commit is contained in:
parent
7de7147743
commit
38f8880966
|
@ -260,6 +260,16 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
}
|
||||
});
|
||||
|
||||
// Info bubble stuff
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var bubble = document.getElementById('infobubble');
|
||||
if (Number(localStorage.getItem('infobubble_dismiss_ts')) < Number(bubble.dataset.ts)) {
|
||||
bubble.removeAttribute('hidden');
|
||||
}
|
||||
$('#infobubble').on('close.bs.alert', function () {
|
||||
localStorage.setItem('infobubble_dismiss_ts', bubble.dataset.ts);
|
||||
})
|
||||
});
|
||||
|
||||
// Decode HTML entities (> etc), used for decoding comment markdown from escaped text
|
||||
function htmlDecode(input){
|
||||
|
|
|
@ -12,10 +12,7 @@
|
|||
{% block body %}
|
||||
|
||||
{% if not search.term %}
|
||||
<div class="alert alert-info">
|
||||
<p>We welcome you to provide feedback on IRC at <a href="irc://irc.rizon.net/nyaa-dev">#nyaa-dev@irc.rizon.net</a></p>
|
||||
<p>Our GitHub: <a href="https://github.com/nyaadevs" target="_blank">https://github.com/nyaadevs</a> - creating <a href="https://github.com/nyaadevs/nyaa/issues">issues</a> for features and faults is recommended!</p>
|
||||
</div>
|
||||
{% include "infobubble.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% include "search_results.html" %}
|
||||
|
|
16
nyaa/templates/infobubble.html
Normal file
16
nyaa/templates/infobubble.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{# Update this to a larger timestamp if you change your announcement #}
|
||||
{# A value of 0 disables the announcements altogether #}
|
||||
{% set info_ts = 0 %}
|
||||
{% if info_ts > 0 %}
|
||||
<div class="alert alert-info alert-dismissible" id="infobubble" data-ts='{{ info_ts }}' hidden>
|
||||
{% include 'infobubble_content.html' %}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<noscript>
|
||||
<div class="alert alert-info" id="infobubble-noscript">
|
||||
{% include 'infobubble_content.html' %}
|
||||
</div>
|
||||
</noscript>
|
||||
{% endif %}
|
1
nyaa/templates/infobubble_content.html
Normal file
1
nyaa/templates/infobubble_content.html
Normal file
|
@ -0,0 +1 @@
|
|||
<strong>Put your announcements into <tt>infobubble_content.html</tt>!</strong>
|
Loading…
Reference in a new issue