diff options
author | Nathan Kinkade <nath@nkinka.de> | 2013-03-19 16:41:42 +0000 |
---|---|---|
committer | Nathan Kinkade <nath@nkinka.de> | 2013-03-19 16:41:42 +0000 |
commit | 3908e37d965fa76ea774e76ddf42365a872a5f27 (patch) | |
tree | 457e1a1e465f83855eee96ba287cd91f1623395c /modules/gallery/js | |
parent | 711651f727e093cc7357a6bbff6bd992fd6dfd80 (diff) | |
parent | 1eab94f6062b5f54ea5d9db01d968e7195f3de9d (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/js')
-rw-r--r-- | modules/gallery/js/albums_form_add.js | 29 | ||||
-rw-r--r-- | modules/gallery/js/l10n_client.js | 14 |
2 files changed, 13 insertions, 30 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(/-+$/, "")); +}); diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index 6d919c29..261461b9 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -121,11 +121,11 @@ jQuery.extend(Gallery, { translation[form] = ''; } $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']") - .attr('value', translation[form]); + .val(translation[form]); $('#plural-' + form).removeClass('hidden'); } } else { - $('#l10n-edit-translation').attr('value', translation); + $('#l10n-edit-translation').val(translation); $('#l10n-edit-translation').removeClass('hidden'); } }; @@ -167,10 +167,10 @@ jQuery.extend(Gallery, { text = source['one']; } $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']") - .attr('value', text); + .val(text); } } else { - $('#l10n-edit-translation').attr('value', source); + $('#l10n-edit-translation').val(source); } } @@ -240,7 +240,7 @@ Gallery.behaviors.l10nClient = function(context) { }); // Custom listener for l10n_client livesearch - $('#l10n-client #g-l10n-search').keyup(function(key) { + $('#l10n-client #g-l10n-search').on("input keyup", function(key) { Gallery.l10nClient.filter($('#l10n-client #g-l10n-search').val()); }); @@ -264,11 +264,11 @@ Gallery.behaviors.l10nClient = function(context) { if (is_plural) { for (var i = 0; i < num_plural_forms; i++) { var form = plural_forms[i]; - translation[form] = $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']").attr('value'); + translation[form] = $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']").val(); is_non_empty = is_non_empty || translation[form]; } } else { - translation = $('#l10n-edit-translation').attr('value'); + translation = $('#l10n-edit-translation').val(); is_non_empty = translation; } Gallery.l10nClient.setString(Gallery.l10nClient.selected, translation); |