Skip to content

Commit

Permalink
Item1947:
Browse files Browse the repository at this point in the history
   * made JQueryPlugin SafeWikiPlugin compatible, i.e. %BUTTON, %TOGGLE and %TABPANE
   * added hoverintent to superfish menu dependencies as without menus are much
     to squirrelly
   * removed deprecated jquery-all.js files
   * added some more nice jqTreeview themes
   * FOSWIKI object initializer recognizes json now as well
   * some minor fixes to jquery.textboxlist plugin



git-svn-id: http://svn.foswiki.org/trunk@4688 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Aug 20, 2009
1 parent 2dc0294 commit 3b14465
Show file tree
Hide file tree
Showing 42 changed files with 210 additions and 510 deletions.
7 changes: 4 additions & 3 deletions JQueryPlugin/data/Sandbox/JQueryPluginExamples.txt
@@ -1,11 +1,12 @@
%META:TOPICINFO{author="ProjectContributor" date="1243603985" format="1.1" reprev="1.7" version="1.7"}%
%META:TOPICINFO{author="micha" comment="reprev" date="1250761838" format="1.1" reprev="1.7" version="1.7"}%
---+!! %TOPIC%
%JQREQUIRE{"debug"}%

Demo of the <nop>FoswikiWidgets implemented by the %SYSTEMWEB%.JQueryPlugin

%TOC%
---++ Buttons
%BUTTON{"%MAKETEXT{"OK"}%" icon="tick" onclick="alert(jQuery(this).text());"}%
%BUTTON{"%MAKETEXT{"OK"}%" icon="tick" onclick="alert($(this).text());"}%
%BUTTON{"%MAKETEXT{"Cancel"}%" icon="cross"}%
%BUTTON{"%MAKETEXT{"Info"}%" icon="information"}%
%BUTTON{"%MAKETEXT{"Add"}%" icon="add"}%
Expand All @@ -16,7 +17,7 @@ Demo of the <nop>FoswikiWidgets implemented by the %SYSTEMWEB%.JQueryPlugin

---++ Shake
%JQREQUIRE{"shake"}%
%BUTTON{"Shake it, baby" icon="bomb" onclick="jQuery('#lorem').shake(3, 10, 180)"}%
%BUTTON{"Shake it, baby" icon="bomb" onclick="$('#lorem').shake(3, 10, 180)"}%
%CLEAR%

<div id="lorem" style="width:300px;">
Expand Down
2 changes: 0 additions & 2 deletions JQueryPlugin/data/System/JQueryAjaxHelper.txt
Expand Up @@ -230,5 +230,3 @@ This one returns an =&lt;img...>= to a user's photo. See the User selector examp
</verbatim>


%META:PREFERENCE{name="ALLOWTOPICVIEW" title="ALLOWTOPICVIEW" type="Set" value=""}%
%META:PREFERENCE{name="PERMSET_VIEW" title="PERMSET_VIEW" type="Local" value="details"}%
3 changes: 2 additions & 1 deletion JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin.pm
Expand Up @@ -29,7 +29,7 @@ use vars qw(
);


$VERSION = '$Rev: 3740 $';
$VERSION = '$Rev: 20090710 (2009-07-10) $';
$RELEASE = '2.02';
$SHORTDESCRIPTION = 'jQuery <nop>JavaScript library for Foswiki';
$NO_PREFS_IN_TOPIC = 1;
Expand Down Expand Up @@ -299,6 +299,7 @@ sub handleJQueryIcon {
$img =~ s/\$iconClass/$iconClass/g;
$img =~ s/\$iconAlt/alt='$iconAlt' /g if $iconAlt;
$img =~ s/\$iconTitle/title='$iconTitle' /g if $iconTitle;
$img =~ s/\$(iconAlt|iconTitle)//go;

return $img;
}
Expand Down
41 changes: 28 additions & 13 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/BUTTON.pm
Expand Up @@ -40,11 +40,12 @@ sub new {
my $this = bless($class->SUPER::new(
$session,
name => 'Button',
version => '1.0',
version => '1.1',
author => 'Michael Daum',
homepage => 'http://foswiki.org/Extensions/JQueryPlugin',
tags => 'BUTTON',
css => ['jquery.button.css'],
javascript => ['jquery.button.init.js'],
), $class);

$this->{summary} = <<'HERE';
Expand Down Expand Up @@ -74,7 +75,6 @@ sub handleButton {
my $theOnClick = $params->{onclick};
my $theOnMouseOver = $params->{onmouseover};
my $theOnMouseOut = $params->{onmouseout};
my $theOnFocus = $params->{onfocus};
my $theTitle = $params->{title};
my $theIconName = $params->{icon} || '';
my $theAccessKey = $params->{accesskey};
Expand All @@ -85,6 +85,8 @@ sub handleButton {
my $theTarget = $params->{target};
my $theType = $params->{type} || 'button';

$theId = 'jqButton'.Foswiki::Plugins::JQueryPlugin::Plugins::getRandom() unless defined $theId;

my $theIcon;
$theIcon = Foswiki::Plugins::JQueryPlugin::Plugins::getIconUrlPath($theIconName) if $theIconName;

Expand All @@ -107,31 +109,44 @@ sub handleButton {
}

if ($theType eq 'submit') {
$theOnClick="jQuery(this).parents('form:first').submit();";
$theOnClick .= ";jQuery(this).parents('form:first').submit();";
}
if ($theType eq 'save') {
$theOnClick="var form = jQuery(this).parents('form:first'); if(typeof(foswikiStrikeOne) == 'function') foswikiStrikeOne(form[0]); form.submit();";
$theOnClick .= ";var form = jQuery(this).parents('form:first'); if(typeof(foswikiStrikeOne) == 'function') foswikiStrikeOne(form[0]); form.submit();";
}
if ($theType eq 'reset') {
$theOnClick="jQuery(this).parents('form:first').resetForm();";
$theOnClick .= ";jQuery(this).parents('form:first').resetForm();";
Foswiki::Plugins::JQueryPlugin::Plugins::createPlugin('Form');
}
if ($theType eq 'clear') {
$theOnClick="jQuery(this).parents('form:first').clearForm();";
$theOnClick .= ";jQuery(this).parents('form:first').clearForm();";
Foswiki::Plugins::JQueryPlugin::Plugins::createPlugin('Form');
}
$theOnClick .= ';return false;' if $theOnClick;
$theOnClick =~ s/;$//;
$theOnClick .= ';return false;';

my $result = "<a class='jqButton $theBg $theClass' href='$theHref'";
my $result = "<a id='$theId' class='jqButton $theBg $theClass' href='$theHref'";
$result .= " accesskey='$theAccessKey' " if $theAccessKey;
$result .= " id='$theId' " if $theId;
$result .= " title='$theTitle' " if $theTitle;
$result .= " onclick=\"$theOnClick\" " if $theOnClick;
$result .= " onmouseover=\"$theOnMouseOver\" " if $theOnMouseOver;
$result .= " onmouseout=\"$theOnMouseOut\" " if $theOnMouseOut;
$result .= " onfocus=\"$theOnFocus\" " if $theOnFocus;
$result .= " style='$theStyle' " if $theStyle;

my @callbacks = ();
push @callbacks, "onclick:function(){$theOnClick}";
if ($theOnMouseOver) {
push @callbacks, "onmouseover:function(){$theOnMouseOver}";
}
if ($theOnMouseOut) {
push @callbacks, "onmouseout:function(){$theOnMouseOut}";
}
my $callbacks = join(', ', @callbacks);

if ($callbacks) {
Foswiki::Func::addToHEAD("JQUERYPLUGIN::BUTTON::$theId", <<"HERE", 'JQUERYPLUGIN::BUTTON');
<meta name="foswiki.jquery.button.$theId" content="{id:'$theId', $callbacks}" />
HERE
}

$result .= ">$theText</a>";
$result .= "<input type='submit' style='display:none' />" if
$theType eq 'submit';
Expand Down
2 changes: 1 addition & 1 deletion JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/EMPTY.pm
Expand Up @@ -41,7 +41,7 @@ sub new {
my $this = bless($class->SUPER::new(
$session,
name => 'Empty',
version => '$Rev$',
version => '$Rev: 20090710 (2009-07-10) $',
author => 'First Last',
homepage => 'http://...',
tags => 'EMPTY',
Expand Down
14 changes: 12 additions & 2 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/MANIFEST
Expand Up @@ -105,8 +105,6 @@ pub/System/JQueryPlugin/jquery-1.3.2p1.js 0644
pub/System/JQueryPlugin/jquery-1.3.2p1.js.gz 0644
pub/System/JQueryPlugin/jquery-1.3.2p1.uncompressed.js 0644
pub/System/JQueryPlugin/jquery-1.3.2.uncompressed.js 0644
pub/System/JQueryPlugin/jquery-all.js 0644
pub/System/JQueryPlugin/jquery-all.js.gz 0644
pub/System/JQueryPlugin/jquery.js 0644
pub/System/JQueryPlugin/jquery.js.gz 0644
pub/System/JQueryPlugin/jquery.noconflict.js 0644
Expand Down Expand Up @@ -143,6 +141,9 @@ pub/System/JQueryPlugin/plugins/button/btn_red_right.gif 0644
pub/System/JQueryPlugin/plugins/button/btn_right.gif 0644
pub/System/JQueryPlugin/plugins/button/jquery.button.css 0644
pub/System/JQueryPlugin/plugins/button/jquery.button.css.gz 0644
pub/System/JQueryPlugin/plugins/button/jquery.button.init.js 0644
pub/System/JQueryPlugin/plugins/button/jquery.button.init.js.gz 0644
pub/System/JQueryPlugin/plugins/button/jquery.button.init.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/button/jquery.button.uncompressed.css 0644
pub/System/JQueryPlugin/plugins/button/Makefile 0644
pub/System/JQueryPlugin/plugins/chili/jquery.chili.init.js 0644
Expand Down Expand Up @@ -318,6 +319,9 @@ pub/System/JQueryPlugin/plugins/superfish/Makefile 0644
pub/System/JQueryPlugin/plugins/superfish/MenuArrow.gif 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.css 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.css.gz 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.init.js 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.init.js.gz 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.init.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.js 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.js.gz 0644
pub/System/JQueryPlugin/plugins/tabpane/jquery.tabpane.uncompressed.css 0644
Expand Down Expand Up @@ -345,6 +349,10 @@ pub/System/JQueryPlugin/plugins/textboxlist/jquery.textboxlist.js.gz 0644
pub/System/JQueryPlugin/plugins/textboxlist/jquery.textboxlist.uncompressed.css 0644
pub/System/JQueryPlugin/plugins/textboxlist/jquery.textboxlist.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/textboxlist/Makefile 0644
pub/System/JQueryPlugin/plugins/toggle/jquery.toggle.init.js 0644
pub/System/JQueryPlugin/plugins/toggle/jquery.toggle.init.js.gz 0644
pub/System/JQueryPlugin/plugins/toggle/jquery.toggle.init.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/toggle/Makefile 0644
pub/System/JQueryPlugin/plugins/tooltip/jquery.tooltip.css 0644
pub/System/JQueryPlugin/plugins/tooltip/jquery.tooltip.css.gz 0644
pub/System/JQueryPlugin/plugins/tooltip/jquery.tooltip.init.js 0644
Expand All @@ -367,8 +375,10 @@ pub/System/JQueryPlugin/plugins/treeview/images/treeview-default.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-default-line.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-famfamfam.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-famfamfam-line.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-grayarrows.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-gray.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-gray-line.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-orangearrows.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-red.gif 0644
pub/System/JQueryPlugin/plugins/treeview/images/treeview-red-line.gif 0644
pub/System/JQueryPlugin/plugins/treeview/jquery.treeview.async.js 0644
Expand Down
1 change: 1 addition & 0 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/SUPERFISH.pm
Expand Up @@ -44,6 +44,7 @@ sub new {
author => 'Joel Birch',
homepage => 'http://users.tpg.com.au/j_birch/plugins/superfish/',
javascript => ['jquery.superfish.js'],
dependencies => ['hoverintent'],
), $class);

$this->{summary} = <<'HERE';
Expand Down
16 changes: 6 additions & 10 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/TABPANE.pm
Expand Up @@ -41,12 +41,12 @@ sub new {
my $this = bless($class->SUPER::new(
$session,
name => 'Tabpane',
version => '1.0',
version => '1.1',
author => 'Michael Daum',
homepage => 'http://michaeldaumconsutling.com',
tags => 'TABPABNE, ENDTABPANE, TAB, ENDTAB',
css => ['jquery.tabpane.css'],
javascript => ['jquery.tabpane.js'],
javascript => ['jquery.tabpane.init.js', 'jquery.tabpane.js'],
#dependencies => ['debug'], # DEBUG
), $class);

Expand Down Expand Up @@ -89,16 +89,12 @@ sub handleTabPane {
$autoMaxExpand = ($autoMaxExpand eq 'on')?'true':'false';
$animate = ($animate eq 'on')?'true':'false';

Foswiki::Func::addToHEAD("JQUERYPLUGIN::TABPANE::$tpId", <<"HERE", 'JQUERYPLUGIN::TABPANE');
my $script = <<"EOS";
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#$tpId").tabpane({select:'$select', autoMaxExpand:$autoMaxExpand, animate:$animate, minHeight:$minHeight});
});
</script>
EOS
<meta name="foswiki.jquery.tabpane.$tpId" content="{id:'$tpId', select:'$select', autoMaxExpand:$autoMaxExpand, animate:$animate, minHeight:$minHeight}" />
HERE

return "<!-- TABPANE -->".$script."<div class='jqTabPane' id='$tpId'>";
return "<div class='jqTabPane' id='$tpId'>";
}

=begin TML
Expand Down
13 changes: 9 additions & 4 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/TOGGLE.pm
Expand Up @@ -40,10 +40,11 @@ sub new {
my $this = bless($class->SUPER::new(
$session,
name => 'Toggle',
version => '0.5',
version => '0.6',
author => 'Michael Daum',
homepage => 'http://michaeldaumconsulting.com',
tags => 'TOGGLE',
javascript => ['jquery.toggle.init.js'],
), $class);

$this->{summary} = <<'HERE';
Expand Down Expand Up @@ -98,12 +99,16 @@ sub handleToggle {
} else {
$showEffect = $hideEffect = "toggle()";
}
my $cmd = "jQuery('$theTarget').each(function() {jQuery(this).is(':visible')?jQuery(this).$showEffect:jQuery(this).$hideEffect;})";

my $cmd = "function() {\$('$theTarget').each(function() {\$(this).is(':visible')?\$(this).$showEffect:\$(this).$hideEffect;});return false;}";
my $toggleId = "jqToggle".Foswiki::Plugins::JQueryPlugin::Plugins::getRandom();

Foswiki::Func::addToHEAD("JQUERYPLUGIN::TOGGLE::$toggleId", <<"HERE", 'JQUERYPLUGIN::TOGGLE');
<meta name="foswiki.jquery.toggle.$toggleId" content="{id:'$toggleId', onclick:$cmd}" />
HERE

return
"<a id='$toggleId' href='#' onclick=\"$cmd; return false;\" title='".$theTitle."' ".$style.'>'.
"<a id='$toggleId' href='#' title='".$theTitle."' ".$style.'>'.
"<span>".
Foswiki::Plugins::JQueryPlugin::Plugins::expandVariables($theText).'</span></a>';
}
Expand Down
7 changes: 1 addition & 6 deletions JQueryPlugin/pub/System/JQueryPlugin/Makefile
@@ -1,5 +1,5 @@
SUBDIRS=i18n plugins themes ui
TARGET=jquery-all.js jquery-1.2.6.js jquery-1.3.2.js jquery-1.3.2p1.js
TARGET=jquery-1.2.6.js jquery-1.3.2.js jquery-1.3.2p1.js

JS_SOURCES=\
jquery-1.2.6.js \
Expand All @@ -11,11 +11,6 @@ JS_SOURCES=\

-include Makefile.include

# DEPRECATED, provided for backwards compatibility
jquery-all.js: $(JS_SOURCES) Makefile
@echo creating $@
@$(MINIFYJS) $(JS_SOURCES) > $@

jquery-1.3.2p1.uncompressed.js: jquery-1.3.2.uncompressed.js jquery.patch
@echo patching $<
@$(PATCH) -i jquery.patch -o $@

0 comments on commit 3b14465

Please sign in to comment.