summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2013-09-13 07:45:29 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2013-09-13 07:45:29 +0200
commit3b61ba0f29b37123207d86e6329af27c9dc7ccfd (patch)
tree94baadee621eadf389c305cf9233a660f0cb609f
parent5be207074a09ac27a2aba37fd455d634dda99873 (diff)
downloadkosten-3b61ba0f29b37123207d86e6329af27c9dc7ccfd.tar.gz
kosten-3b61ba0f29b37123207d86e6329af27c9dc7ccfd.tar.bz2
kosten-3b61ba0f29b37123207d86e6329af27c9dc7ccfd.zip
Update kosten.ls
Diffstat (limited to '')
-rw-r--r--static/js/kosten.ls24
1 files changed, 13 insertions, 11 deletions
diff --git a/static/js/kosten.ls b/static/js/kosten.ls
index 5781126..0cec05f 100644
--- a/static/js/kosten.ls
+++ b/static/js/kosten.ls
@@ -1,17 +1,16 @@
jQuery.fn.extend do
copy : -> @clone!remove-attr 'id class'
-# Start jQuery context
-<-! $
+jq = (f) -> $ !-> f
# Add
-addJS = !->
+export addJS = jq ->
$ 'input[name=date]' .datepicker do
dateFormat: \dd.mm.yy
firstDay: 1
# Show
-showJS = !->
+export showJS = jq ->
$ ".detail span" .click ->
$ @ .prev-all \.mark:last .click!
@@ -26,7 +25,7 @@ showJS = !->
$ \.details .hide!
# Categories
-catsJS = !->
+export catsJS = jq ->
counter = 0
add_img = $ \image#add
new_input = $ \input#new
@@ -34,7 +33,7 @@ catsJS = !->
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
+ .. .attr \src -> @src.replace \add new_name
$ "li > span" .click ->
span = $ @
@@ -42,13 +41,15 @@ catsJS = !->
img = new_image \undo
.. .click ->
$ @ .remove!
- input.fade-out \slow span.toggle
+ <- input.fade-out \slow
+ span.toggle!
# reset text
input.val span.text!
span.toggle!
- input.fade-in \slow -> $ @ .after img
+ <- input.fade-in \slow
+ img.insert-after input
add_img.click ->
input = new_input.copy!
@@ -59,10 +60,11 @@ catsJS = !->
input.attr \name -> @name + counter
.remove-attr \style
- .insert-before add_img.parent!
.wrap "<li />"
-
- input.parent!
+ .parent! # wrap does not return the li
.append img
.hide!
+ .insert-before add_img.parent!
.fade-in \slow input.focus
+
+ counter++