mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-29 02:29:21 +02:00
Merge branch '3.3.x'
This commit is contained in:
commit
e1dce434db
@ -11,7 +11,9 @@ phpbb.alertTime = 100;
|
|||||||
var keymap = {
|
var keymap = {
|
||||||
TAB: 9,
|
TAB: 9,
|
||||||
ENTER: 13,
|
ENTER: 13,
|
||||||
ESC: 27
|
ESC: 27,
|
||||||
|
ARROW_UP: 38,
|
||||||
|
ARROW_DOWN: 40
|
||||||
};
|
};
|
||||||
|
|
||||||
var $dark = $('#darkenwrapper');
|
var $dark = $('#darkenwrapper');
|
||||||
@ -557,7 +559,7 @@ phpbb.search.setValue = function($input, value, multiline) {
|
|||||||
phpbb.search.setValueOnClick = function($input, value, $row, $container) {
|
phpbb.search.setValueOnClick = function($input, value, $row, $container) {
|
||||||
$row.click(function() {
|
$row.click(function() {
|
||||||
phpbb.search.setValue($input, value.result, $input.attr('data-multiline'));
|
phpbb.search.setValue($input, value.result, $input.attr('data-multiline'));
|
||||||
$container.hide();
|
phpbb.search.closeResults($input, $container);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -571,7 +573,7 @@ phpbb.search.setValueOnClick = function($input, value, $row, $container) {
|
|||||||
* @param {object} event Onkeyup event object.
|
* @param {object} event Onkeyup event object.
|
||||||
* @param {function} sendRequest Function to execute AJAX request.
|
* @param {function} sendRequest Function to execute AJAX request.
|
||||||
*
|
*
|
||||||
* @returns {bool} Returns false.
|
* @returns {boolean} Returns false.
|
||||||
*/
|
*/
|
||||||
phpbb.search.filter = function(data, event, sendRequest) {
|
phpbb.search.filter = function(data, event, sendRequest) {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
@ -580,9 +582,16 @@ phpbb.search.filter = function(data, event, sendRequest) {
|
|||||||
searchID = $this.attr('data-results'),
|
searchID = $this.attr('data-results'),
|
||||||
keyword = phpbb.search.getKeyword($this, data[dataName], $this.attr('data-multiline')),
|
keyword = phpbb.search.getKeyword($this, data[dataName], $this.attr('data-multiline')),
|
||||||
cache = phpbb.search.cache.get(searchID),
|
cache = phpbb.search.cache.get(searchID),
|
||||||
|
key = event.keyCode || event.which,
|
||||||
proceed = true;
|
proceed = true;
|
||||||
data[dataName] = keyword;
|
data[dataName] = keyword;
|
||||||
|
|
||||||
|
// No need to search if enter was pressed
|
||||||
|
// for selecting a value from the results.
|
||||||
|
if (key === keymap.ENTER) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (cache.timeout) {
|
if (cache.timeout) {
|
||||||
clearTimeout(cache.timeout);
|
clearTimeout(cache.timeout);
|
||||||
}
|
}
|
||||||
@ -693,22 +702,106 @@ phpbb.search.showResults = function(results, $input, $container, callback) {
|
|||||||
row.appendTo($resultContainer).show();
|
row.appendTo($resultContainer).show();
|
||||||
});
|
});
|
||||||
$container.show();
|
$container.show();
|
||||||
|
|
||||||
|
phpbb.search.navigateResults($input, $container, $resultContainer);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear search results.
|
* Clear search results.
|
||||||
*
|
*
|
||||||
* @param {jQuery} $container Search results container.
|
* @param {jQuery} $container Search results container.
|
||||||
*/
|
*/
|
||||||
phpbb.search.clearResults = function($container) {
|
phpbb.search.clearResults = function($container) {
|
||||||
$container.children(':not(.search-result-tpl)').remove();
|
$container.children(':not(.search-result-tpl)').remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close search results.
|
||||||
|
*
|
||||||
|
* @param {jQuery} $input Search input|textarea.
|
||||||
|
* @param {jQuery} $container Search results container.
|
||||||
|
*/
|
||||||
|
phpbb.search.closeResults = function($input, $container) {
|
||||||
|
$input.off('.phpbb.search');
|
||||||
|
$container.hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigate search results.
|
||||||
|
*
|
||||||
|
* @param {jQuery} $input Search input|textarea.
|
||||||
|
* @param {jQuery} $container Search results container.
|
||||||
|
* @param {jQuery} $resultContainer Search results list container.
|
||||||
|
*/
|
||||||
|
phpbb.search.navigateResults = function($input, $container, $resultContainer) {
|
||||||
|
// Add a namespace to the event (.phpbb.search),
|
||||||
|
// so it can be unbound specifically later on.
|
||||||
|
$input.on('keydown.phpbb.search', function(event) {
|
||||||
|
var key = event.keyCode || event.which,
|
||||||
|
$active = $resultContainer.children('.active');
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
// Close the results
|
||||||
|
case keymap.ESC:
|
||||||
|
phpbb.search.closeResults($input, $container);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Set the value for the selected result
|
||||||
|
case keymap.ENTER:
|
||||||
|
if ($active.length) {
|
||||||
|
var value = $active.find('.search-result > span').text();
|
||||||
|
|
||||||
|
phpbb.search.setValue($input, value, $input.attr('data-multiline'));
|
||||||
|
}
|
||||||
|
|
||||||
|
phpbb.search.closeResults($input, $container);
|
||||||
|
|
||||||
|
// Do not submit the form
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Navigate the results
|
||||||
|
case keymap.ARROW_DOWN:
|
||||||
|
case keymap.ARROW_UP:
|
||||||
|
var up = key === keymap.ARROW_UP,
|
||||||
|
$children = $resultContainer.children();
|
||||||
|
|
||||||
|
if (!$active.length) {
|
||||||
|
if (up) {
|
||||||
|
$children.last().addClass('active');
|
||||||
|
} else {
|
||||||
|
$children.first().addClass('active');
|
||||||
|
}
|
||||||
|
} else if ($children.length > 1) {
|
||||||
|
if (up) {
|
||||||
|
if ($active.is(':first-child')) {
|
||||||
|
$children.last().addClass('active');
|
||||||
|
} else {
|
||||||
|
$active.prev().addClass('active');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($active.is(':last-child')) {
|
||||||
|
$children.first().addClass('active');
|
||||||
|
} else {
|
||||||
|
$active.next().addClass('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$active.removeClass('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not change cursor position in the input element
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$('#phpbb').click(function() {
|
$('#phpbb').click(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
if (!$this.is('.live-search') && !$this.parents().is('.live-search')) {
|
if (!$this.is('.live-search') && !$this.parents().is('.live-search')) {
|
||||||
$('.live-search').hide();
|
phpbb.search.closeResults($('input, textarea'), $('.live-search'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<dt><label for="username">{L_USERNAME}{L_COLON}</label></dt>
|
<dt><label for="username">{L_USERNAME}{L_COLON}</label></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<!-- IF U_LIVE_SEARCH --><div class="dropdown-container dropdown-{S_CONTENT_FLOW_END}"><!-- ENDIF -->
|
<!-- IF U_LIVE_SEARCH --><div class="dropdown-container dropdown-{S_CONTENT_FLOW_END}"><!-- ENDIF -->
|
||||||
<input type="text" name="username" id="username" value="{USERNAME}" class="inputbox"<!-- IF U_LIVE_SEARCH --> autocomplete="off" data-filter="phpbb.search.filter" data-ajax="member_search" data-min-length="3" data-url="{U_LIVE_SEARCH}" data-results="#user-search" data-overlay="false"<!-- ENDIF --> />
|
<input type="text" name="username" id="username" value="{USERNAME}" class="inputbox"<!-- IF U_LIVE_SEARCH --> autocomplete="off" data-filter="phpbb.search.filter" data-ajax="member_search" data-min-length="3" data-url="{U_LIVE_SEARCH}" data-results="#user-search"<!-- ENDIF --> />
|
||||||
<!-- IF U_LIVE_SEARCH -->
|
<!-- IF U_LIVE_SEARCH -->
|
||||||
<div class="dropdown live-search hidden" id="user-search">
|
<div class="dropdown live-search hidden" id="user-search">
|
||||||
<div class="pointer"><div class="pointer-inner"></div></div>
|
<div class="pointer"><div class="pointer-inner"></div></div>
|
||||||
|
@ -703,6 +703,11 @@ dd.profile-warnings {
|
|||||||
box-shadow: 0 0 10px #0077b3;
|
box-shadow: 0 0 10px #0077b3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-results li:hover,
|
||||||
|
.search-results li.active {
|
||||||
|
background-color: #cfe1f6;
|
||||||
|
}
|
||||||
|
|
||||||
/* icon images */
|
/* icon images */
|
||||||
.site_logo { background-image: url("./images/site_logo.gif"); }
|
.site_logo { background-image: url("./images/site_logo.gif"); }
|
||||||
.contact-icon { background-image: url("./images/icons_contact.png"); }
|
.contact-icon { background-image: url("./images/icons_contact.png"); }
|
||||||
|
@ -345,7 +345,8 @@ input[type="button"],
|
|||||||
input[type="submit"],
|
input[type="submit"],
|
||||||
input[type="reset"],
|
input[type="reset"],
|
||||||
input[type="checkbox"],
|
input[type="checkbox"],
|
||||||
input[type="radio"] {
|
input[type="radio"],
|
||||||
|
.search-results li {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user