Make scroll element for full text scrolling configurable

This commit is contained in:
Beatrycze Volk 2021-01-20 16:47:09 +01:00
부모 8f506cded0
커밋 593d8e20e2
4개의 변경된 파일17개의 추가작업 그리고 3개의 파일을 삭제

파일 보기

@ -75,7 +75,7 @@ class FulltextTool extends \Kitodo\Dlf\Common\AbstractPlugin
$this->getTemplate();
$fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
if (!empty($fullTextFile)) {
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext:' . htmlspecialchars($this->pi_getLL('fulltext', '')) . ';fulltext-on:' . htmlspecialchars($this->pi_getLL('fulltext-on', '')) . ';fulltext-off:' . htmlspecialchars($this->pi_getLL('fulltext-off', '')) . ';activate-full-text-initially:' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['activateFullTextInitially'], 0, 1, 0) . '">&nbsp;</a>';
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext:' . htmlspecialchars($this->pi_getLL('fulltext', '')) . ';fulltext-on:' . htmlspecialchars($this->pi_getLL('fulltext-on', '')) . ';fulltext-off:' . htmlspecialchars($this->pi_getLL('fulltext-off', '')) . ';activate-full-text-initially:' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->conf['activateFullTextInitially'], 0, 1, 0) . ';full-text-scroll-element:' . $this->conf['fullTextScrollElement'] . '">&nbsp;</a>';
} else {
$markerArray['###FULLTEXT_SELECT###'] = '<span class="no-fulltext">' . htmlspecialchars($this->pi_getLL('fulltext-not-available', '')) . '</span>';
}

파일 보기

@ -1,5 +1,6 @@
plugin.tx_dlf_annotationtool.templateFile = EXT:dlf/Resources/Private/Templates/AnnotationTool.tmpl
plugin.tx_dlf_fulltexttool.activateFullTextInitially = 0
plugin.tx_dlf_fulltexttool.fullTextScrollElement = html, body
plugin.tx_dlf_fulltexttool.templateFile = EXT:dlf/Resources/Private/Templates/FulltextTool.tmpl
plugin.tx_dlf_fulltextdownloadtool.templateFile = EXT:dlf/Resources/Private/Templates/FulltextDownloadTool.tmpl
plugin.tx_dlf_imagedownloadtool.templateFile = EXT:dlf/Resources/Private/Templates/ImageDownloadTool.tmpl

파일 보기

@ -1064,6 +1064,13 @@ The default behaviour is to show the fulltext after click on the toggle link. Th
1: show fulltext on document load
- :Property:
fullTextScrollElement
:Data Type:
:ref:`t3tsref:data-type-string`
:Default:
html, body
The fulltext is fetched and rendered by JavaSript into the `<div id="tx-dlf-fulltextselection">` of the pageview plugin.

파일 보기

@ -57,13 +57,19 @@ var dlfViewerFullTextControl = function(map, image, fulltextUrl) {
*/
this.dic = $('#tx-dlf-tools-fulltext').length > 0 && $('#tx-dlf-tools-fulltext').attr('data-dic') ?
dlfUtils.parseDataDic($('#tx-dlf-tools-fulltext')) :
{'fulltext':'Fulltext', 'fulltext-on':'Activate Fulltext','fulltext-off':'Deactivate Fulltext', 'activate-full-text-initially':'0'};
{'fulltext':'Fulltext', 'fulltext-on':'Activate Fulltext','fulltext-off':'Deactivate Fulltext', 'activate-full-text-initially':'0', 'full-text-scroll-element':'html, body'};
/**
* @type {number}
* @private
*/
this.activateFullTextInitially = this.dic['activate-full-text-initially'] === "1" ? 1 : 0;
/**
* @type {string}
* @private
*/
this.fullTextScrollElement = this.dic['full-text-scroll-element'];
/**
* @type {ol.Feature|undefined}
@ -338,7 +344,7 @@ dlfViewerFullTextControl.prototype.addHighlightEffect = function(textlineFeature
*/
dlfViewerFullTextControl.prototype.scrollToText = function(element) {
if (element.hasClass('highlight')) {
$('html, body').animate({
$(this.fullTextScrollElement).animate({
scrollTop: element.offset().top
}, 500);
}