mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 02:48:00 +00:00
Extract js/ui_util.js.
This commit is contained in:
32
static/js/ui_util.js
Normal file
32
static/js/ui_util.js
Normal file
@@ -0,0 +1,32 @@
|
||||
var ui_util = (function () {
|
||||
|
||||
var exports = {};
|
||||
|
||||
// Add functions to this that have no non-trivial
|
||||
// dependencies other than jQuery.
|
||||
|
||||
exports.change_tab_to = function (tabname) {
|
||||
$('#gear-menu a[href="' + tabname + '"]').tab('show');
|
||||
};
|
||||
|
||||
exports.focus_on = function (field_id) {
|
||||
// Call after autocompleting on a field, to advance the focus to
|
||||
// the next input field.
|
||||
|
||||
// Bootstrap's typeahead does not expose a callback for when an
|
||||
// autocomplete selection has been made, so we have to do this
|
||||
// manually.
|
||||
$("#" + field_id).focus();
|
||||
};
|
||||
|
||||
exports.blur_active_element = function () {
|
||||
// this blurs anything that may perhaps be actively focused on.
|
||||
document.activeElement.blur();
|
||||
};
|
||||
|
||||
return exports;
|
||||
}());
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = ui_util;
|
||||
}
|
||||
Reference in New Issue
Block a user