Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate annotorious addition #3863

Merged
merged 10 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
//= link landing/slick.min.js
//= link landing/slider.js
//= link datatables.min.js

//= link annotorious/annotorious-openseadragon.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,559 changes: 1,559 additions & 0 deletions app/assets/javascripts/annotorious/annotorious-openseadragon.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion app/views/shared/_osd_div.html.slim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/openseadragon/3.0.0/openseadragon.min.js"
=javascript_include_tag "openseadragon-filtering.js"

=javascript_include_tag "annotorious/annotorious-openseadragon.js"

.image-toolbar(id="image_toolbar")
a#osd_zoom_in =svg_symbol "#icon-zoom-in", class: 'icon'
Expand Down Expand Up @@ -110,6 +110,16 @@
}, 100);
});

var anno = AnnotoriousOSD.createOSDAnnotator(viewer, {
// make sure that the boxes over the text annotations are inert
pointerSelectAction: 'NONE'
});
anno.setFormatter(function() {
// make the annotation boxes transparent rather than opaque
return { fillOpacity: 0 };
});


$('[data-filter]').on('input', updateFilters);

var filters = {
Expand Down
22 changes: 11 additions & 11 deletions app/views/transcribe/translate.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
p.nodata_text
==t('.please_help_this_page', help_link: help_link)
==t('.or_mark_blank', mark_blank: mark_blank) unless @page.status == Page::STATUS_BLANK
.page-imagescan(style="display:none")
.page-imagescan(style=("display:none" unless @fromImage))
=render :partial => '/shared/osd_div'
.page-column
-if @preview_xml
Expand All @@ -90,10 +90,17 @@ h2.legend =t('.page_notes')
javascript:

var lang = "#{@collection.language}";
var fromImage = JSON.parse("#{@fromImage}") || false;
function updateTranscriptionOrImageDisplay(){
$('.page-imagescan').toggle(fromImage);
$('.page-preview').toggle(!fromImage);

var buttonText = (fromImage) ? "#{t('.show_transcription')}" : "#{t('.show_image')}";
$('#toggleImage').html(buttonText);
};

$(function(){
var fromImage = JSON.parse("#{@fromImage}") || false;
updateDisplay(fromImage);
updateTranscriptionOrImageDisplay(fromImage);

$('#page_needs_review').click(function(){
$('#page_mark_blank').prop('checked', false);
Expand All @@ -106,15 +113,8 @@ h2.legend =t('.page_notes')
$('#toggleImage').click(function(){
fromImage = !fromImage;

updateDisplay(fromImage)
updateTranscriptionOrImageDisplay(fromImage)
Cookies.set('fromImage', fromImage, { expires: 365, path: '/' });
});

function updateDisplay(){
$('.page-imagescan').toggle(fromImage);
$('.page-preview').toggle(!fromImage);

var buttonText = (fromImage) ? "#{t('.show_transcription')}" : "#{t('.show_image')}";
$('#toggleImage').html(buttonText);
}
});
Loading