From 98e83d8ffc9cc31986fb2672140aed005480cddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 27 Jul 2010 01:16:48 +0200 Subject: Add category manipulation support --- static/css/style.css | 4 ++++ static/images/add.png | Bin 0 -> 800 bytes static/images/minus.png | Bin 0 -> 3406 bytes static/images/undo.png | Bin 0 -> 649 bytes static/js/cats.js | 39 +++++++++++++++++++++++++++++++++++++++ static/js/lib.js | 6 ++++++ 6 files changed, 49 insertions(+) create mode 100644 static/images/add.png create mode 100644 static/images/minus.png create mode 100644 static/images/undo.png create mode 100644 static/js/cats.js create mode 100644 static/js/lib.js (limited to 'static') diff --git a/static/css/style.css b/static/css/style.css index 2ddf6f2..10f2331 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -88,6 +88,10 @@ div.detail > .mark { cursor: pointer; } +ul.arrow { + list-style-image: url(../images/closed.png); +} + /* Header */ diff --git a/static/images/add.png b/static/images/add.png new file mode 100644 index 0000000..b748150 Binary files /dev/null and b/static/images/add.png differ diff --git a/static/images/minus.png b/static/images/minus.png new file mode 100644 index 0000000..99b21ce Binary files /dev/null and b/static/images/minus.png differ diff --git a/static/images/undo.png b/static/images/undo.png new file mode 100644 index 0000000..b39d182 Binary files /dev/null and b/static/images/undo.png differ diff --git a/static/js/cats.js b/static/js/cats.js new file mode 100644 index 0000000..e65cc28 --- /dev/null +++ b/static/js/cats.js @@ -0,0 +1,39 @@ +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/lib.js b/static/js/lib.js new file mode 100644 index 0000000..43b0dc8 --- /dev/null +++ b/static/js/lib.js @@ -0,0 +1,6 @@ +jQuery.fn.extend({ + // copies an object and removes 'id' and 'class' values + copy: function() { + return this.clone().removeAttr("id").removeAttr("class"); + } +}); -- cgit v1.2.3