<commit_before>/* ------------------------------------------------------------------------
 * manage.js
 * Copyright (c) 2007-2011 Aimbulance, LLC. All rights reserved.
 * ------------------------------------------------------------------------ */

$(document).ready(function(){
  //$("input[type='text']:first", document.forms[0]).focus();
  var element = $('input:visible,select:visible,textarea:visible', document).get(0);
  if (element) element.focus();
});

var Manage = {
  fade_flash: function()
  {
    $('#manage_container div.message').slideUp('slow');  
  },
  
  toggle_element: function(dom_id)
  { 
    var element = $('#' + dom_id);
    
    $.cookie(element.id, (element.is(':visible') ? 0 : 1), { expires: 3, path: '/manage' });
    
    element.is(':visible') ? element.slideUp("slow") : element.slideDown("slow");
  },
  
  init_collection: function(dom_id, class_name)
  { 
    var query = "#" + dom_id + " div." + class_name;
    
    $(query)
      .bind('mouseover', this.handle_over)
      .bind('mouseout', this.handle_out);
  },
  
  handle_over: function(e)
  {
    $(this).find('div.dot-block').show();
    $(this).find('div.act-bl').show();
  },
  
  handle_out: function(e)
  {
    $(this).find('div.dot-block').hide();
    $(this).find('div.act-bl').hide();
  },
  
  append_node: function(sibling, element)
  {
    $(sibling).css({left: 0, top: 0});
    $(element).css({left: 0, top: 0});
    
    $(element).insertAfter(sibling);
  },

  move_node: function(dom_id, direction)
  {
    var element = $('#' + dom_id);
    var sibling = null;
    var node = null;
    
    switch(direction)
    {
      case 'up':
        sibling = element.prev();
        node = element;
        element = sibling;
        sibling = node;
        break;
      case 'down':
        sibling = element.next();
        break;
    }
    
    if (sibling != null)
    { 
      var element_height = element.height() + 10;
      var sibling_height = sibling.height() + 10; 
      
      element.animate({left: 0, top: sibling_height}, { duration: "slow" });
      
      sibling.animate({left: 0, top: -element_height}, {duration: "slow", complete: function(){
        Manage.append_node(sibling, element); 
      }});
    }
  },
  
  init_assets: function(query, url)
  {
    $(query + " a.fancybox").fancybox({
			'titleShow'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none'
		});
    
    $(query + ' a.del').bind("ajax:complete", function(){
      $(this).parents('div.asset').remove();
    });
    
    $(query).sortable({<commit_msg>fix manage.js - after upload, remove foto bind to live<commit_after>/* ------------------------------------------------------------------------
 * manage.js
 * Copyright (c) 2007-2011 Aimbulance, LLC. All rights reserved.
 * ------------------------------------------------------------------------ */

$(document).ready(function(){
  //$("input[type='text']:first", document.forms[0]).focus();
  var element = $('input:visible,select:visible,textarea:visible', document).get(0);
  if (element) element.focus();
});

var Manage = {
  fade_flash: function()
  {
    $('#manage_container div.message').slideUp('slow');  
  },
  
  toggle_element: function(dom_id)
  { 
    var element = $('#' + dom_id);
    
    $.cookie(element.id, (element.is(':visible') ? 0 : 1), { expires: 3, path: '/manage' });
    
    element.is(':visible') ? element.slideUp("slow") : element.slideDown("slow");
  },
  
  init_collection: function(dom_id, class_name)
  { 
    var query = "#" + dom_id + " div." + class_name;
    
    $(query)
      .bind('mouseover', this.handle_over)
      .bind('mouseout', this.handle_out);
  },
  
  handle_over: function(e)
  {
    $(this).find('div.dot-block').show();
    $(this).find('div.act-bl').show();
  },
  
  handle_out: function(e)
  {
    $(this).find('div.dot-block').hide();
    $(this).find('div.act-bl').hide();
  },
  
  append_node: function(sibling, element)
  {
    $(sibling).css({left: 0, top: 0});
    $(element).css({left: 0, top: 0});
    
    $(element).insertAfter(sibling);
  },

  move_node: function(dom_id, direction)
  {
    var element = $('#' + dom_id);
    var sibling = null;
    var node = null;
    
    switch(direction)
    {
      case 'up':
        sibling = element.prev();
        node = element;
        element = sibling;
        sibling = node;
        break;
      case 'down':
        sibling = element.next();
        break;
    }
    
    if (sibling != null)
    { 
      var element_height = element.height() + 10;
      var sibling_height = sibling.height() + 10; 
      
      element.animate({left: 0, top: sibling_height}, { duration: "slow" });
      
      sibling.animate({left: 0, top: -element_height}, {duration: "slow", complete: function(){
        Manage.append_node(sibling, element); 
      }});
    }
  },
  
  init_assets: function(query, url)
  {
    $(query + " a.fancybox").fancybox({
			'titleShow'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none'
		});
    
    $(query + ' a.del').live("ajax:complete", function(){
      $(this).parents('div.asset').remove();
    });
    
    $(query).sortable({
{'fraction_non_alphanumeric': 0.23949661181026138, 'fraction_numerical': 0.008906098741529526, 'mean_word_length': 2.204714640198511, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6341564', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1689, 'n_words': 301}