(function ($, h5ai) { var $context, qrCodesSize, showQrCode = function ($a) { var absHref = $a.attr('href'), url = 'http://' + document.domain + absHref; $context.find('.qrcode').empty().qrcode({ render: Modernizr.canvas ? 'canvas' : 'div', width: qrCodesSize, height: qrCodesSize, color: '#333', text: url }); }, init = function () { qrCodesSize = h5ai.settings.qrCodesSize; if (!qrCodesSize) { return; } var hideTimeoutId = null; $context = $('
'); $context.appendTo('body'); $('#extended') .on('mouseenter', '.entry.file a', function () { showQrCode($(this)); clearTimeout(hideTimeoutId); $context.stop(true, true).fadeIn(400); }) .on('mouseleave', '.entry.file a', function () { hideTimeoutId = setTimeout(function () { $context.stop(true, true).fadeOut(400); }, 200); }); }; h5ai.context = { init: init }; }(jQuery, h5ai));