diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2013-09-11 01:25:24 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2013-09-11 01:25:24 +0200 |
commit | 5be207074a09ac27a2aba37fd455d634dda99873 (patch) | |
tree | d49b160982cbd3006d4125b4db5a96a2dd5196dc | |
parent | 698548529a570b3cab576ae33b5b514d2db7ddb0 (diff) | |
download | kosten-5be207074a09ac27a2aba37fd455d634dda99873.tar.gz kosten-5be207074a09ac27a2aba37fd455d634dda99873.tar.bz2 kosten-5be207074a09ac27a2aba37fd455d634dda99873.zip |
Converted JS to LS
Diffstat (limited to '')
-rw-r--r-- | static/js/kosten.ls | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/static/js/kosten.ls b/static/js/kosten.ls new file mode 100644 index 0000000..5781126 --- /dev/null +++ b/static/js/kosten.ls @@ -0,0 +1,68 @@ +jQuery.fn.extend do + copy : -> @clone!remove-attr 'id class' + +# Start jQuery context +<-! $ + +# Add +addJS = !-> + $ 'input[name=date]' .datepicker do + dateFormat: \dd.mm.yy + firstDay: 1 + +# Show +showJS = !-> + $ ".detail span" .click -> + $ @ .prev-all \.mark:last .click! + + $ ".detail > .mark" .click -> + if (@src.indexOf \closed) is not -1 + @src .= replace \closed \open + else + @src .= replace \open \closed + + $ @ .next-all \.details:first .toggle! + + $ \.details .hide! + +# Categories +catsJS = !-> + counter = 0 + add_img = $ \image#add + new_input = $ \input#new + + new_image = (new_name) -> + # we need to copy the image to get the correct URL + add_img.copy! + .. .attr \src -> @src.replace \add, new_name + + $ "li > span" .click -> + span = $ @ + input = span.next! + img = new_image \undo + .. .click -> + $ @ .remove! + input.fade-out \slow span.toggle + + # reset text + input.val span.text! + + span.toggle! + input.fade-in \slow -> $ @ .after img + + add_img.click -> + input = new_input.copy! + img = new_image \minus + .. .click -> + <- $ @ .parent!fade-out \slow + $ @ .remove! + + input.attr \name -> @name + counter + .remove-attr \style + .insert-before add_img.parent! + .wrap "<li />" + + input.parent! + .append img + .hide! + .fade-in \slow input.focus |