summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2013-09-14 00:27:31 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2013-09-14 00:27:31 +0200
commitf475f0095f2b4af1acab8cfe3d6c866a71b73bf1 (patch)
treef43d5ca41f17765c56bf00afb0a523ffef805b2f /static
parent9b358a4a3e6ce5cad229ba2fa6da9218e88b61e0 (diff)
downloadkosten-f475f0095f2b4af1acab8cfe3d6c866a71b73bf1.tar.gz
kosten-f475f0095f2b4af1acab8cfe3d6c866a71b73bf1.tar.bz2
kosten-f475f0095f2b4af1acab8cfe3d6c866a71b73bf1.zip
Replaced current JS by LS and generated JS
Diffstat (limited to 'static')
-rw-r--r--static/js/add.js6
-rw-r--r--static/js/cats.js39
-rw-r--r--static/js/kosten.js81
-rw-r--r--static/js/kosten.ls26
-rw-r--r--static/js/lib.js6
-rw-r--r--static/js/show.js17
6 files changed, 94 insertions, 81 deletions
diff --git a/static/js/add.js b/static/js/add.js
deleted file mode 100644
index 76c1f4a..0000000
--- a/static/js/add.js
+++ /dev/null
@@ -1,6 +0,0 @@
-$(document).ready(function(){
- $("input[name=date]").datepicker({
- dateFormat: 'dd.mm.yy',
- firstDay: 1
- });
-})
diff --git a/static/js/cats.js b/static/js/cats.js
deleted file mode 100644
index e65cc28..0000000
--- a/static/js/cats.js
+++ /dev/null
@@ -1,39 +0,0 @@
-var counter = 0;
-
-$(document).ready(function(){
- $("li > span").click(function(){
- var span = $(this);
- var img = $("img#add").copy().attr('src', function() { return this.src.replace("add", "undo"); });
-
- img.click(function(){
- var input = $(this).prev();
-
- $(this).remove();
- input.fadeOut("slow",
- function() {
- span.toggle();
- });
-
- input.val(span.text());
- });
-
- span.toggle();
- $(this).next().fadeIn("slow", function() {$(this).after(img); });
- });
-
- $("img#add").click(function(){
- var input = $("input#new").copy();
- var img = $(this).copy().attr('src', function() { return this.src.replace("add", "minus"); });
- img.click(function() { $(this).parent().fadeOut("slow", function() { $(this).remove(); }) });
-
- input.attr('name', function() { return this.name + counter; })
- .removeAttr('style')
- .insertBefore($(this).parent())
- .wrap("<li />");
-
- input.parent().append(img)
- .hide().fadeIn("slow", function (){ input.focus(); });
-
- counter = counter + 1;
- });
-})
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);
diff --git a/static/js/kosten.ls b/static/js/kosten.ls
index 443210a..8bf746d 100644
--- a/static/js/kosten.ls
+++ b/static/js/kosten.ls
@@ -1,7 +1,7 @@
jQuery.fn.extend do
copy : -> @clone!remove-attr 'id class'
-jq = (f) -> $ !-> f
+jq = (f) -> !-> $ f
# Add
export addJS = jq ->
@@ -27,26 +27,26 @@ export showJS = jq ->
# Categories
export catsJS = jq ->
counter = 0
- add_img = $ \image#add
+ add_img = $ \img#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
+ ..attr \src -> @src.replace \add new_name
$ "li > span" .click ->
span = $ @
input = span.next!
img = new_image \undo
- .. .click ->
- $ @ .remove!
+ ..click ->
+ $ @ .remove!
- # reset text
- input.val span.text!
+ # reset text
+ input.val span.text!
- <- input.fade-out \slow
- span.toggle!
+ <- input.fade-out \slow
+ span.toggle!
span.toggle!
<- input.fade-in \slow
@@ -55,9 +55,9 @@ export catsJS = jq ->
add_img.click ->
input = new_input.copy!
img = new_image \minus
- .. .click ->
- <- $ @ .parent!fade-out \slow
- $ @ .remove!
+ ..click ->
+ <- $ @ .parent!fade-out \slow
+ $ @ .remove!
input.attr \name -> @name + counter
.remove-attr \style
@@ -66,6 +66,6 @@ export catsJS = jq ->
.append img
.hide!
.insert-before add_img.parent!
- .fade-in \slow input.focus
+ .fade-in \slow -> input.focus!
counter++
diff --git a/static/js/lib.js b/static/js/lib.js
deleted file mode 100644
index 43b0dc8..0000000
--- a/static/js/lib.js
+++ /dev/null
@@ -1,6 +0,0 @@
-jQuery.fn.extend({
- // copies an object and removes 'id' and 'class' values
- copy: function() {
- return this.clone().removeAttr("id").removeAttr("class");
- }
-});
diff --git a/static/js/show.js b/static/js/show.js
deleted file mode 100644
index 04b9a83..0000000
--- a/static/js/show.js
+++ /dev/null
@@ -1,17 +0,0 @@
-$(document).ready(function(){
-
- $(".detail span").click(function() {
- $(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");
-
- $(this).nextAll(".details:first").toggle();
- })
-
- $(".details").hide();
-})