初始提交: Gitea 项目代码
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import {checkAppUrl, checkAppUrlScheme} from './common-page.ts';
|
||||
|
||||
export function initUserCheckAppUrl() {
|
||||
if (!document.querySelector('.page-content.user.signin, .page-content.user.signup, .page-content.user.link-account')) return;
|
||||
checkAppUrlScheme();
|
||||
}
|
||||
|
||||
export function initUserExternalLogins() {
|
||||
const container = document.querySelector('#external-login-navigator');
|
||||
if (!container) return;
|
||||
|
||||
// whether the auth method requires app url check (need consistent ROOT_URL with visited URL)
|
||||
let needCheckAppUrl = false;
|
||||
for (const link of container.querySelectorAll('.external-login-link')) {
|
||||
needCheckAppUrl = needCheckAppUrl || link.getAttribute('data-require-appurl-check') === 'true';
|
||||
link.addEventListener('click', () => {
|
||||
container.classList.add('is-loading');
|
||||
setTimeout(() => {
|
||||
// recover previous content to let user try again, usually redirection will be performed before this action
|
||||
container.classList.remove('is-loading');
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
if (needCheckAppUrl) {
|
||||
checkAppUrl();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user