vendor/assets/javascripts/groundworkcss/groundwork.all.js in groundworkcss-rails-0.2.3 vs vendor/assets/javascripts/groundworkcss/groundwork.all.js in groundworkcss-rails-0.2.4

- old
+ new

@@ -1,7 +1,13 @@ // Generated by CoffeeScript 1.6.1 +/* -------------------------------------------- + Begin groundwork.coffee +-------------------------------------------- +*/ + + /* * * GroundworkCSS JS by Gary Hepting - https://github.com/groundworkcss/groundwork * * Open source under the BSD License. @@ -10,16 +16,25 @@ * */ (function() { - var limitPaginationItems; + var equalizeColumns, limitPaginationItems; $(document).ready(function() { - var delay; + var delay, dropdown, menu, navitem; + equalizeColumns(); delay = ''; - $('nav > ul > li.menu').on({ + navitem = $('nav > ul > li'); + navitem.find('>a').on({ + focus: function(e) { + $('nav > ul > li').removeClass('on'); + return $('nav > ul > li > ul').hide(); + } + }); + menu = $('nav > ul > li.menu'); + menu.on({ mouseenter: function(e) { if ($(window).width() > 768) { clearTimeout(delay); $('nav > ul > li').removeClass('on'); $('nav > ul > li > ul').hide(); @@ -57,10 +72,43 @@ e.preventDefault(); return false; } } }); + menu.find('>a').on({ + focus: function() { + return $(this).parent('li.menu').trigger('mouseenter'); + } + }); + menu.find('li:last-child > a').on({ + blur: function() { + return $(this).closest('li.menu').trigger('mouseleave'); + } + }); + dropdown = $('.dropdown'); + dropdown.on({ + focus: function() { + return $(this).addClass('on'); + } + }); + dropdown.find('li:last-child a').on({ + blur: function() { + return dropdown.filter('.on').removeClass('on'); + } + }); + $('body').on('click', function(e) { + if ($(e.target).hasClass('dropdown')) { + $(e.target).toggleClass('on'); + } else { + if (dropdown.filter('.on').length) { + dropdown.filter('.on').removeClass('on'); + } + } + if (navitem.filter('.menu.on').length) { + return navitem.filter('.menu.on').removeClass('on'); + } + }); limitPaginationItems(); $('.pagination ul > li:not(.next, .prev) a').on('click', (function(e) { $('.pagination ul > li:not(.next, .prev)').removeClass('active'); $(this).parent('li').addClass('active'); if ($(this).parent('li').hasClass('first')) { @@ -134,17 +182,19 @@ } else { return $(this).removeClass('unselected'); } } }); - $('.tabs > ul > li > a').not('.disabled').on('click', function(e) { + $('.tabs > ul > li > a[href^=#]').on('click', function(e) { var tabs; - tabs = $(this).parents('.tabs'); - tabs.find('> ul li a').removeClass('active'); - $(this).addClass('active'); - tabs.children('div').removeClass('active'); - tabs.children($(this).attr('href')).addClass('active'); + if (!$(this).hasClass('disabled')) { + tabs = $(this).parents('.tabs'); + tabs.find('> ul li a').removeClass('active'); + $(this).addClass('active'); + tabs.children('div').removeClass('active'); + tabs.children($(this).attr('href')).addClass('active'); + } e.preventDefault(); return false; }); $('.responsive').not('table').each(function(index, object) { var compression, max, min; @@ -179,16 +229,13 @@ }); $('.tooltip[title]').tooltip(); return $('div.modal').modal(); }); - $(window).load(function() { - return $('.slider').orbit(); - }); - $(window).resize(function() { - return limitPaginationItems(); + limitPaginationItems(); + return equalizeColumns(); }); limitPaginationItems = function() { return $('.pagination ul').each(function() { var pagination, visibleItemsWidth, visibleSpace, _results; @@ -220,10 +267,34 @@ } return _results; }); }; + equalizeColumns = function() { + return $('.row.equalize').each(function() { + var $row, collapsed, tallest; + $row = $(this); + tallest = 0; + collapsed = false; + $(this).children('*').each(function(i) { + $(this).css('min-height', '0'); + collapsed = $(this).outerWidth() === $row.outerWidth(); + if (!collapsed) { + if (!$(this).hasClass('equal')) { + $(this).addClass('equal'); + } + if ($(this).outerHeight() > tallest) { + return tallest = $(this).outerHeight(); + } + } + }); + if (!collapsed) { + return $(this).children('*').css('min-height', tallest); + } + }); + }; + /* -------------------------------------------- Begin jquery.tooltip.coffee -------------------------------------------- */ @@ -497,14 +568,16 @@ return false; }); elems = []; $.fn.modal = function() { this.each(function() { + var $this; $(this).not('#iframeModal').wrapInner('<div class="modal-content"></div>'); $(this).prepend('<i class="close icon-remove"></i>').prepend('<i class="fullscreen icon-resize-full"></i>').appendTo('body'); + $this = $(this); return $('[href=#' + $(this).attr('id') + ']').on("click", function(e) { - modals.open($(this).attr('href')); + modals.open($(this).attr('href'), $(this).hasClass('fullscreen')); e.preventDefault(); return false; }); }); $('div.modal .close').on("click", function() { @@ -514,18 +587,18 @@ return modals.fullscreen($(this).parent('div.modal')); }); }; modals = (function() { var close, fullscreen, open; - $('html').addClass('modal-ready'); + $('body').addClass('modal-ready'); if ($("#overlay").length < 1) { $('body').append('<div id="overlay"></div>'); } $('#overlay, div.modal .close').bind("click", function(e) { return close(); }); - open = function(elem) { + open = function(elem, fullscreen) { $(window).bind("keydown", function(e) { var keyCode; keyCode = (e.which ? e.which : e.keyCode); if (keyCode === 27) { return close(); @@ -546,20 +619,23 @@ left: '50%', 'margin-top': ($(elem).outerHeight() / -2) + 'px', 'margin-left': ($(elem).outerWidth() / -2) + 'px' }); setTimeout(function() { - return $('html').addClass("modal-active"); + return $('body').addClass("modal-active"); }, 0); setTimeout(function() { - return $('html').removeClass('modal-ready'); + return $('body').removeClass('modal-ready'); }, 400); + if (fullscreen) { + modals.fullscreen(elem); + } }; close = function() { var modal; modal = $('div.modal.active'); $(window).unbind("keydown"); - $('html').removeClass("modal-active").addClass('modal-ready'); + $('body').removeClass("modal-active").addClass('modal-ready'); if (modal.hasClass('iframe')) { $('div#iframeModal iframe').replaceWith('<iframe marginheight="0" marginwidth="0" frameborder="0"></iframe>'); modal.css({ width: '80%', height: '80%'