From 5e0d6a388447aa2dd84e89d265b4d6fbca5146ad Mon Sep 17 00:00:00 2001 From: Hilal Alsibai Date: Tue, 2 Apr 2013 22:38:37 -0700 Subject: [PATCH] Automatically select image type on upload --- r2/r2/templates/subredditstylesheet.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/r2/r2/templates/subredditstylesheet.html b/r2/r2/templates/subredditstylesheet.html index 9058ecf80..3a12baeb2 100644 --- a/r2/r2/templates/subredditstylesheet.html +++ b/r2/r2/templates/subredditstylesheet.html @@ -220,6 +220,14 @@ .replace(/[ _]/g, "-"); $('#img-name').val(f); } + + var ext = file_input.value + .split('.').pop().toLowerCase() + .replace("jpeg", "jpg"); + if (ext == 'png' || ext == 'jpg') { + $('input:radio[name=img_type]').attr('checked', false); + $('input:radio[name=img_type][value="' + ext + '"]').attr('checked', true); + } } } function check_name(form) {