legendary-doc-site/apps/core/assets/js/app.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

import '../semantic/src/semantic.less';
2020-07-02 21:08:53 +00:00
// We need to import the CSS so that webpack will load it.
// The MiniCssExtractPlugin is used to separate it out into
// its own CSS file.
import "../css/app.scss"
// webpack automatically bundles all modules in your
// entry points. Those entry points can be configured
// in "webpack.config.js".
//
// Import deps with the dep name or local files with a relative path, for example:
//
// import {Socket} from "phoenix"
// import socket from "./socket"
//
2020-07-17 23:30:31 +00:00
import "phoenix_html"
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
function togglePasswordFieldVisibility()
{
const passwordFields = document.querySelectorAll('[name="user[password]"]')
passwordFields.forEach((el) => {
if (el.type == 'password')
{
el.type = 'text'
}
else
{
el.type = 'password'
}
})
}
ready(() => {
document.querySelectorAll('.js-passwordRevealer').forEach((el) => {
el.addEventListener('click', togglePasswordFieldVisibility)
})
})