<commit_before>class Habberdash.Background extends Spine.Controller

  constructor: ->
    @attributes = {id: 'background'}
    super
    @html(@view('background', @))
    @$el.css({backgroundColor: @backgroundColor, color: @color})

    @$image = @$('img')
    @imageDimensions = {width: parseInt(@$image.attr('width'), 10), height: parseInt(@$image.attr('height'), 10)}
    @imageDimensions.ratio = @imageDimensions.width / @imageDimensions.height

    $(window).on('resize', @resize)
    @resize()


  setTitle: (title) ->
    @$('h1').html(title)


  resize: =>
    windowDimensions = {width: $(window).width(), height: $(window).height()}
    windowDimensions.ratio = windowDimensions.width / windowDimensions.height

    width = 0
    height = 0
    if @imageDimensions.ratio <= windowDimensions.ratio
      width = windowDimensions.width
      height = windowDimensions.width / @imageDimensions.ratio
    else
      height = windowDimensions.height
      width = windowDimensions.height * @imageDimensions.ratio

    @$el.css({position: 'absolute', top: 0, left: 0, zIndex: '-1', width: '100%', overflow: 'hidden', height: windowDimensions.height})

    @$image.css
      position: 'absolute'
      maxWidth: 'none'
      maxHeight: 'none'
      width: width
      height: height
      top: if @centerImage then (-(height - windowDimensions.height) / 2) else 0
      left: if @centerImage then (-(width - windowDimensions.width) / 2) else 0<commit_msg>removed setTitle, as it won't be used.<commit_after>class Habberdash.Background extends Spine.Controller

  constructor: ->
    @attributes = {id: 'background'}
    super
    @html(@view('background', @))
    @$el.css({backgroundColor: @backgroundColor, color: @color})

    @$image = @$('img')
    @imageDimensions = {width: parseInt(@$image.attr('width'), 10), height: parseInt(@$image.attr('height'), 10)}
    @imageDimensions.ratio = @imageDimensions.width / @imageDimensions.height

    $(window).on('resize', @resize)
    @resize()


  resize: =>
    windowDimensions = {width: $(window).width(), height: $(window).height()}
    windowDimensions.ratio = windowDimensions.width / windowDimensions.height

    width = 0
    height = 0
    if @imageDimensions.ratio <= windowDimensions.ratio
      width = windowDimensions.width
      height = windowDimensions.width / @imageDimensions.ratio
    else
      height = windowDimensions.height
      width = windowDimensions.height * @imageDimensions.ratio

    @$el.css({position: 'absolute', top: 0, left: 0, zIndex: '-1', width: '100%', overflow: 'hidden', height: windowDimensions.height})

    @$image.css
      position: 'absolute'
      maxWidth: 'none'
      maxHeight: 'none'
      width: width
      height: height
      top: if @centerImage then (-(height - windowDimensions.height) / 2) else 0
      left: if @centerImage then (-(width - windowDimensions.width) / 2) else 0
{'fraction_non_alphanumeric': 0.1482889733840304, 'fraction_numerical': 0.011406844106463879, 'mean_word_length': 3.5646687697160884, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '5936278', 'n_tokens_mistral': 900, 'n_tokens_neox': 857, 'n_words': 206}