Replace jQuery.fn.event() shorthand with trigger if called without a method

pull/4094/merge
Janneke Janssen 2017-11-14 20:09:20 +01:00 zatwierdzone przez Matt Westcott
rodzic 2803c47f08
commit bb6ed6102e
12 zmienionych plików z 14 dodań i 14 usunięć

Wyświetl plik

@ -53,7 +53,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
// focus first suitable input found
var timeout = setTimeout(function() {
$('.input input,.input textarea,.input .richtext', self.container).first().focus();
$('.input input,.input textarea,.input .richtext', self.container).first().trigger('focus');
}, 250);
};

Wyświetl plik

@ -180,7 +180,7 @@ $(function() {
$(document).on('click', '.tab-toggle', function(e) {
e.preventDefault();
$('.tab-nav a[href="' + $(this).attr('href') + '"]').click();
$('.tab-nav a[href="' + $(this).attr('href') + '"]').trigger('click');
});
$('.dropdown').each(function() {

Wyświetl plik

@ -386,7 +386,7 @@ $(function() {
$form.on('change keyup DOMSubtreeModified', function () {
clearTimeout(autoUpdatePreviewDataTimeout);
autoUpdatePreviewDataTimeout = setTimeout(setPreviewData, 1000);
}).change();
}).trigger('change');
}
});

Wyświetl plik

@ -93,5 +93,5 @@ function(modal) {
Focus on the search box when opening the modal.
FIXME: this doesn't seem to have any effect (at least on Chrome)
*/
$('#id_q', modal.body).focus();
$('#id_q', modal.body).trigger('focus');
}

Wyświetl plik

@ -23,5 +23,5 @@ function(modal) {
}
refreshFormFields();
$("input[name='restriction_type']", modal.body).change(refreshFormFields);
$("input[name='restriction_type']", modal.body).trigger('change', refreshFormFields);
}

Wyświetl plik

@ -95,7 +95,7 @@
{{ block.super }}
<script>
$(function(){
$('form input[name=username]').focus();
$('form input[name=username]').trigger('focus');
})
</script>
{% endblock %}

Wyświetl plik

@ -23,5 +23,5 @@ function(modal) {
}
refreshFormFields();
$("input[name='restriction_type']", modal.body).change(refreshFormFields);
$("input[name='restriction_type']", modal.body).trigger('change', refreshFormFields);
}

Wyświetl plik

@ -75,7 +75,7 @@
<script>
$(function(){
$('#page-edit-form .tab-content section.active input').first().focus();
$('#page-edit-form .tab-content section.active input').first().trigger('focus');
/* Make user confirm before leaving the editor if there are unsaved changes */
{% trans "This page has unsaved changes." as confirmation_message %}

Wyświetl plik

@ -83,7 +83,7 @@ function(modal) {
$(this).data('timer', wait);
});
$('#collection_chooser_collection_id').change(search);
$('#collection_chooser_collection_id').trigger('change', search);
{% url 'wagtailadmin_tag_autocomplete' as autocomplete_url %}
$('#id_tags', modal.body).tagit({

Wyświetl plik

@ -68,13 +68,13 @@ $(function() {
});
}
$form.change($.debounce(500, formChangeHandler));
$form.keyup($.debounce(500, formChangeHandler));
$form.trigger('change', $.debounce(500, formChangeHandler));
$form.trigger('keyup', $.debounce(500, formChangeHandler));
formChangeHandler();
// When the user clicks the URL, automatically select the whole thing (for easier copying)
$result.on('click', function() {
$(this).select();
$(this).trigger('select');
});
});
});

Wyświetl plik

@ -90,7 +90,7 @@ function(modal) {
var wait = setTimeout(search, 200);
$(this).data('timer', wait);
});
$('#collection_chooser_collection_id').change(search);
$('#collection_chooser_collection_id').trigger('change', search);
$('a.suggested-tag').on('click', function() {
currentTag = $(this).text();
$('#id_q').val('');

Wyświetl plik

@ -1,7 +1,7 @@
function(modal) {
function ajaxifyLinks (context) {
$('.listing a.choose-query', context).click(chooseQuery);
$('.listing a.choose-query', context).trigger('click', chooseQuery);
$('.pagination a', context).on('click', function() {
var page = this.getAttribute("data-page");