<commit_before>Chaplin = require 'chaplin'
getSlug = require 'speakingurl'
_ = require 'underscore'

mediator = Chaplin.mediator

module.exports = class Layout extends Chaplin.Layout

  regions:
    'header': '#bkts-header'

  events:
    'keyup input[data-sluggify]': 'keyUpSluggify'
    'click [href="#menu"]': 'clickMenu'
    'click .nav-primary a': 'clickMenuNav'
    'click .logout a': 'fadeAwayFadeAway'

  clickMenu: (e) ->
    e.preventDefault()
    @$('.nav-primary').toggleClass('hidden-xs').toggle().slideToggle 200

  clickMenuNav: ->
    if @$('.hidden-xs:visible').length is 0
      @$('.nav-primary').css(display: 'block').slideToggle 150, =>
        @$('.nav-primary').toggleClass('hidden-xs').toggle()

  initialize: ->
    super

    toastr.options =
      debug: false
      positionClass: "toast-bottom-right"
      showDuration: 100
      hideDuration: 100
      timeOut: 2100
      extendedTimeOut: 1000
      showEasing: 'swing'
      hideEasing: 'swing'
      showMethod: 'slideDown'
      hideMethod: 'slideUp'

    # Add delegated tooltip for all help icons
    @$el.tooltip
      selector: '.show-tooltip'

    # Add Fastclick for touch devices
    Modernizr.load
      test: Modernizr.touch
      yep: "/#{mediator.options.adminSegment}/vendor/fastclick/fastclick.js"
      complete: ->
        FastClick?.attach document.body

  keyUpSluggify: (e) ->
    $el = @$(e.currentTarget)

    val = $el.val()
    $target = @$("input[name=\"#{$el.data('sluggify')}\"]")
    slug = getSlug val

    $target.val slug

  fadeAwayFadeAway: ->
    $('body').css opacity: .85<commit_msg>Bucket squish on click<commit_after>Chaplin = require 'chaplin'
getSlug = require 'speakingurl'
_ = require 'underscore'

mediator = Chaplin.mediator

module.exports = class Layout extends Chaplin.Layout

  regions:
    'header': '#bkts-header'

  events:
    'keyup input[data-sluggify]': 'keyUpSluggify'
    'click [href="#menu"]': 'clickMenu'
    'mouseup #logo a': 'clickLogo'
    'click .nav-primary a': 'clickMenuNav'
    'click .logout a': 'fadeAwayFadeAway'

  clickMenu: (e) ->
    e.preventDefault()
    @$('.nav-primary').toggleClass('hidden-xs').toggle().slideToggle 200

  clickMenuNav: ->
    if @$('.hidden-xs:visible').length is 0
      @$('.nav-primary').css(display: 'block').slideToggle 150, =>
        @$('.nav-primary').toggleClass('hidden-xs').toggle()

  initialize: ->
    super

    toastr.options =
      debug: false
      positionClass: "toast-bottom-right"
      showDuration: 100
      hideDuration: 100
      timeOut: 2100
      extendedTimeOut: 1000
      showEasing: 'swing'
      hideEasing: 'swing'
      showMethod: 'slideDown'
      hideMethod: 'slideUp'

    # Add delegated tooltip for all help icons
    @$el.tooltip
      selector: '.show-tooltip'

    # Add Fastclick for touch devices
    Modernizr.load
      test: Modernizr.touch
      yep: "/#{mediator.options.adminSegment}/vendor/fastclick/fastclick.js"
      complete: ->
        FastClick?.attach document.body

  keyUpSluggify: (e) ->
    $el = @$(e.currentTarget)

    val = $el.val()
    $target = @$("input[name=\"#{$el.data('sluggify')}\"]")
    slug = getSlug val

    $target.val slug

  fadeAwayFadeAway: ->
    $('body').css opacity: .85

  clickLogo: (e) ->
    e.preventDefault()

    @$logoImg ?= $('#logo img')

    TweenLite.killTweensOf @$logoImg

    TweenLite.from @$logoImg, .5,
      scaleX: .65
      ease: Elastic.easeOut
    TweenLite.from @$logoImg, .5,
      scaleY: .65
      delay: .05
      ease: Elastic.easeOut
      immediateRender: yes
{'fraction_non_alphanumeric': 0.15190582959641255, 'fraction_numerical': 0.015134529147982063, 'mean_word_length': 2.896288209606987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7037614', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1204, 'n_words': 252}