Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fc53682b

Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt

  • ID fc53682b03f43e2ab081867ee69e102747dfdf51
  • Vorgänger 74c1fd62
  • Nachfolger 8eeb7c70

JS: einige Scope-Fehler gefixt (von jshint)

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.

Unterschiede anzeigen:

js/kivi.Order.js
198 198

  
199 199
    kivi.run_once_for('.row_entry', 'on_kbd_click_show_hide', function(elt) {
200 200
      $(elt).keydown(function(event) {
201
        var row;
201 202
        if(event.keyCode == 40 && event.shiftKey == true) {
202 203
          // shift arrow down
203 204
          event.preventDefault();
204
          var row = $(event.target).parents(".row_entry").first();
205
          row = $(event.target).parents(".row_entry").first();
205 206
          $(row).children().not(':first').show();
206 207
          return false;
207 208
        }
208 209
        if(event.keyCode == 38 && event.shiftKey == true) {
209 210
          // shift arrow up
210 211
          event.preventDefault();
211
          var row = $(event.target).parents(".row_entry").first();
212
          row = $(event.target).parents(".row_entry").first();
212 213
          $(row).children().not(':first').hide();
213 214
          return false;
214 215
        }
js/kivi.js
111 111
  };
112 112

  
113 113
  ns.t8 = function(text, params) {
114
    var text = ns._locale[text] || text;
114
    text = ns._locale[text] || text;
115
    var key, value
115 116

  
116 117
    if( Object.prototype.toString.call( params ) === '[object Array]' ) {
117 118
      var len = params.length;
118 119

  
119 120
      for(var i=0; i<len; ++i) {
120
        var key = i + 1;
121
        var value = params[i];
121
        key = i + 1;
122
        value = params[i];
122 123
        text = text.split("#"+ key).join(value);
123 124
      }
124 125
    }
125 126
    else if( typeof params == 'object' ) {
126
      for(var key in params) {
127
        var value = params[key];
127
      for(key in params) {
128
        value = params[key];
128 129
        text = text.split("#{"+ key +"}").join(value);
129 130
      }
130 131
    }
js/requirement_spec.js
873 873
// -------------------------------------------------------------------------
874 874

  
875 875
ns.create_context_menus = function(data) {
876
  var general_actions;
876 877
  if (data.is_template) {
877
    var general_actions = {
878
    general_actions = {
878 879
        sep98:           "---------"
879 880
      , general_actions: { name: kivi.t8('Requirement spec template actions'), className: 'context-menu-heading' }
880 881
      // , sep99:           "---------"
......
893 894
    });
894 895

  
895 896
  } else {                      // if (is_template)
896
    var general_actions = {
897
    general_actions = {
897 898
        sep98:              "---------"
898 899
      , general_actions:    { name: kivi.t8('Requirement spec actions'), className: 'context-menu-heading' }
899 900
      , create_pdf:         { name: kivi.t8('Create PDF'),              icon: "pdf",    callback: kivi.requirement_spec.create_reqspec_pdf }
......
901 902
      , create_version:     { name: kivi.t8('Create new version'),      icon: "new",    callback: kivi.requirement_spec.create_version, disabled: kivi.requirement_spec.disable_commands }
902 903
      , copy_reqspec:       { name: kivi.t8('Copy requirement spec'),   icon: "copy",   callback: kivi.requirement_spec.copy_reqspec   }
903 904
      , delete_reqspec:     { name: kivi.t8('Delete requirement spec'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec }
904
      , sep_paste_template: "---------"
905
      , sep_renumber:       "---------"
905 906
      , renumber:           { name: kivi.t8('Renumber sections and function blocks'), icon: "renumber", callback: kivi.requirement_spec.renumber }
906 907
      , sep_paste_template: "---------"
907 908
      , paste_template:     { name: kivi.t8('Paste template'),     icon: "paste",  callback: kivi.requirement_spec.paste_template }

Auch abrufbar als: Unified diff