diff options
author | sualko <klaus@jsxc.org> | 2020-03-24 17:54:30 +0300 |
---|---|---|
committer | sualko <klaus@jsxc.org> | 2020-03-24 17:54:30 +0300 |
commit | f3e2752cad7f90bb0ba92316024611cb86706a49 (patch) | |
tree | 95a78fe6cd4d64e15ce3670e00b10d6743d95d3b /ts | |
parent | 9c1435b7f7e4f6ee039375c758040eeed68ec021 (diff) |
fix: login button
Diffstat (limited to 'ts')
-rw-r--r-- | ts/ChatSubmitButtonInjector.ts | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/ts/ChatSubmitButtonInjector.ts b/ts/ChatSubmitButtonInjector.ts index 3f58cd4..a0ee9e8 100644 --- a/ts/ChatSubmitButtonInjector.ts +++ b/ts/ChatSubmitButtonInjector.ts @@ -9,27 +9,33 @@ export function addChatSubmitButton(formElement: JQuery<any>, translate: (key: s let submitElement = $('<input>'); submitElement.attr({ type: 'button', - id: 'jsxc-submit', }); - submitElement.addClass('login primary'); - if (defaultEnable) { - submitElement.val(translate('Log_in_without_chat')); - submitElement.click(function() { - storage.setItem('loginForm:disable', true); - - formElement.submit(); - }); - } else { - submitElement.val(translate('Log_in_with_chat')); - submitElement.click(function() { - storage.setItem('loginForm:disable', false); + submitElement.addClass('login primary jsxc-submit'); - formElement.submit(); - }); - } + let submitElementWithout = submitElement.clone(); + submitElementWithout.val(translate('Log_in_without_chat')); + submitElementWithout.click(function() { + storage.setItem('loginForm:disable', true); + + formElement.submit(); + }); + + let submitElementWith = submitElement.clone(); + submitElementWith.val(translate('Log_in_with_chat')); + submitElementWith.click(function() { + storage.setItem('loginForm:disable', false); - submitWrapperElement.append(submitElement); - formElement.find('.login-additional').prepend(submitWrapperElement); + formElement.submit(); + }); + + submitWrapperElement.append(submitElementWithout); + submitWrapperElement.append(submitElementWith); + + if (formElement.find('.login-additional').length > 0) { + formElement.find('.login-additional').prepend(submitWrapperElement); + } else { + formElement.find('#submit-wrapper').after(submitWrapperElement); + } $('#lost-password').mouseup(function(ev) { ev.preventDefault(); |