~ubuntu-branches/ubuntu/utopic/horizon/utopic-updates

« back to all changes in this revision

Viewing changes to xstatic/pkg/bootstrap_scss/data/js/bootstrap/transition.js

  • Committer: Package Import Robot
  • Author(s): James Page, Chris Johnston, James Page
  • Date: 2014-10-03 17:54:18 UTC
  • mfrom: (0.4.1) (1.1.44) (70.1.2 utopic)
  • Revision ID: package-import@ubuntu.com-20141003175418-1jomx0azdvnl5fxz
Tags: 1:2014.2~rc1-0ubuntu1
[ Chris Johnston ]
* d/theme/css/ubuntu.css: Fix Ubuntu theme for Instances "more" dropdown
  (LP: #1308651).

[ James Page ]
* New upstream release candidate:
  - d/p/*: Refresh.
* d/watch: Use tarballs.openstack.org for upstream releases. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ========================================================================
 
2
 * Bootstrap: transition.js v3.2.0
 
3
 * http://getbootstrap.com/javascript/#transitions
 
4
 * ========================================================================
 
5
 * Copyright 2011-2014 Twitter, Inc.
 
6
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 
7
 * ======================================================================== */
 
8
 
 
9
 
 
10
+function ($) {
 
11
  'use strict';
 
12
 
 
13
  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
 
14
  // ============================================================
 
15
 
 
16
  function transitionEnd() {
 
17
    var el = document.createElement('bootstrap')
 
18
 
 
19
    var transEndEventNames = {
 
20
      WebkitTransition : 'webkitTransitionEnd',
 
21
      MozTransition    : 'transitionend',
 
22
      OTransition      : 'oTransitionEnd otransitionend',
 
23
      transition       : 'transitionend'
 
24
    }
 
25
 
 
26
    for (var name in transEndEventNames) {
 
27
      if (el.style[name] !== undefined) {
 
28
        return { end: transEndEventNames[name] }
 
29
      }
 
30
    }
 
31
 
 
32
    return false // explicit for ie8 (  ._.)
 
33
  }
 
34
 
 
35
  // http://blog.alexmaccaw.com/css-transitions
 
36
  $.fn.emulateTransitionEnd = function (duration) {
 
37
    var called = false
 
38
    var $el = this
 
39
    $(this).one('bsTransitionEnd', function () { called = true })
 
40
    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
 
41
    setTimeout(callback, duration)
 
42
    return this
 
43
  }
 
44
 
 
45
  $(function () {
 
46
    $.support.transition = transitionEnd()
 
47
 
 
48
    if (!$.support.transition) return
 
49
 
 
50
    $.event.special.bsTransitionEnd = {
 
51
      bindType: $.support.transition.end,
 
52
      delegateType: $.support.transition.end,
 
53
      handle: function (e) {
 
54
        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
 
55
      }
 
56
    }
 
57
  })
 
58
 
 
59
}(jQuery);