1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-11-23 17:42:46 +01:00
TweetDuck/resources/Content/tweetdeck/focus_composer_after_switching_account.js

22 lines
596 B
JavaScript

import { $, $$ } from "../api/jquery.js";
import { onAppReady } from "../api/ready.js";
const refocusInput = function() {
document.querySelector(".js-docked-compose .js-compose-text").focus();
};
const accountItemClickEvent = function() {
setTimeout(refocusInput, 0);
};
/**
* Refocuses composer input after switching account.
*/
export default function() {
onAppReady(function setupAccountSwitchRefocus() {
$(document).on("tduckOldComposerActive", function() {
$$(".js-account-list", ".js-docked-compose").delegate(".js-account-item", "click", accountItemClickEvent);
});
});
};