return _isKey(event, 'ArrowUp', 38);
},
+ /**
+ * Returns true if pressed key equals 'Comma'.
+ *
+ * @param {Event} event event object
+ * @return {boolean}
+ */
+ Comma: function(event) {
+ return _isKey(event, ',', 44);
+ },
+
/**
* Returns true if pressed key equals 'Enter'.
*
[
'Ajax', 'Core', 'Dictionary', 'Dom/ChangeListener',
'Dom/Traverse', 'Language', 'Ui/Dialog', 'Ui/Notification',
- 'WoltLabSuite/Core/Language/Chooser', 'WoltLabSuite/Core/Language/Input'
+ 'WoltLabSuite/Core/Language/Chooser', 'WoltLabSuite/Core/Language/Input', 'EventKey'
],
function(
Ajax, Core, Dictionary, DomChangeListener,
DomTraverse, Language, UiDialog, UiNotification,
- LanguageChooser, LanguageInput
+ LanguageChooser, LanguageInput, EventKey
)
{
"use strict";
* @param {object} event event object
*/
_keyPress: function(event) {
- // 13 = [ENTER]
- if (event.charCode === 13) {
+ if (EventKey.Enter(event)) {
event.preventDefault();
this._saveData();
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Media/Manager/Search
*/
-define(['Ajax', 'Core', 'Dom/Traverse', 'Dom/Util', 'Language', 'Ui/SimpleDropdown'], function(Ajax, Core, DomTraverse, DomUtil, Language, UiSimpleDropdown) {
+define(['Ajax', 'Core', 'Dom/Traverse', 'Dom/Util', 'EventKey', 'Language', 'Ui/SimpleDropdown'], function(Ajax, Core, DomTraverse, DomUtil, EventKey, Language, UiSimpleDropdown) {
"use strict";
/**
* @param {Event} event event object
*/
_keyPress: function(event) {
- // 13 = [ENTER]
- if (event.charCode === 13) {
+ if (EventKey.Enter(event)) {
event.preventDefault();
var innerInfo = DomTraverse.childByClass(this._input.parentNode.parentNode, 'innerInfo');
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Ui/ItemList
*/
-define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'WoltLabSuite/Core/Ui/Suggestion'], function(Core, Dictionary, Language, DomTraverse, UiSuggestion) {
+define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'EventKey', 'WoltLabSuite/Core/Ui/Suggestion'], function(Core, Dictionary, Language, DomTraverse, EventKey, UiSuggestion) {
"use strict";
var _activeId = '';
* @param {object} event event object
*/
_keyPress: function(event) {
- // 13 = [ENTER], 44 = [,]
- if (event.charCode == 13 || event.charCode == 44) {
+ if (EventKey.Enter(event) || EventKey.Comma(event)) {
event.preventDefault();
if (_data.get(event.currentTarget.id).options.restricted) {