]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fixes QRCode style 413/head
authorArthurHoaro <arthur@hoa.ro>
Sun, 13 Dec 2015 19:44:22 +0000 (20:44 +0100)
committerArthurHoaro <arthur@hoa.ro>
Mon, 21 Dec 2015 13:01:52 +0000 (14:01 +0100)
 * fixes a regression misplacing QRCode popup.
 * adds a 'show' class in JS to handle CSS transition.

inc/shaarli.css
plugins/qrcode/qrcode.css [new file with mode: 0755]
plugins/qrcode/qrcode.html
plugins/qrcode/qrcode.php
plugins/qrcode/shaarli-qrcode.js

index 451f0481bd041c5a0be359785e4fe2c82d727b32..d6bbdbc124a3130f09821d945fe4263a2467af3c 100644 (file)
@@ -739,25 +739,6 @@ h1 {
     background: #ffffff;
 }
 
-div#permalinkQrcode {
-    padding: 20px;
-    width: 220px;
-    height: 220px;
-    background-color: #ffffff;
-    border: 1px solid black;
-    position: absolute;
-    top: -100px;
-    left: -100px;
-    text-align: center;
-    font-size: 8pt;
-    z-index: 50;
-    -webkit-box-shadow: 2px 2px 20px 2px #333333;
-    -moz-box-shadow: 2px 2px 20px 2px #333333;
-    -o-box-shadow: 2px 2px 20px 2px #333333;
-    -ms-box-shadow: 2px 2px 20px 2px #333333;
-    box-shadow: 2px 2px 20px 2px #333333;
-}
-
 div.daily {
     font-family: Georgia, 'DejaVu Serif', Norasi, serif;
     background-color: #E6D6BE;
diff --git a/plugins/qrcode/qrcode.css b/plugins/qrcode/qrcode.css
new file mode 100755 (executable)
index 0000000..0d514a0
--- /dev/null
@@ -0,0 +1,23 @@
+.linkqrcode {
+    display: inline;
+    position: relative;
+}
+
+#permalinkQrcode {
+    position: absolute;
+    z-index: 200;
+    padding: 20px;
+    width: 220px;
+    height: 220px;
+    background-color: #ffffff;
+    border: 1px solid black;
+    top: -110px;
+    left: -110px;
+    text-align: center;
+    font-size: 8pt;
+    box-shadow: 2px 2px 20px 2px #333333;
+}
+
+#permalinkQrcode img {
+    margin-bottom: 5px;
+}
index 58ac50074a1aa4b34cd3bd0515feb589be625313..ffdaf3b82ed00e644add10d3eaf8eb9384e20d69 100644 (file)
@@ -1,3 +1,5 @@
-<a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d=%s" onclick="showQrCode(this); return false;" class="qrcode" data-permalink="%s">
-    <img src="%s/qrcode/qrcode.png" width="13" height="13" title="QR-Code">
-</a>
+<div class="linkqrcode">
+    <a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d=%s" onclick="showQrCode(this); return false;" class="qrcode" data-permalink="%s">
+        <img src="%s/qrcode/qrcode.png" width="13" height="13" title="QR-Code">
+    </a>
+</div>
index 5f6e76a2f8c42d035f0c7026158b463935d953b0..a709abaa8328b9a70f8d3b3405a3052197e294f5 100644 (file)
@@ -39,3 +39,19 @@ function hook_qrcode_render_footer($data)
 
     return $data;
 }
+
+/**
+ * When linklist is displayed, include qrcode CSS file.
+ *
+ * @param array $data - header data.
+ *
+ * @return mixed - header data with qrcode CSS file added.
+ */
+function hook_qrcode_render_includes($data)
+{
+    if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
+        $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.css';
+    }
+
+    return $data;
+}
index 0a8de21de7f7a6c8b3b258e97041ae7e41a5cc60..615f54c72c3cfe42e3a8df6b8d3aa3bfc9a46c1b 100644 (file)
@@ -19,7 +19,7 @@ function showQrCode(caller,loading)
     
     // Build the div which contains the QR-Code:
     var element = document.createElement('div');
-    element.id="permalinkQrcode";
+    element.id = 'permalinkQrcode';
 
        // Make QR-Code div commit sepuku when clicked:
     if ( element.attachEvent ){
@@ -37,6 +37,12 @@ function showQrCode(caller,loading)
         element.appendChild(image);
         element.innerHTML += "<br>Click to close";
         caller.parentNode.appendChild(element);
+
+        // Show the QRCode
+        qrcodeImage = document.getElementById('permalinkQrcode');
+        // Workaround to deal with newly created element lag for transition.
+        window.getComputedStyle(qrcodeImage).opacity;
+        qrcodeImage.className = 'show';
     }
     else
     {
@@ -48,7 +54,7 @@ function showQrCode(caller,loading)
 // Remove any displayed QR-Code
 function removeQrcode()
 {
-    var elem = document.getElementById("permalinkQrcode");
+    var elem = document.getElementById('permalinkQrcode');
     if (elem) {
         elem.parentNode.removeChild(elem);
     }