2022-07-18 15:10:21 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fast-json-patch/3.1.1/fast-json-patch.min.js" integrity="sha512-5uDdefwnzyq4N+SkmMBmekZLZNmc6dLixvVxCdlHBfqpyz0N3bzLdrJ55OLm7QrZmgZuhLGgHLDtJwU6RZoFCA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
2021-12-09 11:50:14 +00:00
|
|
|
<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>
|
2023-01-03 16:03:47 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js" integrity="sha512-WFN04846sdKMIP5LKNphMaWzU7YpMyCU245etK3g/2ARYbPK9Ub18eG+ljU96qKRCWh+quCY7yefSmlkQw1ANQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
2022-07-18 15:10:21 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.1/socket.io.min.js" integrity="sha512-mHO4BJ0ELk7Pb1AzhTi3zvUeRgq3RXVOu9tTRfnA6qOxGK4pG2u57DJYolI4KrEnnLTcH9/J5wNOozRTDaybXg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
2021-12-09 14:39:45 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
2022-02-15 08:25:34 +00:00
|
|
|
output='gen/app.%(version)s.js',
|
|
|
|
'js/App.js',
|
2022-09-02 11:07:30 +00:00
|
|
|
'js/Utils.js',
|
|
|
|
'js/Forms/Form.js',
|
|
|
|
'js/Forms/CreateCorpusFileForm.js',
|
|
|
|
'js/Forms/CreateJobForm.js',
|
2022-11-03 14:38:35 +00:00
|
|
|
'js/Forms/CreateContributionForm.js',
|
2022-02-15 08:25:34 +00:00
|
|
|
'js/CorpusAnalysis/CQiClient.js',
|
|
|
|
'js/CorpusAnalysis/CorpusAnalysisApp.js',
|
|
|
|
'js/CorpusAnalysis/CorpusAnalysisConcordance.js',
|
|
|
|
'js/CorpusAnalysis/CorpusAnalysisReader.js',
|
2022-09-07 12:56:40 +00:00
|
|
|
'js/CorpusAnalysis/QueryBuilder.js',
|
2021-12-09 14:39:45 +00:00
|
|
|
'js/RessourceDisplays/RessourceDisplay.js',
|
|
|
|
'js/RessourceDisplays/CorpusDisplay.js',
|
2022-02-15 08:25:34 +00:00
|
|
|
'js/RessourceDisplays/JobDisplay.js',
|
2023-01-04 19:00:37 +00:00
|
|
|
'js/ResourceLists/ResourceList.js',
|
|
|
|
'js/ResourceLists/CorpusFileList.js',
|
|
|
|
'js/ResourceLists/CorpusList.js',
|
|
|
|
'js/ResourceLists/JobList.js',
|
|
|
|
'js/ResourceLists/JobInputList.js',
|
|
|
|
'js/ResourceLists/JobResultList.js',
|
|
|
|
'js/ResourceLists/UserList.js',
|
|
|
|
'js/ResourceLists/PublicUserList.js',
|
|
|
|
'js/ResourceLists/SpacyNLPPipelineModelList.js',
|
|
|
|
'js/ResourceLists/TesseractOCRPipelineModelList.js',
|
2022-12-12 14:37:33 +00:00
|
|
|
'js/XMLtoObject.js'
|
2021-12-09 14:39:45 +00:00
|
|
|
%}
|
2021-05-28 13:51:23 +00:00
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
2021-12-09 14:39:45 +00:00
|
|
|
{%- endassets %}
|
2021-05-28 13:51:23 +00:00
|
|
|
<script>
|
2021-12-09 14:39:45 +00:00
|
|
|
const app = new App();
|
|
|
|
{%- if current_user.is_authenticated %}
|
|
|
|
const currentUserId = {{ current_user.hashid|tojson }};
|
|
|
|
|
|
|
|
// Initialize components for current user
|
2023-01-03 16:03:47 +00:00
|
|
|
app.subscribeUser(currentUserId)
|
|
|
|
.catch((error) => {throw JSON.stringify(error);});
|
|
|
|
app.getUser(currentUserId, true, true)
|
|
|
|
.catch((error) => {throw JSON.stringify(error);});
|
2021-12-09 14:39:45 +00:00
|
|
|
{%- endif %}
|
|
|
|
|
2021-05-28 13:51:23 +00:00
|
|
|
// Disable all option elements with no value
|
2023-01-03 16:03:47 +00:00
|
|
|
for (let optionElement of document.querySelectorAll('option[value=""]')) {
|
|
|
|
optionElement.disabled = true;
|
2021-12-09 14:39:45 +00:00
|
|
|
}
|
|
|
|
|
2023-01-03 16:03:47 +00:00
|
|
|
// Set the data-length attribute on textareas/inputs with the maxlength attribute
|
|
|
|
for (let inputElement of document.querySelectorAll('textarea[maxlength], input[maxlength]')) {
|
2022-04-12 14:11:24 +00:00
|
|
|
inputElement.dataset.length = inputElement.getAttribute('maxlength');
|
|
|
|
}
|
|
|
|
|
2021-12-09 14:39:45 +00:00
|
|
|
// Initialize components
|
2021-05-28 13:51:23 +00:00
|
|
|
M.AutoInit();
|
2022-12-12 14:37:33 +00:00
|
|
|
M.CharacterCounter.init(document.querySelectorAll('input[data-length], textarea[data-length]'));
|
2021-12-09 14:39:45 +00:00
|
|
|
M.Dropdown.init(
|
|
|
|
document.querySelectorAll('#nav-more-dropdown-trigger'),
|
|
|
|
{alignment: 'right', constrainWidth: false, coverTrigger: false}
|
|
|
|
);
|
2023-01-04 19:00:37 +00:00
|
|
|
ResourceList.autoInit();
|
2022-09-02 11:07:30 +00:00
|
|
|
Form.autoInit();
|
2021-12-09 14:39:45 +00:00
|
|
|
|
|
|
|
// Display flashed messages
|
2023-01-03 16:03:47 +00:00
|
|
|
for (let [category, message] of {{ get_flashed_messages(with_categories=True)|tojson }}) {
|
|
|
|
app.flash(message, message);
|
2021-12-09 14:39:45 +00:00
|
|
|
}
|
2021-05-28 13:51:23 +00:00
|
|
|
</script>
|