Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 33a45e0e

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 33a45e0e838cdc9cc1af614e5e98b0ddfa64faec
  • Vorgänger e2ef75e5
  • Nachfolger 90e59318

kivi.js: alle jshint-Warnungen beseitigt & auf strict umgestellt

Unterschiede anzeigen:

js/kivi.js
1 1
namespace("kivi", function(ns) {
2
  "use strict";
3

  
2 4
  ns._locale = {};
3 5
  ns._date_format   = {
4 6
    sep: '.',
......
51 53
  };
52 54

  
53 55
  ns.parse_amount = function(amount) {
54
    if ((amount == undefined) || (amount == ''))
56
    if ((amount === undefined) || (amount === ''))
55 57
      return 0;
56 58

  
57 59
    if (ns._number_format.decimalSep == ',')
......
59 61

  
60 62
    amount = amount.replace(/[\',]/g, "")
61 63

  
64
    /* jshint -W061 */
62 65
    return eval(amount);
63 66
  };
64 67

  
......
77 80
  ns.format_amount = function(amount, places) {
78 81
    amount = amount || 0;
79 82

  
80
    if ((places != undefined) && (places >= 0))
83
    if ((places !== undefined) && (places >= 0))
81 84
      amount = ns.round_amount(amount, Math.abs(places));
82 85

  
83 86
    var parts = ("" + Math.abs(amount)).split(/\./);
......
85 88
    var dec   = parts.length > 1 ? parts[1] : "";
86 89
    var sign  = amount  < 0      ? "-"      : "";
87 90

  
88
    if (places != undefined) {
91
    if (places !== undefined) {
89 92
      while (dec.length < Math.abs(places))
90 93
        dec += "0";
91 94

  
......
93 96
        dec = d.substr(0, places);
94 97
    }
95 98

  
96
    if ((ns._number_format.thousandSep != "") && (intg.length > 3)) {
99
    if ((ns._number_format.thousandSep !== "") && (intg.length > 3)) {
97 100
      var len   = ((intg.length + 2) % 3) + 1,
98 101
          start = len,
99 102
          res   = intg.substr(0, len);
......
105 108
      intg = res;
106 109
    }
107 110

  
108
    var sep = (places != 0) && (dec != "") ? ns._number_format.decimalSep : "";
111
    var sep = (places !== 0) && (dec !== "") ? ns._number_format.decimalSep : "";
109 112

  
110 113
    return sign + intg + sep + dec;
111 114
  };
......
391 394
      return;
392 395
    }
393 396

  
394
    $(selector).filter(function() { return $(this).data(attr_name) != true; }).each(function(idx, elt) {
397
    $(selector).filter(function() { return $(this).data(attr_name) !== true; }).each(function(idx, elt) {
395 398
      var $elt = $(elt);
396 399
      $elt.data(attr_name, true);
397 400
      fn($elt);

Auch abrufbar als: Unified diff