<commit_before>"use strict";

var cslEditor;

// Use FileAPI to read files from local file system
var loadCSL = function () {
	var dialog = $('<div title="Load CSL Style">' + 
			'<p>Choose a CSL file to load<\/p>' +
			'<input type="file" \/>' +
			'<\/div>');
	dialog.find('input[type=file]').change(function (event) {
		var file = event.target.files[0],
			reader = new FileReader();
		reader.onload = function (event) {
			cslEditor.setCslCode(event.target.result);
			dialog.dialog("destroy");
		};
		reader.readAsText(file);
	});

	dialog.dialog({modal : true});
};

// Use Flash based downloadify plugin to save files to local file system
var saveCSL = function (cslCode) {
	var dialog = $('<div title="Save CSL Style">' + 
			'<div id="downloadify" style="padding-left: 300px"></div>' +
			'<div id="installFlash" style="padding-left:50px"></div>' +
			'<div id="refManagerInstructions"><\/div>' +
			'<\/div>'),
		saveButton = dialog.find('#downloadify'),
		filename,
		styleId = cslEditor.getStyleId();
	
	dialog.find('#refManagerInstructions').
			load("../html/fileDialog.html", function () {

		cslEditor.conformStyleToRepoConventions();

		filename = cslEditor.getStyleId().replace(/.*\//g, "").replace(/[\\/:"*?<>| ]+/g, "-") + '.csl';

		// add comment to start
		cslCode = CSLEDIT.data.getCslCode("This style was created with the Visual CSL Editor (" +
			window.location.href + ")");

		dialog.dialog({
			minWidth : 750,<commit_msg>change 'created' to 'edited' in the XML comment, since it's likely the style wasn't created from scratch in the Visual Editor<commit_after>"use strict";

var cslEditor;

// Use FileAPI to read files from local file system
var loadCSL = function () {
	var dialog = $('<div title="Load CSL Style">' + 
			'<p>Choose a CSL file to load<\/p>' +
			'<input type="file" \/>' +
			'<\/div>');
	dialog.find('input[type=file]').change(function (event) {
		var file = event.target.files[0],
			reader = new FileReader();
		reader.onload = function (event) {
			cslEditor.setCslCode(event.target.result);
			dialog.dialog("destroy");
		};
		reader.readAsText(file);
	});

	dialog.dialog({modal : true});
};

// Use Flash based downloadify plugin to save files to local file system
var saveCSL = function (cslCode) {
	var dialog = $('<div title="Save CSL Style">' + 
			'<div id="downloadify" style="padding-left: 300px"></div>' +
			'<div id="installFlash" style="padding-left:50px"></div>' +
			'<div id="refManagerInstructions"><\/div>' +
			'<\/div>'),
		saveButton = dialog.find('#downloadify'),
		filename,
		styleId = cslEditor.getStyleId();
	
	dialog.find('#refManagerInstructions').
			load("../html/fileDialog.html", function () {

		cslEditor.conformStyleToRepoConventions();

		filename = cslEditor.getStyleId().replace(/.*\//g, "").replace(/[\\/:"*?<>| ]+/g, "-") + '.csl';

		// add comment to start
		cslCode = CSLEDIT.data.getCslCode("This style was edited with the Visual CSL Editor (" +
			window.location.href + ")");

		dialog.dialog({
			minWidth : 750,
{'fraction_non_alphanumeric': 0.18884832392963824, 'fraction_numerical': 0.005974112180550946, 'mean_word_length': 3.981818181818182, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '104053', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1005, 'n_words': 241}