Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 39ad46...5c2c02 )
by Sebastian
16s
created

plugins/pageview/tx_dlf_pageview_fulltext_control.js   D

Complexity

Total Complexity 64
Complexity/F 4.57

Size

Lines of Code 432
Function Count 14

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
c 0
b 0
f 0
nc 16
dl 0
loc 432
rs 4.5964
wmc 64
mnd 3
bc 40
fnc 14
bpm 2.8571
cpm 4.5714
noi 21

7 Functions

Rating   Name   Duplication   Size   Complexity  
A dlfViewerFullTextControl.deactivate 0 12 1
A dlfViewerFullTextControl.disableFulltextSelect 0 23 3
B dlfViewerFullTextControl.activate 0 31 4
A dlfViewerFullTextControl.enableFulltextSelect 0 23 3
B tx_dlf_pageview_fulltext_control.js ➔ dlfViewerFullTextControl 0 234 5
B dlfViewerFullTextControl.showFulltext 0 40 3
B dlfViewerFullTextControl.fetchFulltextDataFromServer 0 19 5

How to fix   Complexity   

Complexity

Complex classes like plugins/pageview/tx_dlf_pageview_fulltext_control.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
/**
2
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
3
 *
4
 * This file is part of the Kitodo and TYPO3 projects.
5
 *
6
 * @license GNU General Public License version 3 or later.
7
 * For the full copyright and license information, please read the
8
 * LICENSE.txt file that was distributed with this source code.
9
 */
10
11
/**
12
 * This is necessary to support the scrolling of the element into the viewport
13
 * in case of text hover on the map.
14
 *
15
 * @param elem
16
 * @param speed
17
 * @returns {jQuery}
18
 */
19
jQuery.fn.scrollTo = function(elem, speed) {
20
    var manualOffsetTop = $(elem).parent().height() / 2;
21
    $(this).animate({
22
        scrollTop:  $(this).scrollTop() - $(this).offset().top + $(elem).offset().top - manualOffsetTop
23
    }, speed == undefined ? 1000 : speed);
24
    return this;
25
};
26
27
/**
28
 * Encapsulates especially the fulltext behavior
29
 * @constructor
30
 * @param {ol.Map} map
31
 * @param {Object} image
32
 * @param {string} fulltextUrl
33
 */
34
var dlfViewerFullTextControl = function(map, image, fulltextUrl) {
35
36
    /**
37
     * @private
38
     * @type {ol.Map}
39
     */
40
    this.map = map;
41
42
    /**
43
     * @type {Object}
44
     * @private
45
     */
46
    this.image = image;
47
48
    /**
49
     * @type {string}
50
     * @private
51
     */
52
    this.url = fulltextUrl;
53
54
    /**
55
     * @type {Object}
56
     * @private
57
     */
58
    this.dic = $('#tx-dlf-tools-fulltext').length > 0 && $('#tx-dlf-tools-fulltext').attr('data-dic') ?
59
    	dlfUtils.parseDataDic($('#tx-dlf-tools-fulltext')) :
0 ignored issues
show
Bug introduced by
The variable dlfUtils seems to be never declared. If this is a global, consider adding a /** global: dlfUtils */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
60
    	{'fulltext-on':'Activate Fulltext','fulltext-off':'Dectivate Fulltext'};
61
62
    /**
63
     * @type {ol.Feature|undefined}
64
     * @private
65
     */
66
    this.fulltextData_ = undefined;
67
68
    /**
69
     * @type {Object}
70
     * @private
71
     */
72
    this.layers_ = {
73
        textblock: new ol.layer.Vector({
0 ignored issues
show
Bug introduced by
The variable ol seems to be never declared. If this is a global, consider adding a /** global: ol */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
74
            'source': new ol.source.Vector(),
75
            'style': dlfViewerOL3Styles.defaultStyle()
0 ignored issues
show
Bug introduced by
The variable dlfViewerOL3Styles seems to be never declared. If this is a global, consider adding a /** global: dlfViewerOL3Styles */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
76
        }),
77
        textline: new ol.layer.Vector({
78
            'source': new ol.source.Vector(),
79
            'style': dlfViewerOL3Styles.invisibleStyle()
80
        }),
81
        select: new ol.layer.Vector({
82
            'source': new ol.source.Vector(),
83
            'style': dlfViewerOL3Styles.selectStyle()
84
        }),
85
        hoverTextblock: new ol.layer.Vector({
86
            'source': new ol.source.Vector(),
87
            'style': dlfViewerOL3Styles.hoverStyle()
88
        }),
89
        hoverTextline: new ol.layer.Vector({
90
            'source': new ol.source.Vector(),
91
            'style': dlfViewerOL3Styles.textlineStyle()
92
        })
93
    };
94
95
    /**
96
     * @type {ol.Feature}
97
     * @private
98
     */
99
    this.selectedFeature_ = undefined;
100
101
    /**
102
     * @type {Object}
103
     * @private
104
     */
105
    this.handlers_ = {
106
        mapClick: $.proxy(function(event) {
107
                // the click handler adds the clicked feature to a
108
                // select layer which could be used to create a highlight
109
                // effect on the map
110
111
                var feature = this.map.forEachFeatureAtPixel(event['pixel'], function(feature, layer) {
0 ignored issues
show
Unused Code introduced by
The parameter layer is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
112
                    if (feature.get('type') === 'textblock')
0 ignored issues
show
Complexity Best Practice introduced by
There is no return statement if feature.get("type") === "textblock" is false. Are you sure this is correct? If so, consider adding return; explicitly.

This check looks for functions where a return statement is found in some execution paths, but not in all.

Consider this little piece of code

function isBig(a) {
    if (a > 5000) {
        return "yes";
    }
}

console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined

The function isBig will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly return undefined.

This behaviour may not be what you had intended. In any case, you can add a return undefined to the other execution path to make the return value explicit.

Loading history...
113
                        return feature;
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
114
                });
115
116
                // deselect all
117
                if (feature === undefined) {
118
                    this.layers_.select.getSource().clear();
119
                    this.selectedFeature_ = undefined;
120
                    this.showFulltext(undefined);
121
                    return;
122
                };
123
124
                // highlight features
125
                if (this.selectedFeature_) {
126
127
                    // remove old clicks
128
                    this.layers_.select.getSource().removeFeature(this.selectedFeature_);
129
130
                }
131
132
                if (feature) {
133
134
                    // remove hover for preventing an adding of styles
135
                    this.layers_.hoverTextblock.getSource().clear();
136
137
                    // add feature
138
                    this.layers_.select.getSource().addFeature(feature);
139
140
                }
141
142
                this.selectedFeature_ = feature;
143
144
145
                if (dlfUtils.exists(feature))
0 ignored issues
show
Bug introduced by
The variable dlfUtils seems to be never declared. If this is a global, consider adding a /** global: dlfUtils */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
146
                    this.showFulltext([feature]);
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
147
148
            },
149
        this),
150
        mapHover: $.proxy(function(event) {
151
                // hover in case of dragging
152
                if (event['dragging']) {
153
                    return;
154
                };
155
156
                var hoverSourceTextblock_ = this.layers_.hoverTextblock.getSource(),
157
                    hoverSourceTextline_ = this.layers_.hoverTextline.getSource(),
158
                    selectSource_ = this.layers_.select.getSource(),
159
                    map_ = this.map,
160
                    textblockFeature,
161
                    textlineFeature;
162
163
                map_.forEachFeatureAtPixel(event['pixel'], function(feature, layer) {
0 ignored issues
show
Unused Code introduced by
The parameter layer is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
164
                    if (feature.get('type') === 'textblock')
165
                        textblockFeature = feature;
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
166
                    if (feature.get('type') === 'textline')
167
                        textlineFeature = feature;
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
168
                });
169
170
                //
171
                // Handle TextBlock elements
172
                //
173
                var activeSelectTextBlockEl_ = selectSource_.getFeatures().length > 0 ?
174
                        selectSource_.getFeatures()[0] : undefined,
175
                    activeHoverTextBlockEl_ = hoverSourceTextblock_.getFeatures().length > 0 ?
176
                        hoverSourceTextblock_.getFeatures()[0] : undefined,
177
                    isFeatureEqualSelectFeature_ = activeSelectTextBlockEl_ !== undefined && textblockFeature !== undefined &&
178
                    activeSelectTextBlockEl_.getId() === textblockFeature.getId() ? true : false,
179
                    isFeatureEqualToOldHoverFeature_ = activeHoverTextBlockEl_ !== undefined && textblockFeature !== undefined &&
180
                    activeHoverTextBlockEl_.getId() === textblockFeature.getId() ? true : false;
181
182
                if (!isFeatureEqualToOldHoverFeature_ && !isFeatureEqualSelectFeature_) {
183
184
                    // remove old textblock hover features
185
                    hoverSourceTextblock_.clear();
186
187
                    if (textblockFeature) {
188
                        // add textblock feature to hover
189
                        hoverSourceTextblock_.addFeature(textblockFeature);
190
                    }
191
192
                }
193
194
                //
195
                // Handle TextLine elements
196
                //
197
                var activeHoverTextBlockEl_ = hoverSourceTextline_.getFeatures().length > 0 ?
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable activeHoverTextBlockEl_ already seems to be declared on line 175. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
198
                        hoverSourceTextline_.getFeatures()[0] : undefined,
199
                    isFeatureEqualToOldHoverFeature_ = activeHoverTextBlockEl_ !== undefined && textlineFeature !== undefined &&
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable isFeatureEqualToOldHoverFeature_ already seems to be declared on line 179. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
200
                    activeHoverTextBlockEl_.getId() === textlineFeature.getId() ? true : false;
201
202
                if (!isFeatureEqualToOldHoverFeature_) {
203
204
                    if (activeHoverTextBlockEl_) {
205
206
                        // remove highlight effect on fulltext view
207
                        var oldTargetElem = $('#' + activeHoverTextBlockEl_.getId());
208
209
                        if (oldTargetElem.hasClass('highlight') ) {
210
                            oldTargetElem.removeClass('highlight');
211
                        }
212
213
                        // remove old textline hover features
214
                        hoverSourceTextline_.clear();
215
216
                    }
217
218
                    if (textlineFeature) {
219
220
                        // add highlight effect to fulltext view
221
                        var targetElem = $('#' + textlineFeature.getId());
222
223
                        if (targetElem.length > 0 && !targetElem.hasClass('highlight')) {
224
                            targetElem.addClass('highlight');
225
                            $('#tx-dlf-fulltextselection').scrollTo(targetElem, 50);
226
                            hoverSourceTextline_.addFeature(textlineFeature);
227
                        }
228
229
                    }
230
231
                }
232
233
            },
234
        this)
235
    };
236
237
    // add active / deactive behavior in case of click on control
238
    var anchorEl = $('#tx-dlf-tools-fulltext');
239
    if (anchorEl.length > 0){
240
        var toogleFulltext = $.proxy(function(event) {
241
        	  event.preventDefault();
242
243
        	  if ($(event.target).hasClass('active')){
244
        		  this.deactivate();
245
        		  return;
246
        	  }
247
248
        	  this.activate();
249
          }, this);
250
251
252
        anchorEl.on('click', toogleFulltext);
253
        anchorEl.on('touchstart', toogleFulltext);
254
    }
255
256
    // set initial title of fulltext element
257
    $("#tx-dlf-tools-fulltext")
258
    	.text(this.dic['fulltext-on'])
259
    	.attr('title', this.dic['fulltext-on']);
260
261
    // if fulltext is activated via cookie than run activation methode
262
    if (dlfUtils.getCookie("tx-dlf-pageview-fulltext-select") == 'enabled') {
0 ignored issues
show
Bug introduced by
The variable dlfUtils seems to be never declared. If this is a global, consider adding a /** global: dlfUtils */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
263
    	// activate the fulltext behavior
264
    	this.activate(anchorEl);
265
    }
266
267
};
268
269
/**
270
 * Activate Fulltext Features
271
 */
272
dlfViewerFullTextControl.prototype.activate = function() {
273
274
	var controlEl = $('#tx-dlf-tools-fulltext');
275
276
	// if the activate method is called for the first time fetch
277
	// fulltext data from server
278
	if (this.fulltextData_ === undefined)  {
279
		this.fulltextData_ = dlfViewerFullTextControl.fetchFulltextDataFromServer(this.url, this.image);
280
281
        if (this.fulltextData_ !== undefined) {
282
            // add features to fulltext layer
283
    		this.layers_.textblock.getSource().addFeatures(this.fulltextData_.getTextblocks());
284
            this.layers_.textline.getSource().addFeatures(this.fulltextData_.getTextlines());
285
286
    	    // add first feature of textBlockFeatures to map
287
    	    if (this.fulltextData_.getTextblocks().length > 0) {
288
    	        this.layers_.select.getSource().addFeature(this.fulltextData_.getTextblocks()[0]);
289
    	        this.selectedFeature_ = this.fulltextData_.getTextblocks()[0];
290
    	        this.showFulltext(this.fulltextData_.getTextblocks());
291
    	    }
292
        }
293
	}
294
295
	// now activate the fulltext overlay and map behavior
296
    this.enableFulltextSelect();
297
    dlfUtils.setCookie("tx-dlf-pageview-fulltext-select", 'enabled');
0 ignored issues
show
Bug introduced by
The variable dlfUtils seems to be never declared. If this is a global, consider adding a /** global: dlfUtils */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
298
    $(controlEl).addClass('active');
299
300
    // trigger event
301
    $(this).trigger("activate-fulltext", this);
302
};
303
304
/**
305
 * Activate Fulltext Features
306
 */
307
dlfViewerFullTextControl.prototype.deactivate = function() {
308
309
	var controlEl = $('#tx-dlf-tools-fulltext');
310
311
	// deactivate fulltext
312
	this.disableFulltextSelect();
313
    dlfUtils.setCookie("tx-dlf-pageview-fulltext-select", 'disabled');
0 ignored issues
show
Bug introduced by
The variable dlfUtils seems to be never declared. If this is a global, consider adding a /** global: dlfUtils */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
314
    $(controlEl).removeClass('active');
315
316
    // trigger event
317
    $(this).trigger("deactivate-fulltext", this);
318
};
319
320
/**
321
 * Disable Fulltext Features
322
 *
323
 * @return	void
324
 */
325
dlfViewerFullTextControl.prototype.disableFulltextSelect = function() {
326
327
    // register event listeners
328
    this.map.un('click', this.handlers_.mapClick);
329
    this.map.un('pointermove', this.handlers_.mapHover);
330
331
    // remove layers
332
    for (var key in this.layers_) {
333
        if (this.layers_.hasOwnProperty(key)) {
334
            this.map.removeLayer(this.layers_[key]);
335
        }
336
    };
337
338
    var className = 'fulltext-visible';
339
    $("#tx-dlf-tools-fulltext").removeClass(className)
340
        .text(this.dic['fulltext-on'])
341
        .attr('title', this.dic['fulltext-on']);
342
343
    $('#tx-dlf-fulltextselection').removeClass(className);
344
    $('#tx-dlf-fulltextselection').hide();
345
    $('body').removeClass(className);
346
347
};
348
349
/**
350
 * Activate Fulltext Features
351
 * @param {Array.<ol.Feature>} textBlockFeatures
352
 * @þaram {Array.<ol.Feature>} textLineFeatures
353
 */
354
dlfViewerFullTextControl.prototype.enableFulltextSelect = function(textBlockFeatures, textLineFeatures) {
0 ignored issues
show
Unused Code introduced by
The parameter textBlockFeatures is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter textLineFeatures is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
355
356
    // register event listeners
357
    this.map.on('click', this.handlers_.mapClick);
358
    this.map.on('pointermove', this.handlers_.mapHover);
359
360
    // add layers to map
361
    for (var key in this.layers_) {
362
        if (this.layers_.hasOwnProperty(key)) {
363
            this.map.addLayer(this.layers_[key]);
364
        }
365
    };
366
367
    // show fulltext container
368
    var className = 'fulltext-visible';
369
    $("#tx-dlf-tools-fulltext").addClass(className)
370
      .text(this.dic['fulltext-off'])
371
      .attr('title', this.dic['fulltext-off']);
372
373
    $('#tx-dlf-fulltextselection').addClass(className);
374
    $('#tx-dlf-fulltextselection').show();
375
    $('body').addClass(className);
376
};
377
378
/**
379
 * Method fetches the fulltext data from the server
380
 * @param {string} url
381
 * @param {Object} image
382
 * @param {number=} opt_offset
383
 * @return {ol.Feature|undefined}
384
 * @static
385
 */
386
dlfViewerFullTextControl.fetchFulltextDataFromServer = function(url, image, opt_offset){
387
	  // fetch data from server
388
    var request = $.ajax({
389
        url: url,
390
        async: false
391
    });
392
393
    // parse alto data
394
    var offset = dlfUtils.exists(opt_offset) ? opt_offset : undefined,
0 ignored issues
show
Bug introduced by
The variable dlfUtils seems to be never declared. If this is a global, consider adding a /** global: dlfUtils */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
395
      parser = new dlfAltoParser(image, undefined, undefined, offset),
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like dlfAltoParser should be capitalized.
Loading history...
Bug introduced by
The variable dlfAltoParser seems to be never declared. If this is a global, consider adding a /** global: dlfAltoParser */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
396
    	fulltextCoordinates = request.responseXML ? parser.parseFeatures(request.responseXML) :
397
            request.responseText ? parser.parseFeatures(request.responseText) : [];
398
399
    if (fulltextCoordinates.length > 0) {
400
        return fulltextCoordinates[0];
401
    }
402
403
    return undefined;
404
};
405
406
/**
407
 * Activate Fulltext Features
408
 *
409
 * @param {Array.<ol.Feature>|undefined} features
410
 */
411
dlfViewerFullTextControl.prototype.showFulltext = function(features) {
412
413
    var popupHTML = '',
414
      /**
415
       * Functions wraps fulltext context of a given textblock to a html string
416
       * @param {ol.Feature} feature
417
       * @return {string}
418
       */
419
      appendHTML = function(feature) {
420
          var html = '',
421
            textlines = feature.get('textlines');
422
423
          for (var i = 0; i < textlines.length; i++) {
424
425
              html = html + '<span class="textline" id="' + textlines[i].getId() + '">';
426
427
              var content = textlines[i].get('content');
428
              for (var j = 0; j < content.length; j++) {
429
                  html = html + '<span class="' + content[j].get('type') + '" id="' + content[j].getId()
430
                    + '">' + content[j].get('fulltext').replace(/\n/g, '<br />') + '</span>';
431
              }
432
433
              html = html + '</span>';
434
          }
435
436
          return html;
437
      };
438
439
    // iterate over given textblocks
440
    if (features !== undefined) {
441
442
        for (var i = 0; i < features.length; i++) {
443
            popupHTML = popupHTML + appendHTML(features[i]) + '<br /><br />';
444
        }
445
446
    };
447
448
    $('#tx-dlf-fulltextselection').html(popupHTML);
449
450
};
451