application.js 1.83 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
  // Set a timeout...
12
13
14
15
  // setTimeout(function(){
  //   // Hide the address bar!
  //   window.scrollTo(0, 1);
  // }, 0);
16

17

18
  // table sort example
Jacob Thornton's avatar
Jacob Thornton committed
19
20
  // ==================

21
  // make code pretty
22
  window.prettyPrint && prettyPrint()
23

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

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

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

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

45
  // Copy code blocks in docs
46
47
48
  $(".copy-code").on('focus', function () {
    var el = this
    setTimeout(function () { $(el).select() }, 0)
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
76
77

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

    }
  }

78
})