File modules/template_engine/components/html/component_qrcode/qrcode.min.js
Last commit: Tue Feb 22 21:37:08 2022 +0100 dankert Fix: Displaying the QRCode was broken. Now the QR code is styled with CSS :)
1 import $ from "../../../../cms/ui/themes/default/script/jquery-global.min.js"; 2 export default function(element ) { 3 let createQRCode = async function( value,text) { 4 let Kjua = (await import("../../../../cms/ui/themes/default/script/tools/kjua.min.js")).default; 5 let wrapper = $.create('div').addClass('info-popup').addClass('qrcode-value'); 6 let element = Kjua( { 7 text : value, 8 render : 'svg', 9 mode :'plain', 10 label : '', 11 rounded : 1, 12 fill : null, 13 back : null, 14 } ); 15 wrapper.attr('title',''); 16 wrapper.get(0).appendChild( element ); 17 if ( text ) 18 wrapper.append( $.create('small').addClass('qrcode-text').text(text) ); 19 return wrapper; 20 } 21 $(element).find('.or-qrcode').click( async function() { 22 let $qrCodeElement = $(this); 23 if ( ! $qrCodeElement.children('.or-info-popup').length ) { 24 let qrcodeValue = $qrCodeElement.data('qrcode'); 25 let qrcodeText = $qrCodeElement.data('qrcode-text'); 26 if ( $qrCodeElement.children().length > 0 ) 27 return; 28 $qrCodeElement.append( await createQRCode(qrcodeValue,qrcodeText) ); 29 } 30 $qrCodeElement.toggleClass('info--open'); 31 $qrCodeElement.toggleClass('btn--is-active'); 32 }); 33 };
Downloadmodules/template_engine/components/html/component_qrcode/qrcode.min.js
History Tue, 22 Feb 2022 21:37:08 +0100 dankert Fix: Displaying the QRCode was broken. Now the QR code is styled with CSS :) Sat, 18 Dec 2021 03:47:23 +0100 dankert New: Every ES6-Module should have a minified version for performance reasons. Bad: The Minifier "Jsqueeze" is unable to minify ES6-modules, so we had to implement a simple JS-Minifier which strips out all comments.