application.js 1.96 KB
Newer Older
1
$(function(){
2

3
4
5
  // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
  // IT'S ALL JUST JUNK FOR OUR DOCS!
  // ++++++++++++++++++++++++++++++++++++++++++
Jacob Thornton's avatar
Jacob Thornton committed
6

7

8
9
10
  // Hide the Mobile Safari address bar once loaded
  // ==============================================

11
12
13
14
15
  // Set a timeout...
  setTimeout(function(){
    // Hide the address bar!
    window.scrollTo(0, 1);
  }, 0);
16

17
18
19
20
21
22
23
24
25
26

  // Docs topbar nav
  // ===============

  $('.nav .active').on('click', function (e) {
    e.preventDefault()
    $(this).siblings().toggle()
  });


27
  // table sort example
Jacob Thornton's avatar
Jacob Thornton committed
28
29
  // ==================

30
  // make code pretty
31
  window.prettyPrint && prettyPrint()
32

33
34
35
36
  // table sort example
  if ($.fn.tableSorter) {
    $("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
  }
Jacob Thornton's avatar
Jacob Thornton committed
37
38

  // add on logic
39
40
41
42
  $('.add-on :checkbox').on('click', function () {
    var $this = $(this)
      , method = $this.attr('checked') ? 'addClass' : 'removeClass'
    $(this).parents('.add-on')[method]('active')
43
  })
Jacob Thornton's avatar
Jacob Thornton committed
44

45
  // Disable certain links in docs
46
47
48
  // Please do not carry these styles over to your projects
  // it's merely here to prevent button clicks form taking you
  // away from your spot on page!!
Jacob Thornton's avatar
Jacob Thornton committed
49

50
  $('[href^=#]').click(function (e) {
51
52
    e.preventDefault()
  })
53

54
  // Copy code blocks in docs
55
56
57
  $(".copy-code").on('focus', function () {
    var el = this
    setTimeout(function () { $(el).select() }, 0)
58
  })
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

  if ($.fn.twipsy) {

    // position static twipsies for components page
    if ($(".twipsies a").length) {
      $(window).on('load resize', function () {
        $(".twipsies a").each(function () {
          $(this)
            .twipsy({
              placement: $(this).attr('title')
            , trigger: 'manual'
            })
            .twipsy('show')
          })
      })
    }

    // add tipsies to grid for scaffolding
    if ($('#grid-system').length) {

      $('#grid-system').twipsy({
          selector: '.show-grid > div'
        , title: function () { return $(this).width() + 'px' }
      })

    }
  }

87
})