Issue #3239123 by hooroomoo, bnjmnm, nod_: Refactor (if feasible) uses of the jQuery text function to use vanillaJS
parent
6b8783b23a
commit
8c62a32c2d
|
|
@ -45,7 +45,7 @@
|
||||||
"jquery/no-sizzle": 0,
|
"jquery/no-sizzle": 0,
|
||||||
"jquery/no-slide": 0,
|
"jquery/no-slide": 0,
|
||||||
"jquery/no-submit": 2,
|
"jquery/no-submit": 2,
|
||||||
"jquery/no-text": 0,
|
"jquery/no-text": 2,
|
||||||
"jquery/no-toggle": 0,
|
"jquery/no-toggle": 0,
|
||||||
"jquery/no-trigger": 0,
|
"jquery/no-trigger": 0,
|
||||||
"jquery/no-trim": 2,
|
"jquery/no-trim": 2,
|
||||||
|
|
|
||||||
|
|
@ -108,13 +108,15 @@
|
||||||
// If the table has hidden columns, associate an action link with the
|
// If the table has hidden columns, associate an action link with the
|
||||||
// table to show the columns.
|
// table to show the columns.
|
||||||
if (hiddenLength > 0) {
|
if (hiddenLength > 0) {
|
||||||
this.$link.show().text(this.showText);
|
this.$link.show();
|
||||||
|
this.$link[0].textContent = this.showText;
|
||||||
}
|
}
|
||||||
// When the toggle is pegged, its presence is maintained because the user
|
// When the toggle is pegged, its presence is maintained because the user
|
||||||
// has interacted with it. This is necessary to keep the link visible if
|
// has interacted with it. This is necessary to keep the link visible if
|
||||||
// the user adjusts screen size and changes the visibility of columns.
|
// the user adjusts screen size and changes the visibility of columns.
|
||||||
if (!pegged && hiddenLength === 0) {
|
if (!pegged && hiddenLength === 0) {
|
||||||
this.$link.hide().text(this.hideText);
|
this.$link.hide();
|
||||||
|
this.$link[0].textContent = this.hideText;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -148,7 +150,8 @@
|
||||||
// Keep track of the revealed headers, so they can be hidden later.
|
// Keep track of the revealed headers, so they can be hidden later.
|
||||||
self.$revealedCells = $().add(self.$revealedCells).add($header);
|
self.$revealedCells = $().add(self.$revealedCells).add($header);
|
||||||
});
|
});
|
||||||
this.$link.text(this.hideText).data('pegged', 1);
|
this.$link[0].textContent = this.hideText;
|
||||||
|
this.$link.data('pegged', 1);
|
||||||
}
|
}
|
||||||
// Hide revealed columns.
|
// Hide revealed columns.
|
||||||
else {
|
else {
|
||||||
|
|
@ -177,7 +180,8 @@
|
||||||
// Return the rest of the style attribute values to the element.
|
// Return the rest of the style attribute values to the element.
|
||||||
$cell.attr('style', newProps.join(';'));
|
$cell.attr('style', newProps.join(';'));
|
||||||
});
|
});
|
||||||
this.$link.text(this.showText).data('pegged', 0);
|
this.$link[0].textContent = this.showText;
|
||||||
|
this.$link.data('pegged', 0);
|
||||||
// Refresh the toggle link.
|
// Refresh the toggle link.
|
||||||
$(window).trigger('resize.tableresponsive');
|
$(window).trigger('resize.tableresponsive');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,13 @@
|
||||||
const hiddenLength = this.$headers.filter('.priority-medium:hidden, .priority-low:hidden').length;
|
const hiddenLength = this.$headers.filter('.priority-medium:hidden, .priority-low:hidden').length;
|
||||||
|
|
||||||
if (hiddenLength > 0) {
|
if (hiddenLength > 0) {
|
||||||
this.$link.show().text(this.showText);
|
this.$link.show();
|
||||||
|
this.$link[0].textContent = this.showText;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pegged && hiddenLength === 0) {
|
if (!pegged && hiddenLength === 0) {
|
||||||
this.$link.hide().text(this.hideText);
|
this.$link.hide();
|
||||||
|
this.$link[0].textContent = this.hideText;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -60,7 +62,8 @@
|
||||||
$header.show();
|
$header.show();
|
||||||
self.$revealedCells = $().add(self.$revealedCells).add($header);
|
self.$revealedCells = $().add(self.$revealedCells).add($header);
|
||||||
});
|
});
|
||||||
this.$link.text(this.hideText).data('pegged', 1);
|
this.$link[0].textContent = this.hideText;
|
||||||
|
this.$link.data('pegged', 1);
|
||||||
} else {
|
} else {
|
||||||
this.$revealedCells.hide();
|
this.$revealedCells.hide();
|
||||||
this.$revealedCells.each(function (index, element) {
|
this.$revealedCells.each(function (index, element) {
|
||||||
|
|
@ -83,7 +86,8 @@
|
||||||
|
|
||||||
$cell.attr('style', newProps.join(';'));
|
$cell.attr('style', newProps.join(';'));
|
||||||
});
|
});
|
||||||
this.$link.text(this.showText).data('pegged', 0);
|
this.$link[0].textContent = this.showText;
|
||||||
|
this.$link.data('pegged', 0);
|
||||||
$(window).trigger('resize.tableresponsive');
|
$(window).trigger('resize.tableresponsive');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,9 @@
|
||||||
// Transform each details into a tab.
|
// Transform each details into a tab.
|
||||||
$details.each(function () {
|
$details.each(function () {
|
||||||
const $that = $(this);
|
const $that = $(this);
|
||||||
|
const $summary = $that.find('> summary');
|
||||||
const verticalTab = new Drupal.verticalTab({
|
const verticalTab = new Drupal.verticalTab({
|
||||||
title: $that.find('> summary').text(),
|
title: $summary.length ? $summary[0].textContent : '',
|
||||||
details: $that,
|
details: $that,
|
||||||
});
|
});
|
||||||
tabList.append(verticalTab.item);
|
tabList.append(verticalTab.item);
|
||||||
|
|
@ -281,15 +282,13 @@
|
||||||
*/
|
*/
|
||||||
Drupal.theme.verticalTab = function (settings) {
|
Drupal.theme.verticalTab = function (settings) {
|
||||||
const tab = {};
|
const tab = {};
|
||||||
|
tab.title = $('<strong class="vertical-tabs__menu-item-title"></strong>');
|
||||||
|
tab.title[0].textContent = settings.title;
|
||||||
tab.item = $(
|
tab.item = $(
|
||||||
'<li class="vertical-tabs__menu-item" tabindex="-1"></li>',
|
'<li class="vertical-tabs__menu-item" tabindex="-1"></li>',
|
||||||
).append(
|
).append(
|
||||||
(tab.link = $('<a href="#"></a>')
|
(tab.link = $('<a href="#"></a>')
|
||||||
.append(
|
.append(tab.title)
|
||||||
(tab.title = $(
|
|
||||||
'<strong class="vertical-tabs__menu-item-title"></strong>',
|
|
||||||
).text(settings.title)),
|
|
||||||
)
|
|
||||||
.append(
|
.append(
|
||||||
(tab.summary = $(
|
(tab.summary = $(
|
||||||
'<span class="vertical-tabs__menu-item-summary"></span>',
|
'<span class="vertical-tabs__menu-item-summary"></span>',
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,9 @@
|
||||||
$this.wrap('<div class="vertical-tabs clearfix"></div>').before(tabList);
|
$this.wrap('<div class="vertical-tabs clearfix"></div>').before(tabList);
|
||||||
$details.each(function () {
|
$details.each(function () {
|
||||||
const $that = $(this);
|
const $that = $(this);
|
||||||
|
const $summary = $that.find('> summary');
|
||||||
const verticalTab = new Drupal.verticalTab({
|
const verticalTab = new Drupal.verticalTab({
|
||||||
title: $that.find('> summary').text(),
|
title: $summary.length ? $summary[0].textContent : '',
|
||||||
details: $that
|
details: $that
|
||||||
});
|
});
|
||||||
tabList.append(verticalTab.item);
|
tabList.append(verticalTab.item);
|
||||||
|
|
@ -132,7 +133,9 @@
|
||||||
|
|
||||||
Drupal.theme.verticalTab = function (settings) {
|
Drupal.theme.verticalTab = function (settings) {
|
||||||
const tab = {};
|
const tab = {};
|
||||||
tab.item = $('<li class="vertical-tabs__menu-item" tabindex="-1"></li>').append(tab.link = $('<a href="#"></a>').append(tab.title = $('<strong class="vertical-tabs__menu-item-title"></strong>').text(settings.title)).append(tab.summary = $('<span class="vertical-tabs__menu-item-summary"></span>')));
|
tab.title = $('<strong class="vertical-tabs__menu-item-title"></strong>');
|
||||||
|
tab.title[0].textContent = settings.title;
|
||||||
|
tab.item = $('<li class="vertical-tabs__menu-item" tabindex="-1"></li>').append(tab.link = $('<a href="#"></a>').append(tab.title).append(tab.summary = $('<span class="vertical-tabs__menu-item-summary"></span>')));
|
||||||
return tab;
|
return tab;
|
||||||
};
|
};
|
||||||
})(jQuery, Drupal, drupalSettings);
|
})(jQuery, Drupal, drupalSettings);
|
||||||
|
|
@ -44,9 +44,8 @@
|
||||||
* The label of the block.
|
* The label of the block.
|
||||||
*/
|
*/
|
||||||
function toggleBlockEntry(index, label) {
|
function toggleBlockEntry(index, label) {
|
||||||
const $label = $(label);
|
const $row = $(label).parent().parent();
|
||||||
const $row = $label.parent().parent();
|
const textMatch = label.textContent.toLowerCase().includes(query);
|
||||||
const textMatch = $label.text().toLowerCase().includes(query);
|
|
||||||
$row.toggle(textMatch);
|
$row.toggle(textMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,8 @@
|
||||||
const query = e.target.value.toLowerCase();
|
const query = e.target.value.toLowerCase();
|
||||||
|
|
||||||
function toggleBlockEntry(index, label) {
|
function toggleBlockEntry(index, label) {
|
||||||
const $label = $(label);
|
const $row = $(label).parent().parent();
|
||||||
const $row = $label.parent().parent();
|
const textMatch = label.textContent.toLowerCase().includes(query);
|
||||||
const textMatch = $label.text().toLowerCase().includes(query);
|
|
||||||
$row.toggle(textMatch);
|
$row.toggle(textMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@
|
||||||
if (val === 'new') {
|
if (val === 'new') {
|
||||||
return Drupal.t('New book');
|
return Drupal.t('New book');
|
||||||
}
|
}
|
||||||
|
return Drupal.checkPlain($select.find(':selected')[0].textContent);
|
||||||
return Drupal.checkPlain($select.find(':selected').text());
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
return Drupal.t('New book');
|
return Drupal.t('New book');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Drupal.checkPlain($select.find(':selected').text());
|
return Drupal.checkPlain($select.find(':selected')[0].textContent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,9 @@
|
||||||
$group
|
$group
|
||||||
.attr('data-drupal-ckeditor-toolbar-group-name', name)
|
.attr('data-drupal-ckeditor-toolbar-group-name', name)
|
||||||
.children('.ckeditor-toolbar-group-name')
|
.children('.ckeditor-toolbar-group-name')
|
||||||
.text(name);
|
.each(function () {
|
||||||
|
this.textContent = name;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke a user-provided callback and indicate failure.
|
// Invoke a user-provided callback and indicate failure.
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,9 @@
|
||||||
$group.removeAttr('aria-label').attr('data-drupal-ckeditor-type', 'group').attr('tabindex', 0).children('.ckeditor-toolbar-group-name').attr('id', groupID).end().children('.ckeditor-toolbar-group-buttons').attr('aria-labelledby', groupID);
|
$group.removeAttr('aria-label').attr('data-drupal-ckeditor-type', 'group').attr('tabindex', 0).children('.ckeditor-toolbar-group-name').attr('id', groupID).end().children('.ckeditor-toolbar-group-buttons').attr('aria-labelledby', groupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
$group.attr('data-drupal-ckeditor-toolbar-group-name', name).children('.ckeditor-toolbar-group-name').text(name);
|
$group.attr('data-drupal-ckeditor-toolbar-group-name', name).children('.ckeditor-toolbar-group-name').each(function () {
|
||||||
|
this.textContent = name;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === 'cancel') {
|
if (action === 'cancel') {
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,16 @@
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.ckeditorLanguageSettingsSummary = {
|
Drupal.behaviors.ckeditorLanguageSettingsSummary = {
|
||||||
attach() {
|
attach() {
|
||||||
$('#edit-editor-settings-plugins-language').drupalSetSummary((context) =>
|
$('#edit-editor-settings-plugins-language').drupalSetSummary(
|
||||||
$(
|
(context) => {
|
||||||
|
const $selected = $(
|
||||||
'#edit-editor-settings-plugins-language-language-list-type option:selected',
|
'#edit-editor-settings-plugins-language-language-list-type option:selected',
|
||||||
).text(),
|
);
|
||||||
|
if ($selected.length) {
|
||||||
|
return $selected[0].textContent;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,15 @@
|
||||||
(function ($, Drupal) {
|
(function ($, Drupal) {
|
||||||
Drupal.behaviors.ckeditorLanguageSettingsSummary = {
|
Drupal.behaviors.ckeditorLanguageSettingsSummary = {
|
||||||
attach() {
|
attach() {
|
||||||
$('#edit-editor-settings-plugins-language').drupalSetSummary(context => $('#edit-editor-settings-plugins-language-language-list-type option:selected').text());
|
$('#edit-editor-settings-plugins-language').drupalSetSummary(context => {
|
||||||
|
const $selected = $('#edit-editor-settings-plugins-language-language-list-type option:selected');
|
||||||
|
|
||||||
|
if ($selected.length) {
|
||||||
|
return $selected[0].textContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -67,15 +67,14 @@
|
||||||
this.$el
|
this.$el
|
||||||
.find('[data-toolbar="active"]')
|
.find('[data-toolbar="active"]')
|
||||||
.toggleClass('ckeditor-group-names-are-visible', groupNamesVisible);
|
.toggleClass('ckeditor-group-names-are-visible', groupNamesVisible);
|
||||||
this.$el
|
const $toggle = this.$el.find('.ckeditor-groupnames-toggle');
|
||||||
.find('.ckeditor-groupnames-toggle')
|
$toggle
|
||||||
.text(
|
.each((index, element) => {
|
||||||
groupNamesVisible
|
element.textContent = groupNamesVisible
|
||||||
? Drupal.t('Hide group names')
|
? Drupal.t('Hide group names')
|
||||||
: Drupal.t('Show group names'),
|
: Drupal.t('Show group names');
|
||||||
)
|
})
|
||||||
.attr('aria-pressed', groupNamesVisible);
|
.attr('aria-pressed', groupNamesVisible);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$el.find('[data-toolbar="active"]').toggleClass('ckeditor-group-names-are-visible', groupNamesVisible);
|
this.$el.find('[data-toolbar="active"]').toggleClass('ckeditor-group-names-are-visible', groupNamesVisible);
|
||||||
this.$el.find('.ckeditor-groupnames-toggle').text(groupNamesVisible ? Drupal.t('Hide group names') : Drupal.t('Show group names')).attr('aria-pressed', groupNamesVisible);
|
const $toggle = this.$el.find('.ckeditor-groupnames-toggle');
|
||||||
|
$toggle.each((index, element) => {
|
||||||
|
element.textContent = groupNamesVisible ? Drupal.t('Hide group names') : Drupal.t('Show group names');
|
||||||
|
}).attr('aria-pressed', groupNamesVisible);
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@
|
||||||
Drupal.checkPlain(
|
Drupal.checkPlain(
|
||||||
$(context)
|
$(context)
|
||||||
.find('.js-form-item-comment input:checked')
|
.find('.js-form-item-comment input:checked')
|
||||||
.next('label')
|
.next('label')[0].textContent,
|
||||||
.text(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
Drupal.behaviors.commentFieldsetSummaries = {
|
Drupal.behaviors.commentFieldsetSummaries = {
|
||||||
attach(context) {
|
attach(context) {
|
||||||
const $context = $(context);
|
const $context = $(context);
|
||||||
$context.find('fieldset.comment-entity-settings-form').drupalSetSummary(context => Drupal.checkPlain($(context).find('.js-form-item-comment input:checked').next('label').text()));
|
$context.find('fieldset.comment-entity-settings-form').drupalSetSummary(context => Drupal.checkPlain($(context).find('.js-form-item-comment input:checked').next('label')[0].textContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@
|
||||||
|
|
||||||
if (timestamp > lastViewTimestamp) {
|
if (timestamp > lastViewTimestamp) {
|
||||||
// Turn the placeholder into an actual "new" indicator.
|
// Turn the placeholder into an actual "new" indicator.
|
||||||
const $comment = $(placeholder)
|
placeholder.textContent = newCommentString;
|
||||||
|
$placeholder
|
||||||
.removeClass('hidden')
|
.removeClass('hidden')
|
||||||
.text(newCommentString)
|
|
||||||
.closest('.js-comment')
|
.closest('.js-comment')
|
||||||
// Add 'new' class to the comment, so it can be styled.
|
// Add 'new' class to the comment, so it can be styled.
|
||||||
.addClass('new');
|
.addClass('new');
|
||||||
|
|
@ -41,13 +41,13 @@
|
||||||
// this is the first new comment in the DOM.
|
// this is the first new comment in the DOM.
|
||||||
if (isFirstNewComment) {
|
if (isFirstNewComment) {
|
||||||
isFirstNewComment = false;
|
isFirstNewComment = false;
|
||||||
$comment.prev().before('<a id="new"></a>');
|
$placeholder.prev().before('<a id="new"></a>');
|
||||||
// If the URL points to the first new comment, then scroll to that
|
// If the URL points to the first new comment, then scroll to that
|
||||||
// comment.
|
// comment.
|
||||||
if (window.location.hash === '#new') {
|
if (window.location.hash === '#new') {
|
||||||
window.scrollTo(
|
window.scrollTo(
|
||||||
0,
|
0,
|
||||||
$comment.offset().top - Drupal.displace.offsets.top,
|
$placeholder.offset().top - Drupal.displace.offsets.top,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,15 @@
|
||||||
const lastViewTimestamp = Drupal.history.getLastRead(nodeID);
|
const lastViewTimestamp = Drupal.history.getLastRead(nodeID);
|
||||||
|
|
||||||
if (timestamp > lastViewTimestamp) {
|
if (timestamp > lastViewTimestamp) {
|
||||||
const $comment = $(placeholder).removeClass('hidden').text(newCommentString).closest('.js-comment').addClass('new');
|
placeholder.textContent = newCommentString;
|
||||||
|
$placeholder.removeClass('hidden').closest('.js-comment').addClass('new');
|
||||||
|
|
||||||
if (isFirstNewComment) {
|
if (isFirstNewComment) {
|
||||||
isFirstNewComment = false;
|
isFirstNewComment = false;
|
||||||
$comment.prev().before('<a id="new"></a>');
|
$placeholder.prev().before('<a id="new"></a>');
|
||||||
|
|
||||||
if (window.location.hash === '#new') {
|
if (window.location.hash === '#new') {
|
||||||
window.scrollTo(0, $comment.offset().top - Drupal.displace.offsets.top);
|
window.scrollTo(0, $placeholder.offset().top - Drupal.displace.offsets.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,17 +115,17 @@
|
||||||
function render(results) {
|
function render(results) {
|
||||||
Object.keys(results || {}).forEach((nodeID) => {
|
Object.keys(results || {}).forEach((nodeID) => {
|
||||||
if ($placeholdersToUpdate.hasOwnProperty(nodeID)) {
|
if ($placeholdersToUpdate.hasOwnProperty(nodeID)) {
|
||||||
$placeholdersToUpdate[nodeID]
|
const $placeholderItem = $placeholdersToUpdate[nodeID];
|
||||||
.attr('href', results[nodeID].first_new_comment_link)
|
const result = results[nodeID];
|
||||||
.text(
|
$placeholderItem[0].textContent = Drupal.formatPlural(
|
||||||
Drupal.formatPlural(
|
result.new_comment_count,
|
||||||
results[nodeID].new_comment_count,
|
|
||||||
'1 new comment',
|
'1 new comment',
|
||||||
'@count new comments',
|
'@count new comments',
|
||||||
),
|
);
|
||||||
)
|
$placeholderItem
|
||||||
|
.attr('href', result.first_new_comment_link)
|
||||||
.removeClass('hidden');
|
.removeClass('hidden');
|
||||||
show($placeholdersToUpdate[nodeID]);
|
show($placeholderItem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,11 @@
|
||||||
function render(results) {
|
function render(results) {
|
||||||
Object.keys(results || {}).forEach(nodeID => {
|
Object.keys(results || {}).forEach(nodeID => {
|
||||||
if ($placeholdersToUpdate.hasOwnProperty(nodeID)) {
|
if ($placeholdersToUpdate.hasOwnProperty(nodeID)) {
|
||||||
$placeholdersToUpdate[nodeID].attr('href', results[nodeID].first_new_comment_link).text(Drupal.formatPlural(results[nodeID].new_comment_count, '1 new comment', '@count new comments')).removeClass('hidden');
|
const $placeholderItem = $placeholdersToUpdate[nodeID];
|
||||||
show($placeholdersToUpdate[nodeID]);
|
const result = results[nodeID];
|
||||||
|
$placeholderItem[0].textContent = Drupal.formatPlural(result.new_comment_count, '1 new comment', '@count new comments');
|
||||||
|
$placeholderItem.attr('href', result.first_new_comment_link).removeClass('hidden');
|
||||||
|
show($placeholderItem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,14 @@
|
||||||
this.setAttribute('href', url + glue + destination);
|
this.setAttribute('href', url + glue + destination);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let title = '';
|
||||||
|
const $regionHeading = $region.find('h2');
|
||||||
|
if ($regionHeading.length) {
|
||||||
|
title = $regionHeading[0].textContent.trim();
|
||||||
|
}
|
||||||
// Create a model and the appropriate views.
|
// Create a model and the appropriate views.
|
||||||
const model = new contextual.StateModel({
|
const model = new contextual.StateModel({
|
||||||
title: $region.find('h2').eq(0).text().trim(),
|
title,
|
||||||
});
|
});
|
||||||
const viewOptions = $.extend({ el: $contextual, model }, options);
|
const viewOptions = $.extend({ el: $contextual, model }, options);
|
||||||
contextual.views.push({
|
contextual.views.push({
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,15 @@
|
||||||
const glue = url.indexOf('?') === -1 ? '?' : '&';
|
const glue = url.indexOf('?') === -1 ? '?' : '&';
|
||||||
this.setAttribute('href', url + glue + destination);
|
this.setAttribute('href', url + glue + destination);
|
||||||
});
|
});
|
||||||
|
let title = '';
|
||||||
|
const $regionHeading = $region.find('h2');
|
||||||
|
|
||||||
|
if ($regionHeading.length) {
|
||||||
|
title = $regionHeading[0].textContent.trim();
|
||||||
|
}
|
||||||
|
|
||||||
const model = new contextual.StateModel({
|
const model = new contextual.StateModel({
|
||||||
title: $region.find('h2').eq(0).text().trim()
|
title
|
||||||
});
|
});
|
||||||
const viewOptions = $.extend({
|
const viewOptions = $.extend({
|
||||||
el: $contextual,
|
el: $contextual,
|
||||||
|
|
|
||||||
|
|
@ -35,16 +35,19 @@
|
||||||
this.$el.find('.contextual-links').prop('hidden', !isOpen);
|
this.$el.find('.contextual-links').prop('hidden', !isOpen);
|
||||||
|
|
||||||
// Update the view of the trigger.
|
// Update the view of the trigger.
|
||||||
this.$el
|
const $trigger = this.$el.find('.trigger');
|
||||||
.find('.trigger')
|
$trigger
|
||||||
.text(
|
.each((index, element) => {
|
||||||
Drupal.t('@action @title configuration options', {
|
element.textContent = Drupal.t(
|
||||||
|
'@action @title configuration options',
|
||||||
|
{
|
||||||
'@action': !isOpen
|
'@action': !isOpen
|
||||||
? this.options.strings.open
|
? this.options.strings.open
|
||||||
: this.options.strings.close,
|
: this.options.strings.close,
|
||||||
'@title': this.model.get('title'),
|
'@title': this.model.get('title'),
|
||||||
}),
|
},
|
||||||
)
|
);
|
||||||
|
})
|
||||||
.attr('aria-pressed', isOpen);
|
.attr('aria-pressed', isOpen);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,13 @@
|
||||||
render() {
|
render() {
|
||||||
const isOpen = this.model.get('isOpen');
|
const isOpen = this.model.get('isOpen');
|
||||||
this.$el.find('.contextual-links').prop('hidden', !isOpen);
|
this.$el.find('.contextual-links').prop('hidden', !isOpen);
|
||||||
this.$el.find('.trigger').text(Drupal.t('@action @title configuration options', {
|
const $trigger = this.$el.find('.trigger');
|
||||||
|
$trigger.each((index, element) => {
|
||||||
|
element.textContent = Drupal.t('@action @title configuration options', {
|
||||||
'@action': !isOpen ? this.options.strings.open : this.options.strings.close,
|
'@action': !isOpen ? this.options.strings.open : this.options.strings.close,
|
||||||
'@title': this.model.get('title')
|
'@title': this.model.get('title')
|
||||||
})).attr('aria-pressed', isOpen);
|
});
|
||||||
|
}).attr('aria-pressed', isOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
const message = Drupal.t(
|
const message = Drupal.t(
|
||||||
'Changing the text format to %text_format will permanently remove content that is not allowed in that text format.<br><br>Save your changes before switching the text format to avoid losing data.',
|
'Changing the text format to %text_format will permanently remove content that is not allowed in that text format.<br><br>Save your changes before switching the text format to avoid losing data.',
|
||||||
{
|
{
|
||||||
'%text_format': $(select).find('option:selected').text(),
|
'%text_format': $(select).find('option:selected')[0].textContent,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const confirmationDialog = Drupal.dialog(`<div>${message}</div>`, {
|
const confirmationDialog = Drupal.dialog(`<div>${message}</div>`, {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
if (hasContent && supportContentFiltering) {
|
if (hasContent && supportContentFiltering) {
|
||||||
const message = Drupal.t('Changing the text format to %text_format will permanently remove content that is not allowed in that text format.<br><br>Save your changes before switching the text format to avoid losing data.', {
|
const message = Drupal.t('Changing the text format to %text_format will permanently remove content that is not allowed in that text format.<br><br>Save your changes before switching the text format to avoid losing data.', {
|
||||||
'%text_format': $(select).find('option:selected').text()
|
'%text_format': $(select).find('option:selected')[0].textContent
|
||||||
});
|
});
|
||||||
const confirmationDialog = Drupal.dialog(`<div>${message}</div>`, {
|
const confirmationDialog = Drupal.dialog(`<div>${message}</div>`, {
|
||||||
title: Drupal.t('Change text format?'),
|
title: Drupal.t('Change text format?'),
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,9 @@
|
||||||
* The link to add the block.
|
* The link to add the block.
|
||||||
*/
|
*/
|
||||||
const toggleBlockEntry = (index, link) => {
|
const toggleBlockEntry = (index, link) => {
|
||||||
const $link = $(link);
|
const textMatch =
|
||||||
const textMatch = $link.text().toLowerCase().indexOf(query) !== -1;
|
link.textContent.toLowerCase().indexOf(query) !== -1;
|
||||||
$link.toggle(textMatch);
|
$(link).toggle(textMatch);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Filter if the length of the query is at least 2 characters.
|
// Filter if the length of the query is at least 2 characters.
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,8 @@
|
||||||
const query = e.target.value.toLowerCase();
|
const query = e.target.value.toLowerCase();
|
||||||
|
|
||||||
const toggleBlockEntry = (index, link) => {
|
const toggleBlockEntry = (index, link) => {
|
||||||
const $link = $(link);
|
const textMatch = link.textContent.toLowerCase().indexOf(query) !== -1;
|
||||||
const textMatch = $link.text().toLowerCase().indexOf(query) !== -1;
|
$(link).toggle(textMatch);
|
||||||
$link.toggle(textMatch);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (query.length >= 2) {
|
if (query.length >= 2) {
|
||||||
|
|
|
||||||
|
|
@ -79,14 +79,13 @@
|
||||||
|
|
||||||
$tr.toggleClass('expanded');
|
$tr.toggleClass('expanded');
|
||||||
|
|
||||||
|
const $localePrefix = $tr.find('.locale-translation-update__prefix');
|
||||||
|
if ($localePrefix.length) {
|
||||||
// Change screen reader text.
|
// Change screen reader text.
|
||||||
$tr.find('.locale-translation-update__prefix').text(() => {
|
$localePrefix[0].textContent = $tr.hasClass('expanded')
|
||||||
if ($tr.hasClass('expanded')) {
|
? Drupal.t('Hide description')
|
||||||
return Drupal.t('Hide description');
|
: Drupal.t('Show description');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Drupal.t('Show description');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
$table.find('.requirements, .links').hide();
|
$table.find('.requirements, .links').hide();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,11 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const $tr = $(this).closest('tr');
|
const $tr = $(this).closest('tr');
|
||||||
$tr.toggleClass('expanded');
|
$tr.toggleClass('expanded');
|
||||||
$tr.find('.locale-translation-update__prefix').text(() => {
|
const $localePrefix = $tr.find('.locale-translation-update__prefix');
|
||||||
if ($tr.hasClass('expanded')) {
|
|
||||||
return Drupal.t('Hide description');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Drupal.t('Show description');
|
if ($localePrefix.length) {
|
||||||
});
|
$localePrefix[0].textContent = $tr.hasClass('expanded') ? Drupal.t('Hide description') : Drupal.t('Show description');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$table.find('.requirements, .links').hide();
|
$table.find('.requirements, .links').hide();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
.find('input[name^="options"]:checked')
|
.find('input[name^="options"]:checked')
|
||||||
.parent()
|
.parent()
|
||||||
.each(function () {
|
.each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).find('label').text()));
|
vals.push(Drupal.checkPlain($(this).find('label')[0].textContent));
|
||||||
});
|
});
|
||||||
if (!$(context).find('#edit-options-status').is(':checked')) {
|
if (!$(context).find('#edit-options-status').is(':checked')) {
|
||||||
vals.unshift(Drupal.t('Not published'));
|
vals.unshift(Drupal.t('Not published'));
|
||||||
|
|
@ -35,18 +35,16 @@
|
||||||
const vals = [];
|
const vals = [];
|
||||||
|
|
||||||
vals.push(
|
vals.push(
|
||||||
$(context)
|
$(context).find(
|
||||||
.find(
|
|
||||||
'.js-form-item-language-configuration-langcode select option:selected',
|
'.js-form-item-language-configuration-langcode select option:selected',
|
||||||
)
|
)[0].textContent,
|
||||||
.text(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$(context)
|
$(context)
|
||||||
.find('input:checked')
|
.find('input:checked')
|
||||||
.next('label')
|
.next('label')
|
||||||
.each(function () {
|
.each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
|
|
||||||
return vals.join(', ');
|
return vals.join(', ');
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
$context.find('#edit-workflow').drupalSetSummary(context => {
|
$context.find('#edit-workflow').drupalSetSummary(context => {
|
||||||
const vals = [];
|
const vals = [];
|
||||||
$(context).find('input[name^="options"]:checked').parent().each(function () {
|
$(context).find('input[name^="options"]:checked').parent().each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).find('label').text()));
|
vals.push(Drupal.checkPlain($(this).find('label')[0].textContent));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$(context).find('#edit-options-status').is(':checked')) {
|
if (!$(context).find('#edit-options-status').is(':checked')) {
|
||||||
|
|
@ -23,9 +23,9 @@
|
||||||
});
|
});
|
||||||
$(context).find('#edit-language').drupalSetSummary(context => {
|
$(context).find('#edit-language').drupalSetSummary(context => {
|
||||||
const vals = [];
|
const vals = [];
|
||||||
vals.push($(context).find('.js-form-item-language-configuration-langcode select option:selected').text());
|
vals.push($(context).find('.js-form-item-language-configuration-langcode select option:selected')[0].textContent);
|
||||||
$(context).find('input:checked').next('label').each(function () {
|
$(context).find('input:checked').next('label').each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
return vals.join(', ');
|
return vals.join(', ');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,8 @@
|
||||||
Drupal.announce(announcement);
|
Drupal.announce(announcement);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const $label = $(
|
const $label = $('<label class="media-library-select-all"></label>');
|
||||||
'<label class="media-library-select-all"></label>',
|
$label[0].textContent = Drupal.t('Select all media');
|
||||||
).text(Drupal.t('Select all media'));
|
|
||||||
$label.prepend($checkbox);
|
$label.prepend($checkbox);
|
||||||
$view.find('.js-media-library-item').first().before($label);
|
$view.find('.js-media-library-item').first().before($label);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@
|
||||||
}) : Drupal.t('Zero items selected');
|
}) : Drupal.t('Zero items selected');
|
||||||
Drupal.announce(announcement);
|
Drupal.announce(announcement);
|
||||||
});
|
});
|
||||||
const $label = $('<label class="media-library-select-all"></label>').text(Drupal.t('Select all media'));
|
const $label = $('<label class="media-library-select-all"></label>');
|
||||||
|
$label[0].textContent = Drupal.t('Select all media');
|
||||||
$label.prepend($checkbox);
|
$label.prepend($checkbox);
|
||||||
$view.find('.js-media-library-item').first().before($label);
|
$view.find('.js-media-library-item').first().before($label);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,28 +44,28 @@
|
||||||
show: Drupal.t('Show media item weights'),
|
show: Drupal.t('Show media item weights'),
|
||||||
hide: Drupal.t('Hide media item weights'),
|
hide: Drupal.t('Hide media item weights'),
|
||||||
};
|
};
|
||||||
$(
|
const mediaLibraryToggle = once(
|
||||||
once(
|
|
||||||
'media-library-toggle',
|
'media-library-toggle',
|
||||||
'.js-media-library-widget-toggle-weight',
|
'.js-media-library-widget-toggle-weight',
|
||||||
context,
|
context,
|
||||||
),
|
);
|
||||||
)
|
$(mediaLibraryToggle).on('click', (e) => {
|
||||||
.on('click', (e) => {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(e.currentTarget)
|
const $target = $(e.currentTarget);
|
||||||
|
e.currentTarget.textContent = $target.hasClass('active')
|
||||||
|
? strings.show
|
||||||
|
: strings.hide;
|
||||||
|
$target
|
||||||
.toggleClass('active')
|
.toggleClass('active')
|
||||||
.text(
|
|
||||||
$(e.currentTarget).hasClass('active')
|
|
||||||
? strings.hide
|
|
||||||
: strings.show,
|
|
||||||
)
|
|
||||||
.closest('.js-media-library-widget')
|
.closest('.js-media-library-widget')
|
||||||
.find('.js-media-library-item-weight')
|
.find('.js-media-library-item-weight')
|
||||||
.parent()
|
.parent()
|
||||||
.toggle();
|
.toggle();
|
||||||
})
|
});
|
||||||
.text(strings.show);
|
mediaLibraryToggle.forEach((item) => {
|
||||||
|
item.textContent = strings.show;
|
||||||
|
});
|
||||||
|
|
||||||
$(once('media-library-toggle', '.js-media-library-item-weight', context))
|
$(once('media-library-toggle', '.js-media-library-item-weight', context))
|
||||||
.parent()
|
.parent()
|
||||||
.hide();
|
.hide();
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,16 @@
|
||||||
show: Drupal.t('Show media item weights'),
|
show: Drupal.t('Show media item weights'),
|
||||||
hide: Drupal.t('Hide media item weights')
|
hide: Drupal.t('Hide media item weights')
|
||||||
};
|
};
|
||||||
$(once('media-library-toggle', '.js-media-library-widget-toggle-weight', context)).on('click', e => {
|
const mediaLibraryToggle = once('media-library-toggle', '.js-media-library-widget-toggle-weight', context);
|
||||||
|
$(mediaLibraryToggle).on('click', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(e.currentTarget).toggleClass('active').text($(e.currentTarget).hasClass('active') ? strings.hide : strings.show).closest('.js-media-library-widget').find('.js-media-library-item-weight').parent().toggle();
|
const $target = $(e.currentTarget);
|
||||||
}).text(strings.show);
|
e.currentTarget.textContent = $target.hasClass('active') ? strings.show : strings.hide;
|
||||||
|
$target.toggleClass('active').closest('.js-media-library-widget').find('.js-media-library-item-weight').parent().toggle();
|
||||||
|
});
|
||||||
|
mediaLibraryToggle.forEach(item => {
|
||||||
|
item.textContent = strings.show;
|
||||||
|
});
|
||||||
$(once('media-library-toggle', '.js-media-library-item-weight', context)).parent().hide();
|
$(once('media-library-toggle', '.js-media-library-item-weight', context)).parent().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
const selectContents = document.createElement('option');
|
const selectContents = document.createElement('option');
|
||||||
selectContents.selected = machineName === selected;
|
selectContents.selected = machineName === selected;
|
||||||
selectContents.value = machineName;
|
selectContents.value = machineName;
|
||||||
selectContents.innerText = options[machineName];
|
selectContents.textContent = options[machineName];
|
||||||
$select.append(selectContents);
|
$select.append(selectContents);
|
||||||
totalOptions++;
|
totalOptions++;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
const selectContents = document.createElement('option');
|
const selectContents = document.createElement('option');
|
||||||
selectContents.selected = machineName === selected;
|
selectContents.selected = machineName === selected;
|
||||||
selectContents.value = machineName;
|
selectContents.value = machineName;
|
||||||
selectContents.innerText = options[machineName];
|
selectContents.textContent = options[machineName];
|
||||||
$select.append(selectContents);
|
$select.append(selectContents);
|
||||||
totalOptions++;
|
totalOptions++;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
.find('input[name^="options"]:checked')
|
.find('input[name^="options"]:checked')
|
||||||
.next('label')
|
.next('label')
|
||||||
.each(function () {
|
.each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
if (!$(context).find('#edit-options-status').is(':checked')) {
|
if (!$(context).find('#edit-options-status').is(':checked')) {
|
||||||
vals.unshift(Drupal.t('Not published'));
|
vals.unshift(Drupal.t('Not published'));
|
||||||
|
|
@ -44,13 +44,13 @@
|
||||||
$(
|
$(
|
||||||
'.js-form-item-language-configuration-langcode select option:selected',
|
'.js-form-item-language-configuration-langcode select option:selected',
|
||||||
context,
|
context,
|
||||||
).text(),
|
)[0].textContent,
|
||||||
);
|
);
|
||||||
|
|
||||||
$('input:checked', context)
|
$('input:checked', context)
|
||||||
.next('label')
|
.next('label')
|
||||||
.each(function () {
|
.each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
|
|
||||||
return vals.join(', ');
|
return vals.join(', ');
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
.find('input:checked')
|
.find('input:checked')
|
||||||
.next('label')
|
.next('label')
|
||||||
.each(function () {
|
.each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
if (!$editContext.find('#edit-display-submitted').is(':checked')) {
|
if (!$editContext.find('#edit-display-submitted').is(':checked')) {
|
||||||
vals.unshift(Drupal.t("Don't display post information"));
|
vals.unshift(Drupal.t("Don't display post information"));
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
$context.find('#edit-workflow').drupalSetSummary(context => {
|
$context.find('#edit-workflow').drupalSetSummary(context => {
|
||||||
const vals = [];
|
const vals = [];
|
||||||
$(context).find('input[name^="options"]:checked').next('label').each(function () {
|
$(context).find('input[name^="options"]:checked').next('label').each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$(context).find('#edit-options-status').is(':checked')) {
|
if (!$(context).find('#edit-options-status').is(':checked')) {
|
||||||
|
|
@ -28,9 +28,9 @@
|
||||||
});
|
});
|
||||||
$('#edit-language', context).drupalSetSummary(context => {
|
$('#edit-language', context).drupalSetSummary(context => {
|
||||||
const vals = [];
|
const vals = [];
|
||||||
vals.push($('.js-form-item-language-configuration-langcode select option:selected', context).text());
|
vals.push($('.js-form-item-language-configuration-langcode select option:selected', context)[0].textContent);
|
||||||
$('input:checked', context).next('label').each(function () {
|
$('input:checked', context).next('label').each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
return vals.join(', ');
|
return vals.join(', ');
|
||||||
});
|
});
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
const vals = [];
|
const vals = [];
|
||||||
const $editContext = $(context);
|
const $editContext = $(context);
|
||||||
$editContext.find('input:checked').next('label').each(function () {
|
$editContext.find('input:checked').next('label').each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text()));
|
vals.push(Drupal.checkPlain(this.textContent));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$editContext.find('#edit-display-submitted').is(':checked')) {
|
if (!$editContext.find('#edit-display-submitted').is(':checked')) {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
.find('input:checked')
|
.find('input:checked')
|
||||||
.next('label')
|
.next('label')
|
||||||
.each(function () {
|
.each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text().trim()));
|
vals.push(Drupal.checkPlain(this.textContent.trim()));
|
||||||
});
|
});
|
||||||
return vals.join(', ');
|
return vals.join(', ');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
if ($optionsContext.find('input').is(':checked')) {
|
if ($optionsContext.find('input').is(':checked')) {
|
||||||
$optionsContext.find('input:checked').next('label').each(function () {
|
$optionsContext.find('input:checked').next('label').each(function () {
|
||||||
vals.push(Drupal.checkPlain($(this).text().trim()));
|
vals.push(Drupal.checkPlain(this.textContent.trim()));
|
||||||
});
|
});
|
||||||
return vals.join(', ');
|
return vals.join(', ');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,15 @@
|
||||||
const $fieldItems = this.$el.find('.quickedit-field');
|
const $fieldItems = this.$el.find('.quickedit-field');
|
||||||
const $textElement = $fieldItems.length ? $fieldItems.eq(0) : this.$el;
|
const $textElement = $fieldItems.length ? $fieldItems.eq(0) : this.$el;
|
||||||
this.$textElement = $textElement;
|
this.$textElement = $textElement;
|
||||||
editorModel.set('originalValue', this.$textElement.text().trim());
|
editorModel.set(
|
||||||
|
'originalValue',
|
||||||
|
this.$textElement[0].textContent.trim(),
|
||||||
|
);
|
||||||
|
|
||||||
// Sets the state to 'changed' whenever the value changes.
|
// Sets the state to 'changed' whenever the value changes.
|
||||||
let previousText = editorModel.get('originalValue');
|
let previousText = editorModel.get('originalValue');
|
||||||
$textElement.on('keyup paste', (event) => {
|
$textElement.on('keyup paste', (event) => {
|
||||||
const currentText = $textElement.text().trim();
|
const currentText = $textElement[0].textContent.trim();
|
||||||
if (previousText !== currentText) {
|
if (previousText !== currentText) {
|
||||||
previousText = currentText;
|
previousText = currentText;
|
||||||
editorModel.set('currentValue', currentText);
|
editorModel.set('currentValue', currentText);
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@
|
||||||
const $fieldItems = this.$el.find('.quickedit-field');
|
const $fieldItems = this.$el.find('.quickedit-field');
|
||||||
const $textElement = $fieldItems.length ? $fieldItems.eq(0) : this.$el;
|
const $textElement = $fieldItems.length ? $fieldItems.eq(0) : this.$el;
|
||||||
this.$textElement = $textElement;
|
this.$textElement = $textElement;
|
||||||
editorModel.set('originalValue', this.$textElement.text().trim());
|
editorModel.set('originalValue', this.$textElement[0].textContent.trim());
|
||||||
let previousText = editorModel.get('originalValue');
|
let previousText = editorModel.get('originalValue');
|
||||||
$textElement.on('keyup paste', event => {
|
$textElement.on('keyup paste', event => {
|
||||||
const currentText = $textElement.text().trim();
|
const currentText = $textElement[0].textContent.trim();
|
||||||
|
|
||||||
if (previousText !== currentText) {
|
if (previousText !== currentText) {
|
||||||
previousText = currentText;
|
previousText = currentText;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,9 @@
|
||||||
*/
|
*/
|
||||||
initialize(options) {
|
initialize(options) {
|
||||||
// Insert the text of the quick edit toggle.
|
// Insert the text of the quick edit toggle.
|
||||||
this.$el.find('a').text(options.strings.quickEdit);
|
this.$el.find('a').each((index, element) => {
|
||||||
|
element.textContent = options.strings.quickEdit;
|
||||||
|
});
|
||||||
// Initial render.
|
// Initial render.
|
||||||
this.render();
|
this.render();
|
||||||
// Re-render whenever this entity's isActive attribute changes.
|
// Re-render whenever this entity's isActive attribute changes.
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize(options) {
|
initialize(options) {
|
||||||
this.$el.find('a').text(options.strings.quickEdit);
|
this.$el.find('a').each((index, element) => {
|
||||||
|
element.textContent = options.strings.quickEdit;
|
||||||
|
});
|
||||||
this.render();
|
this.render();
|
||||||
this.listenTo(this.model, 'change:isActive', this.render);
|
this.listenTo(this.model, 'change:isActive', this.render);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -127,18 +127,18 @@
|
||||||
case 'opened':
|
case 'opened':
|
||||||
// The saving throbber is not managed by AJAX system. The
|
// The saving throbber is not managed by AJAX system. The
|
||||||
// EntityToolbarView manages this visual element.
|
// EntityToolbarView manages this visual element.
|
||||||
|
$button[0].textContent = Drupal.t('Save');
|
||||||
$button
|
$button
|
||||||
.removeClass('action-saving icon-throbber icon-end')
|
.removeClass('action-saving icon-throbber icon-end')
|
||||||
.text(Drupal.t('Save'))
|
|
||||||
.removeAttr('disabled')
|
.removeAttr('disabled')
|
||||||
.attr('aria-hidden', !isDirty);
|
.attr('aria-hidden', !isDirty);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// The changes to the fields of the entity are being committed.
|
// The changes to the fields of the entity are being committed.
|
||||||
case 'committing':
|
case 'committing':
|
||||||
|
$button[0].textContent = Drupal.t('Saving');
|
||||||
$button
|
$button
|
||||||
.addClass('action-saving icon-throbber icon-end')
|
.addClass('action-saving icon-throbber icon-end')
|
||||||
.text(Drupal.t('Saving'))
|
|
||||||
.attr('disabled', 'disabled');
|
.attr('disabled', 'disabled');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,13 @@
|
||||||
|
|
||||||
switch (this.model.get('state')) {
|
switch (this.model.get('state')) {
|
||||||
case 'opened':
|
case 'opened':
|
||||||
$button.removeClass('action-saving icon-throbber icon-end').text(Drupal.t('Save')).removeAttr('disabled').attr('aria-hidden', !isDirty);
|
$button[0].textContent = Drupal.t('Save');
|
||||||
|
$button.removeClass('action-saving icon-throbber icon-end').removeAttr('disabled').attr('aria-hidden', !isDirty);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'committing':
|
case 'committing':
|
||||||
$button.addClass('action-saving icon-throbber icon-end').text(Drupal.t('Saving')).attr('disabled', 'disabled');
|
$button[0].textContent = Drupal.t('Saving');
|
||||||
|
$button.addClass('action-saving icon-throbber icon-end').attr('disabled', 'disabled');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,13 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
editMode = !!editMode;
|
editMode = !!editMode;
|
||||||
const $editButton = $(toggleEditSelector);
|
|
||||||
let $editables;
|
let $editables;
|
||||||
|
const editButton = document.querySelector(toggleEditSelector);
|
||||||
// Turn on edit mode.
|
// Turn on edit mode.
|
||||||
if (editMode) {
|
if (editMode) {
|
||||||
$editButton.text(Drupal.t('Editing'));
|
if (editButton) {
|
||||||
|
editButton.textContent = Drupal.t('Editing');
|
||||||
|
}
|
||||||
closeToolbarTrays();
|
closeToolbarTrays();
|
||||||
|
|
||||||
$editables = $(
|
$editables = $(
|
||||||
|
|
@ -142,8 +144,9 @@
|
||||||
$editables.off('.settingstray');
|
$editables.off('.settingstray');
|
||||||
$(quickEditItemSelector).off('.settingstray');
|
$(quickEditItemSelector).off('.settingstray');
|
||||||
}
|
}
|
||||||
|
if (editButton) {
|
||||||
$editButton.text(Drupal.t('Edit'));
|
editButton.textContent = Drupal.t('Edit');
|
||||||
|
}
|
||||||
closeOffCanvas();
|
closeOffCanvas();
|
||||||
disableQuickEdit();
|
disableQuickEdit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
editMode = !!editMode;
|
editMode = !!editMode;
|
||||||
const $editButton = $(toggleEditSelector);
|
|
||||||
let $editables;
|
let $editables;
|
||||||
|
const editButton = document.querySelector(toggleEditSelector);
|
||||||
|
|
||||||
if (editMode) {
|
if (editMode) {
|
||||||
$editButton.text(Drupal.t('Editing'));
|
if (editButton) {
|
||||||
|
editButton.textContent = Drupal.t('Editing');
|
||||||
|
}
|
||||||
|
|
||||||
closeToolbarTrays();
|
closeToolbarTrays();
|
||||||
$editables = $(once('settingstray', '[data-drupal-settingstray="editable"]'));
|
$editables = $(once('settingstray', '[data-drupal-settingstray="editable"]'));
|
||||||
|
|
||||||
|
|
@ -81,7 +84,10 @@
|
||||||
$(quickEditItemSelector).off('.settingstray');
|
$(quickEditItemSelector).off('.settingstray');
|
||||||
}
|
}
|
||||||
|
|
||||||
$editButton.text(Drupal.t('Edit'));
|
if (editButton) {
|
||||||
|
editButton.textContent = Drupal.t('Edit');
|
||||||
|
}
|
||||||
|
|
||||||
closeOffCanvas();
|
closeOffCanvas();
|
||||||
disableQuickEdit();
|
disableQuickEdit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const $target = $(target);
|
|
||||||
const $preview = $target.find('em');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler that replaces date characters with value.
|
* Event handler that replaces date characters with value.
|
||||||
*
|
*
|
||||||
|
|
@ -47,8 +44,14 @@
|
||||||
dateFormats[key] ? dateFormats[key] : value,
|
dateFormats[key] ? dateFormats[key] : value,
|
||||||
);
|
);
|
||||||
|
|
||||||
$preview.text(dateString);
|
// Set date preview.
|
||||||
$target.toggleClass('js-hide', !dateString.length);
|
target.forEach((item) => {
|
||||||
|
item.querySelectorAll('em').forEach((em) => {
|
||||||
|
em.textContent = dateString;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(target).toggleClass('js-hide', !dateString.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,15 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const $target = $(target);
|
|
||||||
const $preview = $target.find('em');
|
|
||||||
|
|
||||||
function dateFormatHandler(e) {
|
function dateFormatHandler(e) {
|
||||||
const baseValue = e.target.value || '';
|
const baseValue = e.target.value || '';
|
||||||
const dateString = baseValue.replace(/\\?(.?)/gi, (key, value) => dateFormats[key] ? dateFormats[key] : value);
|
const dateString = baseValue.replace(/\\?(.?)/gi, (key, value) => dateFormats[key] ? dateFormats[key] : value);
|
||||||
$preview.text(dateString);
|
target.forEach(item => {
|
||||||
$target.toggleClass('js-hide', !dateString.length);
|
item.querySelectorAll('em').forEach(em => {
|
||||||
|
em.textContent = dateString;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$(target).toggleClass('js-hide', !dateString.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(source).on('keyup.dateFormat change.dateFormat input.dateFormat', dateFormatHandler).trigger('keyup');
|
$(source).on('keyup.dateFormat change.dateFormat input.dateFormat', dateFormatHandler).trigger('keyup');
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,16 @@
|
||||||
const re = new RegExp(`\\b${query}`, 'i');
|
const re = new RegExp(`\\b${query}`, 'i');
|
||||||
|
|
||||||
function showModuleRow(index, row) {
|
function showModuleRow(index, row) {
|
||||||
const $row = $(row);
|
const sources = row.querySelectorAll(
|
||||||
const $sources = $row.find(
|
|
||||||
'.table-filter-text-source, .module-name, .module-description',
|
'.table-filter-text-source, .module-name, .module-description',
|
||||||
);
|
);
|
||||||
const textMatch = $sources.text().search(re) !== -1;
|
let sourcesConcat = '';
|
||||||
$row.closest('tr').toggle(textMatch);
|
// Concatenate the textContent of the elements in the row.
|
||||||
|
sources.forEach((item) => {
|
||||||
|
sourcesConcat += item.textContent;
|
||||||
|
});
|
||||||
|
const textMatch = sourcesConcat.search(re) !== -1;
|
||||||
|
$(row).closest('tr').toggle(textMatch);
|
||||||
}
|
}
|
||||||
// Search over all rows and packages.
|
// Search over all rows and packages.
|
||||||
$rowsAndDetails.show();
|
$rowsAndDetails.show();
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,13 @@
|
||||||
const re = new RegExp(`\\b${query}`, 'i');
|
const re = new RegExp(`\\b${query}`, 'i');
|
||||||
|
|
||||||
function showModuleRow(index, row) {
|
function showModuleRow(index, row) {
|
||||||
const $row = $(row);
|
const sources = row.querySelectorAll('.table-filter-text-source, .module-name, .module-description');
|
||||||
const $sources = $row.find('.table-filter-text-source, .module-name, .module-description');
|
let sourcesConcat = '';
|
||||||
const textMatch = $sources.text().search(re) !== -1;
|
sources.forEach(item => {
|
||||||
$row.closest('tr').toggle(textMatch);
|
sourcesConcat += item.textContent;
|
||||||
|
});
|
||||||
|
const textMatch = sourcesConcat.search(re) !== -1;
|
||||||
|
$(row).closest('tr').toggle(textMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rowsAndDetails.show();
|
$rowsAndDetails.show();
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ drupal.system.modules:
|
||||||
- core/jquery
|
- core/jquery
|
||||||
- core/drupal
|
- core/drupal
|
||||||
- core/drupal.debounce
|
- core/drupal.debounce
|
||||||
|
- core/drupal.nodelist.foreach
|
||||||
- core/once
|
- core/once
|
||||||
- core/jquery.once.bc
|
- core/jquery.once.bc
|
||||||
- core/drupal.announce
|
- core/drupal.announce
|
||||||
|
|
@ -79,6 +80,7 @@ drupal.system.date:
|
||||||
dependencies:
|
dependencies:
|
||||||
- core/jquery
|
- core/jquery
|
||||||
- core/drupal
|
- core/drupal
|
||||||
|
- core/drupal.nodelist.foreach
|
||||||
- core/drupalSettings
|
- core/drupalSettings
|
||||||
- core/once
|
- core/once
|
||||||
- core/jquery.once.bc
|
- core/jquery.once.bc
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,10 @@
|
||||||
attach() {
|
attach() {
|
||||||
const toolbarEscape = once('escapeAdmin', '[data-toolbar-escape-admin]');
|
const toolbarEscape = once('escapeAdmin', '[data-toolbar-escape-admin]');
|
||||||
if (toolbarEscape.length && pathInfo.currentPathIsAdmin) {
|
if (toolbarEscape.length && pathInfo.currentPathIsAdmin) {
|
||||||
const $toolbarEscape = $(toolbarEscape);
|
|
||||||
if (escapeAdminPath !== null) {
|
if (escapeAdminPath !== null) {
|
||||||
$toolbarEscape.attr('href', escapeAdminPath);
|
$(toolbarEscape).attr('href', escapeAdminPath);
|
||||||
} else {
|
} else {
|
||||||
$toolbarEscape.text(Drupal.t('Home'));
|
toolbarEscape[0].textContent = Drupal.t('Home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,10 @@
|
||||||
const toolbarEscape = once('escapeAdmin', '[data-toolbar-escape-admin]');
|
const toolbarEscape = once('escapeAdmin', '[data-toolbar-escape-admin]');
|
||||||
|
|
||||||
if (toolbarEscape.length && pathInfo.currentPathIsAdmin) {
|
if (toolbarEscape.length && pathInfo.currentPathIsAdmin) {
|
||||||
const $toolbarEscape = $(toolbarEscape);
|
|
||||||
|
|
||||||
if (escapeAdminPath !== null) {
|
if (escapeAdminPath !== null) {
|
||||||
$toolbarEscape.attr('href', escapeAdminPath);
|
$(toolbarEscape).attr('href', escapeAdminPath);
|
||||||
} else {
|
} else {
|
||||||
$toolbarEscape.text(Drupal.t('Home'));
|
toolbarEscape[0].textContent = Drupal.t('Home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,10 @@
|
||||||
// Twist the toggle.
|
// Twist the toggle.
|
||||||
$toggle.toggleClass('open', switcher);
|
$toggle.toggleClass('open', switcher);
|
||||||
// Adjust the toggle text.
|
// Adjust the toggle text.
|
||||||
$toggle
|
$toggle.find('.action').each((index, element) => {
|
||||||
.find('.action')
|
|
||||||
// Expand Structure, Collapse Structure.
|
// Expand Structure, Collapse Structure.
|
||||||
.text(switcher ? ui.handleClose : ui.handleOpen);
|
element.textContent = switcher ? ui.handleClose : ui.handleOpen;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -107,8 +107,9 @@
|
||||||
const $item = $(element);
|
const $item = $(element);
|
||||||
if ($item.children('ul.toolbar-menu').length) {
|
if ($item.children('ul.toolbar-menu').length) {
|
||||||
const $box = $item.children('.toolbar-box');
|
const $box = $item.children('.toolbar-box');
|
||||||
|
const $link = $box.find('a');
|
||||||
options.text = Drupal.t('@label', {
|
options.text = Drupal.t('@label', {
|
||||||
'@label': $box.find('a').text(),
|
'@label': $link.length ? $link[0].textContent : '',
|
||||||
});
|
});
|
||||||
$item
|
$item
|
||||||
.children('.toolbar-box')
|
.children('.toolbar-box')
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@
|
||||||
switcher = typeof switcher !== 'undefined' ? switcher : !$item.hasClass('open');
|
switcher = typeof switcher !== 'undefined' ? switcher : !$item.hasClass('open');
|
||||||
$item.toggleClass('open', switcher);
|
$item.toggleClass('open', switcher);
|
||||||
$toggle.toggleClass('open', switcher);
|
$toggle.toggleClass('open', switcher);
|
||||||
$toggle.find('.action').text(switcher ? ui.handleClose : ui.handleOpen);
|
$toggle.find('.action').each((index, element) => {
|
||||||
|
element.textContent = switcher ? ui.handleClose : ui.handleOpen;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleClickHandler(event) {
|
function toggleClickHandler(event) {
|
||||||
|
|
@ -50,8 +52,9 @@
|
||||||
|
|
||||||
if ($item.children('ul.toolbar-menu').length) {
|
if ($item.children('ul.toolbar-menu').length) {
|
||||||
const $box = $item.children('.toolbar-box');
|
const $box = $item.children('.toolbar-box');
|
||||||
|
const $link = $box.find('a');
|
||||||
options.text = Drupal.t('@label', {
|
options.text = Drupal.t('@label', {
|
||||||
'@label': $box.find('a').text()
|
'@label': $link.length ? $link[0].textContent : ''
|
||||||
});
|
});
|
||||||
$item.children('.toolbar-box').append(Drupal.theme('toolbarMenuItemToggle', options));
|
$item.children('.toolbar-box').append(Drupal.theme('toolbarMenuItemToggle', options));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -292,9 +292,9 @@
|
||||||
$orientationToggleButton[0].value = antiOrientation;
|
$orientationToggleButton[0].value = antiOrientation;
|
||||||
$orientationToggleButton
|
$orientationToggleButton
|
||||||
.attr('title', this.strings[antiOrientation])
|
.attr('title', this.strings[antiOrientation])
|
||||||
.text(this.strings[antiOrientation])
|
|
||||||
.removeClass(iconClass)
|
.removeClass(iconClass)
|
||||||
.addClass(iconAntiClass);
|
.addClass(iconAntiClass);
|
||||||
|
$orientationToggleButton[0].textContent = this.strings[antiOrientation];
|
||||||
|
|
||||||
// Update data offset attributes for the trays.
|
// Update data offset attributes for the trays.
|
||||||
const dir = document.documentElement.dir;
|
const dir = document.documentElement.dir;
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,8 @@
|
||||||
const $orientationToggle = this.$el.find('.toolbar-toggle-orientation').toggle(this.model.get('isTrayToggleVisible'));
|
const $orientationToggle = this.$el.find('.toolbar-toggle-orientation').toggle(this.model.get('isTrayToggleVisible'));
|
||||||
const $orientationToggleButton = $orientationToggle.find('button');
|
const $orientationToggleButton = $orientationToggle.find('button');
|
||||||
$orientationToggleButton[0].value = antiOrientation;
|
$orientationToggleButton[0].value = antiOrientation;
|
||||||
$orientationToggleButton.attr('title', this.strings[antiOrientation]).text(this.strings[antiOrientation]).removeClass(iconClass).addClass(iconAntiClass);
|
$orientationToggleButton.attr('title', this.strings[antiOrientation]).removeClass(iconClass).addClass(iconAntiClass);
|
||||||
|
$orientationToggleButton[0].textContent = this.strings[antiOrientation];
|
||||||
const dir = document.documentElement.dir;
|
const dir = document.documentElement.dir;
|
||||||
const edge = dir === 'rtl' ? 'right' : 'left';
|
const edge = dir === 'rtl' ? 'right' : 'left';
|
||||||
$trays.removeAttr('data-offset-left data-offset-right data-offset-top');
|
$trays.removeAttr('data-offset-left data-offset-right data-offset-top');
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,9 @@
|
||||||
re,
|
re,
|
||||||
`${response.title} $1 ${response.siteName}`,
|
`${response.title} $1 ${response.siteName}`,
|
||||||
);
|
);
|
||||||
|
document.querySelectorAll('h1.page-title').forEach((item) => {
|
||||||
$('h1.page-title').text(response.title);
|
item.textContent = response.title;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,9 @@
|
||||||
const escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
const escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
const re = new RegExp(`.+ (.) ${escapedSiteName}`);
|
const re = new RegExp(`.+ (.) ${escapedSiteName}`);
|
||||||
doc.title = oldTitle.replace(re, `${response.title} $1 ${response.siteName}`);
|
doc.title = oldTitle.replace(re, `${response.title} $1 ${response.siteName}`);
|
||||||
$('h1.page-title').text(response.title);
|
document.querySelectorAll('h1.page-title').forEach(item => {
|
||||||
|
item.textContent = response.title;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Drupal.theme.tableDragChangedWarning = function () {
|
Drupal.theme.tableDragChangedWarning = function () {
|
||||||
|
|
|
||||||
|
|
@ -537,8 +537,7 @@
|
||||||
$description = $option.find('.description');
|
$description = $option.find('.description');
|
||||||
options[i] = {
|
options[i] = {
|
||||||
// Search on the lowercase version of the title text + description.
|
// Search on the lowercase version of the title text + description.
|
||||||
searchText: `${$title.text().toLowerCase()} ${$description
|
searchText: `${$title[0].textContent.toLowerCase()} ${$description[0].textContent.toLowerCase()}
|
||||||
.text()
|
|
||||||
.toLowerCase()}`,
|
.toLowerCase()}`,
|
||||||
// Maintain a reference to the jQuery object for each row, so we don't
|
// Maintain a reference to the jQuery object for each row, so we don't
|
||||||
// have to create a new object inside the performance-sensitive keyup
|
// have to create a new object inside the performance-sensitive keyup
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,8 @@
|
||||||
$title = $option.find('.title');
|
$title = $option.find('.title');
|
||||||
$description = $option.find('.description');
|
$description = $option.find('.description');
|
||||||
options[i] = {
|
options[i] = {
|
||||||
searchText: `${$title.text().toLowerCase()} ${$description.text().toLowerCase()}`,
|
searchText: `${$title[0].textContent.toLowerCase()} ${$description[0].textContent.toLowerCase()}
|
||||||
|
.toLowerCase()}`,
|
||||||
$div: $option
|
$div: $option
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,15 @@
|
||||||
const query = e.target.value.toLowerCase();
|
const query = e.target.value.toLowerCase();
|
||||||
|
|
||||||
function showViewRow(index, row) {
|
function showViewRow(index, row) {
|
||||||
const $row = $(row);
|
const sources = row.querySelectorAll(
|
||||||
const $sources = $row.find(
|
|
||||||
'[data-drupal-selector="views-table-filter-text-source"]',
|
'[data-drupal-selector="views-table-filter-text-source"]',
|
||||||
);
|
);
|
||||||
const textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
|
let sourcesConcat = '';
|
||||||
$row.closest('tr').toggle(textMatch);
|
sources.forEach((item) => {
|
||||||
|
sourcesConcat += item.textContent;
|
||||||
|
});
|
||||||
|
const textMatch = sourcesConcat.toLowerCase().indexOf(query) !== -1;
|
||||||
|
$(row).closest('tr').toggle(textMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter if the length of the query is at least 2 characters.
|
// Filter if the length of the query is at least 2 characters.
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,13 @@
|
||||||
const query = e.target.value.toLowerCase();
|
const query = e.target.value.toLowerCase();
|
||||||
|
|
||||||
function showViewRow(index, row) {
|
function showViewRow(index, row) {
|
||||||
const $row = $(row);
|
const sources = row.querySelectorAll('[data-drupal-selector="views-table-filter-text-source"]');
|
||||||
const $sources = $row.find('[data-drupal-selector="views-table-filter-text-source"]');
|
let sourcesConcat = '';
|
||||||
const textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
|
sources.forEach(item => {
|
||||||
$row.closest('tr').toggle(textMatch);
|
sourcesConcat += item.textContent;
|
||||||
|
});
|
||||||
|
const textMatch = sourcesConcat.toLowerCase().indexOf(query) !== -1;
|
||||||
|
$(row).closest('tr').toggle(textMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.length >= 2) {
|
if (query.length >= 2) {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ views_ui.admin:
|
||||||
- core/drupal.form
|
- core/drupal.form
|
||||||
- core/drupal.ajax
|
- core/drupal.ajax
|
||||||
- core/drupal.dropbutton
|
- core/drupal.dropbutton
|
||||||
|
- core/drupal.nodelist.foreach
|
||||||
- views/views.ajax
|
- views/views.ajax
|
||||||
- views_ui/admin.styling
|
- views_ui/admin.styling
|
||||||
|
|
||||||
|
|
@ -24,6 +25,7 @@ views_ui.listing:
|
||||||
dependencies:
|
dependencies:
|
||||||
- core/jquery
|
- core/jquery
|
||||||
- core/drupal
|
- core/drupal
|
||||||
|
- core/drupal.string.includes
|
||||||
- core/once
|
- core/once
|
||||||
- core/jquery.once.bc
|
- core/jquery.once.bc
|
||||||
- views_ui/admin.styling
|
- views_ui/admin.styling
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
const $that = $(this);
|
const $that = $(this);
|
||||||
/* eslint-disable new-cap */
|
/* eslint-disable new-cap */
|
||||||
const verticalTab = new Drupal.verticalTab({
|
const verticalTab = new Drupal.verticalTab({
|
||||||
title: $that.find('> summary').text(),
|
title: $that.find('> summary')[0].textContent,
|
||||||
details: $that,
|
details: $that,
|
||||||
});
|
});
|
||||||
/* eslint-enable new-cap */
|
/* eslint-enable new-cap */
|
||||||
|
|
@ -394,16 +394,14 @@
|
||||||
*/
|
*/
|
||||||
Drupal.theme.verticalTab = (settings) => {
|
Drupal.theme.verticalTab = (settings) => {
|
||||||
const tab = {};
|
const tab = {};
|
||||||
|
tab.title = $('<strong class="vertical-tabs__menu-link-title"></strong>');
|
||||||
|
tab.title[0].textContent = settings.title;
|
||||||
tab.item = $(
|
tab.item = $(
|
||||||
'<li class="vertical-tabs__menu-item" tabindex="-1"></li>',
|
'<li class="vertical-tabs__menu-item" tabindex="-1"></li>',
|
||||||
).append(
|
).append(
|
||||||
(tab.link = $('<a href="#" class="vertical-tabs__menu-link"></a>').append(
|
(tab.link = $('<a href="#" class="vertical-tabs__menu-link"></a>').append(
|
||||||
$('<span class="vertical-tabs__menu-link-content"></span>')
|
$('<span class="vertical-tabs__menu-link-content"></span>')
|
||||||
.append(
|
.append(tab.title)
|
||||||
(tab.title = $(
|
|
||||||
'<strong class="vertical-tabs__menu-link-title"></strong>',
|
|
||||||
).text(settings.title)),
|
|
||||||
)
|
|
||||||
.append(
|
.append(
|
||||||
(tab.summary = $(
|
(tab.summary = $(
|
||||||
'<span class="vertical-tabs__menu-link-summary"></span>',
|
'<span class="vertical-tabs__menu-link-summary"></span>',
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
$details.each(function initializeVerticalTabItems() {
|
$details.each(function initializeVerticalTabItems() {
|
||||||
const $that = $(this);
|
const $that = $(this);
|
||||||
const verticalTab = new Drupal.verticalTab({
|
const verticalTab = new Drupal.verticalTab({
|
||||||
title: $that.find('> summary').text(),
|
title: $that.find('> summary')[0].textContent,
|
||||||
details: $that
|
details: $that
|
||||||
});
|
});
|
||||||
tabList.append(verticalTab.item);
|
tabList.append(verticalTab.item);
|
||||||
|
|
@ -166,7 +166,9 @@
|
||||||
|
|
||||||
Drupal.theme.verticalTab = settings => {
|
Drupal.theme.verticalTab = settings => {
|
||||||
const tab = {};
|
const tab = {};
|
||||||
tab.item = $('<li class="vertical-tabs__menu-item" tabindex="-1"></li>').append(tab.link = $('<a href="#" class="vertical-tabs__menu-link"></a>').append($('<span class="vertical-tabs__menu-link-content"></span>').append(tab.title = $('<strong class="vertical-tabs__menu-link-title"></strong>').text(settings.title)).append(tab.summary = $('<span class="vertical-tabs__menu-link-summary"></span>'))));
|
tab.title = $('<strong class="vertical-tabs__menu-link-title"></strong>');
|
||||||
|
tab.title[0].textContent = settings.title;
|
||||||
|
tab.item = $('<li class="vertical-tabs__menu-item" tabindex="-1"></li>').append(tab.link = $('<a href="#" class="vertical-tabs__menu-link"></a>').append($('<span class="vertical-tabs__menu-link-content"></span>').append(tab.title).append(tab.summary = $('<span class="vertical-tabs__menu-link-summary"></span>'))));
|
||||||
return tab;
|
return tab;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue