<commit_before>
var fusion = P(Element, function(_, super_) {
	_.klass = ['fusion'];
	_.lineNumber = true;
	_.hasChildren = true;
	_.number_of_vars = 0;
	_.evaluatable = true;
	_.vars_loaded = false;

	_.helpText = "<<fusion 360>>\nStore values in to Fusion 360 User Parameters.  Enter the user parameter name on the left and the value or expression on the right.  Click 'sync to Fusion' to store these values in to Fusion 360.";

	_.init = function() {
		this.varList = {};
		super_.init.call(this);
	}
	_.innerHtml = function() {
		return '<div class="' + css_prefix + 'focusableItems" data-id="0">' + focusableHTML('CodeBlock', 'fusion 360') + helpBlock()
		+ '</div><div class="' + css_prefix + 'insert ' + css_prefix + 'hide_print"></div><div class="another_link explain ' + css_prefix + 'hide_print" style="margin-left: 60px;"><a href="#">Add another parameter</a></div><div class="' + css_prefix + 'insert"></div>'
		+ '<div class="sync hide_print"></div>'
		+ '<div class="' + css_prefix + 'focusableItems" data-id="2">' + focusableHTML('CodeBlock', 'end') + '</div>';
	}
	_.postInsertHandler = function() {
		this.focusableItems = [[registerFocusable(CodeBlock,this, 'fusion 360', { })], [-1], [registerFocusable(CodeBlock,this, 'end', { })]];
		super_.postInsertHandler.call(this);
		if(this.jQ) this.jQ.find('.another_link a').on('click', function(_this) { return function(e) {
			choose_fusion_var().appendTo(_this).show(250).focus(L);
			e.preventDefault();
			e.stopPropagation();
		}; }(this));
		window.ajaxRequest("/fusion/get_vars", {id: this.worksheet.server_id}, function(_this) { return function(response) { 
			vars = response.vars.split("&");
			for(var i = 0; i < vars.length; i++) {
				var varname = vars[i].replace(/=.*$/,'')
				_this.varList[varname] = varname;
			}
			_this.varList["new+"]="Create new user parameter";
			_this.vars_loaded = true;
			_this.jQ.find('div.sync').html('<a href="fusion360://command=insert&file=na&privateInfo=SwiftCalcs_load_' + response.id + '" onclick="$(this).addClass(\'grey\');return true;" target="_blank" class="button grey">Sync to Fusion 360</a> <span class="explain">Make sure Fusion 360 is open on your machine</span>')
			var children = _this.children();
			for(var i = 0; i < children.length; i++)
				if(children[i] instanceof choose_fusion_var) children[i].loadVars(_this.varList);
		} }(this), function(_this) { return function(response) { 
			_this.remove(0);
		} }(this));
		return this;
	}
  _.toString = function() {
  	return '{fusion}{{' + this.argumentList().join('}{') + '}}';
  }
	_.validateChild = function(child) {
		return (child instanceof fusion_var) || (child instanceof choose_fusion_var);<commit_msg>Add random number gen to clicks on fusion sync to avoid double 'sync' message<commit_after>
var fusion = P(Element, function(_, super_) {
	_.klass = ['fusion'];
	_.lineNumber = true;
	_.hasChildren = true;
	_.number_of_vars = 0;
	_.evaluatable = true;
	_.vars_loaded = false;

	_.helpText = "<<fusion 360>>\nStore values in to Fusion 360 User Parameters.  Enter the user parameter name on the left and the value or expression on the right.  Click 'sync to Fusion' to store these values in to Fusion 360.";

	_.init = function() {
		this.varList = {};
		super_.init.call(this);
	}
	_.innerHtml = function() {
		return '<div class="' + css_prefix + 'focusableItems" data-id="0">' + focusableHTML('CodeBlock', 'fusion 360') + helpBlock()
		+ '</div><div class="' + css_prefix + 'insert ' + css_prefix + 'hide_print"></div><div class="another_link explain ' + css_prefix + 'hide_print" style="margin-left: 60px;"><a href="#">Add another parameter</a></div><div class="' + css_prefix + 'insert"></div>'
		+ '<div class="sync hide_print"></div>'
		+ '<div class="' + css_prefix + 'focusableItems" data-id="2">' + focusableHTML('CodeBlock', 'end') + '</div>';
	}
	_.postInsertHandler = function() {
		this.focusableItems = [[registerFocusable(CodeBlock,this, 'fusion 360', { })], [-1], [registerFocusable(CodeBlock,this, 'end', { })]];
		super_.postInsertHandler.call(this);
		if(this.jQ) this.jQ.find('.another_link a').on('click', function(_this) { return function(e) {
			choose_fusion_var().appendTo(_this).show(250).focus(L);
			e.preventDefault();
			e.stopPropagation();
		}; }(this));
		window.ajaxRequest("/fusion/get_vars", {id: this.worksheet.server_id}, function(_this) { return function(response) { 
			vars = response.vars.split("&");
			for(var i = 0; i < vars.length; i++) {
				var varname = vars[i].replace(/=.*$/,'')
				_this.varList[varname] = varname;
			}
			_this.varList["new+"]="Create new user parameter";
			_this.vars_loaded = true;
			_this.jQ.find('div.sync').html('<a href="#" onclick="window.open(\'fusion360://command=insert&file=na&privateInfo=SwiftCalcs_load_' + response.id + '_' + Math.floor(Math.random() * (1000000001)) + '\',\'_blank\');$(this).addClass(\'grey\');return true;" class="button grey">Sync to Fusion 360</a> <span class="explain">Make sure Fusion 360 is open on your machine</span>')
			var children = _this.children();
			for(var i = 0; i < children.length; i++)
				if(children[i] instanceof choose_fusion_var) children[i].loadVars(_this.varList);
		} }(this), function(_this) { return function(response) { 
			_this.remove(0);
		} }(this));
		return this;
	}
  _.toString = function() {
  	return '{fusion}{{' + this.argumentList().join('}{') + '}}';
  }
	_.validateChild = function(child) {
		return (child instanceof fusion_var) || (child instanceof choose_fusion_var);
{'fraction_non_alphanumeric': 0.1900271985494107, 'fraction_numerical': 0.01486854034451496, 'mean_word_length': 4.818565400843882, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '1337219', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1796, 'n_words': 418}