<commit_before>#= require jquery
#= require way.min
#= require underscore-min
#= require screenfull

unless String::trim then String::trim = -> @replace /^\s+|\s+$/g, ""
wall_id = null
wall = {}
SIZE = 5
per_page = SIZE
INTERVAL = 3000

window.main = {
  initialize : (id)->
    this.load(id)
  wall_url: (id) ->
    "/walls/#{id}.json"

  load: (id) ->
    $.get this.wall_url(id), (data) ->
      wall = data.wall
      way.set "wall", wall
      wall_id = id
      if wall.background_image_url
        $("body").css("background-image", "url(#{wall.background_image_url})")

      main.draw(0)
  draw: (start) ->
    console.log("===>", start)
    normal = wall.messages
    sticky = wall.sticky_messages
    current = wall.messages.slice(start, start + per_page)

    if sticky.length > 0
      per_page = SIZE - sticky.length
      current = sticky.concat(normal.slice(start, start + per_page))

    next_start = start + (per_page - sticky.length)

    way.set "messages", current

    if normal[next_start]
      setTimeout ->
        main.draw(start + per_page)
      , INTERVAL
    else
      setTimeout ->
        main.load(wall_id)
      , INTERVAL

$(document).ready ->
  if screenfull.isFullscreen<commit_msg>fix js<commit_after>#= require jquery
#= require way.min
#= require underscore-min
#= require screenfull

unless String::trim then String::trim = -> @replace /^\s+|\s+$/g, ""
wall_id = null
wall = {}
SIZE = 5
per_page = SIZE
INTERVAL = 3000

window.main = {
  initialize : (id)->
    this.load(id)
  wall_url: (id) ->
    "/walls/#{id}.json"

  load: (id) ->
    $.get this.wall_url(id), (data) ->
      wall = data.wall
      way.set "wall", wall
      wall_id = id
      if wall.background_image_url
        $("body").css("background-image", "url(#{wall.background_image_url})")

      main.draw(0)
  draw: (start) ->
    normal = wall.messages
    sticky = wall.sticky_messages
    current = wall.messages.slice(start, start + per_page)

    if sticky.length > 0
      per_page = SIZE - sticky.length
      current = sticky.concat(normal.slice(start, start + per_page))

    next_start = start + (per_page - sticky.length)

    way.set "messages", current

    if normal[next_start]
      setTimeout ->
        main.draw(start + per_page)
      , INTERVAL
    else
      setTimeout ->
        main.load(wall_id)
      , INTERVAL

}

$(document).ready ->
  if screenfull.isFullscreen
{'fraction_non_alphanumeric': 0.14760914760914762, 'fraction_numerical': 0.0058212058212058215, 'mean_word_length': 2.6509863429438543, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '1868688', 'n_tokens_mistral': 848, 'n_tokens_neox': 803, 'n_words': 178}