From f475f0095f2b4af1acab8cfe3d6c866a71b73bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sat, 14 Sep 2013 00:27:31 +0200 Subject: Replaced current JS by LS and generated JS --- static/js/add.js | 6 ---- static/js/cats.js | 39 -------------------------- static/js/kosten.js | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ static/js/kosten.ls | 26 ++++++++--------- static/js/lib.js | 6 ---- static/js/show.js | 17 ----------- 6 files changed, 94 insertions(+), 81 deletions(-) delete mode 100644 static/js/add.js delete mode 100644 static/js/cats.js create mode 100644 static/js/kosten.js delete mode 100644 static/js/lib.js delete mode 100644 static/js/show.js (limited to 'static') 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("
  • "); - - 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("
  • ").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(); -}) -- cgit v1.2.3