Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup QR code links without jQuery #3206

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions themes/bootstrap3/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,20 @@ var VuFind = (function VuFind() {
};

function setupQRCodeLinks(_container) {
var container = _container || $('body');

container.find('a.qrcodeLink').on('click', function qrcodeToggle() {
var holder = $(this).next('.qrcode');
if (holder.find('img').length === 0) {
// We need to insert the QRCode image
var template = holder.find('.qrCodeImgTag').html();
holder.html(template);
}
var container = _container || document.body;
var qrcodeLinks = container.querySelectorAll('a.qrcodeLink');
qrcodeLinks.forEach((link) => {
link.addEventListener('click', () => {
var holder = this.nextElementSibling;
padmasreegade marked this conversation as resolved.
Show resolved Hide resolved
if (holder.find('img').length === 0) {
// We need to insert the QRCode image
var template = holder.find('.qrCodeImgTag').html();
holder.html(template);
}
});
});
}

demiankatz marked this conversation as resolved.
Show resolved Hide resolved
/**
* Initialize result page scripts.
*
Expand Down