This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/core/static/js/passbook.js

19 lines
421 B
JavaScript

function convertToSlug(Text) {
return Text
.toLowerCase()
.replace(/[^\w ]+/g, '')
.replace(/ +/g, '-')
;
}
const $source = $('input[name=name]');
const $result = $('input[name=slug]');
const typeHandler = function (e) {
$result.val(convertToSlug(e.target.value));
}
$source.on('input', typeHandler) // register for oninput
$source.on('propertychange', typeHandler) // for IE8