Skip to content

Commit

Permalink
Item14972: compatibility with latest JQueryPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Oct 26, 2020
1 parent 7ffaa9c commit e9ef4f7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
3 changes: 2 additions & 1 deletion data/System/JQSerialPagerContrib.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ register the serial pager widget to Foswiki.

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 26 Oct 2020: | compatibility with latest <nop>JQueryPlugin; fixed width based on width of parent container |
| 30 Aug 2017: | fixed filter, keeping hidden items when a filter is changing again |
| 23 Jan 2017: | fixed counting items in a list |
| 01 Nov 2016: | added filter feature to search in large lists |
Expand All @@ -103,7 +104,7 @@ register the serial pager widget to Foswiki.
%META:FILEATTACHMENT{name="JQSerialPagerContribSnap1.png" attachment="JQSerialPagerContribSnap1.png" attr="" comment="" date="1485185041" size="13939" user="ProjectContributor" version="1"}%
%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Michael Daum"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2012-2017 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2012-2020 Michael Daum"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="Foswiki:Extensions/%TOPIC%"}%
%META:FIELD{name="License" title="License" value="[[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]]"}%
Expand Down
11 changes: 3 additions & 8 deletions lib/Foswiki/Contrib/JQSerialPagerContrib.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# JQSerialPagerContrib is Copyright (C) 2012-2017 Michael Daum http://michaeldaumconsulting.com
# JQSerialPagerContrib is Copyright (C) 2012-2020 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -18,14 +18,9 @@ package Foswiki::Contrib::JQSerialPagerContrib;
use strict;
use warnings;

our $VERSION = '2.10';
our $RELEASE = '30 Aug 2017';
our $VERSION = '3.00';
our $RELEASE = '26 Oct 2020';
our $SHORTDESCRIPTION = 'Splits up a list and makes it a pager scroller thingy';
our $NO_PREFS_IN_TOPIC = 1;

sub init {
require Foswiki::Plugins::JQueryPlugin;
Foswiki::Plugins::JQueryPlugin::registerPlugin("SerialPager", "Foswiki::Contrib::JQSerialPagerContrib::Core");
}

1;
2 changes: 1 addition & 1 deletion lib/Foswiki/Contrib/JQSerialPagerContrib/Config.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ---+ Extensions
# ---++ JQueryPlugin
# ---+++ Extra plugins
# **STRING**
# **STRING EXPERT**
$Foswiki::cfg{JQueryPlugin}{Plugins}{SerialPager}{Module} = 'Foswiki::Contrib::JQSerialPagerContrib::Core';
# **BOOLEAN**
$Foswiki::cfg{JQueryPlugin}{Plugins}{SerialPager}{Enabled} = 1;
Expand Down
7 changes: 4 additions & 3 deletions lib/Foswiki/Contrib/JQSerialPagerContrib/Core.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# JQSerialPagerContrib is Copyright (C) 2012-2017 Michael Daum http://michaeldaumconsulting.com
# JQSerialPagerContrib is Copyright (C) 2012-2020 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -18,6 +18,7 @@ package Foswiki::Contrib::JQSerialPagerContrib::Core;
use strict;
use warnings;

use Foswiki::Contrib::JQSerialPagerContrib ();
use Foswiki::Plugins::JQueryPlugin::Plugin ();
our @ISA = qw( Foswiki::Plugins::JQueryPlugin::Plugin );

Expand All @@ -27,15 +28,15 @@ sub new {
my $this = bless(
$class->SUPER::new(
name => 'SerialPager',
version => '2.01',
version => $Foswiki::Contrib::JQSerialPagerContrib::VERSION,
author => 'Michael Daum',
homepage => 'http://foswiki.org/Extensions/JQSerialPagerContrib',
documentation => 'JQSerialPagerContrib',
css => ['jquery.serialpager.css'],
javascript => ['jquery.serialpager.js'],
puburl => '%PUBURLPATH%/%SYSTEMWEB%/JQSerialPagerContrib',
i18n => $Foswiki::cfg{SystemWebName} . "/JQSerialPagerContrib/i18n",
dependencies => ['livequery', 'serialscroll', 'i18n'],
dependencies => ['serialscroll', 'i18n'],
),
$class
);
Expand Down
16 changes: 11 additions & 5 deletions pub/System/JQSerialPagerContrib/jquery.serialpager.uncompressed.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* serial pager
*
* (c)opyright 2012-2017 Michael Daum http://michaeldaumconsulting.com
* (c)opyright 2012-2020 Michael Daum http://michaeldaumconsulting.com
*/
"use strict";
(function($) {
Expand Down Expand Up @@ -47,7 +47,8 @@
$ul = self.elem.find("ul"),
$newUl, $prev, $next, $counter,
$hiddenUl = $("<ul class='foswikiHidden'></ul>"),
nrPages, $pane, filterRegExp;
nrPages, $pane, filterRegExp,
parentWidth = self.elem.parent().width();

if (typeof(self.buttons) !== 'undefined') {
self.buttons.remove();
Expand Down Expand Up @@ -79,6 +80,9 @@

for (page = 0; page < nrPages; page++) {
$newUl = $("<ul class='jqSerialPagerPage'></ul>").appendTo($pane);
if (parentWidth) {
$newUl.width(parentWidth);
}
$ul.find("li:lt("+self.opts.pagesize+")").appendTo($newUl);
}

Expand Down Expand Up @@ -136,12 +140,14 @@
window.setTimeout(function() {
var $widthElem = self.opts.widthElem?self.elem.find(self.opts.widthElem).first():self.elem,
width = $widthElem.width();
if (width) {
if (width && width != parentWidth) {
self.elem.find(".jqSerialPagerPage").css("width", width+1);
}
}, 0);
});

self.elem.width(self.opts.width);
if (self.opts.width !== 'auto') {
self.elem.width(self.opts.width);
}

return nrPages;
};
Expand Down

0 comments on commit e9ef4f7

Please sign in to comment.