<commit_before>(function($) {

	var Waltz = this.Waltz = function(opts) {
        // If there are no opts, Waltz is not supported on this site
		if (!opts) return;
        // If the 'check' selector exists, then we're logged in, 
        // so don't show Waltz
		if ($(opts.site.config.login.check).length != 0) {
            chrome.runtime.sendMessage({ method: "acknowledgeLogin" });
            return;
        };

		var _this = this;

		this.options = opts;

		this.loginCredentials = false;

		chrome.runtime.sendMessage({
			method: "getCredentials",
			domain: this.options.site.domain

		}, function(creds) {
			if(creds.error) {
				if(creds.error === "authentication") {
					console.log("auth error");
				} else {
					console.log(creds.error, creds.status);
				}
			} else {
				_this.loginCredentials = creds.creds	
				_this.drawClefWidget();		

                console.log("Loaded credentials");
                chrome.runtime.sendMessage({
                    method: "checkTransition"
                }, function(inTransition) {
                    if (inTransition) {
                        _this.checkAuthentication(function() {
                            var errorMessage = "Invalid username and password. Please try entering your credentials again.";
                            _this.requestCredentials(errorMessage); 
                        });
                    }
                    chrome.runtime.sendMessage({ method: "acknowledgeLogin" });
                });
			}
		});

		window.addEventListener('message', this.closeIFrame.bind(this));
	}

	Waltz.prototype.storeLogin = function(username, password) {
		chrome.runtime.sendMessage({
			domain: this.options.site.domain,
			username: username,
			password: password
		});
	}

	Waltz.prototype.decryptCredentials = function(cb) {
		var self = this;
		if(self.loginCredentials && typeof(self.loginCredentials.password === "string")) {
			chrome.runtime.sendMessage({
				method: "decrypt",
				domain: self.options.site.domain,
				value: self.loginCredentials.password

			}, function(response) {

				if(typeof(cb) === "function") {
					cb({
						username: self.loginCredentials.username,
						password: <PASSWORD>.<PASSWORD>,
						error: response.error
					});
				}

			});
		}
	}

	Waltz.prototype.encryptCredentials = function(credentials, cb) {

		chrome.runtime.sendMessage({
			method: "saveCredentials",
			domain: this.options.site.domain,
			username: credentials.username,
			password: <PASSWORD>
		}, function(response) {
			if(typeof(cb) === "function") {
				cb();
			}

		});
	}

	Waltz.prototype.loadIFrame = function() {
		if (this.iframe) return;

		var self = this;

		var $iframe = this.iframe = $("<iframe id='clef_iframe'>");

		$iframe.attr('src', self.options.cyHost+'/login');

		$("body").append($iframe);

		$iframe.css({
			position: 'fixed',
			height: '100%',
			width: '100%',
			top: 0,
			left: 0,
			border: 'none',
			display: 'none',
			"z-index": 999999999
		});

		$iframe.on('load', function() {
			$iframe[0].contentWindow.postMessage(null, self.options.cyHost);
		});
	}

	Waltz.prototype.logIn = function(cb) {
		var self = this;


		if (!this.iframe) {
			this.loadIframe();
		}

		this.iframe.fadeIn();

		addEventListener("message", function(e) {
			if(e.data.auth) {
				self.iframe.remove();
				if (typeof cb == "function") {
					cb();<commit_msg>fixes Iframe -> IFrame<commit_after>(function($) {

	var Waltz = this.Waltz = function(opts) {
        // If there are no opts, Waltz is not supported on this site
		if (!opts) return;
        // If the 'check' selector exists, then we're logged in, 
        // so don't show Waltz
		if ($(opts.site.config.login.check).length != 0) {
            chrome.runtime.sendMessage({ method: "acknowledgeLogin" });
            return;
        };

		var _this = this;

		this.options = opts;

		this.loginCredentials = false;

		chrome.runtime.sendMessage({
			method: "getCredentials",
			domain: this.options.site.domain

		}, function(creds) {
			if(creds.error) {
				if(creds.error === "authentication") {
					console.log("auth error");
				} else {
					console.log(creds.error, creds.status);
				}
			} else {
				_this.loginCredentials = creds.creds	
				_this.drawClefWidget();		

                console.log("Loaded credentials");
                chrome.runtime.sendMessage({
                    method: "checkTransition"
                }, function(inTransition) {
                    if (inTransition) {
                        _this.checkAuthentication(function() {
                            var errorMessage = "Invalid username and password. Please try entering your credentials again.";
                            _this.requestCredentials(errorMessage); 
                        });
                    }
                    chrome.runtime.sendMessage({ method: "acknowledgeLogin" });
                });
			}
		});

		window.addEventListener('message', this.closeIFrame.bind(this));
	}

	Waltz.prototype.storeLogin = function(username, password) {
		chrome.runtime.sendMessage({
			domain: this.options.site.domain,
			username: username,
			password: password
		});
	}

	Waltz.prototype.decryptCredentials = function(cb) {
		var self = this;
		if(self.loginCredentials && typeof(self.loginCredentials.password === "string")) {
			chrome.runtime.sendMessage({
				method: "decrypt",
				domain: self.options.site.domain,
				value: self.loginCredentials.password

			}, function(response) {

				if(typeof(cb) === "function") {
					cb({
						username: self.loginCredentials.username,
						password: response.output,
						error: response.error
					});
				}

			});
		}
	}

	Waltz.prototype.encryptCredentials = function(credentials, cb) {

		chrome.runtime.sendMessage({
			method: "saveCredentials",
			domain: this.options.site.domain,
			username: credentials.username,
			password: <PASSWORD>
		}, function(response) {
			if(typeof(cb) === "function") {
				cb();
			}

		});
	}

	Waltz.prototype.loadIFrame = function() {
		if (this.iframe) return;

		var self = this;

		var $iframe = this.iframe = $("<iframe id='clef_iframe'>");

		$iframe.attr('src', self.options.cyHost+'/login');

		$("body").append($iframe);

		$iframe.css({
			position: 'fixed',
			height: '100%',
			width: '100%',
			top: 0,
			left: 0,
			border: 'none',
			display: 'none',
			"z-index": 999999999
		});

		$iframe.on('load', function() {
			$iframe[0].contentWindow.postMessage(null, self.options.cyHost);
		});
	}

	Waltz.prototype.logIn = function(cb) {
		var self = this;


		if (!this.iframe) {
			this.loadIFrame();
		}

		this.iframe.fadeIn();

		addEventListener("message", function(e) {
			if(e.data.auth) {
				self.iframe.remove();
				if (typeof cb == "function") {
					cb();
{'fraction_non_alphanumeric': 0.14755791648221928, 'fraction_numerical': 0.005607200826324332, 'mean_word_length': 2.492014425553838, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '763133', 'n_tokens_mistral': 2499, 'n_tokens_neox': 2042, 'n_words': 397}