Click to choose a random icon when posting an entry.
Patch by yvi.
diffs (70 lines):
diff -r 4c2d441485d3 -r 6cd7c120dd96 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat Mon Jul 05 22:57:18 2010 +0800
+++ b/bin/upgrading/en.dat Mon Jul 05 23:22:24 2010 +0800
@@ -1150,6 +1150,8 @@ entryform.userpic=Userpic:
entryform.userpic=Userpic:
entryform.userpic.choose=Choose userpic
+
+entryform.userpic.random=Choose random icon
entryform.userpics=User Picture Icon:
diff -r 4c2d441485d3 -r 6cd7c120dd96 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Mon Jul 05 22:57:18 2010 +0800
+++ b/cgi-bin/weblib.pl Mon Jul 05 23:22:24 2010 +0800
@@ -1251,8 +1251,12 @@ sub entry_form {
$out .= "<a href='javascript:void(0);' id='lj_userpicselect'>
</a>";
# userpic browse button
$$onload .= " insertViewThumbs();" if
$remote->can_use_userpic_select;
+
+ # random icon button
+ $out .= "<a href='javascript:void(0)' onclick='randomicon();'
id='randomicon'>" . BML::ml('entryform.userpic.random') . "</a>";
$out .= LJ::help_icon_html("userpics", "", " ") . "\n";
$out .= "</p>\n\n";
+ $$onload .= " showRandomIcon();";
}
diff -r 4c2d441485d3 -r 6cd7c120dd96 htdocs/js/entry.js
--- a/htdocs/js/entry.js Mon Jul 05 22:57:18 2010 +0800
+++ b/htdocs/js/entry.js Mon Jul 05 23:22:24 2010 +0800
@@ -461,6 +461,19 @@ function changeSecurityOptions(defaultjo
});
}
+function showRandomIcon() {
+ $('randomicon').style.display = 'inline';
+}
+
+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;
+ var randomnumber=Math.floor(Math.random()*numberoficons);
+ icons_list.selectedIndex = randomnumber+1;
+ userpic_preview();
+}
+
///////////////////// Insert Object code
var InOb = new Object;
diff -r 4c2d441485d3 -r 6cd7c120dd96 htdocs/stc/entry.css
--- a/htdocs/stc/entry.css Mon Jul 05 22:57:18 2010 +0800
+++ b/htdocs/stc/entry.css Mon Jul 05 23:22:24 2010 +0800
@@ -124,6 +124,15 @@
font-size: 90%;
line-height: 110%;
}
+
+#randomicon {
+ display: none;
+ font-size: 85%;
+ text-align: center;
+ float: left;
+ margin: 4px 0px 0px 5px;
+}
+
#metainfo {
float: left;
margin-right: 10px;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog