diff options
Diffstat (limited to 'static/js')
-rw-r--r-- | static/js/kosten.js | 41 | ||||
-rw-r--r-- | static/js/kosten.ls | 40 |
2 files changed, 38 insertions, 43 deletions
diff --git a/static/js/kosten.js b/static/js/kosten.js index e7170cb..4600a24 100644 --- a/static/js/kosten.js +++ b/static/js/kosten.js @@ -12,7 +12,7 @@ }; }; setLang = function(){ - return Highcharts.setOptions({ + Highcharts.setOptions({ colors: ['#2f7ed8', '#0d233a', '#8bbc21', '#910000', '#1aadce', '#492970', '#f28f43', '#77a1e5', '#c42525', '#a6c96a'], lang: { months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], @@ -25,7 +25,7 @@ }); }; out$.addJS = addJS = jq(function(){ - return $('input[name=date]').datepicker({ + $('input[name=date]').datepicker({ dateFormat: 'dd.mm.yy', firstDay: 1 }); @@ -33,7 +33,7 @@ out$.showJS = showJS = jq(function(){ setLang(); $(".detail .heading").click(function(){ - return $(this).closest('.detail').children('.mark:first').click(); + $(this).closest('.detail').children('.mark:first').click(); }); $(".detail > .mark").click(function(){ if (this.src.indexOf('closed') !== -1) { @@ -41,10 +41,10 @@ } else { this.src = this.src.replace('open', 'closed'); } - return $(this).nextAll('.details:first').toggle(); + $(this).nextAll('.details:first').toggle(); }); $('.details').hide(); - return $('.pie').each(function(){ + $('.pie').each(function(){ var x$, k, v; x$ = $(this); x$.highcharts({ @@ -93,7 +93,6 @@ }()) }] }); - return x$; }); }); out$.statJS = statJS = jq(function(){ @@ -101,16 +100,15 @@ setLang(); month = 30 * 24 * 60 * 60 * 1000; constDialog = function(){ - var df, diag_opts; + var df; df = Highcharts.dateFormat; - diag_opts = { - title: df('%B %Y', this.x) - }; $.get(df('/stats/_const/%Y/%d', this.x), function(data){ - $(data).dialog(diag_opts); + $(data).dialog({ + title: df('%B %Y', this.x) + }); }); }; - return $('.stats').each(function(){ + $('.stats').each(function(){ var x$; x$ = $(this); x$.highcharts('StockChart', { @@ -149,7 +147,6 @@ pointFormat: '<b>{point.y} €</b><br/>' } }); - return x$; }); }); out$.catsJS = catsJS = jq(function(){ @@ -173,30 +170,30 @@ x$.click(function(){ $(this).remove(); input.val(span.text()); - return input.fadeOut('slow', function(){ - return span.toggle(); + input.fadeOut('slow', function(){ + span.toggle(); }); }); span.toggle(); - return input.fadeIn('slow', function(){ - return img.insertAfter(input); + input.fadeIn('slow', function(){ + img.insertAfter(input); }); }); - return addImg.click(function(){ + addImg.click(function(){ var input, x$, img; input = newInput.copy(); x$ = img = newImage('minus'); x$.click(function(){ - return $(this).parent().fadeOut('slow', function(){ - return $(this).remove(); + $(this).parent().fadeOut('slow', function(){ + $(this).remove(); }); }); input.attr('name', function(){ return this.name + counter; }).removeAttr('style').wrap("<li />").parent().append(img).hide().insertBefore(addImg.parent()).fadeIn('slow', function(){ - return input.focus(); + input.focus(); }); - return counter++; + counter++; }); }); }).call(this); diff --git a/static/js/kosten.ls b/static/js/kosten.ls index 01bc10c..26bd3b6 100644 --- a/static/js/kosten.ls +++ b/static/js/kosten.ls @@ -4,7 +4,7 @@ jQuery.fn.extend do jq = (f) -> !-> $ f # Call this to localize Highcharts -set-lang = -> +set-lang = !-> Highcharts .set-options do # old colors colors: [\#2f7ed8 \#0d233a \#8bbc21 \#910000 \#1aadce \#492970 @@ -21,19 +21,19 @@ set-lang = -> range-selector-zoom: null # Add -export addJS = jq -> +export addJS = jq !-> $ 'input[name=date]' .datepicker do date-format: \dd.mm.yy first-day: 1 # Show -export showJS = jq -> +export showJS = jq !-> set-lang! - $ ".detail .heading" .click -> + $ ".detail .heading" .click !-> $ @ .closest \.detail .children \.mark:first .click! - $ ".detail > .mark" .click -> + $ ".detail > .mark" .click !-> if (@src.index-of \closed) isnt -1 @src .= replace \closed \open else @@ -44,7 +44,7 @@ export showJS = jq -> $ \.details .hide! # draw the pies - <- $ \.pie .each + <-! $ \.pie .each $ @ ..highcharts do title: text: null @@ -71,22 +71,20 @@ export showJS = jq -> ] # Statistics -export statJS = jq -> +export statJS = jq !-> set-lang! month = 30d * 24h * 60min * 60s * 1000ms const-dialog = !-> df = Highcharts.date-format - diag_opts = - #title: "Konstante Ausgaben #{df '%b %Y' @x}" - title: df '%B %Y' @x data <-! $.get df '/stats/_const/%Y/%d' @x - $ data .dialog diag_opts + $ data .dialog do + title: df '%B %Y' @x - <- $ \.stats .each + <-! $ \.stats .each $ @ ..highcharts 'StockChart' do title: text: null @@ -115,7 +113,7 @@ export statJS = jq -> # Categories -export catsJS = jq -> +export catsJS = jq !-> counter = 0 add-img = $ \img#add new-input = $ \input#new @@ -125,28 +123,28 @@ export catsJS = jq -> add-img.copy! ..attr \src -> @src.replace \add new-name - $ "li > span" .click -> + $ "li > span" .click !-> span = $ @ input = span.next! img = new-image \undo - ..click -> + ..click !-> $ @ .remove! # reset text input.val span.text! - <- input.fade-out \slow + <-! input.fade-out \slow span.toggle! span.toggle! - <- input.fade-in \slow + <-! input.fade-in \slow img.insert-after input - add-img.click -> + add-img.click !-> input = new-input.copy! img = new-image \minus - ..click -> - <- $ @ .parent!fade-out \slow + ..click !-> + <-! $ @ .parent!fade-out \slow $ @ .remove! input.attr \name -> @name + counter @@ -156,6 +154,6 @@ export catsJS = jq -> .append img .hide! .insert-before add-img.parent! - .fade-in \slow -> input.focus! + .fade-in \slow !-> input.focus! counter++ |