application.js 1.81 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
  // Hide the Mobile Safari address bar once loaded
  // ==============================================

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

16
  // table sort example
Jacob Thornton's avatar
Jacob Thornton committed
17
18
  // ==================

19
  // make code pretty
20
  window.prettyPrint && prettyPrint()
21

22
23
24
25
  // table sort example
  if ($.fn.tableSorter) {
    $("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
  }
Jacob Thornton's avatar
Jacob Thornton committed
26
27

  // add on logic
28
29
30
31
  $('.add-on :checkbox').on('click', function () {
    var $this = $(this)
      , method = $this.attr('checked') ? 'addClass' : 'removeClass'
    $(this).parents('.add-on')[method]('active')
32
  })
Jacob Thornton's avatar
Jacob Thornton committed
33

34
  // Disable certain links in docs
35
36
37
  // 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
38

39
  $('[href^=#]').click(function (e) {
40
41
    e.preventDefault()
  })
42

43
  // Copy code blocks in docs
44
45
46
  $(".copy-code").on('focus', function () {
    var el = this
    setTimeout(function () { $(el).select() }, 0)
47
  })
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

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

    }
  }

76
})