diff options
Diffstat (limited to 'static/js/kosten.js')
-rw-r--r-- | static/js/kosten.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/static/js/kosten.js b/static/js/kosten.js new file mode 100644 index 0000000..c1df1ca --- /dev/null +++ b/static/js/kosten.js @@ -0,0 +1,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); |