Skip to content

Commit

Permalink
Item12694: default to fast animation speed
Browse files Browse the repository at this point in the history
Item12583: revert to simple floats in $VERSION



git-svn-id: http://svn.foswiki.org/trunk@17160 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Dec 12, 2013
1 parent 454778c commit 52d2b74
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 30 deletions.
24 changes: 2 additions & 22 deletions TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use warnings;
use vars qw( @twistystack $doneHeader $doneDefaults $twistyCount
$prefMode $prefShowLink $prefHideLink $prefRemember);

use version; our $VERSION = version->declare("v1.6.18");
our $RELEASE = '1.6.18';
our $VERSION = '1.62';
our $RELEASE = '1.62';
our $SHORTDESCRIPTION =
'Twisty section Javascript library to open/close content dynamically';
our $NO_PREFS_IN_TOPIC = 1;
Expand All @@ -42,8 +42,6 @@ sub initPlugin {
$doneHeader = 0;
$twistyCount = 0;

_exportAnimationSpeed();

Foswiki::Plugins::JQueryPlugin::registerPlugin( 'twisty',
'Foswiki::Plugins::TwistyPlugin::TWISTY' );
Foswiki::Func::registerTagHandler( 'TWISTYSHOW', \&_TWISTYSHOW );
Expand All @@ -57,24 +55,6 @@ sub initPlugin {
return 1;
}

sub _exportAnimationSpeed {

my $pref =
Foswiki::Func::getPreferencesValue('TWISTYANIMATIONSPEED')
|| Foswiki::Func::getPluginPreferencesValue('TWISTYANIMATIONSPEED')
|| '0';

# add TWISTYANIMATIONSPEED to the html head so
# that it may be used in the client JS with
# foswiki.getPreference('TWISTYANIMATIONSPEED')
Foswiki::Func::addToZone( "script", "TWISTYPLUGIN::META",
<<"HERE", "JQUERYPLUGIN::FOSWIKI::PREFERENCES" );
<script type='text/javascript'>jQuery.extend(foswiki.preferences, { TWISTYANIMATIONSPEED: '$pref' });</script>
HERE

return;
}

sub _setDefaults {
return if $doneDefaults;
$doneDefaults = 1;
Expand Down
1 change: 1 addition & 0 deletions TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data/System/VarTWISTYSHOW.txt 0644
data/System/VarTWISTYTOGGLE.txt 0644
lib/Foswiki/Plugins/TwistyPlugin.pm 0644
lib/Foswiki/Plugins/TwistyPlugin/TWISTY.pm 0644
pub/System/TwistyPlugin/Makefile 0644
pub/System/TwistyPlugin/twisty.js 0644
pub/System/TwistyPlugin/twisty.js.gz 0644
pub/System/TwistyPlugin/twisty.uncompressed.js 0644
Expand Down
8 changes: 8 additions & 0 deletions TwistyPlugin/pub/System/TwistyPlugin/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FOSWIKI_ROOT?=~/foswiki/trunk/core
TARGET=\
jquery.twisty.css \
jquery.twisty.js \
twisty.css \
twisty.js

-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,13 @@ if (!foswiki) foswiki = {};
$(this).removeClass('foswikiMakeVisible');
});
$('.twistyContent').livequery(function() {
var ref = foswiki.TwistyPlugin.init(this);
var $this = $(this);
var speed;
var ref = foswiki.TwistyPlugin.init(this),
$this = $(this), speed;
if ($this.get(0).tagName == 'SPAN') {
// do not animate spans because the animation turns inline display into block
speed = 0;
} else {
speed = foswiki.getPreference('TWISTYANIMATIONSPEED') || 0;
/* .getPreference() returns a string or null, but .animate() wants an integer or a string */
if (RegExp(/^\d+$/).test(speed)) {
speed = parseInt(speed);
}
speed = 600;
}
ref.speed = speed;
});
Expand Down

0 comments on commit 52d2b74

Please sign in to comment.