diff --git a/app/assets/javascripts/osem.js b/app/assets/javascripts/osem.js index 15995933..2086f813 100644 --- a/app/assets/javascripts/osem.js +++ b/app/assets/javascripts/osem.js @@ -31,6 +31,19 @@ $(function () { }); }); + /** + * Randomize order of parallel elements by shuffling the decks + * Adapted from https://stackoverflow.com/questions/7070054 + */ + + $(document).ready( function() { + $.each($(".shuffle-deck"), function(index, deck) { + for(var i = deck.children.length; i >= 0; i--) { + deck.appendChild(deck.children[Math.random() * i | 0]); + } + }); + }); + $(".select-help-toggle").change(function () { var id = $(this).attr('id'); $('.' + id).collapse('hide'); diff --git a/app/views/conferences/_highlights.haml b/app/views/conferences/_highlights.haml index 1949f4a2..b44a24b1 100644 --- a/app/views/conferences/_highlights.haml +++ b/app/views/conferences/_highlights.haml @@ -4,7 +4,7 @@ Program Highlights .row .col-md-12 - .row.row-centered + .row.row-centered.shuffle-deck - highlights.each do |event| - speaker = event.speakers_ordered.first .col-md-3.col-sm-3.col-centered.col-top.highlights