aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2022-05-13 13:21:13 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2022-05-13 13:21:13 +0000
commit024421a96574dbb6c2a6ffc8fbd7d469140e6643 (patch)
tree6d50ee586c19a1267bcce838a6a245cf104011b2 /resources/assets/javascripts/bootstrap
parentc6893fd30b8430605978ee4525f577b9fa5a47a2 (diff)
load jquery.qrcode via npm and rework integration into stud.ip
Closes #993 Merge request studip/studip!571
Diffstat (limited to 'resources/assets/javascripts/bootstrap')
-rw-r--r--resources/assets/javascripts/bootstrap/qr_code.js42
1 files changed, 1 insertions, 41 deletions
diff --git a/resources/assets/javascripts/bootstrap/qr_code.js b/resources/assets/javascripts/bootstrap/qr_code.js
index cddc153..3a627f7 100644
--- a/resources/assets/javascripts/bootstrap/qr_code.js
+++ b/resources/assets/javascripts/bootstrap/qr_code.js
@@ -1,4 +1,4 @@
-jQuery(document).on('click', 'a[data-qr-code]', function (event) {
+$(document).on('click', 'a[data-qr-code]', function (event) {
const data = $(this).data();
STUDIP.QRCode.show(this.href, {
print: data.qrCodePrint ?? false,
@@ -8,43 +8,3 @@ jQuery(document).on('click', 'a[data-qr-code]', function (event) {
event.preventDefault();
});
-
-STUDIP.ready((event) => {
- $('code.qr', event.target).each(function () {
- let content = $(this).text().trim();
- let code = $('<div class="qrcode">').hide();
- STUDIP.QRCode.generate(code[0], content, {
- width: 1024,
- height: 1024
- });
- $(this).replaceWith(code);
- setTimeout(() => code.show(), 0);
- });
- jQuery(document).on(
- 'click',
- '#qr_code .PrintAction',
- function() {
- //We must hide the other page elements for the print view functionality.
- //Furthermore we must set the width and height of the qr-code.
- jQuery('#layout_wrapper').css(
- {
- display: 'none'
- }
- );
- jQuery('#qr_code').addClass('print-view');
-
- //Now we can print:
- window.print();
- }
- );
-
- jQuery(document).on(
- 'fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange',
- function(event) {
- //After the print action is called
- //we must reset the style changes made above:
- jQuery('#layout_wrapper').removeAttr('style');
- }
- );
-});
-