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

Complexity

Total Complexity 7
Complexity/F 1.4

Size

Lines of Code 73
Function Count 5

Duplication

Duplicated Lines 21
Ratio 28.77 %

Importance

Changes 0
Metric Value
eloc 51
dl 21
loc 73
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: mic <[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: 'ATTENTION : ',
18
        error: 'ERREUR : ',
19
        heading: 'MESSAGE DE DEBUG JAXON :\n',
20
        request: {
21
            uri: 'URI: ',
22
            init: 'INITIALISATION DE LA REQUETE',
23
            creating: 'INITIALISATION DE L\'OBJET REQUETE',
24
            starting: 'DEBUT DE LA REQUETE',
25
            preparing: 'PREPARATION DE LA REQUETE',
26
            calling: 'APPEL : ',
27
            sending: 'ENVOI DE LA REQUETE',
28
            sent: 'ENVOYE [{length} octets]'
29
        },
30
        response: {
31
            long: '...\n[REPONSE LONGUE]\n...',
32
            success: 'RECUS [statut : {status}, taille: {length} octets, temps: {duration}ms] :\n',
33
            content: 'Le serveur a retourné le statut HTTP suivant : {status}\nRECUS :\n{text}',
34
            redirect: 'Le serveur a indiqué une redirection vers :<br />{location}',
35
            no_processor: 'Aucune fonction disponible pour traiter la réponse du serveur.\n',
36
            check_errors:  '.\nVérifie s\'il existe des messages d\'erreur du serveur.'
37
        },
38
        processing: {
39
            parameters: 'TRAITEMENT DES PARAMETRES [{count}]',
40
            no_parameters: 'AUCUN PARAMETRE A TRAITER',
41
            calling: 'DEBUT DE L\'APPEL JAXON (déprécié: utilisez plutôt 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: 'APPEL JAXON ({cmd}, {options})',
43
            done: 'TERMINE [{duration}ms]'
44
        }
45
    };
46
47
    jaxon.debug.exceptions = [];
48
    jaxon.debug.exceptions[10001] = 'Réponse XML non valide : La réponse contient une balise inconnue : {data}.';
49
    jaxon.debug.exceptions[10002] = 'GetRequestObject : XMLHttpRequest n\'est pas disponible, jaxon est désactivé.';
50
    jaxon.debug.exceptions[10003] = 'File pleine : Ne peut ajouter un objet à la file car elle est pleine.';
51
    jaxon.debug.exceptions[10004] = 'Réponse XML non valide : La réponse contient une balise ou un texte inattendu : {data}.';
52
    jaxon.debug.exceptions[10005] = 'URI de la requete non valide : URI non valide ou manquante; auto-détection échouée; veuillez en spécifier une explicitement.';
53
    jaxon.debug.exceptions[10006] = 'Réponse de commande invalide : Commande de réponse reçue mal formée.';
54
    jaxon.debug.exceptions[10007] = 'Réponse de commande invalide : Commande [{data}] est inconnue.';
55
    jaxon.debug.exceptions[10008] = 'L\'élément d\'ID [{data}] est introuvable dans le document.';
56
    jaxon.debug.exceptions[10009] = 'Requête invalide : Aucun nom de fonction indiqué en paramètre.';
57
    jaxon.debug.exceptions[10010] = 'Requête invalide : Aucun objet indiqué en paramètre pour la fonction.';
58
59
    jaxon.debug.lang = {
60
        isLoaded: true
61
    };
62
}
63
64 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...
65
    /*
66
        Object: mise � jour
67
    */
68
    jaxon.config.status.update = function() {
69
        return {
70
            onRequest: function() {
71
                window.status = 'Envoi de la requête...';
72
            },
73
            onWaiting: function() {
74
                window.status = 'Attente de la réponse...';
75
            },
76
            onProcessing: function() {
77
                window.status = 'En cours de traitement...';
78
            },
79
            onComplete: function() {
80
                window.status = 'Fait.';
81
            }
82
        }
83
    }
84
}
85