fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-01-23 03:17 am

[dw-free] Make choosing random icon a button

[commit: http://hg.dwscoalition.org/dw-free/rev/71034390bebc]

http://bugs.dwscoalition.org/show_bug.cgi?id=4177

Use camel case for the function name; in inline onclick handlers, the
variable name randomicon was being treated as the element id, not as a
function reference, so we want the function name to not match. Changes to
input type='button'... rather than a button so we don't submit the form.
Also remove extra whitespace which was causing the buttons to look
unbalanced.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/Web.pm
  • htdocs/js/quickreply.js
--------------------------------------------------------------------------------
diff -r 239d226a0b65 -r 71034390bebc cgi-bin/LJ/Web.pm
--- a/cgi-bin/LJ/Web.pm	Mon Jan 23 08:08:23 2012 +0800
+++ b/cgi-bin/LJ/Web.pm	Mon Jan 23 11:18:38 2012 +0800
@@ -944,12 +944,10 @@
                                        ("", BML::ml('/talkpost.bml.opt.defpic'), map { ($_, $_) } @pics));
 
             # userpic browse button
-            $qrhtml .= qq {
-                <input type="button" id="lj_userpicselect" value="Browse" />
-                } if $remote->can_use_userpic_select;
-
-            my $onclick = $beta_jquery ? "" : "onclick='randomicon();'";
-            $qrhtml .= "<button $onclick id='randomicon'>" . BML::ml('/talkpost.bml.userpic.random2') . "</button>";
+            $qrhtml .= qq {<input type="button" id="lj_userpicselect" value="Browse" />} if $remote->can_use_userpic_select;
+
+            my $onclick = $beta_jquery ? "" : "onclick='randomIcon();'";
+            $qrhtml .= "<input type='button' $onclick id='randomicon' value='" . BML::ml('/talkpost.bml.userpic.random2') . "' />";
 
             $qrhtml .= LJ::help_icon_html("userpics", " ");
         }
diff -r 239d226a0b65 -r 71034390bebc htdocs/js/quickreply.js
--- a/htdocs/js/quickreply.js	Mon Jan 23 08:08:23 2012 +0800
+++ b/htdocs/js/quickreply.js	Mon Jan 23 11:18:38 2012 +0800
@@ -145,7 +145,7 @@
         submitform();
    }
 
-   function randomicon() {
+   function randomIcon() {
         var icons_list = document.getElementById('prop_picture_keyword');
         // we need to ignore the "(default)" option for this code
         var numberoficons = icons_list.length-1;
--------------------------------------------------------------------------------