diff options
author | ArthurHoaro <arthur@hoa.ro> | 2015-12-13 20:44:22 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2015-12-21 14:01:52 +0100 |
commit | 28a4fc546fd937ba4aef89e2a70bf3e1ae1508d3 (patch) | |
tree | a0b3c198f1af5d28d4f8192a958bd1bf6fb7bb0b /plugins/qrcode/shaarli-qrcode.js | |
parent | 79851b489087f8a3027ecd805255cd13ee6fcf63 (diff) | |
download | Shaarli-28a4fc546fd937ba4aef89e2a70bf3e1ae1508d3.tar.gz Shaarli-28a4fc546fd937ba4aef89e2a70bf3e1ae1508d3.tar.zst Shaarli-28a4fc546fd937ba4aef89e2a70bf3e1ae1508d3.zip |
Fixes QRCode style
* fixes a regression misplacing QRCode popup.
* adds a 'show' class in JS to handle CSS transition.
Diffstat (limited to 'plugins/qrcode/shaarli-qrcode.js')
-rw-r--r-- | plugins/qrcode/shaarli-qrcode.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/qrcode/shaarli-qrcode.js b/plugins/qrcode/shaarli-qrcode.js index 0a8de21d..615f54c7 100644 --- a/plugins/qrcode/shaarli-qrcode.js +++ b/plugins/qrcode/shaarli-qrcode.js | |||
@@ -19,7 +19,7 @@ function showQrCode(caller,loading) | |||
19 | 19 | ||
20 | // Build the div which contains the QR-Code: | 20 | // Build the div which contains the QR-Code: |
21 | var element = document.createElement('div'); | 21 | var element = document.createElement('div'); |
22 | element.id="permalinkQrcode"; | 22 | element.id = 'permalinkQrcode'; |
23 | 23 | ||
24 | // Make QR-Code div commit sepuku when clicked: | 24 | // Make QR-Code div commit sepuku when clicked: |
25 | if ( element.attachEvent ){ | 25 | if ( element.attachEvent ){ |
@@ -37,6 +37,12 @@ function showQrCode(caller,loading) | |||
37 | element.appendChild(image); | 37 | element.appendChild(image); |
38 | element.innerHTML += "<br>Click to close"; | 38 | element.innerHTML += "<br>Click to close"; |
39 | caller.parentNode.appendChild(element); | 39 | caller.parentNode.appendChild(element); |
40 | |||
41 | // Show the QRCode | ||
42 | qrcodeImage = document.getElementById('permalinkQrcode'); | ||
43 | // Workaround to deal with newly created element lag for transition. | ||
44 | window.getComputedStyle(qrcodeImage).opacity; | ||
45 | qrcodeImage.className = 'show'; | ||
40 | } | 46 | } |
41 | else | 47 | else |
42 | { | 48 | { |
@@ -48,7 +54,7 @@ function showQrCode(caller,loading) | |||
48 | // Remove any displayed QR-Code | 54 | // Remove any displayed QR-Code |
49 | function removeQrcode() | 55 | function removeQrcode() |
50 | { | 56 | { |
51 | var elem = document.getElementById("permalinkQrcode"); | 57 | var elem = document.getElementById('permalinkQrcode'); |
52 | if (elem) { | 58 | if (elem) { |
53 | elem.parentNode.removeChild(elem); | 59 | elem.parentNode.removeChild(elem); |
54 | } | 60 | } |