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-07-13 10:40:37 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.1/socket.io.min.js" integrity="sha512-+NaO7d6gQ1YPxvc/qHIqZEchjGm207SszoNeMgppoqD/67fEqmc1edS8zrbxPD+4RQI3gDgT/83ihpFW61TG/Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
2023-06-21 06:46:08 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/plotly.js/2.24.2/plotly.min.js" integrity="sha512-dAXqGCq94D0kgLSPnfvd/pZpCMoJQpGj2S2XQmFQ9Ay1+96kbjss02ISEh+TBNXMggGg/1qoMcOHcxg+Op/Jmw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
2023-07-06 11:02:22 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako_inflate.min.js" integrity="sha512-mlnC6JeOvg9V4vBpWMxGKscsCdScB6yvGVCeFF2plnQMRmwH69s9F8SHPbC0oirqfePmRBhqx2s3Bx7WIvHfWg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
2023-06-13 13:41:34 +00:00
|
|
|
|
2023-10-04 10:32:27 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
|
|
|
output='gen/app.%(version)s.js',
|
2023-10-12 12:13:47 +00:00
|
|
|
'js/app/index.js',
|
|
|
|
'js/app/app.js'
|
|
|
|
%}
|
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
|
|
{%- endassets %}
|
|
|
|
|
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
|
|
|
output='gen/utils.%(version)s.js',
|
|
|
|
'js/utils/index.js',
|
|
|
|
'js/utils/utils.js'
|
2023-10-04 10:32:27 +00:00
|
|
|
%}
|
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
|
|
{%- endassets %}
|
|
|
|
|
2023-06-29 10:09:28 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
|
|
|
output='gen/cqi.%(version)s.js',
|
2023-10-04 10:32:27 +00:00
|
|
|
'js/cqi/index.js',
|
2023-10-12 08:03:12 +00:00
|
|
|
'js/cqi/constants.js',
|
2023-06-29 10:09:28 +00:00
|
|
|
'js/cqi/errors.js',
|
|
|
|
'js/cqi/status.js',
|
2023-10-04 10:32:27 +00:00
|
|
|
'js/cqi/api/index.js',
|
2023-06-29 10:09:28 +00:00
|
|
|
'js/cqi/api/client.js',
|
2023-10-04 10:32:27 +00:00
|
|
|
'js/cqi/models/index.js',
|
2023-06-29 10:09:28 +00:00
|
|
|
'js/cqi/models/resource.js',
|
|
|
|
'js/cqi/models/attributes.js',
|
|
|
|
'js/cqi/models/subcorpora.js',
|
|
|
|
'js/cqi/models/corpora.js',
|
|
|
|
'js/cqi/client.js'
|
|
|
|
%}
|
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
|
|
{%- endassets %}
|
2023-10-04 10:32:27 +00:00
|
|
|
|
2023-03-08 10:42:53 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
|
|
|
output='gen/Forms.%(version)s.js',
|
2023-10-05 14:08:04 +00:00
|
|
|
'js/forms/index.js',
|
2023-10-11 12:26:07 +00:00
|
|
|
'js/forms/base-form.js',
|
2023-10-05 14:08:04 +00:00
|
|
|
'js/forms/create-contribution-form.js',
|
|
|
|
'js/forms/create-corpus-file-form.js',
|
|
|
|
'js/forms/create-job-form.js'
|
2023-03-08 10:42:53 +00:00
|
|
|
%}
|
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
|
|
{%- endassets %}
|
2023-10-04 10:32:27 +00:00
|
|
|
|
2023-03-08 10:42:53 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
2023-10-05 12:11:17 +00:00
|
|
|
output='gen/resource-displays.%(version)s.js',
|
|
|
|
'js/resource-displays/index.js',
|
2023-10-11 12:26:07 +00:00
|
|
|
'js/resource-displays/resource-display.js',
|
2023-10-05 12:11:17 +00:00
|
|
|
'js/resource-displays/corpus-display.js',
|
|
|
|
'js/resource-displays/job-display.js'
|
2023-03-08 10:42:53 +00:00
|
|
|
%}
|
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
|
|
{%- endassets %}
|
2023-10-04 10:32:27 +00:00
|
|
|
|
2023-03-08 10:42:53 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
2023-10-11 14:20:17 +00:00
|
|
|
output='gen/resource-lists.%(version)s.js',
|
|
|
|
'js/resource-lists/index.js',
|
|
|
|
'js/resource-lists/resource-list.js',
|
|
|
|
'js/resource-lists/admin-user-list.js',
|
|
|
|
'js/resource-lists/corpus-file-list.js',
|
|
|
|
'js/resource-lists/corpus-follower-list.js',
|
|
|
|
'js/resource-lists/corpus-list.js',
|
|
|
|
'js/resource-lists/corpus-text-info-list.js',
|
|
|
|
'js/resource-lists/corpus-token-list.js',
|
|
|
|
'js/resource-lists/detailed-public-corpus-list.js',
|
|
|
|
'js/resource-lists/job-input-list.js',
|
|
|
|
'js/resource-lists/job-list.js',
|
|
|
|
'js/resource-lists/job-result-list.js',
|
|
|
|
'js/resource-lists/public-corpus-list.js',
|
|
|
|
'js/resource-lists/spacy-nlp-pipeline-model-list.js',
|
|
|
|
'js/resource-lists/tesseract-ocr-pipeline-model-list.js',
|
|
|
|
'js/resource-lists/user-list.js'
|
2023-03-08 10:42:53 +00:00
|
|
|
%}
|
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
|
|
{%- endassets %}
|
2023-10-04 10:32:27 +00:00
|
|
|
|
2023-03-08 10:42:53 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
2023-10-04 10:32:27 +00:00
|
|
|
output='gen/requests.%(version)s.js',
|
|
|
|
'js/requests/index.js',
|
|
|
|
'js/requests/admin.js',
|
|
|
|
'js/requests/contributions.js',
|
|
|
|
'js/requests/corpora.js',
|
|
|
|
'js/requests/jobs.js',
|
|
|
|
'js/requests/users.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 %}
|
2023-10-04 10:32:27 +00:00
|
|
|
|
2023-09-25 10:42:10 +00:00
|
|
|
{%- assets
|
|
|
|
filters='rjsmin',
|
|
|
|
output='gen/CorpusAnalysis.%(version)s.js',
|
|
|
|
'js/CorpusAnalysis/QueryBuilder/ElementReferencesQueryBuilder.js',
|
|
|
|
'js/CorpusAnalysis/QueryBuilder/GeneralFunctionsQueryBuilder.js',
|
|
|
|
'js/CorpusAnalysis/QueryBuilder/StructuralAttributeBuilderFunctionsQueryBuilder.js',
|
|
|
|
'js/CorpusAnalysis/QueryBuilder/TokenAttributeBuilderFunctionsQueryBuilder.js',
|
|
|
|
'js/CorpusAnalysis/CorpusAnalysisApp.js',
|
|
|
|
'js/CorpusAnalysis/CorpusAnalysisConcordance.js',
|
|
|
|
'js/CorpusAnalysis/QueryBuilder.js',
|
|
|
|
'js/CorpusAnalysis/CorpusAnalysisReader.js',
|
|
|
|
'js/CorpusAnalysis/CorpusAnalysisStaticVisualization.js'
|
|
|
|
%}
|
|
|
|
<script src="{{ ASSET_URL }}"></script>
|
|
|
|
{%- endassets %}
|
2023-10-04 10:32:27 +00:00
|
|
|
|
2021-05-28 13:51:23 +00:00
|
|
|
<script>
|
2023-10-04 12:07:39 +00:00
|
|
|
// TODO: Implement an app.run method and use this for all of the following
|
2023-10-12 12:13:47 +00:00
|
|
|
const app = new App.App();
|
2021-12-09 14:39:45 +00:00
|
|
|
{%- 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-05-31 14:10:05 +00:00
|
|
|
for (let optgroupElement of document.querySelectorAll('optgroup[label=""]')) {
|
|
|
|
for (let c of optgroupElement.children) {
|
|
|
|
optgroupElement.parentElement.insertAdjacentElement('afterbegin', c);
|
|
|
|
}
|
|
|
|
optgroupElement.remove();
|
|
|
|
|
|
|
|
}
|
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-10-09 12:21:31 +00:00
|
|
|
ResourceDisplays.autoInit();
|
2023-10-11 14:20:17 +00:00
|
|
|
ResourceLists.autoInit();
|
2023-10-05 14:08:04 +00:00
|
|
|
Forms.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
|
|
|
}
|
2023-04-13 14:08:07 +00:00
|
|
|
|
2023-04-18 09:32:04 +00:00
|
|
|
// Initialize manual modal
|
|
|
|
let manualModalTableOfContentsElement = document.querySelector('#manual-modal-table-of-contents');
|
|
|
|
let manualModalTableOfContents = M.Tabs.init(manualModalTableOfContentsElement);
|
|
|
|
let manualModalElement = document.querySelector('#manual-modal');
|
|
|
|
let manualModal = M.Modal.init(
|
|
|
|
manualModalElement,
|
|
|
|
{
|
|
|
|
onOpenStart: (manualModalElement, modalTriggerElement) => {
|
|
|
|
if ('manualModalChapter' in modalTriggerElement.dataset) {
|
|
|
|
manualModalTableOfContents.select(modalTriggerElement.dataset.manualModalChapter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2023-04-13 14:08:07 +00:00
|
|
|
// Initialize terms of use modal
|
|
|
|
const termsOfUseModal = document.getElementById('terms-of-use-modal');
|
|
|
|
M.Modal.init(
|
|
|
|
termsOfUseModal,
|
|
|
|
{
|
|
|
|
dismissible: false,
|
|
|
|
onCloseEnd: () => {
|
2023-10-04 12:07:39 +00:00
|
|
|
requests.users.entity.acceptTermsOfUse();
|
2023-04-13 14:08:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2023-04-17 07:43:12 +00:00
|
|
|
{% if current_user.is_authenticated and not current_user.terms_of_use_accepted %}
|
2023-04-13 14:08:07 +00:00
|
|
|
termsOfUseModal.M_Modal.open();
|
|
|
|
{% endif %}
|
|
|
|
|
2021-05-28 13:51:23 +00:00
|
|
|
</script>
|