updated to use drupal once function instead of jquery once
This commit is contained in:
parent
469bd8005d
commit
4c8c26f4b2
5 changed files with 12 additions and 11 deletions
|
|
@ -3,6 +3,7 @@ advanced.search.admin:
|
||||||
js/advanced_search.admin.js: {}
|
js/advanced_search.admin.js: {}
|
||||||
dependencies:
|
dependencies:
|
||||||
- core/drupal.tabledrag
|
- core/drupal.tabledrag
|
||||||
|
- core/once
|
||||||
|
|
||||||
advanced.search.form:
|
advanced.search.form:
|
||||||
js:
|
js:
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
updateFieldWeights(table, regionName);
|
updateFieldWeights(table, regionName);
|
||||||
};
|
};
|
||||||
|
|
||||||
$(context).find('select.field-display').once('field-display').on('change', function (event) {
|
$(once('field-display', 'select.field-display', context)).on('change', function (event) {
|
||||||
var row = $(this).closest('tr');
|
var row = $(this).closest('tr');
|
||||||
var select = $(this);
|
var select = $(this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
Drupal.behaviors.advanced_search_form = {
|
Drupal.behaviors.advanced_search_form = {
|
||||||
attach: function (context, settings) {
|
attach: function (context, settings) {
|
||||||
if (settings.advanced_search_form.id !== 'undefined') {
|
if (settings.advanced_search_form.id !== 'undefined') {
|
||||||
const $form = $('form#' + settings.advanced_search_form.id).once();
|
const $form = $(once('search-form', 'form#' + settings.advanced_search_form.id));
|
||||||
if ($form.length > 0) {
|
if ($form.length > 0) {
|
||||||
window.addEventListener("pushstate", function (e) {
|
window.addEventListener("pushstate", function (e) {
|
||||||
$form.attr('action', window.location.pathname + window.location.search);
|
$form.attr('action', window.location.pathname + window.location.search);
|
||||||
|
|
|
||||||
|
|
@ -171,8 +171,11 @@
|
||||||
"-" +
|
"-" +
|
||||||
settings.view_display_id.replace(/_/g, "-")
|
settings.view_display_id.replace(/_/g, "-")
|
||||||
);
|
);
|
||||||
exposed_form
|
$(once('exposed-form',
|
||||||
.once()
|
"form#views-exposed-form-" +
|
||||||
|
settings.view_name.replace(/_/g, "-") +
|
||||||
|
"-" +
|
||||||
|
settings.view_display_id.replace(/_/g, "-")))
|
||||||
.find("input[type=submit], input[type=image]")
|
.find("input[type=submit], input[type=image]")
|
||||||
.not("[data-drupal-selector=edit-reset]")
|
.not("[data-drupal-selector=edit-reset]")
|
||||||
.each(function (index) {
|
.each(function (index) {
|
||||||
|
|
@ -228,8 +231,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach behavior to pager, summary, facet links.
|
// Attach behavior to pager, summary, facet links.
|
||||||
$("[data-drupal-pager-id], [data-drupal-facets-summary-id], [data-drupal-facet-id]")
|
$(once("new-window", "[data-drupal-pager-id], [data-drupal-facets-summary-id], [data-drupal-facet-id]"))
|
||||||
.once()
|
|
||||||
.find("a:not(.facet-item)")
|
.find("a:not(.facet-item)")
|
||||||
.click(function (e) {
|
.click(function (e) {
|
||||||
// Let ctrl/cmd click open in a new window.
|
// Let ctrl/cmd click open in a new window.
|
||||||
|
|
@ -245,8 +247,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
/* digitalutsc added */
|
/* digitalutsc added */
|
||||||
$('.pager__sort select[name="order"]')
|
$(once('params-sort', '.pager__sort select[name="order"]'))
|
||||||
.once()
|
|
||||||
.change(function () {
|
.change(function () {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
var params = Drupal.Views.parseQueryString(href);
|
var params = Drupal.Views.parseQueryString(href);
|
||||||
|
|
@ -263,8 +264,7 @@
|
||||||
|
|
||||||
|
|
||||||
// Trigger on sort change.
|
// Trigger on sort change.
|
||||||
$('[data-drupal-pager-id] select[name="order"]')
|
$(once('sort-change', '[data-drupal-pager-id] select[name="order"]'))
|
||||||
.once()
|
|
||||||
.change(function () {
|
.change(function () {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
var params = Drupal.Views.parseQueryString(href);
|
var params = Drupal.Views.parseQueryString(href);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
// Hide facets over the limit.
|
// Hide facets over the limit.
|
||||||
facetsList.each(function () {
|
facetsList.each(function () {
|
||||||
$(this).children('li:gt(' + zero_based_limit + ')').once('applysoftlimit').hide();
|
$(once('applysoftlimit', $(this).children('li:gt(' + zero_based_limit + ')'))).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue