Skip to content

Commit

Permalink
Item14801: prevent flickering rendering a qr code
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Dec 17, 2018
1 parent e5aa884 commit b031378
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 19 deletions.
12 changes: 4 additions & 8 deletions data/System/JQRCodeContrib.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1527683603" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1545040934" format="1.1" version="1"}%
---+!! %TOPIC%
%$SHORTDESCRIPTION%

Expand Down Expand Up @@ -45,7 +45,7 @@ TEL;TYPE=FAX:1234567
EMAIL:foo@bar.com
END:VCARD
</div>"
else="*You get (if installed):*$n$n<img src='%PUBURLPATH%/System/JQRCodeContrib/example.png' width='200' height='200' alt='qrcode' />"
else="*You get (if installed):*$n$n<img src='%PUBURLPATH%/%WEB%/JQRCodeContrib/example.png' width='200' height='200' alt='qrcode' />"
}%

---++ Syntax
Expand Down Expand Up @@ -73,6 +73,7 @@ may be added to the element.
---++ Change History

%TABLE{columnwidths="7em" tablewidth="100%"}%
| 17 Dec 2018 | prevent flickering when generating the code; fix dependencies; docu fixes |
| 30 May 2018 | initial version |

%META:FORM{name="PackageForm"}%
Expand All @@ -85,9 +86,4 @@ may be added to the element.
%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="https://foswiki.org/Extensions/%25$ROOTMODULE%25"}%
%META:FIELD{name="Support" title="Support" value="https://foswiki.org/Support/%25$ROOTMODULE%25"}%
%META:FILEATTACHMENT{name="example.png" attachment="example.png" attr="" comment="" date="1527683603" size="10041" user="ProjectContributor" version="1"}%
%META:PREFERENCE{name="NATSKIN_BANNERCELLSIZE" title="NATSKIN_BANNERCELLSIZE" type="Local" value="30"}%
%META:PREFERENCE{name="NATSKIN_BANNERPARTICLESCOLOR" title="NATSKIN_BANNERPARTICLESCOLOR" type="Local" value="#ffffff"}%
%META:PREFERENCE{name="NATSKIN_BANNERSPEED" title="NATSKIN_BANNERSPEED" type="Local" value="0.5"}%
%META:PREFERENCE{name="NATSKIN_BANNERMAXPARTICLES" title="NATSKIN_BANNERMAXPARTICLES" type="Local" value="70"}%
%META:PREFERENCE{name="NATSKIN_BANNERSIZEVARIATION" title="NATSKIN_BANNERSIZEVARIATION" type="Local" value="3"}%
%META:FILEATTACHMENT{name="example.png" attachment="example.png" attr="" comment="" date="1545040934" size="10041" user="ProjectContributor" version="1"}%
4 changes: 2 additions & 2 deletions lib/Foswiki/Contrib/JQRCodeContrib.pm
Expand Up @@ -20,8 +20,8 @@ use warnings;

use Foswiki::Func ();

our $VERSION = '1.00';
our $RELEASE = '30 May 2018';
our $VERSION = '1.10';
our $RELEASE = '17 Dec 2018';
our $SHORTDESCRIPTION = 'QR code generator';
our $NO_PREFS_IN_TOPIC = 1;

Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Contrib/JQRCodeContrib/Core.pm
Expand Up @@ -33,6 +33,7 @@ sub new {
javascript => ['pkg.js'],
puburl => '%PUBURLPATH%/%SYSTEMWEB%/JQRCodeContrib',
dependencies => ['livequery'],
css => ['qrcode.css'],
),
$class
);
Expand Down
4 changes: 0 additions & 4 deletions lib/Foswiki/Contrib/JQRCodeContrib/DEPENDENCIES
@@ -1,4 +0,0 @@
# Dependencies for JQRCodeContrib
# Example:
# Time::ParseDate,>=2003.0211,cpan,Required.
# Foswiki::Plugins,>=1.2,perl,Requires version 1.2 of handler API.
4 changes: 4 additions & 0 deletions lib/Foswiki/Contrib/JQRCodeContrib/MANIFEST
Expand Up @@ -4,9 +4,13 @@ lib/Foswiki/Contrib/JQRCodeContrib/Config.spec 0644
lib/Foswiki/Contrib/JQRCodeContrib/Core.pm 0644
lib/Foswiki/Contrib/JQRCodeContrib/DEPENDENCIES 0644
lib/Foswiki/Contrib/JQRCodeContrib.pm 0644
pub/System/JQRCodeContrib/example.png 0644
pub/System/JQRCodeContrib/init.uncompressed.js 0644
pub/System/JQRCodeContrib/jquery-qrcode.uncompressed.js 0644
pub/System/JQRCodeContrib/Makefile 0644
pub/System/JQRCodeContrib/pkg.js 0644
pub/System/JQRCodeContrib/pkg.js.gz 0644
pub/System/JQRCodeContrib/pkg.uncompressed.js 0644
pub/System/JQRCodeContrib/qrcode.css 0644
pub/System/JQRCodeContrib/qrcode.css.gz 0644
pub/System/JQRCodeContrib/qrcode.uncompressed.css 0644
2 changes: 1 addition & 1 deletion pub/System/JQRCodeContrib/Makefile
@@ -1,5 +1,5 @@
FOSWIKI_ROOT?=~/foswiki/core
TARGET=pkg.js
TARGET=pkg.js qrcode.css
PKG_JS_SOURCE=jquery-qrcode.uncompressed.js init.uncompressed.js

-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include
Expand Down
2 changes: 1 addition & 1 deletion pub/System/JQRCodeContrib/init.uncompressed.js
Expand Up @@ -10,7 +10,7 @@ jQuery(function($) {
text = $this.text(),
opts = $.extend({text: text}, defaults, $this.data());
$this.empty();
$this.addClass("qrcode_inited");
$this.qrcode(opts);
$this.addClass("qrcode_inited");
});
});
5 changes: 2 additions & 3 deletions pub/System/JQRCodeContrib/pkg.uncompressed.js
Expand Up @@ -2335,15 +2335,14 @@
jQuery(function($) {
var defaults = {
"size": 100,
"ecLevel": "H",
"color": "#3a3",
"ecLevel": "H"
};
$(".qrcode:not(.qrcode_inited)").livequery(function() {
var $this = $(this),
text = $this.text(),
opts = $.extend({text: text}, defaults, $this.data());
$this.empty();
$this.addClass("qrcode_inited");
$this.qrcode(opts);
$this.addClass("qrcode_inited");
});
});
1 change: 1 addition & 0 deletions pub/System/JQRCodeContrib/qrcode.css
@@ -0,0 +1 @@
.qrcode{display:none}.qrcode_inited{display:block}
Binary file added pub/System/JQRCodeContrib/qrcode.css.gz
Binary file not shown.
6 changes: 6 additions & 0 deletions pub/System/JQRCodeContrib/qrcode.uncompressed.css
@@ -0,0 +1,6 @@
.qrcode {
display:none;
}
.qrcode_inited {
display:block;
}

0 comments on commit b031378

Please sign in to comment.