39 lines
No EOL
1.5 KiB
JavaScript
39 lines
No EOL
1.5 KiB
JavaScript
/**
|
|
* DO NOT EDIT THIS FILE.
|
|
* See the following change record for more information,
|
|
* https://www.drupal.org/node/2815083
|
|
* @preserve
|
|
**/
|
|
(function ($, Drupal) {
|
|
function DetailsSummarizedContent(node) {
|
|
this.$node = $(node);
|
|
this.setupSummary();
|
|
}
|
|
$.extend(DetailsSummarizedContent, {
|
|
instances: []
|
|
});
|
|
$.extend(DetailsSummarizedContent.prototype, {
|
|
setupSummary: function setupSummary() {
|
|
this.$detailsSummarizedContentWrapper = $(Drupal.theme('detailsSummarizedContentWrapper'));
|
|
this.$node.on('summaryUpdated', $.proxy(this.onSummaryUpdated, this)).trigger('summaryUpdated').find('> summary').append(this.$detailsSummarizedContentWrapper);
|
|
},
|
|
onSummaryUpdated: function onSummaryUpdated() {
|
|
var text = this.$node.drupalGetSummary();
|
|
this.$detailsSummarizedContentWrapper.html(Drupal.theme('detailsSummarizedContentText', text));
|
|
}
|
|
});
|
|
Drupal.behaviors.detailsSummary = {
|
|
attach: function attach(context) {
|
|
DetailsSummarizedContent.instances = DetailsSummarizedContent.instances.concat(once('details', 'details', context).map(function (details) {
|
|
return new DetailsSummarizedContent(details);
|
|
}));
|
|
}
|
|
};
|
|
Drupal.DetailsSummarizedContent = DetailsSummarizedContent;
|
|
Drupal.theme.detailsSummarizedContentWrapper = function () {
|
|
return "<span class=\"summary\"></span>";
|
|
};
|
|
Drupal.theme.detailsSummarizedContentText = function (text) {
|
|
return text ? " (".concat(text, ")") : '';
|
|
};
|
|
})(jQuery, Drupal); |