Project

General

Profile

Download (1.22 KB) Statistics
| Branch: | Revision:

hydrilla-fixes-bundle / src / accounts-fedoraproject-org-fix / fedoraaccounts.js @ ecc6c218

1
/**
2
 * SPDX-License-Identifier: CC0-1.0
3
 *
4
 * Fix registration of a Fedora account
5
 *
6
 * Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org>
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the CC0 1.0 Universal License as published by
10
 * the Creative Commons Corporation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * CC0 1.0 Universal License for more details.
16
 */
17

    
18
/* Haketilo fix to use with https://accounts.fedoraproject.org */
19

    
20
var by_id = id => document.getElementById(id);
21

    
22
var login_register_tabs = ['login', 'register'].map(by_id);
23
var login_register_buttons = login_register_tabs.map(e => by_id(`${e.id}-tab`))
24

    
25
function switch_tab(i)
26
{
27
    login_register_buttons[i].classList.add('active');
28
    login_register_buttons[1 - i].classList.remove('active');
29

    
30
    login_register_tabs[i].classList.add('show', 'active');
31
    login_register_tabs[1 - i].classList.remove('show', 'active');
32
}
33

    
34
for (const i of [0, 1]) {
35
    login_register_buttons[i].addEventListener('click', () => switch_tab(i));
36
    login_register_buttons[i].href = '#'
37
}
(1-1/2)