blob: c0f022bbbf26ccb9e64fdf3808ce32b838a3507f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(($, Drupal) => {
function DetailsSummarizedContent(node) {
this.$node = $(node);
this.setupSummary();
}
$.extend(DetailsSummarizedContent, {
instances: []
});
$.extend(DetailsSummarizedContent.prototype, {
setupSummary() {
this.$detailsSummarizedContentWrapper = $(Drupal.theme('detailsSummarizedContentWrapper'));
this.$node.on('summaryUpdated', $.proxy(this.onSummaryUpdated, this)).trigger('summaryUpdated').find('> summary').append(this.$detailsSummarizedContentWrapper);
},
onSummaryUpdated() {
const text = this.$node.drupalGetSummary();
this.$detailsSummarizedContentWrapper.html(Drupal.theme('detailsSummarizedContentText', text));
}
});
Drupal.behaviors.detailsSummary = {
attach(context) {
DetailsSummarizedContent.instances = DetailsSummarizedContent.instances.concat(once('details', 'details', context).map(details => new DetailsSummarizedContent(details)));
}
};
Drupal.DetailsSummarizedContent = DetailsSummarizedContent;
Drupal.theme.detailsSummarizedContentWrapper = () => `<span class="summary"></span>`;
Drupal.theme.detailsSummarizedContentText = text => text ? ` (${text})` : '';
})(jQuery, Drupal);
|