X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/05901815616a29900729502d346b1eed8d9ae923..6dc65dcaa0245bfb27f1a857016b8c25f8214557:/src/wolnelektury/static/js/base.js?ds=sidebyside diff --git a/src/wolnelektury/static/js/base.js b/src/wolnelektury/static/js/base.js index 8502d6272..01c6d4e4b 100644 --- a/src/wolnelektury/static/js/base.js +++ b/src/wolnelektury/static/js/base.js @@ -74,7 +74,13 @@ $("iframe", this).attr("src", $("iframe", this).attr('data-src')); }); - $(".media-eink .carousel").cycle({fx: "none"}); + $(".carousel").each(function() { + opts = {}; + if ($('html').hasClass('media-eink')) { + opts.fx = 'none' + } + $(this).cycle(opts); + }); (function() { @@ -170,6 +176,12 @@ }); $('.hoverclick').click(function() {$(this).closest('.hoverget').toggleClass('hover');}); + $('.hoverclick').keydown(function(event){ + var keyCode = (event.keyCode ? event.keyCode : event.which); + if (keyCode == 13) { + $(this).trigger('click'); + } + }); $(function(){ $("#search").search(); @@ -349,6 +361,27 @@ return false; }); + $("#id_method").val('payu-re'); + $(".methods .button").click(function() { + $("#id_method").val($(this).attr('data-method')); + $(".methods .button").removeClass('active'); + $(this).addClass("active"); + }); + + + $("#skiplink-search").click(function() { + console.log('skiplink search'); + $("#search").focus(); + return false; + }); + + // experiments + $(".experiment input").on('change', function() { + let name = $(this).attr('name'); + let val = $(this).val(); + document.cookie = 'EXPERIMENT_' + name + '=' + val + '; path=/; max-age=31536000'; + window.location.reload(true); + }); }); })(jQuery);