jaxon-examples/public/js/lang/jaxon.nl.js   A
last analyzed

Complexity

Total Complexity 7
Complexity/F 1.4

Size

Lines of Code 76
Function Count 5

Duplication

Duplicated Lines 21
Ratio 27.63 %

Importance

Changes 0
Metric Value
eloc 51
dl 21
loc 76
rs 10
c 0
b 0
f 0
wmc 7
mnd 2
bc 2
fnc 5
bpm 0.4
cpm 1.4
noi 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
/**
2
 * translation for: jaxon v.x.x
3
 * @version: 1.0.0
4
 * @author: jeffrey <[email protected]>
5
 * @copyright jaxon project
6
 * @license GNU/GPL
7
 * @package jaxon x.x.x
8
 * @since v.x.x.x
9
 * save as UTF-8
10
 */
11
12
if ('undefined' != typeof jaxon.debug) {
0 ignored issues
show
Bug introduced by
The variable jaxon seems to be never declared. If this is a global, consider adding a /** global: jaxon */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
13
    /*
14
        Array: text
15
    */
16
    jaxon.debug.messages = {
17
        warning: 'FOUTMELDING: ',
18
        error: 'FOUT: ',
19
        heading: 'JAXON FOUTMELDINGS BERICHT:\n',
20
        request: {
21
            uri: 'URI: ',
22
            init: 'INITIALISATIE AANVRAAG',
23
            creating: 'INITIALISATIE OBJECT AANVRAAG',
24
            starting: 'BEGIN JAXON AANVRAAG',
25
            preparing: 'VOORBEREIDING AANVRAAG',
26
            calling: 'AANROEPING: ',
27
            sending: 'VERZENDING AANVRAAG',
28
            sent: 'VERZONDEN [{length} bytes]'
29
        },
30
        response: {
31
            long: '...\n[LANG ANTWOORD]\n...',
32
            success: 'ONTVANGEN [status: {status}, omvang: {length} bytes, Zeit: {duration}ms]:\n',
33
            content: 'De server retourneert de volgende HTTP-status: {status}\nONTVANGEN:\n{text}',
34
            redirect: 'De server retourneert een doorverwijzing naar:<br />{location}',
35
            no_processor: 'Er is geen verwerkingsbestand gespecificeerd om de aanvraag te verwerken.\n',
36
            check_errors: '.\nBekijk foutmeldingen van de server.'
37
        },
38
        processing: {
39
            parameters: 'VERWERKING PARAMETERS [{count}]',
40
            no_parameters: 'GEEN PARAMETERS OM TE VERWERKEN',
41
            calling: 'BEGIN JAXON AANVRAAG (verouderd: gebruik jaxon.request)',
0 ignored issues
show
Unused Code Bug introduced by
The key calling is used more than once in this object expression.
Loading history...
42
            calling: 'JAXON AANVRAAG ({cmd}, {options})',
43
            done: 'KLAAR [{duration}ms]'
44
        }
45
    };
46
47
    /*
48
        Array: exceptions
49
    */
50
    jaxon.debug.exceptions = [];
51
    jaxon.debug.exceptions[10001] = 'Ongeldig XML-antwoord: het antwoord bevat een onbekende tag: {data}.';
52
    jaxon.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest is niet beschikbaar, XajaX is uitgeschakeld.';
53
    jaxon.debug.exceptions[10003] = 'Wachtrij limiet overschreden: kan het object niet in de wachtrij plaatsen, omdat die vol is.';
54
    jaxon.debug.exceptions[10004] = 'Ongeldig XML-antwoord: het antwoord bevat een onverwachte tag of tekst: {data}.';
55
    jaxon.debug.exceptions[10005] = 'Ongeldige Request-URI: Ongeldige of ontbrekende URI; automatische detectie faalt; specificeer een URI expliciet.';
56
    jaxon.debug.exceptions[10006] = 'Ongeldig antwoord bevel: misvormd antwoord bevel ontvangen.';
57
    jaxon.debug.exceptions[10007] = 'Ongeldig antwoord bevel: Bevel [{data}] is niet bekend.';
58
    jaxon.debug.exceptions[10008] = 'Element met het ID [{data}] kon niet in het document worden gevonden.';
59
    jaxon.debug.exceptions[10009] = 'Ongeldige aanvraag: Missende functie parameter - naam.';
60
    jaxon.debug.exceptions[10010] = 'Ongeldige aanvraag: Missende functie parameter - object.';
61
62
    jaxon.debug.lang = {
63
        isLoaded: true
64
    };
65
}
66
67 View Code Duplication
if (typeof jaxon.config != 'undefined' && typeof jaxon.config.status != 'undefined') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
68
    /*
69
        Object: update
70
    */
71
    jaxon.config.status.update = function() {
72
        return {
73
            onRequest: function() {
74
                window.status = "Verzenden aanvraag...";
75
            },
76
            onWaiting: function() {
77
                window.status = "Wachten op antwoord...";
78
            },
79
            onProcessing: function() {
80
                window.status = "Verwerking...";
81
            },
82
            onComplete: function() {
83
                window.status = "Afgesloten.";
84
            }
85
        }
86
    }
87
}
88