Skip to content

Commit

Permalink
Item9815: Restore randomness for non-remembering twisties + 1 line of…
Browse files Browse the repository at this point in the history
… perltidy

git-svn-id: http://svn.foswiki.org/trunk@9708 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed Oct 24, 2010
1 parent bbc8f8a commit d22b7a3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sub _exportAnimationSpeed {
# add TWISTYANIMATIONSPEED to the html head so
# that it may be used in the client JS with
# foswiki.getPreference('TWISTYANIMATIONSPEED')
Foswiki::Func::addToZone("head", "TWISTYPLUGIN::META", <<"HERE");
Foswiki::Func::addToZone( "head", "TWISTYPLUGIN::META", <<"HERE");
<meta name="foswiki.TWISTYANIMATIONSPEED" content="$pref" />
HERE

Expand Down Expand Up @@ -165,8 +165,18 @@ sub _TWISTY {
my $id = $params->{'id'};
if ( !defined $id || $id eq '' ) {
$params->{'id'} = _createId( $params->{'id'}, $theWeb, $theTopic );
my $remember = $params->{'remember'} || $prefRemember;
if ($remember) {

# Cannot generate random ID, otherwise remember won't work
$params->{'id'} .= ++$twistyCount;
}
else {

# randomize this id in case the twisty is loaded through AJAX
$params->{'id'} .= int( rand(10000) ) + 1;
}
}
$params->{'id'} .= ++$twistyCount;
return _TWISTYBUTTON( $session, $params, $theTopic, $theWeb )
. _TWISTYTOGGLE( $session, $params, $theTopic, $theWeb );
}
Expand Down

0 comments on commit d22b7a3

Please sign in to comment.