Nicer search, minor fixes.
[wolnelektury.git] / src / wolnelektury / static / js / base.js
index 2c2daa5..01c6d4e 100644 (file)
             $("iframe", this).attr("src", $("iframe", this).attr('data-src'));
         });
 
+        $(".carousel").each(function() {
+            opts = {};
+            if ($('html').hasClass('media-eink')) {
+                opts.fx = 'none'
+            }
+            $(this).cycle(opts);
+        });
+
 
         (function() {
             var $current = null;
         });
 
         $('.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();
             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);