exports.showCountDownTimerToReconnectOnModal = function($modal, pad) { if (clientVars.automaticReconnectionTimeout && $modal.is('.with_reconnect_timer')) { createCountDownElementsIfNecessary($modal); var timer = createTimerForModal($modal, pad); $modal.find('#cancelreconnect').one('click', function() { timer.cancel(); disableAutomaticReconnection($modal); }); enableAutomaticReconnection($modal); } } var createCountDownElementsIfNecessary = function($modal) { var elementsDoNotExist = $modal.find('#cancelreconnect').length === 0; if (elementsDoNotExist) { var $defaultMessage = $modal.find('#defaulttext'); var $reconnectButton = $modal.find('#forcereconnect'); // create extra DOM elements, if they don't exist const $reconnectTimerMessage = $('

') .addClass('reconnecttimer') .append( $('') .attr('data-l10n-id', 'pad.modals.reconnecttimer') .text('Trying to reconnect in ')) .append( $('') .addClass('timetoexpire')); const $cancelReconnect = $('