summaryrefslogtreecommitdiff
path: root/static/js/kosten.js
blob: 279f35161287b88badfe0decccaefa58308e901a (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// 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();
    });
    $('.details').hide();
    return $('.pie').each(function(){
      var x$, k, v;
      x$ = $(this);
      x$.highcharts({
        title: {
          text: null
        },
        tooltip: {
          hideDelay: 200,
          formatter: function(){
            return this.key + ": <b>" + this.y.toFixed(2) + " €</b> / " + this.percentage.toFixed(2) + "%";
          }
        },
        chart: {
          backgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false,
          margin: [0, 0, 0, 0]
        },
        credits: {
          enabled: false
        },
        series: [{
          type: 'pie',
          size: '50%',
          allowPointSelect: true,
          dataLabels: {
            color: x$.css('color')
          },
          data: (function(){
            var ref$, results$ = [];
            for (k in ref$ = x$.data('pie')) {
              v = ref$[k];
              results$.push({
                name: v > 0 ? k : '',
                y: v,
                visible: v > 0
              });
            }
            return results$;
          }())
        }]
      });
      return x$;
    });
  });
  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);