Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions js/layout/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,23 +375,26 @@ $(function() {
$(this).text('Show');
};
});

//prepare the advanced search js / no js verions method selection
$('#search-tabbed #page-sort').prepend('<input type="hidden" name="method" value="autoSearch">');
$('.no-js-search-method input[checked]').attr('checked', false);

//prepare the advanced search textfield
$('#search-tabbed #page-sort').prepend('<input type="hidden" name="method" value="autoSearch">');

var $methodRadios = $('[name="method"]');
var $methodButtons = $('[data-type-name]');
var selectMethod = function () {
$('[name="method"]').attr('value', $(this).data('type-name'));
$methodRadios.prop('checked', false)
.filter('[value="' + $(this).data('type-name') + '"]')
.prop('checked', true);
}
$('[data-type-name]').on('click', selectMethod);
$('[data-type-name]').on('keydown', function (e) {
$methodButtons.on('click', selectMethod);
$methodButtons.on('keydown', function (e) {
if ([32, 13].indexOf(e.keyCode) !== -1) {
selectMethod.call(this);
}
});

// Wait for scripts initialization
setTimeout(function () {
$methodButtons.filter('[data-type-name="' + $methodRadios.filter(':checked').val() + '"]').click();
}, 0);

//tick anything as true by populating any hidden field
$('[data-type-hidden]').on('click', function () {
var nameValue = $(this).data('type-hidden');
Expand Down
23 changes: 13 additions & 10 deletions js/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -1804,23 +1804,26 @@ $(function() {
$(this).text('Show');
};
});

//prepare the advanced search js / no js verions method selection
$('#search-tabbed #page-sort').prepend('<input type="hidden" name="method" value="autoSearch">');
$('.no-js-search-method input[checked]').attr('checked', false);

//prepare the advanced search textfield
$('#search-tabbed #page-sort').prepend('<input type="hidden" name="method" value="autoSearch">');

var $methodRadios = $('[name="method"]');
var $methodButtons = $('[data-type-name]');
var selectMethod = function () {
$('[name="method"]').attr('value', $(this).data('type-name'));
$methodRadios.prop('checked', false)
.filter('[value="' + $(this).data('type-name') + '"]')
.prop('checked', true);
}
$('[data-type-name]').on('click', selectMethod);
$('[data-type-name]').on('keydown', function (e) {
$methodButtons.on('click', selectMethod);
$methodButtons.on('keydown', function (e) {
if ([32, 13].indexOf(e.keyCode) !== -1) {
selectMethod.call(this);
}
});

// Wait for scripts initialization
setTimeout(function () {
$methodButtons.filter('[data-type-name="' + $methodRadios.filter(':checked').val() + '"]').click();
}, 0);

//tick anything as true by populating any hidden field
$('[data-type-hidden]').on('click', function () {
var nameValue = $(this).data('type-hidden');
Expand Down
6 changes: 3 additions & 3 deletions js/production.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion search-tabbed.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
panel: none
---

<form id="search-tabbed" action="results-search.html" class="form-remove-query-duplicates">
<form id="search-tabbed" action="results-search.html">

<div id="page-sort" class="tabs-block sort-tabs">
<ul>
Expand Down