<commit_before>$(document).ready(function() {
	$('span.add-plugin').click(function(){
		var select = $(this).parent().children("select")
		var pluginvalue = select.attr('value')
		var placeholder = $(this).parent().parent().parent().parent().parent().children("h2").text()
		var page_id = window.location.href.split("/")[6]  
		var language = $('#id_language').attr('value')
		var target_div = $(this).parent().parent().parent().children('div.plugin-editor')
		if (pluginvalue) {
			var pluginname = select.children('[@selected]').text()
			var ul_list = $(this).parent().parent().children("ul.plugin-list")
			$.post("add-plugin/", { page_id:page_id, placeholder:placeholder, plugin_type:pluginvalue, language:language }, function(data){
				if ('error' != data) {
					loadPluginForm(target_div, data)
					ul_list.append('<li id="plugin_' + data + '" class="' + pluginvalue + ' active"><span class="drag"></span><span class="text">' + pluginname + '</span><span class="delete"></span></li>')
					setclickfunctions();
				}
			}, "html" );
		}
	});
	$('ul.plugin-list').sortable({	handle:'span.drag',
									//appendTo:'body',
									axis:'y',
									opacity:0.9,
									zIndex:2000,
									update:function(event, ui){
										var array = ui.element.sortable('toArray')
										var d = ""
										for(var i=0;i<array.length;i++){
											d += array[i].split("plugin_")[1]
											if (i!=array.length-1){
												d += "_"
											}
										}
										
										$.post("move-plugin", { ids:d },
										  function(data){
										  }, "json");
	
									}
								})
	setclickfunctions();
});

function setclickfunctions(){
	$('ul.plugin-list .text').click(function(){
		var target = $(this).parent().parent().parent().parent().children("div.plugin-editor")
		var id = $(this).parent().attr("id").split("plugin_")[1]
		loadPluginForm(target, id)
		return false
	})
	
	$('ul.plugin-list .delete').click(function(){
		var plugin_id = $(this).parent().attr("id").split("plugin_")[1]
		$.post("remove-plugin/", { plugin_id:plugin_id }, function(data){
			$("#plugin_"+data).remove()
		}, "html");
   	});
   
   	
}

function setiframeheight(height, id){
	$('#iframe_'+id).height(height+"px")
}

function hide_iframe(id, msg){
	$('#iframe_'+id).parent().html("<p>"+msg+"</p>")
}

function loadPluginForm(target, id){
	var object = '<iframe id="iframe_'+id+'" src="edit-plugin/'+id+'/" frameborder="0"></iframe>' 
	target.html(object)
	$('ul.plugin-list .active').removeClass("active")
	$('#plugin_'+id).addClass("active")
};<commit_msg>Reformatted javascript, adding semi-colons<commit_after>$(document).ready(function() {
    $('span.add-plugin').click(function(){
        var select = $(this).parent().children("select");
        var pluginvalue = select.attr('value');
        var placeholder = $(this).parent().parent().parent().parent().parent().children("h2").text();
        var page_id = window.location.href.split("/")[6];
        var language = $('#id_language').attr('value');
        var target_div = $(this).parent().parent().parent().children('div.plugin-editor');
        if (pluginvalue) {
            var pluginname = select.children('[@selected]').text();
            var ul_list = $(this).parent().parent().children("ul.plugin-list");
            $.post("add-plugin/", { page_id:page_id, placeholder:placeholder, plugin_type:pluginvalue, language:language }, function(data){
                if ('error' != data) {
                    loadPluginForm(target_div, data);
                    ul_list.append('<li id="plugin_' + data + '" class="' + pluginvalue + ' active"><span class="drag"></span><span class="text">' + pluginname + '</span><span class="delete"></span></li>');
                    setclickfunctions();
                }
            }, "html" );
        }
    });
    $('ul.plugin-list').sortable({handle:'span.drag',
                                  //appendTo:'body',
                                  axis:'y',
                                  opacity:0.9,
                                  zIndex:2000,
                                  update:function(event, ui){
                                      var array = ui.element.sortable('toArray');
                                      var d = "";
                                      for(var i=0;i<array.length;i++){
                                          d += array[i].split("plugin_")[1];
                                          if (i!=array.length-1){
                                              d += "_";
                                          }
                                      }

                                      $.post("move-plugin", { ids:d },
                                          function(data){
                                      }, "json");

                                  }
                                 }
                                );
    setclickfunctions();
});

function setclickfunctions(){
    $('ul.plugin-list .text').click(function(){
        var target = $(this).parent().parent().parent().parent().children("div.plugin-editor");
        var id = $(this).parent().attr("id").split("plugin_")[1];
        loadPluginForm(target, id);
        return false;
    });

    $('ul.plugin-list .delete').click(function(){
        var plugin_id = $(this).parent().attr("id").split("plugin_")[1];
        $.post("remove-plugin/", { plugin_id:plugin_id }, function(data){
        $("#plugin_"+data).remove();
                }, "html");
        });
}

function setiframeheight(height, id){
    $('#iframe_'+id).height(height+"px");
}

function hide_iframe(id, msg){
    $('#iframe_'+id).parent().html("<p>"+msg+"</p>");
}

function loadPluginForm(target, id){
    var object = '<iframe id="iframe_'+id+'" src="edit-plugin/'+id+'/" frameborder="0"></iframe>';
    target.html(object);
    $('ul.plugin-list .active').removeClass("active");
    $('#plugin_'+id).addClass("active");
};
{'fraction_non_alphanumeric': 0.2022169969768223, 'fraction_numerical': 0.0047027208599261005, 'mean_word_length': 2.1441393875395987, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6069997', 'n_tokens_mistral': 1918, 'n_tokens_neox': 1673, 'n_words': 246}