print: make it nice

now the user can use <mark> aswell as the theme, when marking search results in the page;
to only print users <mark> with color, we had to adjust the serach highlighting
This commit is contained in:
Sören Weber 2024-04-05 00:22:12 +02:00
parent a955167df4
commit 7ee2023bff
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
7 changed files with 24 additions and 20 deletions
static/js

View file

@ -1323,9 +1323,9 @@ function mark() {
var value = sessionStorage.getItem( window.relearn.absBaseUri + '/search-value' );
var highlightableElements = document.querySelectorAll( '.highlightable' );
highlight( highlightableElements, value, { element: 'mark' } );
highlight( highlightableElements, value, { element: 'mark', className: 'search' } );
var markedElements = document.querySelectorAll( 'mark' );
var markedElements = document.querySelectorAll( 'mark.search' );
for( var i = 0; i < markedElements.length; i++ ){
var parent = markedElements[i].parentNode;
while( parent && parent.classList ){
@ -1410,7 +1410,7 @@ function highlightNode( node, re, nodeName, className ){
function unmark() {
sessionStorage.removeItem( window.relearn.absBaseUri + '/search-value' );
var markedElements = document.querySelectorAll( 'mark' );
var markedElements = document.querySelectorAll( 'mark.search' );
for( var i = 0; i < markedElements.length; i++ ){
var parent = markedElements[i].parentNode;
while( parent && parent.classList ){
@ -1435,7 +1435,7 @@ function unmark() {
}
var highlighted = document.querySelectorAll( '.highlightable' );
unhighlight( highlighted, { element: 'mark' } );
unhighlight( highlighted, { element: 'mark', className: 'search' } );
psm && setTimeout( function(){ psm.update(); }, 10 );
}