mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-26 03:14:19 +00:00
68 lines
3.1 KiB
Django/Jinja
68 lines
3.1 KiB
Django/Jinja
<script src="https://cdnjs.cloudflare.com/ajax/libs/fast-json-patch/3.1.0/fast-json-patch.min.js" integrity="sha512-KrvLlmKBiDoTa0Fke92aFoEv4xS0+cuYGP27nt39w0yLZWvVOhArmZ29uuOe3uOOBcbnkpvnLhkvYcYjahSOwg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/list.js/2.3.1/list.min.js" integrity="sha512-93wYgwrIFL+b+P3RvYxi/WUFRXXUDSLCT2JQk9zhVGXuS2mHl2axj6d+R6pP+gcU5isMHRj1u0oYE/mWyt/RjA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.0/socket.io.min.js" integrity="sha512-pxLMWs4E33rW9tdIhovcCp2dCo9k4Q8eHw7CETjyjdXf4aX6wvsEBq+KdOJJRFALr6FxNoXx+jksgbE74TZjEw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
{%- assets
|
|
filters='rjsmin',
|
|
output='gen/app.%(version)s.js',
|
|
'js/App.js',
|
|
'js/CorpusAnalysis/CQiClient.js',
|
|
'js/CorpusAnalysis/CorpusAnalysisApp.js',
|
|
'js/CorpusAnalysis/CorpusAnalysisConcordance.js',
|
|
'js/CorpusAnalysis/CorpusAnalysisReader.js',
|
|
'js/JobStatusNotifier.js',
|
|
'js/RessourceDisplays/RessourceDisplay.js',
|
|
'js/RessourceDisplays/CorpusDisplay.js',
|
|
'js/RessourceDisplays/JobDisplay.js',
|
|
'js/RessourceLists/RessourceList.js',
|
|
'js/RessourceLists/CorpusList.js',
|
|
'js/RessourceLists/CorpusFileList.js',
|
|
'js/RessourceLists/JobList.js',
|
|
'js/RessourceLists/JobInputList.js',
|
|
'js/RessourceLists/JobResultList.js',
|
|
'js/RessourceLists/QueryResultList.js',
|
|
'js/RessourceLists/UserList.js',
|
|
'js/UploadForm.js'
|
|
%}
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
{%- endassets %}
|
|
<script>
|
|
const app = new App();
|
|
{%- if current_user.is_authenticated %}
|
|
const currentUserId = {{ current_user.hashid|tojson }};
|
|
const jobStatusNotifier = new JobStatusNotifier(currentUserId);
|
|
|
|
// Initialize components for current user
|
|
app.addEventListener('users.patch', patch => jobStatusNotifier.usersPatchHandler(patch));
|
|
app.getUserById(currentUserId)
|
|
.then(
|
|
user => {return;},
|
|
error => {throw JSON.stringify(error);}
|
|
);
|
|
{%- endif %}
|
|
|
|
// Disable all option elements with no value
|
|
for (let optionElementWithoutValue of document.querySelectorAll('option[value=""]')) {
|
|
optionElementWithoutValue.disabled = true;
|
|
}
|
|
|
|
// Set the data-length attribute on inputs with the maxlength attribute
|
|
for (let inputElement of document.querySelectorAll('input[maxlength]')) {
|
|
inputElement.dataset.length = inputElement.getAttribute('maxlength');
|
|
}
|
|
|
|
// Initialize components
|
|
M.AutoInit();
|
|
M.CharacterCounter.init(document.querySelectorAll('input[data-length][type="text"], input[data-length][type="email"], input[data-length][type="search"], input[data-length][type="password"], input[data-length][type="tel"], input[data-length][type="url"]'));
|
|
M.Dropdown.init(
|
|
document.querySelectorAll('#nav-more-dropdown-trigger'),
|
|
{alignment: 'right', constrainWidth: false, coverTrigger: false}
|
|
);
|
|
RessourceList.autoInit();
|
|
UploadForm.autoInit();
|
|
|
|
// Display flashed messages
|
|
for (let flashedMessage of {{ get_flashed_messages(with_categories=True)|tojson }}) {
|
|
app.flash(flashedMessage[1], flashedMessage[0]);
|
|
}
|
|
</script>
|