summaryrefslogtreecommitdiff
path: root/static/js/kosten.js
blob: c1df1cac60459be33659299a2b48fb50777ac230 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Generated by LiveScript 1.2.0
(function(){
  var jq, addJS, showJS, catsJS, out$ = typeof exports != 'undefined' && exports || this;
  jQuery.fn.extend({
    copy: function(){
      return this.clone().removeAttr('id class');
    }
  });
  jq = function(f){
    return function(){
      $(f);
    };
  };
  out$.addJS = addJS = jq(function(){
    return $('input[name=date]').datepicker({
      dateFormat: 'dd.mm.yy',
      firstDay: 1
    });
  });
  out$.showJS = showJS = jq(function(){
    $(".detail span").click(function(){
      return $(this).prevAll('.mark:last').click();
    });
    $(".detail > .mark").click(function(){
      if (this.src.indexOf('closed') !== -1) {
        this.src = this.src.replace('closed', 'open');
      } else {
        this.src = this.src.replace('open', 'closed');
      }
      return $(this).nextAll('.details:first').toggle();
    });
    return $('.details').hide();
  });
  out$.catsJS = catsJS = jq(function(){
    var counter, add_img, new_input, new_image;
    counter = 0;
    add_img = $('img#add');
    new_input = $('input#new');
    new_image = function(new_name){
      var x$;
      x$ = add_img.copy();
      x$.attr('src', function(){
        return this.src.replace('add', new_name);
      });
      return x$;
    };
    $("li > span").click(function(){
      var span, input, x$, img;
      span = $(this);
      input = span.next();
      x$ = img = new_image('undo');
      x$.click(function(){
        $(this).remove();
        input.val(span.text());
        return input.fadeOut('slow', function(){
          return span.toggle();
        });
      });
      span.toggle();
      return input.fadeIn('slow', function(){
        return img.insertAfter(input);
      });
    });
    return add_img.click(function(){
      var input, x$, img;
      input = new_input.copy();
      x$ = img = new_image('minus');
      x$.click(function(){
        return $(this).parent().fadeOut('slow', function(){
          return $(this).remove();
        });
      });
      input.attr('name', function(){
        return this.name + counter;
      }).removeAttr('style').wrap("<li />").parent().append(img).hide().insertBefore(add_img.parent()).fadeIn('slow', function(){
        return input.focus();
      });
      return counter++;
    });
  });
}).call(this);