summaryrefslogtreecommitdiff
path: root/modules/gallery/js/albums_form_add.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/js/albums_form_add.js')
-rw-r--r--modules/gallery/js/albums_form_add.js29
1 files changed, 6 insertions, 23 deletions
diff --git a/modules/gallery/js/albums_form_add.js b/modules/gallery/js/albums_form_add.js
index a568f35d..55ad8ce6 100644
--- a/modules/gallery/js/albums_form_add.js
+++ b/modules/gallery/js/albums_form_add.js
@@ -1,23 +1,6 @@
-$("#g-add-album-form input[name=title]").change(
- function() {
- $("#g-add-album-form input[name=name]").attr(
- "value", $("#g-add-album-form input[name=title]").attr("value")
- .replace(/[\s\/]+/g, "-").replace(/\.+$/, ""));
- $("#g-add-album-form input[name=slug]").attr(
- "value", $("#g-add-album-form input[name=title]").attr("value")
- .replace(/[^A-Za-z0-9-_]+/g, "-")
- .replace(/^-+/, "")
- .replace(/-+$/, ""));
- });
-$("#g-add-album-form input[name=title]").keyup(
- function() {
- $("#g-add-album-form input[name=name]").attr(
- "value", $("#g-add-album-form input[name=title]").attr("value")
- .replace(/[\s\/]+/g, "-")
- .replace(/\.+$/, ""));
- $("#g-add-album-form input[name=slug]").attr(
- "value", $("#g-add-album-form input[name=title]").attr("value")
- .replace(/[^A-Za-z0-9-_]+/g, "-")
- .replace(/^-+/, "")
- .replace(/-+$/, ""));
- });
+$("#g-add-album-form input[name='title']").on("input keyup", function() {
+ $("#g-add-album-form input[name='name']").val(
+ $(this).val().replace(/[\s\/\\]+/g, "-").replace(/\.+$/, ""));
+ $("#g-add-album-form input[name='slug']").val(
+ $(this).val().replace(/[^A-Za-z0-9-_]+/g, "-").replace(/^-+/, "").replace(/-+$/, ""));
+});