<commit_before>controllers = require './controllers'
debug = (require 'debug')('app')
nedb  = require 'nedb'
{ gui } = global

angular.module('starCore', [])
	.factory('core', ->
		return global.star
	)
	.factory('imagesDb', ->
		db = new nedb { autoload: true, nodeWebkitAppName: 'star', filename: 'images.db' }
		imageStructure =
			created: Date.now()
			filename: ''
			rating: '' # safe, questionable, explicit, unknown
			hashes:
				md5: ''
				sha1: ''
			size:
				filesize: 0
				height: 0
				width: 0
			thumb:
				height: 0
				width: 0
				filename: ''
			sources: ['']
			tags: ['']
		# todo constraints

		return db
	)
	.factory('tagDb', ->
		db = new nedb { autoload: true, nodeWebkitAppName: 'star', filename: 'tags.db' }
		tagStructure =
			type: '' # author, copyright, series, character, unknown
			tag: ''
		# todo constraints

		return db
	)
	.factory('manifest', ->
		return gui.App.manifest
	)

angular.module('star', ['starCore'])
	.config(['$routeProvider', ($routeProvider) ->
		# define routes
		$routeProvider
			.when('/404', { templateUrl: 'templates/404.html' })
			.when('/image', { redirectTo: '/list' })
			.when('/', { templateUrl: 'templates/ImageList.html', controller: controllers.ImageList })
			.when('/list', { templateUrl: 'templates/ImageList.html', controller: controllers.ImageList })
			.when('/list/:page', { templateUrl: 'templates/ImageList.html', controller: controllers.ImageList })

			#.when('/image/new', { templateUrl: 'templates/latest.html', controller: controllers.ImageNew })
			#.when('/image/import', { templateUrl: 'templates/latest.html', controller: controllers.ImageImport })
			.when('/image/:imageId', { templateUrl: 'templates/ImageView.html', controller: controllers.ImageView })
			#.when('/image/:imageId/edit', { templateUrl: '', controller: controllers.ImageEdit })
			.otherwise({redirectTo: '/404'}) # todo change?
	])
<commit_msg>Tweaks to simplify angular code.<commit_after>controllers = require './controllers'
debug = (require 'debug')('app')
nedb  = require 'nedb'
{ gui } = global

angular.module('starCore', [])
	.factory('gui', ->
		gui
	)
	.factory('manifest', ->
		gui.App.manifest
	)
	.factory('imagesDb', ->
		db = new nedb { autoload: true, nodeWebkitAppName: 'star', filename: 'images.db' }
		imageStructure =
			created: Date.now()
			filename: ''
			rating: '' # safe, questionable, explicit, unknown
			hashes:
				md5: ''
				sha1: ''
			size:
				filesize: 0
				height: 0
				width: 0
			thumb:
				height: 0
				width: 0
				filename: ''
			sources: ['']
			tags: ['']
		# todo constraints

		db
	)
	.factory('tagDb', ->
		db = new nedb { autoload: true, nodeWebkitAppName: 'star', filename: 'tags.db' }
		tagStructure =
			type: '' # author, copyright, series, character, unknown
			tag: ''
		# todo constraints

		db
	)

angular.module('star', ['starCore'])
	.config(['$routeProvider', ($routeProvider) ->
		# define routes
		$routeProvider
			.when('/404', { templateUrl: 'templates/404.html' })
			.when('/image', { redirectTo: '/list' })
			.when('/', { templateUrl: 'templates/ImageList.html', controller: controllers.ImageList })
			.when('/list', { templateUrl: 'templates/ImageList.html', controller: controllers.ImageList })
			.when('/list/:page', { templateUrl: 'templates/ImageList.html', controller: controllers.ImageList })

			#.when('/image/new', { templateUrl: 'templates/latest.html', controller: controllers.ImageNew })
			#.when('/image/import', { templateUrl: 'templates/latest.html', controller: controllers.ImageImport })
			.when('/image/:imageId', { templateUrl: 'templates/ImageView.html', controller: controllers.ImageView })
			#.when('/image/:imageId/edit', { templateUrl: '', controller: controllers.ImageEdit })
			.otherwise({redirectTo: '/404'}) # todo change?
	])

{'fraction_non_alphanumeric': 0.17956819378620326, 'fraction_numerical': 0.00842548709847288, 'mean_word_length': 3.8518518518518516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1740067', 'n_tokens_mistral': 1405, 'n_tokens_neox': 1193, 'n_words': 264}