Sha256: f7f64fc27aace42e17f6055a36968f417eed3b8fde44d77085479b1d6365c8be

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

$(document).ready(function() {
  //Popovers
  Kinney.twitter_bootstrap_popover_placement = function(){
    var width = window.innerWidth;
    if ($('#kinney_people_show').length > 0){
      return 'bottom';
    }
    if (width<900) return 'bottom';
    // FIXME: is there a better way to get the parent of the element which triggered the popover?
    if ($($(this)[0].$element[0]).parent().hasClass('odd') || $($(this)[0].$element[0]).parent().hasClass('left')) {
      return 'right';
    }
    return 'left';
  }

  // This is a test that ought to work in testing for touch devices
  Kinney.is_touch_device = function() {
    return !!('ontouchstart' in window);
  }

  // We only want popovers to show up on the desktop. These are currently just
  // informational, so we do not need to show them on touch devices.
  if ( !Kinney.is_touch_device() ){
    $('[rel="popover"]').popover({
      trigger: 'hover',
      placement: Kinney.twitter_bootstrap_popover_placement
    });

    $('[rel="tooltip"]').tooltip();
  } 


  // Modals
  $('.image_modal_trigger').click(function(e){
    var data_target = $(this).data('target');
    $(data_target).modal({
      remote: false
    });
    e.preventDefault();
  });


});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kinney-0.0.3 app/assets/javascripts/kinney/popovers.js
kinney-0.0.2 app/assets/javascripts/kinney/popovers.js
kinney-0.0.1 app/assets/javascripts/kinney/popovers.js