From fde0a9ec43f18b3dda8d5dc14728f77fcb281704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 17 Jan 2014 01:17:22 +0100 Subject: More LiveScriptier --- static/js/kosten.js | 30 ++++++++++---------- static/js/kosten.ls | 82 ++++++++++++++++++++++++++--------------------------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/static/js/kosten.js b/static/js/kosten.js index dbf1efe..2fe6846 100644 --- a/static/js/kosten.js +++ b/static/js/kosten.js @@ -1,6 +1,6 @@ // Generated by LiveScript 1.2.0 (function(){ - var jq, set_lang, addJS, showJS, statJS, catsJS, out$ = typeof exports != 'undefined' && exports || this; + var jq, setLang, addJS, showJS, statJS, catsJS, out$ = typeof exports != 'undefined' && exports || this; jQuery.fn.extend({ copy: function(){ return this.clone().removeAttr('id class'); @@ -11,7 +11,7 @@ $(f); }; }; - set_lang = function(){ + setLang = function(){ return Highcharts.setOptions({ lang: { months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], @@ -30,7 +30,7 @@ }); }); out$.showJS = showJS = jq(function(){ - set_lang(); + setLang(); $(".detail .heading").click(function(){ return $(this).closest('.detail').children('.mark:first').click(); }); @@ -92,7 +92,7 @@ }); out$.statJS = statJS = jq(function(){ var month; - set_lang(); + setLang(); month = 30 * 24 * 60 * 60 * 1000; return $('.stats').each(function(){ var x$; @@ -128,15 +128,15 @@ }); }); out$.catsJS = catsJS = jq(function(){ - var counter, add_img, new_input, new_image; + var counter, addImg, newInput, newImage; counter = 0; - add_img = $('img#add'); - new_input = $('input#new'); - new_image = function(new_name){ + addImg = $('img#add'); + newInput = $('input#new'); + newImage = function(newName){ var x$; - x$ = add_img.copy(); + x$ = addImg.copy(); x$.attr('src', function(){ - return this.src.replace('add', new_name); + return this.src.replace('add', newName); }); return x$; }; @@ -144,7 +144,7 @@ var span, input, x$, img; span = $(this); input = span.next(); - x$ = img = new_image('undo'); + x$ = img = newImage('undo'); x$.click(function(){ $(this).remove(); input.val(span.text()); @@ -157,10 +157,10 @@ return img.insertAfter(input); }); }); - return add_img.click(function(){ + return addImg.click(function(){ var input, x$, img; - input = new_input.copy(); - x$ = img = new_image('minus'); + input = newInput.copy(); + x$ = img = newImage('minus'); x$.click(function(){ return $(this).parent().fadeOut('slow', function(){ return $(this).remove(); @@ -168,7 +168,7 @@ }); input.attr('name', function(){ return this.name + counter; - }).removeAttr('style').wrap("
  • ").parent().append(img).hide().insertBefore(add_img.parent()).fadeIn('slow', function(){ + }).removeAttr('style').wrap("
  • ").parent().append(img).hide().insertBefore(addImg.parent()).fadeIn('slow', function(){ return input.focus(); }); return counter++; diff --git a/static/js/kosten.ls b/static/js/kosten.ls index 5312a9a..6106ab5 100644 --- a/static/js/kosten.ls +++ b/static/js/kosten.ls @@ -3,32 +3,32 @@ jQuery.fn.extend do jq = (f) -> !-> $ f -# Call this to localize HighCharts -set_lang = -> - Highcharts .setOptions do +# Call this to localize Highcharts +set-lang = -> + Highcharts .set-options do lang: months: [\Januar, \Februar, \März, \April, \Mai, \Juni, \Juli, \August, \September, \Oktober, \November, \Dezember] - shortMonths: [\Jan, \Feb, \Mär, \Apr, \Mai, \Jun, \Jul, \Aug, \Sep, \Okt, \Nov, \Dez] + short-months: [\Jan, \Feb, \Mär, \Apr, \Mai, \Jun, \Jul, \Aug, \Sep, \Okt, \Nov, \Dez] weekdays: [\Sonntag, \Montag, \Dienstag, \Mittwoch, \Donnerstag, \Freitag, \Samstag] - rangeSelectorFrom: \von - rangeSelectorTo: \bis - rangeSelectorZoom: null + range-selector-from: \von + range-selector-to: \bis + range-selector-zoom: null # Add export addJS = jq -> $ 'input[name=date]' .datepicker do - dateFormat: \dd.mm.yy - firstDay: 1 + date-format: \dd.mm.yy + first-day: 1 # Show export showJS = jq -> - set_lang! + set-lang! $ ".detail .heading" .click -> $ @ .closest \.detail .children \.mark:first .click! $ ".detail > .mark" .click -> - if (@src.indexOf \closed) is not -1 + if (@src.index-of \closed) is not -1 @src .= replace \closed \open else @src .= replace \open \closed @@ -43,20 +43,20 @@ export showJS = jq -> ..highcharts do title: text: null tooltip: - hideDelay: 200 + hide-delay: 200 formatter: -> - "#{@key}: #{@y.toFixed 2} € / #{@percentage.toFixed 2}%" + "#{@key}: #{@y.toFixed 2} € / #{@percentage.to-fixed 2}%" chart: - backgroundColor: null - plotBorderWidth: null - plotShadow: off - spacingTop: 0 + background-color: null + plot-border-width: null + plot-shadow: off + spacing-top: 0 credits: enabled: false series: [ type: \pie size: \70% - allowPointSelect: true - dataLabels: + allow-point-select: true + data-labels: color: ..css \color distance: 20 data: [ {name: if v>0 then k else '' , y: v, visible: v > 0} \ @@ -65,8 +65,8 @@ export showJS = jq -> # Statistics export statJS = jq -> - set_lang! - + set-lang! + month = 30 * 24 * 60 * 60 * 1000 <- $ \.stats .each @@ -74,42 +74,42 @@ export statJS = jq -> ..highcharts 'StockChart' do title: text: null credits: enabled: false - rangeSelector: + range-selector: buttons: [] - inputDateFormat: "%d. %b %Y" - inputEditDateFormat: "%d.%m.%Y" - inputDateParser: (value) -> + input-date-format: "%d. %b %Y" + input-edit-date-format: "%d.%m.%Y" + input-date-parser: (value) -> value .= split /\./ - Date.UTC(value[2], # year + Date.UTC value[2], # year value[1] - 1, # month ... 0-based -.- value[0], #day 0,0,0,0 # time - ) - xAxis: - minTickInterval: month - minRange: month + + x-axis: + min-tick-interval: month + min-range: month series: [ data : ..data \stats ] tooltip: - pointFormat: "{point.y} €
    " + point-format: "{point.y} €
    " # Categories export catsJS = jq -> counter = 0 - add_img = $ \img#add - new_input = $ \input#new + add-img = $ \img#add + new-input = $ \input#new - new_image = (new_name) -> + 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 + add-img.copy! + ..attr \src -> @src.replace \add new-name $ "li > span" .click -> span = $ @ input = span.next! - img = new_image \undo + img = new-image \undo ..click -> $ @ .remove! @@ -123,9 +123,9 @@ export catsJS = jq -> <- input.fade-in \slow img.insert-after input - add_img.click -> - input = new_input.copy! - img = new_image \minus + add-img.click -> + input = new-input.copy! + img = new-image \minus ..click -> <- $ @ .parent!fade-out \slow $ @ .remove! @@ -136,7 +136,7 @@ export catsJS = jq -> .parent! # wrap does not return the li .append img .hide! - .insert-before add_img.parent! + .insert-before add-img.parent! .fade-in \slow -> input.focus! counter++ -- cgit v1.2.3