application.js 1.54 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
  // make code pretty
  prettyPrint && prettyPrint()
9

10
11
12
13
  // table sort example
  if ($.fn.tableSorter) {
    $("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
  }
Jacob Thornton's avatar
Jacob Thornton committed
14
15

  // add on logic
16
17
18
19
  $('.add-on :checkbox').on('click', function () {
    var $this = $(this)
      , method = $this.attr('checked') ? 'addClass' : 'removeClass'
    $(this).parents('.add-on')[method]('active')
20
  })
Jacob Thornton's avatar
Jacob Thornton committed
21

22
  // Disable certain links in docs
23
24
25
  // 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
26

27
  $('[href^=#]').click(function (e) {
28
29
    e.preventDefault()
  })
30

31
  // Copy code blocks in docs
32
33
34
  $(".copy-code").on('focus', function () {
    var el = this
    setTimeout(function () { $(el).select() }, 0)
35
  })
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

  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' }
      })

    }
  }

})