Skip to content

Commit

Permalink
FIX: Restoring the highlighting of searched paragraphs (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lejeune committed Apr 4, 2022
1 parent 1f8223d commit b359c29
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/templates/memo.html
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ <h1 {{#editable}}class="editable"{{/editable}}><img src="{{>relpath}}style/{{typ
$("#add").attr("title", "{{i18n.i_create.coding}}");
$("#leave-name").attr("placeHolder", "{{i18n.i_name.coding}}");
$('#lexical').removeClass('hidden');
$('.post').children('font').wrapAll('<p></p>');
break;
case ('coding'):
$("h1>img").attr("title", "{{i18n.i_memo.coding}}");
Expand Down Expand Up @@ -367,9 +368,6 @@ <h1 {{#editable}}class="editable"{{/editable}}><img src="{{>relpath}}style/{{typ
converter.setFlavor('github');
renderComments(converter);
renderPreviews(converter);
if ("{{type}}" == 'interview') {
$('.post').children('font').wrapAll('<p></p>');;
}
$('.post').html(function(i, text) {
if ("{{type}}" == 'interview') {
return text.replace(/\n \n/g, '</font></p><p><font>');
Expand Down Expand Up @@ -425,9 +423,9 @@ <h1 {{#editable}}class="editable"{{/editable}}><img src="{{>relpath}}style/{{typ
$('#repeated').removeClass('disabled');
}
});
const par = window.location.hash.substring(1);
if (par !== '') highlight(par);
}
const par = window.location.hash.substring(1);
if (par !== '') highlight(par);
stickToHeader();
{{^statements}}
poller('memo', '{{update_seq}}');
Expand All @@ -438,9 +436,11 @@ <h1 {{#editable}}class="editable"{{/editable}}><img src="{{>relpath}}style/{{typ
});

function highlight(p) {
$('.post p').eq(p-1).addClass('highlight');
$('.post').children().eq(p-1).addClass('highlight');
var prev = document.querySelector(".highlight").previousSibling;
if (p == "1") prev = document.getElementById('authorization');
if (p == "1") {
prev = document.getElementById('authorization')
} else if (this_type != 'interview') prev = prev.previousSibling;
prev.scrollIntoView({ behavior: 'smooth', block: 'center'});
$('.highlight').addClass('fadeout');
}
Expand Down

0 comments on commit b359c29

Please sign in to comment.