<commit_before># Collections
Posts = new Meteor.Collection("posts")
Users = new Meteor.Collection("users_proto")
Notifications = new Meteor.Collection("notifications")

# Subscriptions
Meteor.subscribe( "my_notifs" )
Meteor.subscribe( "my_posts" )

# Backbone router
class Router extends Backbone.Router
  routes:
    "": "home"
    "i/*args": "use_instance"
    "p/:post_id": "show_post"
   
  home: ->
    Session.set('showing_post', undefined)
    Session.set('home', true)

  show_post: (post_id) ->
    Meteor.call('get_post_by_id', post_id, (error, result) ->
      Session.set('showing_post', result)
    )
    Meteor.subscribe( "current_posts", post_id )

  use_instance: (args) ->
    args = args.split( '/' )
    domain = args[0]
    window.instance = domain
    other = args[1..].join( '/' )
    l = $( "<link/>" )
    l.attr( 'type', 'text/css' )
    l.attr( 'rel', 'stylesheet' )
    l.attr( 'href', "//#{domain}/style.css" )
    $('head').append( l )
    if other?
      Backbone.history.navigate("/#{other}", trigger: true)
      @navigate("/i/#{domain}/#{other}")

  link: (url) ->
    unless window.instance?<commit_msg>fixed buggy backbone routing.<commit_after># Collections
Posts = new Meteor.Collection("posts")
Users = new Meteor.Collection("users_proto")
Notifications = new Meteor.Collection("notifications")

# Subscriptions
Meteor.subscribe( "my_notifs" )
Meteor.subscribe( "my_posts" )

# Backbone router
class Router extends Backbone.Router
  routes:
    "": "home"
    "i/*args": "use_instance"
    "p/:post_id": "show_post"
   
  home: ->
    Session.set('showing_post', undefined)
    Session.set('home', true)

  show_post: (post_id) ->
    Meteor.call('get_post_by_id', post_id, (error, result) ->
      Session.set('showing_post', result)
    )
    Meteor.subscribe( "current_posts", post_id )
    #history.replaceState(null,'Socrenchus','/')

  use_instance: (args) ->
    args = args.split( '/' )
    domain = args[0]
    window.instance = domain
    other = args[1..].join( '/' )
    l = $( "<link/>" )
    l.attr( 'type', 'text/css' )
    l.attr( 'rel', 'stylesheet' )
    l.attr( 'href', "//#{domain}/style.css" )
    $('head').append( l )
    Backbone.history.options.root = "/i/#{domain}/"
    if other?
      Backbone.history.navigate("/#{other}", trigger: true)
  
  link: (url) ->
    unless window.instance?
{'fraction_non_alphanumeric': 0.1828231292517007, 'fraction_numerical': 0.0017006802721088435, 'mean_word_length': 3.3654916512059367, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 15, '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': '5301096', 'n_tokens_mistral': 843, 'n_tokens_neox': 828, 'n_words': 158}