| |
| {# Default ui_lang values if not provided by context processor #} |
| {% if ui_lang is not defined %} |
| {% set ui_lang = {'next_button': 'Next', 'previous_button': 'Previous', 'jump_prev_unannotated': 'Previous unannotated', 'jump_next_unannotated': 'Next unannotated', 'labeled_badge': 'Labeled', 'not_labeled_badge': 'Not labeled', 'submit_button': 'Submit', 'progress_label': 'Progress', 'go_button': 'Go', 'logout': 'Logout', 'loading': 'Loading annotation interface...', 'error_heading': 'Error', 'retry_button': 'Retry', 'adjudicate': 'Adjudicate', 'codebook': 'Codebook', 'instructions_heading': 'Instructions', 'text_to_annotate': 'Text to Annotate:', 'video_to_annotate': 'Video to Annotate:', 'audio_to_annotate': 'Audio to Annotate:', 'powered_by': 'Powered by', 'cite_us': 'Cite Us', 'html_lang': 'en', 'html_dir': 'ltr'} %} |
| {% endif %} |
| <!DOCTYPE html> |
| <html lang="{{ ui_lang.html_lang|default('en') }}" dir="{{ ui_lang.html_dir|default('ltr') }}"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Card Sort Test</title> |
|
|
| |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> |
|
|
| |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}"> |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='span-styles.css') }}"> |
|
|
| {% set frontend_assets = frontend_assets | default({}) %} |
|
|
| |
| {% if frontend_assets.image_annotation | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='image-annotation.css') }}?v=2"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.audio_annotation | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='audio-annotation.css') }}?v=2"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.video_annotation | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='video-annotation.css') }}"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.span_link | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='span-link-styles.css') }}"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.event_annotation | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='event-annotation.css') }}"> |
| {% endif %} |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='spreadsheet-display.css') }}"> |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='coding-trace.css') }}"> |
|
|
| |
| {% if frontend_assets.live_coding_agent | default(false) %} |
| <script src="{{ url_for('static', filename='live-coding-agent-viewer.js') }}" defer></script> |
| {% endif %} |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/format-displays.css') }}"> |
|
|
| |
| {% if frontend_assets.document_bbox | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='document-bbox.css') }}"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.pdf_bbox | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='pdf-annotation.css') }}"> |
| {% endif %} |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='display-logic.css') }}"> |
|
|
| |
| {% if frontend_assets.coreference | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/coreference.css') }}"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.segmentation_tools | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/segmentation.css') }}"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.conversation_tree | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/conversation-tree.css') }}"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.tracking | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/tracking.css') }}"> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.triage | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/triage.css') }}"> |
| {% endif %} |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/entity-linking.css') }}"> |
|
|
| |
| {% if frontend_assets.tiered_annotation | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/tiered-annotation.css') }}"> |
| {% endif %} |
|
|
| {% if agent_proxy_enabled | default(false) %} |
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/agent-chat.css') }}"> |
| {% endif %} |
|
|
| {% if chat_enabled | default(false) %} |
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/llm-chat-sidebar.css') }}?v=1"> |
| {% endif %} |
|
|
| |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/memos.css') }}?v=2"> |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/search.css') }}?v=2"> |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/codebook.css') }}?v=10"> |
|
|
| |
| <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> |
|
|
| |
| {{ PROJECT_BASE_CSS | safe }} |
| </head> |
|
|
| <body> |
| |
| <nav class="potato-navbar" role="navigation"> |
| <div class="navbar-inner"> |
| <div class="navbar-brand"> |
| {% if header_logo_url %} |
| <img class="header-logo" src="{{ header_logo_url }}" alt="Logo"> |
| {% endif %} |
| <span class="task-name">Card Sort Test</span> |
| </div> |
|
|
| <div class="navbar-center"> |
| <div class="annotation-status-indicator" id="annotation-status"> |
| <span class="status-badge {{ annotation_status }}"> |
| {% if annotation_status == 'labeled' %} |
| {{ ui_lang.labeled_badge }} |
| {% elif annotation_status == 'in_progress' %} |
| {{ ui_lang.in_progress_badge }} |
| {% else %} |
| {{ ui_lang.not_labeled_badge }} |
| {% endif %} |
| </span> |
| </div> |
|
|
| <div class="navbar-divider"></div> |
|
|
| <div class="progress-section"> |
| <span class="progress-label">{{ ui_lang.progress_label }}</span> |
| <span class="fw-medium" id="progress-counter">{{finished}}/{{total_count}}</span> |
| </div> |
|
|
| {% if ibws_round_info %} |
| <div class="navbar-divider"></div> |
| <div class="ibws-round-banner" id="ibws-round-banner"> |
| <span class="ibws-round-label">Round {{ ibws_round_info.current_round }}{% if ibws_round_info.max_rounds %} of {{ ibws_round_info.max_rounds }}{% endif %}</span> |
| <span class="ibws-round-detail">{{ ibws_round_info.terminal_items }}/{{ ibws_round_info.total_items }} ranked</span> |
| </div> |
| {% endif %} |
|
|
| <div class="navbar-divider"></div> |
|
|
| {% if instance_index is defined %} |
| <div class="instance-number-section"> |
| <span class="instance-number-label">Instance</span> |
| <span class="fw-medium" id="instance-number">#{{ instance_index|int + 1 }}</span> |
| </div> |
| {% endif %} |
|
|
| {% if not jumping_to_id_disabled %} |
| <div class="navbar-divider"></div> |
|
|
| <div class="nav-controls"> |
| <button type="button" class="nav-control-btn" id="jump-unannotated-prev-btn" |
| onclick="jumpToUnannotatedPrev()" title="{{ ui_lang.jump_prev_unannotated }}"> |
| <i class="fas fa-backward"></i> |
| </button> |
| <button type="button" class="nav-control-btn" id="jump-unannotated-btn" |
| onclick="jumpToUnannotated()" title="{{ ui_lang.jump_next_unannotated }}"> |
| <i class="fas fa-forward"></i> |
| </button> |
| </div> |
|
|
| <div class="navbar-divider"></div> |
|
|
| <div class="goto-section"> |
| <input type="number" id="go_to" placeholder="#" |
| value="" min="0" max="{{total_count}}" required |
| onfocusin="user_input()" onfocusout="user_input_leave()"> |
| <button type="button" class="goto-btn" id="go-to-btn">{{ ui_lang.go_button }}</button> |
| </div> |
| {% endif %} |
| </div> |
|
|
| <div class="navbar-end"> |
| {% if is_adjudicator %} |
| <a href="/adjudicate" class="adjudicate-btn" title="Adjudication Mode"> |
| <i class="fas fa-gavel"></i> {{ ui_lang.adjudicate }} |
| </a> |
| {% endif %} |
| {% if annotation_codebook_url %} |
| <a href="{{ annotation_codebook_url | replace('data_files/', '/media/') }}" |
| class="codebook-btn" |
| target="_blank" |
| rel="noopener noreferrer" |
| title="Open annotation codebook"> |
| <i class="fas fa-book-open"></i> {{ ui_lang.codebook }} |
| </a> |
| {% endif %} |
| <div class="user-pill"> |
| <span class="username" id="username-display">{{username}}</span> |
| <a href="/logout" class="logout-btn">{{ ui_lang.logout }}</a> |
| </div> |
| </div> |
| </div> |
| </nav> |
|
|
| <div class="container-fluid"> |
| |
| <div id="task_layout" class="shadcn-card mb-2 {% if has_image_annotation or has_video_annotation or has_audio_annotation %}media-annotation{% else %}text-annotation{% endif %}"> |
| <div class="shadcn-card-content"> |
| |
| <div id="loading-state" class="text-center py-5"> |
| <div class="loading-spinner mb-3"></div> |
| <p>{{ ui_lang.loading }}</p> |
| </div> |
|
|
| |
| <div id="error-state" class="error-message" style="display: none;"> |
| <h5><i class="fas fa-exclamation-triangle me-2"></i>{{ ui_lang.error_heading }}</h5> |
| <p id="error-message-text"></p> |
| <button id="error-retry-btn" class="shadcn-button shadcn-button-primary" onclick="loadCurrentInstance()"> |
| <i class="fas fa-redo me-2"></i>{{ ui_lang.retry_button }} |
| </button> |
| <a id="error-done-link" href="/done" class="shadcn-button shadcn-button-primary" style="display: none;"> |
| <i class="fas fa-check me-2"></i>Finish |
| </a> |
| </div> |
|
|
| |
| <div id="main-content" style="display: none;"> |
| {% if annotation_instructions | default('') %} |
| <details class="annotation-instructions-banner" open> |
| <summary>{{ ui_lang.instructions_heading|default('Instructions') }}</summary> |
| <div class="annotation-instructions-content"> |
| {{ annotation_instructions | safe }} |
| </div> |
| </details> |
| {% endif %} |
| |
| <div class="mb-4"> |
| {% if has_instance_display | default(false) %} |
| |
| {{ display_html | safe }} |
| |
| <div id="instance-text" style="display: none;"> |
| <div id="text-content" data-original-text="{{instance_plain_text | sanitize_html}}">{{instance | sanitize_html}}</div> |
| </div> |
| {% elif has_video_annotation | default(false) %} |
| <h5 class="mb-3">{{ ui_lang.video_to_annotate|default('Video to Annotate:') }}</h5> |
| |
| <div id="instance-text" class="instance-text-container" style="position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0);"> |
| <div id="text-content" data-original-text="{{instance_plain_text | sanitize_html}}">{{instance | sanitize_html}}</div> |
| </div> |
| {% elif has_audio_annotation | default(false) %} |
| <h5 class="mb-3">{{ ui_lang.audio_to_annotate|default('Audio to Annotate:') }}</h5> |
| |
| <div id="instance-text" class="instance-text-container" style="position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0);"> |
| <div id="text-content" data-original-text="{{instance_plain_text | sanitize_html}}">{{instance | sanitize_html}}</div> |
| </div> |
| {% elif has_image_annotation | default(false) %} |
| |
| |
| <div id="instance-text" style="display: none;"> |
| <div id="text-content" data-original-text="{{instance_plain_text | sanitize_html}}" data-image-url="{{instance | sanitize_html}}">{{instance | sanitize_html}}</div> |
| </div> |
| {% else %} |
| {% if is_annotation_page %} |
| {% if ui_lang.text_to_annotate|default('Text to Annotate:') %} |
| <h5 class="instance-text-heading">{{ ui_lang.text_to_annotate|default('Text to Annotate:') }}</h5> |
| {% endif %} |
| <div id="instance-text" class="p-3 border rounded instance-text-container" style="background-color: var(--light-bg); position: relative;"> |
| <div id="text-content" data-original-text="{{instance_plain_text | sanitize_html}}" style="position: relative; z-index: 1; pointer-events: auto;">{{instance | sanitize_html}} |
| <div id="span-overlays" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 2;"> |
| </div> |
| </div> |
| </div> |
| {% else %} |
| <div id="instance-text" style="display: none;"> |
| <div id="text-content" data-original-text=""></div> |
| </div> |
| {% endif %} |
| {% endif %} |
| </div> |
|
|
|
|
|
|
| |
| <div id="status" class="status" style="display: none;"></div> |
| |
| <input type="hidden" id="instance_id" name="instance_id" value="{{instance_id}}"> |
|
|
| |
| |
| |
| |
| |
| <div id="instance-json-data" style="display: none;" |
| data-instance-json='{{ (instance_record if instance_record is defined and instance_record else {}) | tojson }}'></div> |
|
|
| |
| {% if triage_info is defined and triage_info %} |
| <div class="triage-flag" id="triage-flag" role="note" |
| aria-label="Triage: this item was prioritized in the queue"> |
| <span class="triage-flag-icon" aria-hidden="true">!</span> |
| <span class="triage-flag-text"> |
| Prioritized for review<span class="triage-flag-sep"> · </span><span class="triage-flag-reason">{{ triage_info.reason }}</span> |
| </span> |
| </div> |
| {% endif %} |
|
|
| |
| {% if judge_prediction is defined and judge_prediction %} |
| {% set jp = judge_prediction %} |
| {% set jconf = (jp.confidence * 100)|int %} |
| {% set jqual = 'Low confidence' if jp.confidence < 0.5 else ('Moderate confidence' if jp.confidence < 0.8 else 'High confidence') %} |
| <div class="judge-suggestion" id="judge-suggestion" |
| data-schema="{{ jp.schema }}" data-judge-label="{{ jp.label }}"> |
| <div class="judge-suggestion-row"> |
| <div class="judge-suggestion-main"> |
| <span class="judge-badge-icon" aria-hidden="true">⚖</span> |
| <span class="judge-suggestion-label"> |
| Judge suggests |
| <span class="judge-suggested-value">{{ jp.label }}</span> |
| for <span class="judge-schema-name">{{ jp.schema }}</span> |
| </span> |
| <span class="judge-confidence">{{ jqual }} · {{ jconf }}%</span> |
| </div> |
| <button type="button" class="btn btn-secondary judge-accept-btn" |
| id="judge-accept-btn" |
| data-schema="{{ jp.schema }}" data-judge-label="{{ jp.label }}"> |
| Accept |
| </button> |
| {% if jp.running and jp.running.n %} |
| <span class="judge-running" |
| title="Running agreement between you/your team and the judge on this task (Cohen's κ)"> |
| {{ (jp.running.agreement_rate * 100)|int }}% agree (n={{ jp.running.n }}){% if jp.running.kappa is not none %} · κ {{ '%.2f'|format(jp.running.kappa) }}{% endif %} |
| </span> |
| {% endif %} |
| </div> |
| {% if jp.reasoning %} |
| <details class="judge-reasoning"> |
| <summary>Judge reasoning</summary> |
| <p>{{ jp.reasoning }}</p> |
| </details> |
| {% endif %} |
| </div> |
| <script> |
| (function() { |
| var btn = document.getElementById('judge-accept-btn'); |
| if (!btn) return; |
| btn.addEventListener('click', function() { |
| var schema = btn.getAttribute('data-schema'); |
| var label = btn.getAttribute('data-judge-label'); |
| |
| var inputs = document.querySelectorAll( |
| 'input.annotation-input[schema="' + schema + '"]'); |
| var matched = false; |
| inputs.forEach(function(inp) { |
| if (inp.value === label || inp.getAttribute('label_name') === label) { |
| inp.checked = true; |
| inp.dispatchEvent(new Event('change', { bubbles: true })); |
| matched = true; |
| } |
| }); |
| if (matched) { btn.textContent = 'Accepted'; btn.disabled = true; } |
| }); |
| })(); |
| </script> |
| {% endif %} |
|
|
| |
| <div id="annotation-forms"> |
| |
| |
| |
| |
| |
|
|
| <div class="annotation_schema"> |
|
|
| <form id="categorize" class="annotation-form shadcn-card-sort-container" |
| action="javascript:void(0)" |
| data-annotation-id="0" |
| data-annotation-type="card_sort" |
| data-schema-name="categorize" |
| data-items-field="items" |
| data-grid-columns="1"> |
| <fieldset schema_name="categorize"> |
| <legend class="shadcn-card-sort-title">Sort items into groups</legend> |
|
|
| <div class="card-sort-layout"> |
| <div class="card-sort-source" id="categorize-source"> |
| <div class="card-sort-source-header">Drag items into groups</div> |
| <div class="card-sort-source-items" id="categorize-source-items" |
| ondragover="event.preventDefault(); this.classList.add('card-sort-drag-over')" |
| ondragleave="this.classList.remove('card-sort-drag-over')" |
| ondrop="cardSortDrop(event, 'categorize', '__source__')"> |
| </div> |
| </div> |
|
|
| <div class="card-sort-groups" id="categorize-groups"> |
| <div class="card-sort-group" data-group="Group A" id="categorize-group-group-a"><div class="card-sort-group-header"><span class="card-sort-group-name">Group A</span><span class="card-sort-group-count">0</span></div><div class="card-sort-group-items" ondragover="event.preventDefault(); this.classList.add('card-sort-drag-over')" ondragleave="this.classList.remove('card-sort-drag-over')" ondrop="cardSortDrop(event, 'categorize', 'Group A')"></div></div><div class="card-sort-group" data-group="Group B" id="categorize-group-group-b"><div class="card-sort-group-header"><span class="card-sort-group-name">Group B</span><span class="card-sort-group-count">0</span></div><div class="card-sort-group-items" ondragover="event.preventDefault(); this.classList.add('card-sort-drag-over')" ondragleave="this.classList.remove('card-sort-drag-over')" ondrop="cardSortDrop(event, 'categorize', 'Group B')"></div></div><div class="card-sort-group" data-group="Group C" id="categorize-group-group-c"><div class="card-sort-group-header"><span class="card-sort-group-name">Group C</span><span class="card-sort-group-count">0</span></div><div class="card-sort-group-items" ondragover="event.preventDefault(); this.classList.add('card-sort-drag-over')" ondragleave="this.classList.remove('card-sort-drag-over')" ondrop="cardSortDrop(event, 'categorize', 'Group C')"></div></div> |
| </div> |
| </div> |
|
|
| |
|
|
| <input type="hidden" |
| class="annotation-input card-sort-data-input" |
| id="categorize_categorize_hidden" |
| name="categorize:::categorize" |
| schema="categorize" |
| label_name="categorize" |
| validation="" |
| value=""> |
| </fieldset> |
| </form> |
|
|
| <script> |
| (function() { |
| var cardSortConfig = {"mode": "closed", "groups": ["Group A", "Group B", "Group C"], "items_field": "items", "allow_empty_groups": true, "allow_multiple": false}; |
| |
| window.cardSortDrop = function(event, schemaName, groupName) { |
| event.preventDefault(); |
| event.currentTarget.classList.remove('card-sort-drag-over'); |
| |
| var cardText = event.dataTransfer.getData('text/plain'); |
| var sourceGroup = event.dataTransfer.getData('application/x-source-group'); |
| if (!cardText) return; |
| |
| |
| if (sourceGroup) { |
| var sourceContainer; |
| if (sourceGroup === '__source__') { |
| sourceContainer = document.getElementById(schemaName + '-source-items'); |
| } else { |
| var groups = document.querySelectorAll('#' + schemaName + '-groups .card-sort-group'); |
| groups.forEach(function(g) { |
| if (g.dataset.group === sourceGroup) sourceContainer = g.querySelector('.card-sort-group-items'); |
| }); |
| } |
| if (sourceContainer) { |
| var cards = sourceContainer.querySelectorAll('.card-sort-card'); |
| cards.forEach(function(c) { if (c.textContent.trim() === cardText) c.remove(); }); |
| } |
| } |
| |
| |
| var targetContainer; |
| if (groupName === '__source__') { |
| targetContainer = document.getElementById(schemaName + '-source-items'); |
| } else { |
| var groups = document.querySelectorAll('#' + schemaName + '-groups .card-sort-group'); |
| groups.forEach(function(g) { |
| if (g.dataset.group === groupName) targetContainer = g.querySelector('.card-sort-group-items'); |
| }); |
| } |
| |
| if (targetContainer) { |
| var card = createCard(cardText, schemaName, groupName); |
| targetContainer.appendChild(card); |
| } |
| |
| updateGroupCounts(schemaName); |
| cardSortSaveData(schemaName); |
| }; |
| |
| window.cardSortAddGroup = function(schemaName) { |
| var input = document.getElementById(schemaName + '-new-group-input'); |
| var name = input.value.trim(); |
| if (!name) return; |
| |
| var groupsContainer = document.getElementById(schemaName + '-groups'); |
| |
| |
| var existing = groupsContainer.querySelectorAll('.card-sort-group'); |
| for (var i = 0; i < existing.length; i++) { |
| if (existing[i].dataset.group === name) return; |
| } |
| |
| var groupDiv = document.createElement('div'); |
| groupDiv.className = 'card-sort-group'; |
| groupDiv.dataset.group = name; |
| groupDiv.innerHTML = '<div class="card-sort-group-header">' + |
| '<span class="card-sort-group-name">' + escapeHtml(name) + '</span>' + |
| '<span class="card-sort-group-count">0</span>' + |
| '<button type="button" class="card-sort-remove-group" onclick="cardSortRemoveGroup(\'' + schemaName + '\',this)">×</button>' + |
| '</div>' + |
| '<div class="card-sort-group-items" ondragover="event.preventDefault();this.classList.add(\'card-sort-drag-over\')" ' + |
| 'ondragleave="this.classList.remove(\'card-sort-drag-over\')" ' + |
| 'ondrop="cardSortDrop(event,\'' + schemaName + '\',\'' + name.replace(/'/g, "\\'") + '\')">' + |
| '</div>'; |
| groupsContainer.appendChild(groupDiv); |
| input.value = ''; |
| cardSortSaveData(schemaName); |
| }; |
| |
| window.cardSortRemoveGroup = function(schemaName, btn) { |
| var group = btn.closest('.card-sort-group'); |
| |
| var cards = group.querySelectorAll('.card-sort-card'); |
| var source = document.getElementById(schemaName + '-source-items'); |
| cards.forEach(function(c) { |
| c.setAttribute('draggable', 'true'); |
| source.appendChild(c); |
| }); |
| group.remove(); |
| updateGroupCounts(schemaName); |
| cardSortSaveData(schemaName); |
| }; |
| |
| function createCard(text, schemaName, groupName) { |
| var card = document.createElement('div'); |
| card.className = 'card-sort-card'; |
| card.textContent = text; |
| card.setAttribute('draggable', 'true'); |
| card.addEventListener('dragstart', function(e) { |
| e.dataTransfer.setData('text/plain', text); |
| e.dataTransfer.setData('application/x-source-group', groupName); |
| card.classList.add('card-sort-dragging'); |
| }); |
| card.addEventListener('dragend', function() { |
| card.classList.remove('card-sort-dragging'); |
| }); |
| return card; |
| } |
| |
| function updateGroupCounts(schemaName) { |
| var groups = document.querySelectorAll('#' + schemaName + '-groups .card-sort-group'); |
| groups.forEach(function(g) { |
| var count = g.querySelectorAll('.card-sort-group-items .card-sort-card').length; |
| g.querySelector('.card-sort-group-count').textContent = count; |
| }); |
| } |
| |
| function cardSortSaveData(schemaName) { |
| var result = {}; |
| var groups = document.querySelectorAll('#' + schemaName + '-groups .card-sort-group'); |
| groups.forEach(function(g) { |
| var groupName = g.dataset.group; |
| var cards = g.querySelectorAll('.card-sort-group-items .card-sort-card'); |
| result[groupName] = Array.from(cards).map(function(c) { return c.textContent.trim(); }); |
| }); |
| |
| var input = document.getElementById(schemaName).querySelector('.card-sort-data-input'); |
| input.value = JSON.stringify(result); |
| input.setAttribute('data-modified', 'true'); |
| input.dispatchEvent(new Event('change', { bubbles: true })); |
| } |
| |
| function escapeHtml(str) { |
| var div = document.createElement('div'); |
| div.textContent = str; |
| return div.innerHTML; |
| } |
| |
| |
| window._cardSortCreateCard = createCard; |
| window._cardSortUpdateCounts = updateGroupCounts; |
| window._cardSortSaveData = cardSortSaveData; |
| })(); |
| </script> |
| |
|
|
| </div> |
|
|
| </div> |
|
|
| |
| {{ var_elems | safe }} |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="potato-nav"> |
| {% if can_go_back | default(true) %} |
| <button class="shadcn-button shadcn-button-outline" id="prev-btn" onclick="navigateToPrevious()"> |
| <i class="fas fa-arrow-left me-2"></i>{{ ui_lang.previous_button }} |
| </button> |
| {% else %} |
| <div id="prev-btn-placeholder"></div> |
| {% endif %} |
| <button class="shadcn-button shadcn-button-primary" id="next-btn" onclick="navigateToNext()"> |
| {{ ui_lang.next_button }}<i class="fas fa-arrow-right ms-2"></i> |
| </button> |
| </div> |
|
|
| {% if custom_footer_html | default('') %} |
| |
| {{ custom_footer_html | safe }} |
| {% endif %} |
|
|
| |
| <footer class="potato-footer"> |
| {{ ui_lang.powered_by|default('Powered by') }} <a href="https://potatoannotator.com/" target="_blank" rel="noopener noreferrer">Potato</a> |
| <span class="footer-sep">·</span> |
| <a href="https://github.com/davidjurgens/potato" target="_blank" rel="noopener noreferrer">GitHub</a> |
| <span class="footer-sep">·</span> |
| <a href="https://github.com/davidjurgens/potato#cite-us" target="_blank" rel="noopener noreferrer">{{ ui_lang.cite_us|default('Cite Us') }}</a> |
| </footer> |
| </div> |
|
|
| |
| <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> |
|
|
| |
| <script type="text/javascript"> |
| window.config = { |
| annotation_task_name: {{ annotation_task_name | tojson }}, |
| is_annotation_page: {{ 'true' if is_annotation_page else 'false' }}, |
| debug: {{ 'true' if debug_mode else 'false' }}, |
| ui_debug: {{ 'true' if ui_debug else 'false' }}, |
| server_debug: {{ 'true' if server_debug else 'false' }}, |
| debug_phase: {{ debug_phase | tojson if debug_phase else 'null' }}, |
| api_key: "test_api_key", |
| username: {{ username | tojson }}, |
| ui_config: {} |
| }; |
| |
| |
| if (!window.config.ui_debug) { |
| |
| window._originalConsole = { |
| log: console.log, |
| debug: console.debug, |
| info: console.info, |
| warn: console.warn |
| }; |
| |
| console.log = function() {}; |
| console.debug = function() {}; |
| console.info = function() {}; |
| |
| } |
| |
| |
| window.enableUIDebug = function() { |
| if (window._originalConsole) { |
| console.log = window._originalConsole.log; |
| console.debug = window._originalConsole.debug; |
| console.info = window._originalConsole.info; |
| console.warn = window._originalConsole.warn; |
| console.log('UI debug logging enabled'); |
| } |
| }; |
| </script> |
| <script id="ui-config" type="application/json">{% if ui_config %}{{ ui_config | tojson | safe }}{% else %}{}{% endif %}</script> |
| <script> |
| (function(){ |
| try { |
| var el = document.getElementById('ui-config'); |
| if (el && el.textContent && el.textContent.trim().length > 0) { |
| window.config.ui_config = JSON.parse(el.textContent); |
| } |
| } catch (e) { console.warn('Failed to parse ui_config', e); } |
| })(); |
| </script> |
|
|
| |
| <script src="{{ url_for('static', filename='interaction_tracker.js') }}?v=1"></script> |
| <script src="{{ url_for('static', filename='span-core.js') }}?v=11"></script> |
| <script src="{{ url_for('static', filename='ai_assistant_manager.js') }}?v=1"></script> |
| |
| <script src="{{ url_for('static', filename='display-logic.js') }}?v=1"></script> |
| |
| {% if has_instance_display | default(false) %} |
| <script src="{{ url_for('static', filename='instance-display.js') }}?v=2"></script> |
| {% endif %} |
| <script src="{{ url_for('static', filename='annotation.js') }}?v=23"></script> |
|
|
| |
| {% if frontend_assets.image_annotation | default(false) %} |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/5.3.1/fabric.min.js"></script> |
| |
| <script src="{{ url_for('static', filename='image-annotation.js') }}?v=2"></script> |
| {% endif %} |
| |
| {% if ai_enabled and ((frontend_assets.image_annotation | default(false)) or (frontend_assets.video_annotation | default(false))) %} |
| <script src="{{ url_for('static', filename='visual_ai_assistant.js') }}?v=1"></script> |
| |
| <script src="{{ url_for('static', filename='option_highlight_manager.js') }}?v=2"></script> |
| {% endif %} |
|
|
| |
| {% if (frontend_assets.audio_annotation | default(false)) or (frontend_assets.video_annotation | default(false)) %} |
| <script src="{{ url_for('static', filename='peaks.min.js') }}"></script> |
| {% endif %} |
| |
| {% if frontend_assets.audio_annotation | default(false) %} |
| <script src="{{ url_for('static', filename='audio-annotation.js') }}?v=2"></script> |
| {% endif %} |
| |
| {% if frontend_assets.video_annotation | default(false) %} |
| <script src="{{ url_for('static', filename='video-annotation.js') }}?v=10"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.span_link | default(false) %} |
| <script src="{{ url_for('static', filename='span-link-manager.js') }}?v=7"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.event_annotation | default(false) %} |
| <script src="{{ url_for('static', filename='event-annotation.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| <script src="{{ url_for('static', filename='entity-linking.js') }}?v=1"></script> |
|
|
| |
| {% if frontend_assets.coreference | default(false) %} |
| <script src="{{ url_for('static', filename='coreference-manager.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.segmentation_tools | default(false) %} |
| <script src="{{ url_for('static', filename='segmentation-tools.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.conversation_tree | default(false) %} |
| <script src="{{ url_for('static', filename='conversation-tree.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.tracking | default(false) %} |
| <script src="{{ url_for('static', filename='tracking-interpolation.js') }}?v=1"></script> |
| <script src="{{ url_for('static', filename='tracking-ui.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.triage | default(false) %} |
| <script src="{{ url_for('static', filename='triage.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.tiered_annotation | default(false) %} |
| <script src="{{ url_for('static', filename='tiered-annotation.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.document_bbox | default(false) %} |
| <script src="{{ url_for('static', filename='document-bbox.js') }}?v=3"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.pdf_bbox | default(false) %} |
| <script src="{{ url_for('static', filename='pdf-bbox.js') }}?v=3"></script> |
| {% endif %} |
|
|
| {% if agent_proxy_enabled | default(false) %} |
| |
| <script src="{{ url_for('static', filename='agent-chat.js') }}?v=1"></script> |
| {% endif %} |
|
|
| {% if chat_enabled | default(false) %} |
| |
| <script src="{{ url_for('static', filename='llm-chat-sidebar.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| {% if frontend_assets.web_agent_viewer | default(false) %} |
| <script src="{{ url_for('static', filename='web-agent-overlays.js') }}?v=1"></script> |
| <script src="{{ url_for('static', filename='web-agent-viewer.js') }}?v=1"></script> |
| {% endif %} |
| {% if frontend_assets.web_agent_playback | default(false) %} |
| <script src="{{ url_for('static', filename='web-agent-playback.js') }}?v=1"></script> |
| {% endif %} |
| |
| {% if frontend_assets.web_agent_recorder | default(false) %} |
| <script src="{{ url_for('static', filename='web-agent-recorder.js') }}?v=1"></script> |
| {% endif %} |
| |
| {% if live_agent_enabled | default(false) %} |
| <link rel="stylesheet" href="{{ url_for('static', filename='css/live-agent.css') }}?v=1"> |
| <script src="{{ url_for('static', filename='live-agent-viewer.js') }}?v=1"></script> |
| {% endif %} |
|
|
| |
| <script> |
| window.addEventListener('keydown', function(e) { |
| console.log('[GLOBAL DEBUG] keydown:', e.key, 'code:', e.code, 'target:', e.target.tagName); |
| }, true); |
| </script> |
|
|
| |
| <script> |
| document.addEventListener('DOMContentLoaded', function() { |
| |
| if (window.config && window.config.ui_config && window.config.ui_config.max_instance_height) { |
| const maxHeight = window.config.ui_config.max_instance_height; |
| const instanceTextContainer = document.getElementById('instance-text'); |
| |
| if (instanceTextContainer) { |
| |
| instanceTextContainer.style.setProperty('--max-instance-height', maxHeight + 'px'); |
| |
| |
| instanceTextContainer.classList.add('max-height-limited'); |
| |
| console.log('Applied maximum instance height:', maxHeight + 'px'); |
| } |
| } |
| }); |
| </script> |
|
|
| |
| |
| {% if is_annotation_page %} |
| <button type="button" id="memo-panel-toggle" class="memo-panel-toggle" hidden> |
| 📝 Notes |
| </button> |
| <div id="memo-panel" class="memo-panel" hidden aria-label="Notes panel"> |
| <div class="memo-panel-header"> |
| <span>Notes</span> |
| <button type="button" id="memo-panel-close" aria-label="Close notes">×</button> |
| </div> |
| <div id="memo-list" class="memo-list"></div> |
| <div class="memo-composer"> |
| <textarea id="memo-new-body" placeholder="Add a note about this instance…"></textarea> |
| <div id="memo-anchor-wrap" class="memo-anchor-hint" hidden> |
| <label> |
| <input type="checkbox" id="memo-anchor-check"> |
| Attach to selected text: “<span id="memo-anchor-quote"></span>” |
| </label> |
| </div> |
| <div class="memo-composer-row"> |
| <label>Visibility |
| <select id="memo-new-visibility"> |
| <option value="private">Private</option> |
| <option value="shared">Shared</option> |
| </select> |
| </label> |
| <button type="button" id="memo-add-btn" class="memo-primary">Add note</button> |
| </div> |
| </div> |
| </div> |
| <script src="{{ url_for('static', filename='memos.js') }}?v=1"></script> |
|
|
| |
| |
| |
| <button type="button" id="search-panel-toggle" class="search-panel-toggle" hidden> |
| 🔍 Find |
| </button> |
| <div id="search-panel" class="search-panel" hidden aria-label="Search panel"> |
| <div class="search-panel-header"> |
| <span>Find instances</span> |
| <button type="button" id="search-panel-close" aria-label="Close search">×</button> |
| </div> |
| <div class="search-form"> |
| <input type="text" id="search-q" placeholder="Search instance text…" |
| aria-label="Search query"> |
| <button type="button" id="search-go" class="search-primary">Search</button> |
| </div> |
| <div id="search-results" class="search-results" aria-live="polite"> |
| <div class="search-empty">Search to find instances, then Claim |
| one to add it to your queue.</div> |
| </div> |
| </div> |
| <script src="{{ url_for('static', filename='search.js') }}?v=3"></script> |
|
|
| |
| |
| |
| <button type="button" id="cb-panel-toggle" class="cb-panel-toggle" hidden> |
| 🏷 Codebook |
| </button> |
| <div id="cb-panel" class="cb-panel" hidden role="region" |
| aria-label="Codebook panel"> |
| <div class="cb-panel-header"> |
| <span>Codebook</span> |
| <button type="button" id="cb-panel-close" |
| aria-label="Close codebook">×</button> |
| </div> |
| <div id="cb-stale-banner" class="cb-stale-banner" hidden> |
| <span class="cb-stale-msg" id="cb-stale-msg" |
| role="status"></span> |
| <button type="button" id="cb-stale-dismiss" |
| class="cb-stale-x" |
| aria-label="Dismiss this notice">×</button> |
| </div> |
| <div id="cb-tree" class="cb-tree" aria-live="polite"> |
| <div class="cb-empty">Loading…</div> |
| </div> |
| <div class="cb-worklist-section" id="cb-worklist-section" hidden> |
| <h2 id="cb-worklist-head" class="cb-worklist-head">Review</h2> |
| <div id="cb-worklist" class="cb-worklist" |
| aria-labelledby="cb-worklist-head"> |
| <div class="cb-empty">Nothing to review.</div> |
| </div> |
| </div> |
| <div id="cb-admin-section" class="cb-admin-section" hidden> |
| <h2 class="cb-admin-head">Curate (admin)</h2> |
| <div class="cb-admin-group"> |
| <label class="cb-admin-label" |
| for="cb-merge-src">Merge a code into another</label> |
| <div class="cb-admin-row"> |
| <select id="cb-merge-src" class="cb-admin-select" |
| aria-label="Code to merge from"></select> |
| <span class="cb-admin-arrow" aria-hidden="true">→</span> |
| <select id="cb-merge-dst" class="cb-admin-select" |
| aria-label="Code to merge into"></select> |
| </div> |
| <button type="button" id="cb-merge-btn" |
| class="cb-primary">Merge</button> |
| </div> |
| <div class="cb-admin-group"> |
| <label class="cb-admin-label" |
| for="cb-split-src">Split a code by annotator</label> |
| <div class="cb-admin-row"> |
| <select id="cb-split-src" class="cb-admin-select" |
| aria-label="Code to split"></select> |
| <input type="text" id="cb-split-annotator" |
| class="cb-admin-input" |
| placeholder="annotator" |
| aria-label="Annotator to split out"> |
| </div> |
| <input type="text" id="cb-split-name" |
| class="cb-admin-input" |
| placeholder="New code name…" |
| aria-label="New code name"> |
| <button type="button" id="cb-split-btn" |
| class="cb-primary">Split</button> |
| </div> |
| <div id="cb-admin-error" class="cb-error" hidden |
| role="alert" tabindex="-1"></div> |
| <div id="cb-admin-status" class="cb-admin-status" |
| role="status" aria-live="polite"></div> |
| <div class="cb-admin-group"> |
| <h3 class="cb-admin-sub" id="cb-proposals-head"> |
| Pending proposals</h3> |
| <div id="cb-proposals" class="cb-proposals" |
| aria-labelledby="cb-proposals-head" |
| aria-live="polite"> |
| <div class="cb-empty">No pending proposals.</div> |
| </div> |
| </div> |
| <details class="cb-admin-group cb-changes-wrap"> |
| <summary class="cb-admin-sub">Recent changes</summary> |
| <ul id="cb-changes" class="cb-changes-list"></ul> |
| </details> |
| </div> |
| <div id="cb-composer" class="cb-composer" hidden> |
| <div class="cb-composer-row"> |
| <input type="text" id="cb-new-name" |
| placeholder="Add a code…" |
| aria-label="New code name"> |
| <button type="button" id="cb-add-btn" |
| class="cb-primary">Add</button> |
| </div> |
| <div id="cb-error" class="cb-error" hidden></div> |
| <div id="cb-mode-hint" class="cb-mode-hint"></div> |
| </div> |
| </div> |
| <script src="{{ url_for('static', filename='codebook.js') }}?v=10"></script> |
| {% endif %} |
| </body> |
| </html> |
|
|