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

View File

@ -100,9 +100,8 @@
<script> <script>
socket.emit('subscribe_foreign_user_ressources', {{ user.id }});
var corpusList = new CorpusList("corpora", foreignCorporaSubscribers); var corpusList = new CorpusList("corpora", foreignCorporaSubscribers);
var jobList = new JobList("jobs", foreignJobsSubscribers); var jobList = new JobList("jobs", foreignJobsSubscribers);
socket.emit("subscribe_foreign_user_ressources", {{ user.id }});
</script> </script>
{% endblock %} {% 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/add_job.js') }}"></script>
<script src="{{ url_for('static', filename='js/CorpusList.js') }}"></script> <script src="{{ url_for('static', filename='js/CorpusList.js') }}"></script>
<script src="{{ url_for('static', filename='js/JobList.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> </head>
<body> <body>
<header> <header>
@ -105,5 +97,15 @@
</div> </div>
</footer> </footer>
<script src="{{ url_for('static', filename='js/Materialize/materialize.min.js') }}"></script> <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> </body>
</html> </html>