<commit_before>var _ = require('underscore')
var Backbone = require('backbone')
var remoteStorage = require('remotestorage')
var AppView = require('./views/app')
var Doc = require('./models/doc')
var Docs = require('./collections/docs')
var State = require('./models/state')

function Litewrite () {
  this.initialize()
}

_.extend(Litewrite.prototype, Backbone.Events, {
  initialize: function () {
    _.bindAll(this, 'loadDoc', 'open', 'openOnCreate', 'updateCurrentDoc', 'handlePrevious', 'updateDocs', 'handleRemoteRemove', 'triggerConnected', 'triggerDisconnected')

    this.state = new State()
    this.doc = new Doc()
    this.docs = new Docs()

    this.doc
      .on('change:content', this.doc.updateLastEdited)
      .on('change:public', this.doc.updateLastEdited)
      .on('change:content', this.doc.updateTitle)
      .on('change:id', this.handlePrevious)
      .on('change:id', this.setUrl)
      .on('change:title', this.setWindowTitle)
      .on('change', this.updateDocs)

    this.state.fetch().always(_.bind(function () {
      this.docs.fetch().always(this.loadDoc)
    }, this))

    this.app = new AppView({ litewrite: this, model: this.doc, collection: this.docs })

    if (window.cordova) {
        remoteStorage.setCordovaRedirectUri('https://khertan.net/')
    }
    remoteStorage.displayWidget('remotestorage-connect')

    remoteStorage.on('ready', this.triggerConnected)
    remoteStorage.on('disconnected', this.triggerDisconnected)
  },

  loadDoc: function () {
    this.docs
      .on('add', this.openOnCreate)
      .on('remoteUpdate', this.updateCurrentDoc)
      .on('remove', this.handleRemoteRemove)<commit_msg>use http://litewrite.net as redirect uri to keep sync with litewrite.net<commit_after>var _ = require('underscore')
var Backbone = require('backbone')
var remoteStorage = require('remotestorage')
var AppView = require('./views/app')
var Doc = require('./models/doc')
var Docs = require('./collections/docs')
var State = require('./models/state')

function Litewrite () {
  this.initialize()
}

_.extend(Litewrite.prototype, Backbone.Events, {
  initialize: function () {
    _.bindAll(this, 'loadDoc', 'open', 'openOnCreate', 'updateCurrentDoc', 'handlePrevious', 'updateDocs', 'handleRemoteRemove', 'triggerConnected', 'triggerDisconnected')

    this.state = new State()
    this.doc = new Doc()
    this.docs = new Docs()

    this.doc
      .on('change:content', this.doc.updateLastEdited)
      .on('change:public', this.doc.updateLastEdited)
      .on('change:content', this.doc.updateTitle)
      .on('change:id', this.handlePrevious)
      .on('change:id', this.setUrl)
      .on('change:title', this.setWindowTitle)
      .on('change', this.updateDocs)

    this.state.fetch().always(_.bind(function () {
      this.docs.fetch().always(this.loadDoc)
    }, this))

    this.app = new AppView({ litewrite: this, model: this.doc, collection: this.docs })

    if (window.cordova) {
        remoteStorage.setCordovaRedirectUri('http://litewrite.net/')
    }
    remoteStorage.displayWidget('remotestorage-connect')

    remoteStorage.on('ready', this.triggerConnected)
    remoteStorage.on('disconnected', this.triggerDisconnected)
  },

  loadDoc: function () {
    this.docs
      .on('add', this.openOnCreate)
      .on('remoteUpdate', this.updateCurrentDoc)
      .on('remove', this.handleRemoteRemove)
{'fraction_non_alphanumeric': 0.160820451843044, 'fraction_numerical': 0.0, 'mean_word_length': 3.977810650887574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '3257519', 'n_tokens_mistral': 1056, 'n_tokens_neox': 1038, 'n_words': 188}