Aleksander Machniak
2013-05-24 ec0f74a5b2eeca20c0f287985e7270685f54a37a
Unify codestile
1 files modified
40 ■■■■ changed files
program/js/treelist.js 40 ●●●● patch | view | raw | blame | history
program/js/treelist.js
@@ -31,18 +31,18 @@
        check_droptarget: function(node){ return !node.virtual }
    }, p || {});
    var container = $(node);
    var data = p.data || [];
    var indexbyid = {};
    var selection = null;
    var drag_active = false;
    var box_coords = {};
    var item_coords = [];
    var autoexpand_timer;
    var autoexpand_item;
    var body_scroll_top = 0;
    var list_scroll_top = 0;
    var me = this;
  var container = $(node),
    data = p.data || [],
    indexbyid = {},
    selection = null,
    drag_active = false,
    box_coords = {},
    item_coords = [],
    autoexpand_timer,
    autoexpand_item,
    body_scroll_top = 0,
    list_scroll_top = 0,
    me = this;
    /////// export public members and methods
@@ -61,20 +61,17 @@
    this.get_item = get_item;
    this.get_selection = get_selection;
    /////// startup code (constructor)
    // abort if node not found
    if (!container.length)
        return;
    if (p.data) {
  if (p.data)
        index_data({ children:data });
    }
    // load data from DOM
    else {
  else
        update_data();
    }
    // register click handlers on list
    container.on('click', 'div.treetoggle', function(e){
@@ -98,6 +95,7 @@
    function collapse(id, recursive, set)
    {
        var node;
        if (node = indexbyid[id]) {
            node.collapsed = typeof set == 'undefined' || set;
            update_dom(node);
@@ -218,6 +216,7 @@
    function update_node(id, updates, sort)
    {
        var li, node = indexbyid[id];
        if (node) {
            li = id2dom(id);
@@ -277,6 +276,7 @@
    function remove(id)
    {
        var node, li;
        if (node = indexbyid[id]) {
            li = id2dom(id);
            li.remove();
@@ -345,12 +345,10 @@
        else
            li.appendTo(parent);
        if (typeof node.html == 'string') {
    if (typeof node.html == 'string')
            li.html(node.html);
        }
        else if (typeof node.html == 'object') {
    else if (typeof node.html == 'object')
            li.append(node.html);
        }
        if (node.virtual)
            li.addClass('virtual');