Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference to non-existent jquery.js from silverstripe/admin #184

Open
oddnoc opened this issue May 16, 2023 · 2 comments
Open

Reference to non-existent jquery.js from silverstripe/admin #184

oddnoc opened this issue May 16, 2023 · 2 comments

Comments

@oddnoc
Copy link

oddnoc commented May 16, 2023

silverstripe/admin no longer provides jquery.js

Requirements::javascript("silverstripe/admin: thirdparty/jquery/jquery.js");

@zemiacsik
Copy link

@Firesphere
Copy link

Blocking the jQuery at all, and replace the password switch with something like:

const showClick = document.getElementsByClassName('showOnClick')[0]
const container = document.getElementsByClassName('showOnClickContainer')[0];
export default function() {
    if (showClick) {
        const link = showClick.querySelectorAll('a')[0];
        if (link) {
            link.addEventListener('click', function(e) {
                e.preventDefault();
                let classes = container.classList;
                if (classes.contains('d-none')) {
                    classes.remove('d-none');
                } else {
                    classes.add('d-none');
                }
            });
        }
    }
}

Fixes the whole jquery problem alltogether.

The script, IMO, is not worth requiring a library. It's a simple show/hide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants