Minor updates

This commit is contained in:
Patrick Jentsch 2020-01-17 10:49:04 +01:00
parent 04bfe108c3
commit 501eb3756c
3 changed files with 13 additions and 20 deletions

View File

@ -1,5 +1,3 @@
var darkModeEnabled = false;
var flashedMessages = [];
var socket = io();
var corpora;
@ -90,7 +88,7 @@ socket.on('update-foreign-jobs', function(msg) {
});
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener("DOMContentLoaded", function() {
M.AutoInit();
M.CharacterCounter.init(document.querySelectorAll(`input[data-length][type="text"]`));
M.Dropdown.init(document.getElementById("nav-notifications"),
@ -102,11 +100,5 @@ document.addEventListener('DOMContentLoaded', function() {
entry.parentNode.classList.add("active");
}
}
if (darkModeEnabled) {
DarkReader.enable({"brightness": 100, "contrast": 100, "sepia": 0});
}
for (flashedMessage of flashedMessages) {
toast(flashedMessage);
}
socket.emit('subscribe_user_ressources');
socket.emit("subscribe_user_ressources");
});

View File

@ -100,9 +100,8 @@
<script>
socket.emit('subscribe_foreign_user_ressources', {{ user.id }});
var corpusList = new CorpusList("corpora", foreignCorporaSubscribers);
var jobList = new JobList("jobs", foreignJobsSubscribers);
socket.emit("subscribe_foreign_user_ressources", {{ user.id }});
</script>
{% endblock %}

View File

@ -20,14 +20,6 @@
<script src="{{ url_for('static', filename='js/add_job.js') }}"></script>
<script src="{{ url_for('static', filename='js/CorpusList.js') }}"></script>
<script src="{{ url_for('static', filename='js/JobList.js') }}"></script>
<script>
{% if current_user.is_authenticated and current_user.is_dark %}
darkModeEnabled = true;
{% endif %}
{% for flashed_message in get_flashed_messages() %}
flashedMessages.push("{{ flashed_message }}");
{% endfor %}
</script>
</head>
<body>
<header>
@ -105,5 +97,15 @@
</div>
</footer>
<script src="{{ url_for('static', filename='js/Materialize/materialize.min.js') }}"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
{% if current_user.is_authenticated and current_user.is_dark %}
DarkReader.enable({"brightness": 100, "contrast": 100, "sepia": 0});
{% endif %}
{% for flashed_message in get_flashed_messages() %}
toast("{{ flashed_message }}");
{% endfor %}
});
</script>
</body>
</html>