wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r22842: LJSUP-13571: Create lj tag 'lj-random' f...

Committer: wisest-owl
LJSUP-13571: Create lj tag 'lj-random' for posts

U   trunk/cgi-bin/cleanhtml.pl
Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2012-09-07 13:46:31 UTC (rev 22841)
+++ trunk/cgi-bin/cleanhtml.pl	2012-09-07 13:51:16 UTC (rev 22842)
@@ -839,6 +839,15 @@
                     $newdata .= "<b>[Unknown LJ tag]</b>";
                 }
             }
+            elsif ($tag eq "lj-random")
+            {
+                my $max = abs($attr->{'max'}) || 10_000_000;
+                my $min = abs($attr->{'min'}) || 0;
+                if ($max < $min) {
+                    ($max, $min) = ($min, $max);
+                }
+                $newdata .= int(rand($max-$min)) + $min;
+            }
             elsif ($tag eq "lj-raw")
             {
                 # Strip it out, but still register it as being open

Tags: livejournal, pl, wisest-owl
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments