From fc53682b03f43e2ab081867ee69e102747dfdf51 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 4 Apr 2016 17:10:31 +0200 Subject: [PATCH] JS: einige Scope-Fehler gefixt (von jshint) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Variablengültigheit hängt nicht von {} ab, sondern gelten immer für die ganze Funktion. Daher ergibt mehrfachess »var xyz« innerhalb einer Funktion keinen Sinn. --- js/kivi.Order.js | 5 +++-- js/kivi.js | 11 ++++++----- js/requirement_spec.js | 7 ++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/js/kivi.Order.js b/js/kivi.Order.js index eea906df5..d933def6f 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -198,17 +198,18 @@ namespace('kivi.Order', function(ns) { kivi.run_once_for('.row_entry', 'on_kbd_click_show_hide', function(elt) { $(elt).keydown(function(event) { + var row; if(event.keyCode == 40 && event.shiftKey == true) { // shift arrow down event.preventDefault(); - var row = $(event.target).parents(".row_entry").first(); + row = $(event.target).parents(".row_entry").first(); $(row).children().not(':first').show(); return false; } if(event.keyCode == 38 && event.shiftKey == true) { // shift arrow up event.preventDefault(); - var row = $(event.target).parents(".row_entry").first(); + row = $(event.target).parents(".row_entry").first(); $(row).children().not(':first').hide(); return false; } diff --git a/js/kivi.js b/js/kivi.js index 6b47e1bf5..58a631a78 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -111,20 +111,21 @@ namespace("kivi", function(ns) { }; ns.t8 = function(text, params) { - var text = ns._locale[text] || text; + text = ns._locale[text] || text; + var key, value if( Object.prototype.toString.call( params ) === '[object Array]' ) { var len = params.length; for(var i=0; i