Browse Source

Make scroll element for full text scrolling configurable

pull/581/head
Beatrycze Volk 3 months ago
parent
commit
593d8e20e2
4 changed files with 17 additions and 3 deletions
  1. +1
    -1
      Classes/Plugin/Tools/FulltextTool.php
  2. +1
    -0
      Configuration/TypoScript/Toolbox/setup.txt
  3. +7
    -0
      Documentation/Plugins/Index.rst
  4. +8
    -2
      Resources/Public/Javascript/PageView/FulltextControl.js

+ 1
- 1
Classes/Plugin/Tools/FulltextTool.php View File

@@ -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
- 0
Configuration/TypoScript/Toolbox/setup.txt View File

@@ -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


+ 7
- 0
Documentation/Plugins/Index.rst View File

@@ -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.



+ 8
- 2
Resources/Public/Javascript/PageView/FulltextControl.js View File

@@ -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);
}


Loading…
Cancel
Save