Skip to content

Commit

Permalink
Item14994: don't generate inline @import-ed css
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Nov 16, 2020
1 parent 6fcc2cf commit e157573
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 106 deletions.
1 change: 1 addition & 0 deletions JSCalendarContrib/.gitignore
@@ -1,3 +1,4 @@
*swp
*,v
*,pfv
*.gz
Expand Down
90 changes: 14 additions & 76 deletions JSCalendarContrib/data/System/JSCalendarContrib.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1512791273" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1605551505" format="1.1" version="1"}%
%META:TOPICPARENT{name="Contribs"}%
---+!! %TOPIC%
<img src="%ATTACHURL%/screenshot.gif" class="foswikiRight" />
Expand Down Expand Up @@ -31,34 +31,37 @@ You can also use the calendar directly in your own hand-built forms.

---++++ Preparation
Just add this inline in the topic text:

<verbatim class="tml">
%INCLUDE{"%SYSTEMWEB%.JSCalendarContribInline"}%
</verbatim>

You may pass language and style options:

<verbatim class="tml">
%INCLUDE{"%SYSTEMWEB%.JSCalendarContribInline" lang="nl" style="blue"}%
</verbatim>

The default =lang= is =en=, the default =style= is =large=.

---++++ Displaying the calendar
To display a calendar icon next to a text input field:

<verbatim class="tml">
<input type="text" class="foswikiInputField" id="cal_val_here" />
<img src="%PUBURLPATH%/%SYSTEMWEB%/JSCalendarContrib/img.gif"\
class="foswikiButton foswikiEditFormCalendarButton" \
onclick="return showCalendar('cal_val_here','%e %B %Y %H:%M:%S ')" />
</verbatim>

If the contrib is installed, you will see such a field here:

%INCLUDE{"%SYSTEMWEB%.JSCalendarContribInline" style="large"}%
<input type="text" class="foswikiInputField" id="cal_val_here" />
<img src="%PUBURLPATH%/%SYSTEMWEB%/JSCalendarContrib/img.gif" \
class="foswikiButton foswikiEditFormCalendarButton" \
onclick="return showCalendar('cal_val_here','%e %B %Y %H:%M:%S')" />

<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

---+++ Installation Instructions
%$INSTALL_INSTRUCTIONS%

Expand All @@ -71,13 +74,12 @@ If the contrib is installed, you will see such a field here:
| JSCALENDARCONTRIB_STYLE | large |
| JSCALENDARCONTRIB_LANG | en |

---+++ Contrib Info

Another great Foswiki extension from the <img src="%ATTACHURLPATH%/wikiringlogo20x20.png" alt="WikiRing" /> *WikiRing* - working together to improve your wiki experience!
---++ Dependencies
%$DEPENDENCIES%

<!-- Warning Do not merge trunk version of this contrib to release branch. It is currently not compatible. -->

| Change History: | |
---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 18 Nov 2020 (1.60) | Foswiktask:Item14994: don't generate inline @import-ed css for performance reasons |
| 08 Dec 2017 (1.56) | Foswikitask:Item14554: remove link to unused wikiring.com domain. |
| 14 Jun 2015 (1.55) | Released with Foswiki 2.0, copyright updates, minor doc updates. |
| 18 Dec 2014 (1.54) | Foswikitask:Item13099: fixed img button of date formfield, Delegated the PUBURL implementation to the store<br />\
Expand Down Expand Up @@ -113,77 +115,13 @@ Another great Foswiki extension from the <img src="%ATTACHURLPATH%/wikiringlogo2
*Related Topics:* %LOCALSITEPREFS%
<!-- %JQREQUIRE{"chili"}% -->


%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Foswiki:Main/CrawfordCurrie http://c-dot.co.uk"}%
%META:FIELD{name="Version" title="Version" value="%25$VERSION%25"}%
%META:FIELD{name="Release" title="Release" value="%25$RELEASE%25"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/distro"}%
%META:FIELD{name="Copyright" title="Copyright" value="Foswiki Contributors, All Rights Reserved"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/%25TOPIC%25"}%
%META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/%25TOPIC%25"}%
%META:FILEATTACHMENT{name="calendar-win2k-1.css.gz" attr="h" comment="" date="1512791273" size="832" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar.php" attr="h" comment="" date="1512791273" size="4490" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="test-position.html" attr="h" comment="" date="1512791273" size="1491" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-setup_src.js" attr="h" comment="" date="1512791273" size="8786" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-brown.css" attr="h" comment="" date="1512791273" size="2829" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="wikiringlogo20x20.png" attr="h" comment="" date="1512791273" size="1343" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-large.css.gz" attr="h" comment="" date="1512791273" size="903" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-2.css" attr="h" comment="" date="1512791273" size="3970" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="simple-2.html" attr="h" comment="" date="1512791273" size="3738" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="ChangeLog" attr="h" comment="" date="1512791273" size="25100" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-1.css" attr="h" comment="" date="1512791273" size="3970" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-large_src.css" attr="h" comment="" date="1512791273" size="5119" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="img.gif" attr="h" comment="" date="1512791273" size="1266" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="menuarrow2.gif" attr="h" comment="" date="1512791273" size="49" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="index.html" attr="h" comment="" date="1512791273" size="12637" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="release-notes.html" attr="h" comment="" date="1512791273" size="18436" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-blue.css" attr="h" comment="" date="1512791273" size="2888" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-green_src.css" attr="h" comment="" date="1512791273" size="4781" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-system.css.gz" attr="h" comment="" date="1512791273" size="887" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-cold-1_src.css" attr="h" comment="" date="1512791273" size="5782" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="multiple-dates.html" attr="h" comment="" date="1512791273" size="2929" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-setup.js.gz" attr="h" comment="" date="1512791273" size="1207" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="README" attr="h" comment="" date="1512791273" size="910" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-tas.css.gz" attr="h" comment="" date="1512791273" size="942" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar.js.gz" attr="h" comment="" date="1512791273" size="9387" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="dayinfo.html" attr="h" comment="" date="1512791273" size="3039" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-cold-2.css.gz" attr="h" comment="" date="1512791273" size="833" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-blue2.css.gz" attr="h" comment="" date="1512791273" size="869" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-blue_src.css" attr="h" comment="" date="1512791273" size="4830" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="screenshot.gif" attr="h" comment="" date="1512791273" size="9363" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar_stripped.js" attr="h" comment="" date="1512791273" size="34315" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-tas.css" attr="h" comment="" date="1512791273" size="3363" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="simple-1.html" attr="h" comment="" date="1512791273" size="9448" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="foswiki.js.gz" attr="h" comment="" date="1512791273" size="353" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="foswiki.js" attr="h" comment="" date="1512791273" size="702" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-cold-1.css.gz" attr="h" comment="" date="1512791273" size="851" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="simple-3.html" attr="h" comment="" date="1512791273" size="4486" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-cold-2_src.css" attr="h" comment="" date="1512791273" size="5986" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar.js" attr="h" comment="" date="1512791273" size="34223" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar_src.js" attr="h" comment="" date="1512791273" size="50394" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="bugtest-hidden-selects.html" attr="h" comment="" date="1512791273" size="3993" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-2.css.gz" attr="h" comment="" date="1512791273" size="833" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-blue2.css" attr="h" comment="" date="1512791273" size="3048" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-1_src.css" attr="h" comment="" date="1512791273" size="5986" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-tas_src.css" attr="h" comment="" date="1512791273" size="5309" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-green.css.gz" attr="h" comment="" date="1512791273" size="828" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-green.css" attr="h" comment="" date="1512791273" size="2851" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-brown.css.gz" attr="h" comment="" date="1512791273" size="810" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar_icon.psd" attr="h" comment="" date="1512791273" size="27902" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="foswiki_src.js" attr="h" comment="" date="1512791273" size="1167" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-setup.js" attr="h" comment="" date="1512791273" size="3922" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-cold-2.css" attr="h" comment="" date="1512791273" size="3970" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-blue2_src.css" attr="h" comment="" date="1512791273" size="5006" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-setup_stripped.js" attr="h" comment="" date="1512791273" size="4919" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-system.css" attr="h" comment="" date="1512791273" size="3764" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="menuarrow.gif" attr="h" comment="" date="1512791273" size="68" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-blue.css.gz" attr="h" comment="" date="1512791273" size="828" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-cold-1.css" attr="h" comment="" date="1512791273" size="3790" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-win2k-2_src.css" attr="h" comment="" date="1512791273" size="5986" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="test.php" attr="h" comment="" date="1512791273" size="3279" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="menuarrow3.gif" attr="h" comment="" date="1512791273" size="1101" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-system_src.css" attr="h" comment="" date="1512791273" size="5707" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-brown_src.css" attr="h" comment="" date="1512791273" size="4716" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="calendar-large.css" attr="h" comment="" date="1512791273" size="3032" user="ProjectContributor" version="1"}%
18 changes: 4 additions & 14 deletions JSCalendarContrib/data/System/JSCalendarContribInline.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1430848859" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1605551505" format="1.1" version="1"}%
%META:TOPICPARENT{name="JSCalendarContrib"}%
---+ %TOPIC%

Expand All @@ -11,19 +11,9 @@ Inline include of [[JSCalendarContrib]] HTML for use in forms.
<verbatim class="tml">
%STARTINCLUDE%%STARTSECTION{"loadCalendar"}%%ADDTOZONE{
"head"
id="JSCalendarContrib/calendar-%IF{
"defined style and $style!=''"
then="%style%"
else="large"
}%"
text="<style type='text/css' media='all'>
@import url('%PUBURLPATH%/%SYSTEMWEB%/JSCalendarContrib/calendar-%IF{
"defined style and $style!=''"
then="%style%"
else="large"
}%.css');
.calendar {z-index:2000;}
</style>"
id="JSCalendarContrib/calendar-%style{default="large"}%"
text="<link rel='stylesheet' type='text/css' media='all' href='%PUBURLPATH%/%SYSTEMWEB%/JSCalendarContrib/calendar-%style{default="large"}%.css' />
<style>.calendar {z-index:2000;}</style>"
}%%TMPL:P{
"LIBJS"
id="JSCalendarContrib/calendar"
Expand Down
33 changes: 19 additions & 14 deletions JSCalendarContrib/lib/Foswiki/Contrib/JSCalendarContrib.pm
Expand Up @@ -18,8 +18,8 @@ use warnings;

use Foswiki::Func (); # The plugins API

our $VERSION = '1.56';
our $RELEASE = '08 Dec 2017';
our $VERSION = '1.60';
our $RELEASE = '16 Nov 2020';
our $SHORTDESCRIPTION =
"[[http://dynarch.com/mishoo/calendar.epl][Mishoo JSCalendar]] date and time picker, packaged for use by plugins, skins and add-ons";

Expand Down Expand Up @@ -206,35 +206,40 @@ sub addHEAD {
my $base = '%PUBURLPATH%/%SYSTEMWEB%/JSCalendarContrib';

my $css = <<HERE;
<style type='text/css' media='all'>
\@import url('$base/calendar-$style.css');
.calendar {z-index:2000;}
</style>
<style> .calendar {z-index:2000;}</style>
<link rel='stylesheet' href='$base/calendar-$style.css' media='all' />
HERE
Foswiki::Func::addToZone( 'head', 'JSCalendarContrib/css', $css );
Foswiki::Func::addToZone( 'head', "JSCalendarContrib/calendar-$style",
$css );

Foswiki::Func::addToZone( 'script', 'JSCalendarContrib/calendar',
"<script type='text/javascript' src='$base/calendar.js'></script>" );
Foswiki::Func::addToZone(
'script',
'JSCalendarContrib/calendar',
"<script src='$base/calendar.js'></script>"
);

Foswiki::Func::addToZone(
'script',
'JSCalendarContrib/calendar-lang',
"<script type='text/javascript' src='$base/lang/calendar-$lang.js'></script>",
"<script src='$base/lang/calendar-$lang.js'></script>",
'JSCalendarContrib/calendar'
);

# Add the setup separately; there might be different setups required
# in a single HTML page.
Foswiki::Func::addToZone( 'script', "JSCalendarContrib/$setup",
"<script type='text/javascript' src='$base/$setup.js'></script>",
'JSCalendarContrib/calendar' );
Foswiki::Func::addToZone(
'script',
"JSCalendarContrib/$setup",
"<script src='$base/$setup.js'></script>",
'JSCalendarContrib/calendar'
);
}

1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2015 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2008-2020 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Expand Down
Expand Up @@ -125,4 +125,3 @@ pub/System/JSCalendarContrib/skins/aqua/today-bg.gif 0644
pub/System/JSCalendarContrib/skins/aqua/transparent-bg.png 0644
pub/System/JSCalendarContrib/test-position.html 0644
pub/System/JSCalendarContrib/test.php 0644
pub/System/JSCalendarContrib/wikiringlogo20x20.png 0644
2 changes: 1 addition & 1 deletion JSCalendarContrib/lib/Foswiki/Form/Date.pm
Expand Up @@ -81,7 +81,7 @@ __DATA__
Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/
# Copyright (C) 2008 Foswiki Contributors. All Rights Reserved.
# Copyright (C) 2008-2020 Foswiki Contributors. All Rights Reserved.
# Foswiki Contributors are listed in the AUTHORS file in the root
# of this distribution. NOTE: Please extend that file, not this notice.
#
Expand Down
Binary file not shown.

0 comments on commit e157573

Please sign in to comment.