IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Modification d'une regex existante


Sujet :

JavaScript

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    320
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 320
    Points : 79
    Points
    79
    Par défaut Modification d'une regex existante
    Bonjour,
    A partir du code source d'une page web, celui ci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    "updi(event,'2017-06-04 16:00 CEST (T+ 0:00)<br>Distances:&nbsp;0.0nm/218.9nm<br><b>Wind:</b> 322&deg; 8.6 kt (<b>TWA 45&deg;</b>)<br><b>Heading:</b> 277&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 5.44 kts','220px')"
    La regex :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    var expr = /updi\(event\,\'(.*)<br>Distances:&nbsp;(.*)<br><b>Wind:<\/b>(.*)\(<b>TWA(.*);<\/b>\)<br><b>Heading:<\/b>(.*)<b>Sail:<\/b>(.*)<br><b>Boat Speed:<\/b>(.*)','(.*)'\)/gi
    me génère ceci :
    Nom : Capture d’écran 2017-06-08 à 21.00.58.png
Affichages : 102
Taille : 15,5 Ko

    je souhaite la modifier pour quelle affiche ceci :
    Nom : Capture d’écran 2017-06-08 à 21.10.32.png
Affichages : 103
Taille : 11,2 Ko

    Une idée des modifs à effectuer dans la regex ? le reste je peux me débrouiller tout seul

  2. #2
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    En php.

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    <?php
    $text = "updi(event,'2017-06-04 16:00 CEST (T+ 0:00)<br>Distances:&nbsp;0.0nm/218.9nm<br><b>Wind:</b> 322&deg; 8.6 kt (<b>TWA 45&deg;</b>)<br><b>Heading:</b> 277&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 5.44 kts','220px')";
    $pattern = "/updi\(event\,\'(\d{4}-\d\d-\d\d)\s(\d\d:\d\d)\s([^(]+)\((.+)\)<br>Distances:&nbsp;([^\/]*)\/(.*)<br><b>Wind:<\/b>(.*)\(<b>TWA(.*);<\/b>\)<br><b>Heading:<\/b>(.*)<b>Sail:<\/b>(.*)<br><b>Boat Speed:<\/b>(.*)','(.*)'\)/msi";
    preg_match_all($pattern,$text,$array);
     for ($i=1;$i<count($array);$i++) {
      print $array[$i][0]."<br/>";
     }

    donne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    2017-06-04
    16:00
    CEST 
    T+ 0:00
    0.0nm
    218.9nm
     322° 8.6 kt 
     45°
     277°
     Jib
     5.44 kts
    220px
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  3. #3
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 637
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 637
    Points : 66 661
    Points
    66 661
    Billets dans le blog
    1
    Par défaut
    @badaze => tu n'as pas pris en compte l'inversion du format date

    c'est curieux que ta regex te génère directement un table html...
    tu peux nous montrer le code du match ? ou plutôt le replace ?


    Ma version javascript avec un replace
    https://jsfiddle.net/6xeq2e9m/2

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <table>
      <tr id="line">
      </tr>
    </table>
    Code JavaScript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    $ (function(){
      chaine= "updi(event,'2017-06-04 16:00 CEST (T+ 0:00)<br>Distances:&nbsp;0.0nm/218.9nm<br><b>Wind:</b> 322&deg; 8.6 kt (<b>TWA 45&deg;</b>)<br><b>Heading:</b> 277&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 5.44 kts','220px')"
     
      reg= /updi\(event,'(\d{4})-(\d{2})-(\d{2})\s([^ ]+)\s([^ ]+)\s\(([^)]+)\)[^\/]+\/(\d+\.\d+nm)[^ ]+\s(\d+&deg;)\s(\d+\.\d+ kt)[^\d]+(\d+&deg;)[^\d]+(\d+&deg;)[^ ]+ ([a-z]+)[^\d]+(\d+\.\d+ kts)/gi;
     
      html=chaine.replace(reg,"<td>$3/$2/$1</td><td>$4</td><td>$5</td><td>$6</td><td>$7</td><td>$8</td><td>$9</td><td>$10</td><td>$11</td><td>$12</td><td>$13</td>")
     
      $('#line').html(html);
     
    })
    Code css : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    td { border: solid 1px silver ;
      font-family: verdana;
      font-size: 10px;
      background-color: #ffffff;
      padding: 0 2px;
      }
    table {
      border-collapse: collapse;
    }
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  4. #4
    Expert éminent
    Avatar de Watilin
    Homme Profil pro
    En recherche d'emploi
    Inscrit en
    Juin 2010
    Messages
    3 093
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : En recherche d'emploi

    Informations forums :
    Inscription : Juin 2010
    Messages : 3 093
    Points : 6 754
    Points
    6 754
    Par défaut
    SpaceFrog pose une bonne question. rlelamer, je ne comprends pas vraiment où tu butes étant donné que tu as déjà une regexp fonctionnelle capable d’extraire plus que les infos dont tu as besoin.

    Comme autre approche, il me semble malin de tirer parti des capacités d’analyse de code HTML des navigateurs. Dit simplement, tu crées une <div> et tu lui colles le code HTML. Tu vas récupérer un arbre DOM duquel tu pourras extraire les infos que tu veux en utilisant les méthodes du DOM.
    La FAQ JavaScript – Les cours JavaScript
    Touche F12 = la console → l’outil indispensable pour développer en JavaScript !

  5. #5
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    @spacefrog. Je n'avais même pas vu ! Très beau ton code !!!
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  6. #6
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 637
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 637
    Points : 66 661
    Points
    66 661
    Billets dans le blog
    1
    Par défaut
    @badaze => Merci
    Je ne sais pas si il répond à 100% à la demande car certains groupes de capture sont peut être variables...
    c'est juste fait pour l'exemple à partir de string donné.
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  7. #7
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Ce n'est pas une déclaration. Faut pas se méprendre !

    J'avais participé à la discussion initiale de rlelamer et toutes les lignes sont du même acabit.
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  8. #8
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    320
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 320
    Points : 79
    Points
    79
    Par défaut
    Bonsoir,
    Désolé de vous répondre si tard mais trop de taf
    J'fais une modification et je post ici le code que j'utilise actuellement

    @badaze: j'ai mis en pause la création de l'extension google chrome car pu le temps je suis en saison j'reprendrais ça activement après l'été et tu m'avais dis que tu creuserais pour ta gouverne les extensions, tu l'as fais ?

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    320
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 320
    Points : 79
    Points
    79
    Par défaut
    Voici le code que j'utilise actuellement :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    <html>
        <head>
            <meta charset="UTF-8">
            <script>
     
    // returns info from the html file content
    function info_from_file_content(_content)
    {
        var res = [];
        res['course'] = /<title>(.*)<\/title>/g.exec(_content)[1];
        res['lat'] = parseFloat(/var boat_lat = (.*);/g.exec(_content)[1]);
        res['lon'] = parseFloat(/var boat_lon = (.*);/g.exec(_content)[1]);
        return res;
    }
     
    // Convert lon / lat decimal to degree minute second
    function dms_lon(lon) {
      var EW = (lon>=0)?'E':'W'
      var d_lon = Math.trunc(lon);
      var x_lon = (lon - d_lon) * 60;
      var m_lon = Math.trunc(x_lon);
      var y_lon = (x_lon - m_lon) * 60;
      s_lon = Math.trunc(y_lon);
     
      d_lon = Math.abs(d_lon);
      m_lon = Math.abs(m_lon);
      s_lon = Math.abs(s_lon);
     
      var bd_lon = (d_lon>=100)?d_lon:'0'+d_lon;
      var ad_lon = (d_lon>=10)?bd_lon:'00'+d_lon;
      var am_lon = (m_lon>=10)?m_lon:'0'+m_lon;
      var as_lon = (s_lon>=10)?s_lon:'0'+s_lon;
      return ad_lon + '°' + EW + ' ' + am_lon + "'" + as_lon +'"'; 
    }
     
    function dms_lat(lat) {
      var NS = (lat>=0)?'N':'S'
      var d_lat = Math.trunc(lat);
      var x_lat = (lat - d_lat) * 60;
      var m_lat = Math.trunc(x_lat);
      var y_lat = (x_lat - m_lat) * 60;
      s_lat = Math.trunc(y_lat);
     
      d_lat = Math.abs(d_lat);
      m_lat = Math.abs(m_lat);
      s_lat = Math.abs(s_lat);
     
      var bd_lat = (d_lat>=100)?d_lat:'0'+d_lat;
      var ad_lat = (d_lat>=10)?bd_lat:'00'+d_lat;
      var am_lat = (m_lat>=10)?m_lat:'0'+m_lat;
      var as_lat = (s_lat>=10)?s_lat:'0'+s_lat;
      return ad_lat + '°' + NS + ' ' + am_lat + "'" + as_lat +'"'; 
    }
     
    // Display info in the table
    function display_info(_values)
    {
        document.getElementById('output_info').innerHTML = '<tr><td align="center">Course VR</td><td align="center">Position GPS</td></tr><tr><td align="center">'+_values['course']+'</td><td align="center">'+dms_lon(_values['lon'])+' - '+dms_lat(_values['lat'])+'</td></tr>';
    }
     
    // returns data from the html file content
    function data_from_file_content(_content)
    {
        var expr = /updi\(event\,\'(.*)<br>Distances:&nbsp;(.*)<br><b>Wind:<\/b>(.*)\(<b>TWA(.*);<\/b>\)<br><b>Heading:<\/b>(.*)<b>Sail:<\/b>(.*)<br><b>Boat Speed:<\/b>(.*)','(.*)'\)/gi;
        var value;
        var values = [];
        var nombreValeurs, sommeTWA;
        var cotePrecedent = "";
        while(value = expr.exec(_content))
        {
            var res = [];
            res['date']=value[1];
            res['distance']=value[2];
            res['wind']=value[3];
            res['twa']=parseFloat(value[4]);
            res['heading']=value[5];
            res['sail']=value[6];
            res['speed']=value[7];
     
    // recherche du changement de côté
            res['cote'] = (res['twa'] >= 0)?'tribord':'babord';
            if (cotePrecedent !== res['cote']) {
                nombreValeurs = 0;
                sommeTWA = 0;
                sommeHDG = 0;
                cotePrecedent = res['cote'];
            }
     
    // calcul de la moyenne TWA
            nombreValeurs++;
            sommeTWA += res['twa'];
            res['TWAmoy'] = sommeTWA / nombreValeurs;
     
            values.push(res);
        }
        return values;
    }
     
    // Display data in the table
    function display_data(_values)
    {
        var table_content = '<tr><td align="center">Date et Heure</td><td align="center">Distance</td><td align="center">Vent</td><td align="center">TWA</td><td align="center">HDG</td><td align="center">Voile</td><td align="center">Vitesse bateau</td><td align="center">TWA Moy</td></tr>';
        for(var l=0; l<_values.length; l++)
        {
            var twa = parseFloat(_values[l]['twa']);
            var twa_color = (twa>=0)?'green':'red';
            table_content += '<tr><td align="center">'+_values[l]['date']+'</td><td align="center">'+_values[l]['distance']+'</td><td align="center">'+_values[l]['wind']+'</td><td align="center" style=\'color:'+twa_color+';\'>'+Math.abs(twa)+'°</td><td align="center" style="color:blue" >'+_values[l]['heading']+'</td><td align="center">'+_values[l]['sail']+'</td><td align="center">'+_values[l]['speed']+'</td><td align="center">'+_values[l]['TWAmoy']+'</td></tr>';
        }
        document.getElementById('output').innerHTML = table_content;
    }
     
    // This function is called when the button is pushed
    function button_clicked()
    {
        var file_content = document.getElementById('file').value;
     
        var info = info_from_file_content( file_content );
        display_info( info );
     
        var data = data_from_file_content( file_content );
        display_data( data );
    }
     
            </script>
        </head>
    <body background="bgimg.jpg">
    <h1 align="center" style="color:white"> Route zezo.org </h1>
    <textarea id="file" rows="3"></textarea><br />
    <br />
    <button onclick="button_clicked();">Extraire Route ZEZO</button><br />
    <br />
    <table border="3" align="center" bgcolor="white" id="output_info"><tr><td align="center">Course VR</td><td align="center">Position GPS</td></tr></table><br />
    <br />
    <table border="3" align="center" bgcolor="white" id="output"><tr><td align="center">Date et Heure</td><td align="center">Distance</td><td align="center">Vent</td><td align="center">TWA</td><td align="center">HDG</td><td align="center">Voile</td><td align="center">Vitesse bateau</td><td align="center">TWA Moy</td></tr></table>
    </body>
    </html>
    Ne pas tenir compte de la colonne TWA Moy (elle est fausse, elle ne tiens pas compte des 10 min d'itération inexistante entre 2 points

    Voici un exemple de code source de la page que j'exploite

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta name="viewport" content="width=device-width, user-scalable=no initial-scale=1.0, minimum-scale=1.0" />
    <title>Atlantic Record</title>
    <link href="div.css?42" rel="stylesheet" type="text/css">
    <!--[if lt IE 7]>
    <link href="div6.css?23" rel="stylesheet" type="text/css">
    <![endif]-->
    <!--[if lt IE 9]>
    <style type="text/css">
    .ie {
    	display: none;
    }
    </style>
    <![endif]-->
    <script type="text/javascript">
    var scale = 16;
    var session_id = "533047d63e0a612ed9a6860aab28c9a4";
    var days = 10;
    var boat_lat = 40.4584;
    var boat_lon = -73.8367;
    var goal_lat = 49.9401;
    var goal_lon = -5.09781;
    var scroll_x = 629; 
    var scroll_y = -657; 
    var boat_heading = 69.8506527089398;
    var iso_id = 'cc/4f5178c078e9c998553b2dc0a806724016'; 
    var iso_minx = -5; 
    var iso_miny = 0; 
    var iso_maxx = 1; 
    var iso_maxy = 4;
    var wind_time = 0;
    var grib_steps = 5;
    var windbase = 1497463200;
    var datastamp = '12+231';
    var mobile = 0;
    </script>
     
    <SCRIPT type="text/javascript" src="util.js?30" defer></SCRIPT>
     
    <SCRIPT type="text/javascript" src="iwind.js?32" defer></SCRIPT>
     
    <SCRIPT type="text/javascript" src="cwind.js?30" defer></SCRIPT>
    <SCRIPT type="text/javascript" src="scroll.js?32" defer></SCRIPT>
     
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
     
      ga('create', 'UA-27385643-1', 'zezo.org');
      ga('send', 'pageview');
     
    </script>
     
    </head>
    <body onload="init()">
    <div style="position: relative; top:0px; width:100%;">
     
    <div id="fs_menubar">
    &nbsp;<a href="/index.html" style="color:black;"><u>H</u>ome</a>&nbsp;&nbsp;
    <a href="/forum.pl" style="color:black;"><u>F</u>orum</a>&nbsp;&nbsp;
    <a href="/fb.html" style="color:black;"><u>C</u>ontact</a>&nbsp;&nbsp;
    <a href="/qa.html" style="color:black;"><u>Q</u>&amp;A</a>&nbsp;&nbsp;
    <a href="/about.html" style="color:black;"><u>A</u>bout</a>&nbsp;
    <a href="polars.html?pro=0" style="color:black;" target="vor_polars"><u>P</u>olars</a>&nbsp;|
    &nbsp;
    <!-- Announcement area --> 
    <!--font size="-1"> <Would you like to support the project by 
    <a style="text-decoration:underline;" href="about.html#donate">donating</a> 
    a small amount for hardware upgrade? Read the 
    <a style="text-decoration:underline;" href="about.html#tech">full story</a>. -->
    <b>Atlantic Record</b>
    <span style="color:red">New! </span><a style="text-decoration:underline;" href="http://sail.zezo.org/forum.pl?tid=5969">6% speed adjustment and other changes</a>
    <div style="float:right"><a href="about.html#donate"><img src="http://i.zezo.org/img/btn_donate_SM.gif"></a></div>
    </div>
     
    <div id="new_nav">
    <button class="nnav" onmousedown="zoom_out();" title="Zoom Out"><b>&minus;</b></button><select class="nnav" title="Zoom level" onchange="select_zoom(this);">
     
    	<option value="8" >1%</option>
     
    	<option value="16" selected>2%</option>
     
    	<option value="32" >5%</option>
     
    	<option value="64" >10%</option>
     
    	<option value="128" >25%</option>
     
    	<option value="256" >50%</option>
     
    	<option value="512" >100%</option>
     
    </select><button class="nnav" onmousedown="zoom_in();" title="Zoom In" style="margin-right:20px;"><b>+</b></button>
    <button class="nnav pad2 ie" onmousedown="toggle_tracks();" title="Toggle tracks"><img id="track_icon" style="vertical-align: text-top;" width="16px" height="16px" src="img/icon_track_gray.png"></button>
    <button class="nnav pad2" onmousedown="wind_display(0);" title="None"><img style="vertical-align: text-top;" width="16px" height="16px" src="img/icon_n.png"></button><button class="nnav pad2" onmousedown="wind_display(1);" title="Black barbs"><img style="vertical-align: text-top;" width="16px" height="16px" src="img/icon_bb.png"></button><button class="nnav pad2 ie" onmousedown="wind_display(2);" title="Color barbs"><img style="vertical-align: text-top;" width="16px" height="16px" src="img/icon_cb.png"></button><button class="nnav pad2 ie" onmousedown="wind_display(3);" title="Arrows"><img style="vertical-align: text-top;" width="16px" height="16px" src="img/icon_a.png"></button>
    <button title="Previous  wind" class="nnav" onmousedown="prev_wind();">&lt;</button><select id="hours" class="nnav" title="Wind time" onchange="show_wind(this.selectedIndex * 3);">
     
    	<option selected>Now</option>
     
    	<option >+3 h</option>
     
    	<option >+6 h</option>
     
    	<option >+9 h</option>
     
    	<option >+12 h</option>
     
    	<option >+15 h</option>
     
    	<option >+18 h</option>
     
    	<option >+21 h</option>
     
    	<option >+24 h</option>
     
    	<option >+27 h</option>
     
    	<option >+30 h</option>
     
    	<option >+33 h</option>
     
    	<option >+36 h</option>
     
    	<option >+39 h</option>
     
    	<option >+42 h</option>
     
    	<option >+45 h</option>
     
    	<option >+48 h</option>
     
    	<option >+51 h</option>
     
    	<option >+54 h</option>
     
    	<option >+57 h</option>
     
    	<option >+60 h</option>
     
    	<option >+63 h</option>
     
    	<option >+66 h</option>
     
    	<option >+69 h</option>
     
    	<option >+72 h</option>
     
    	<option >+75 h</option>
     
    	<option >+78 h</option>
     
    	<option >+81 h</option>
     
    	<option >+84 h</option>
     
    	<option >+87 h</option>
     
    	<option >+90 h</option>
     
    	<option >+93 h</option>
     
    	<option >+96 h</option>
     
    	<option >+99 h</option>
     
    	<option >+102 h</option>
     
    	<option >+105 h</option>
     
    	<option >+108 h</option>
     
    	<option >+111 h</option>
     
    	<option >+114 h</option>
     
    	<option >+117 h</option>
     
    	<option >+120 h</option>
     
    	<option >+123 h</option>
     
    	<option >+126 h</option>
     
    	<option >+129 h</option>
     
    	<option >+132 h</option>
     
    	<option >+135 h</option>
     
    	<option >+138 h</option>
     
    	<option >+141 h</option>
     
    	<option >+144 h</option>
     
    	<option >+147 h</option>
     
    	<option >+150 h</option>
     
    	<option >+153 h</option>
     
    	<option >+156 h</option>
     
    	<option >+159 h</option>
     
    	<option >+162 h</option>
     
    	<option >+165 h</option>
     
    	<option >+168 h</option>
     
    	<option >+171 h</option>
     
    	<option >+174 h</option>
     
    	<option >+177 h</option>
     
    	<option >+180 h</option>
     
    	<option >+183 h</option>
     
    	<option >+186 h</option>
     
    	<option >+189 h</option>
     
    	<option >+192 h</option>
     
    	<option >+195 h</option>
     
    	<option >+198 h</option>
     
    	<option >+201 h</option>
     
    	<option >+204 h</option>
     
    	<option >+207 h</option>
     
    	<option >+210 h</option>
     
    	<option >+213 h</option>
     
    	<option >+216 h</option>
     
    	<option >+219 h</option>
     
    	<option >+222 h</option>
     
    	<option >+225 h</option>
     
    	<option >+228 h</option>
     
    	<option >+231 h</option>
     
    	<option >+234 h</option>
     
    	<option >+237 h</option>
     
    	<option >+240 h</option>
     
    </select><button class="nnav" title="Next wind" style="margin-right: 30px;" onmousedown="next_wind();">&gt;</button>
    <select onchange="set_days(this.selectedIndex + 1);" class="nnav" title="Track duration">
     
    	<option >1d</option>
     
    	<option >2d</option>
     
    	<option >3d</option>
     
    	<option >4d</option>
     
    	<option >5d</option>
     
    	<option >6d</option>
     
    	<option >7d</option>
     
    	<option >8d</option>
     
    	<option >9d</option>
     
    	<option  selected>10d</option>
     
    </select>
     
    <!--button class="nnav"><b>?</b></button-->
    </div><!-- new nav--> 
    <!-- div id="boat_name_d" style="clear: right;">
    		<form method="GET" action="chart.pl">
    		<input type="text" name="boat" size="20" title="Boat name" id="boat_name" placeholder="Enter Boat Name"  value="">
    		<input type="hidden" name="sid" value="533047d63e0a612ed9a6860aab28c9a4">
    		<button type="submit">Get</button>
    		</form>
    </div--!>
     
    <div id="latlon" style="clear: right;">
    	<form method="GET" action="chart.pl">
    	<input type="tel" name="lon_deg" size="3" maxlength="3" style="width: 3ch;" value="73">&deg
    	<input type="tel" name="lon_min" size="2" maxlength="2" style="width: 2ch;" value="50">'
    	<input type="tel" name="lon_sec" size="2" maxlength="2" style="width: 2ch;" value="12">"
    	<select name="lon_ew">
    		<option >E</option>
    		<option selected>W</option>
    	<select>
    	<input type="tel" name="lat_deg" size="3" maxlength="3" style="width: 3ch;" value="40">&deg
    	<input type="tel" name="lat_min" size="2" maxlength="2" style="width: 2ch;" value="27">'
    	<input type="tel" name="lat_sec" size="2" maxlength="2" style="width: 2ch;" value="30">"
    	<select name="lat_ns">
    		<option selected>N</option>
    		<option >S</option>
    	<select>
    	<button type="submit">Go!</button>
    	</form>
    </div>
     
     
     
    </div>
    <div id="vp_container">
    <div id="vp_canvas" onmousedown="grab(event)">
    <div id="wind_info" >Wind:&nbsp;<span id="wind_data"></span></div>
    <div id="tile_layer"></div>
    <div id="iso_layer" style="z-index:0" ></div>
    <div id="winds_layer"></div>
    <div id="dot_layer" style="z-index:0">
     
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1183px; top:791px;" 
    	onmouseover="updi(event,'2017-06-14 20:50 CEST (T+ 0:00)<br>Distances:&nbsp;0.0nm/2861.5nm<br><b>Wind:</b> 81&deg; 6.6 kt (<b>TWA -43&deg;</b>)<br><b>Heading:</b> 127&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 10.94 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(0);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1162px; top:785px;" 
    	onmouseover="updi(event,'2017-06-15 02:00 CEST (T+ 5:10)<br>Distances:&nbsp;63.3nm/2800.6nm<br><b>Wind:</b> 136&deg; 9.0 kt (<b>TWA 65&deg;</b>)<br><b>Heading:</b> 66&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 13.98 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(6);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1136px; top:779px;" 
    	onmouseover="updi(event,'2017-06-15 08:00 CEST (T+11:10)<br>Distances:&nbsp;141.8nm/2725.5nm<br><b>Wind:</b> 131&deg; 6.9 kt (<b>TWA 55&deg;</b>)<br><b>Heading:</b> 74&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 12.29 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(12);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1119px; top:767px;" 
    	onmouseover="updi(event,'2017-06-15 14:00 CEST (T+17:10)<br>Distances:&nbsp;202.0nm/2662.0nm<br><b>Wind:</b> 132&deg; 3.5 kt (<b>TWA 130&deg;</b>)<br><b>Heading:</b> 5&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 7.32 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(18);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1105px; top:754px;" 
    	onmouseover="updi(event,'2017-06-15 20:00 CEST (T+23:10)<br>Distances:&nbsp;259.5nm/2602.2nm<br><b>Wind:</b> 190&deg; 6.5 kt (<b>TWA 130&deg;</b>)<br><b>Heading:</b> 56&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 12.36 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(24);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1080px; top:746px;" 
    	onmouseover="updi(event,'2017-06-16 02:00 CEST (T+29:10)<br>Distances:&nbsp;333.1nm/2529.1nm<br><b>Wind:</b> 200&deg; 4.2 kt (<b>TWA 110&deg;</b>)<br><b>Heading:</b> 86&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 9.84 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(30);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1054px; top:746px;" 
    	onmouseover="updi(event,'2017-06-16 08:00 CEST (T+35:10)<br>Distances:&nbsp;400.7nm/2465.2nm<br><b>Wind:</b> 178&deg; 5.9 kt (<b>TWA 90&deg;</b>)<br><b>Heading:</b> 90&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 13.68 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(36);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1029px; top:739px;" 
    	onmouseover="updi(event,'2017-06-16 14:00 CEST (T+41:10)<br>Distances:&nbsp;472.3nm/2395.1nm<br><b>Wind:</b> 186&deg; 6.2 kt (<b>TWA 125&deg;</b>)<br><b>Heading:</b> 57&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 12.65 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(42);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-1000px; top:728px;" 
    	onmouseover="updi(event,'2017-06-16 20:00 CEST (T+47:10)<br>Distances:&nbsp;558.2nm/2308.4nm<br><b>Wind:</b> 204&deg; 10.5 kt (<b>TWA 142&deg;</b>)<br><b>Heading:</b> 62&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 14.92 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(48);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-968px; top:721px;" 
    	onmouseover="updi(event,'2017-06-17 02:00 CEST (T+53:10)<br>Distances:&nbsp;649.8nm/2218.5nm<br><b>Wind:</b> 220&deg; 10.5 kt (<b>TWA 142&deg;</b>)<br><b>Heading:</b> 78&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 14.87 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(54);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-960px; top:701px;" 
    	onmouseover="updi(event,'2017-06-17 08:00 CEST (T+59:10)<br>Distances:&nbsp;695.3nm/2166.9nm<br><b>Wind:</b> 229&deg; 7.8 kt (<b>TWA -120&deg;</b>)<br><b>Heading:</b> 345&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 15.01 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(60);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-974px; top:679px;" 
    	onmouseover="updi(event,'2017-06-17 14:00 CEST (T+65:10)<br>Distances:&nbsp;703.0nm/2162.4nm<br><b>Wind:</b> 201&deg; 16.3 kt (<b>TWA -140&deg;</b>)<br><b>Heading:</b> 338&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 21.23 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(66);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-961px; top:649px;" 
    	onmouseover="updi(event,'2017-06-17 20:00 CEST (T+71:10)<br>Distances:&nbsp;793.0nm/2087.6nm<br><b>Wind:</b> 192&deg; 21.2 kt (<b>TWA 150&deg;</b>)<br><b>Heading:</b> 41&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 24.03 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(72);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-919px; top:625px;" 
    	onmouseover="updi(event,'2017-06-18 02:00 CEST (T+77:10)<br>Distances:&nbsp;928.3nm/1959.9nm<br><b>Wind:</b> 212&deg; 16.1 kt (<b>TWA -154&deg;</b>)<br><b>Heading:</b> 8&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 17.03 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(78);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-887px; top:613px;" 
    	onmouseover="updi(event,'2017-06-18 08:00 CEST (T+83:10)<br>Distances:&nbsp;1015.2nm/1875.4nm<br><b>Wind:</b> 205&deg; 15.5 kt (<b>TWA 120&deg;</b>)<br><b>Heading:</b> 84&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 21.58 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(84);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-826px; top:607px;" 
    	onmouseover="updi(event,'2017-06-18 14:00 CEST (T+89:10)<br>Distances:&nbsp;1150.2nm/1731.0nm<br><b>Wind:</b> 207&deg; 20.5 kt (<b>TWA 130&deg;</b>)<br><b>Heading:</b> 75&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 25.31 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(90);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-759px; top:592px;" 
    	onmouseover="updi(event,'2017-06-18 20:00 CEST (T+95:10)<br>Distances:&nbsp;1312.4nm/1569.5nm<br><b>Wind:</b> 206&deg; 24.2 kt (<b>TWA 135&deg;</b>)<br><b>Heading:</b> 70&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 28.13 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(96);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-688px; top:573px;" 
    	onmouseover="updi(event,'2017-06-19 02:00 CEST (T+101:10)<br>Distances:&nbsp;1486.8nm/1402.0nm<br><b>Wind:</b> 205&deg; 25.0 kt (<b>TWA 140&deg;</b>)<br><b>Heading:</b> 62&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 28.90 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(102);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-617px; top:553px;" 
    	onmouseover="updi(event,'2017-06-19 08:00 CEST (T+107:10)<br>Distances:&nbsp;1656.0nm/1246.3nm<br><b>Wind:</b> 201&deg; 23.1 kt (<b>TWA 130&deg;</b>)<br><b>Heading:</b> 68&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 27.06 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(108);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-545px; top:540px;" 
    	onmouseover="updi(event,'2017-06-19 14:00 CEST (T+113:10)<br>Distances:&nbsp;1816.0nm/1097.4nm<br><b>Wind:</b> 195&deg; 21.9 kt (<b>TWA 115&deg;</b>)<br><b>Heading:</b> 78&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 25.81 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(114);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-472px; top:535px;" 
    	onmouseover="updi(event,'2017-06-19 20:00 CEST (T+119:10)<br>Distances:&nbsp;1968.7nm/951.8nm<br><b>Wind:</b> 196&deg; 20.0 kt (<b>TWA 105&deg;</b>)<br><b>Heading:</b> 89&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 24.77 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(120);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-405px; top:534px;" 
    	onmouseover="updi(event,'2017-06-20 02:00 CEST (T+125:10)<br>Distances:&nbsp;2108.5nm/818.9nm<br><b>Wind:</b> 199&deg; 15.6 kt (<b>TWA 95&deg;</b>)<br><b>Heading:</b> 100&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 20.61 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(126);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-352px; top:537px;" 
    	onmouseover="updi(event,'2017-06-20 08:00 CEST (T+131:10)<br>Distances:&nbsp;2216.5nm/712.5nm<br><b>Wind:</b> 174&deg; 10.3 kt (<b>TWA 80&deg;</b>)<br><b>Heading:</b> 86&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 15.89 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(132);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-308px; top:537px;" 
    	onmouseover="updi(event,'2017-06-20 14:00 CEST (T+137:10)<br>Distances:&nbsp;2308.5nm/632.9nm<br><b>Wind:</b> 148&deg; 12.2 kt (<b>TWA 55&deg;</b>)<br><b>Heading:</b> 89&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 15.13 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(138);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-267px; top:534px;" 
    	onmouseover="updi(event,'2017-06-20 20:00 CEST (T+143:10)<br>Distances:&nbsp;2393.2nm/570.3nm<br><b>Wind:</b> 119&deg; 10.8 kt (<b>TWA 45&deg;</b>)<br><b>Heading:</b> 70&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 13.19 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(144);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-243px; top:549px;" 
    	onmouseover="updi(event,'2017-06-21 02:00 CEST (T+149:10)<br>Distances:&nbsp;2445.6nm/495.7nm<br><b>Wind:</b> 97&deg; 18.2 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 136&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 14.39 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(150);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-215px; top:566px;" 
    	onmouseover="updi(event,'2017-06-21 08:00 CEST (T+155:10)<br>Distances:&nbsp;2511.1nm/408.7nm<br><b>Wind:</b> 97&deg; 18.8 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 135&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 14.50 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(156);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-189px; top:583px;" 
    	onmouseover="updi(event,'2017-06-21 14:00 CEST (T+161:10)<br>Distances:&nbsp;2577.8nm/321.3nm<br><b>Wind:</b> 96&deg; 16.6 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 135&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 14.17 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(162);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-171px; top:606px;" 
    	onmouseover="updi(event,'2017-06-21 20:00 CEST (T+167:10)<br>Distances:&nbsp;2630.4nm/242.3nm<br><b>Wind:</b> 120&deg; 15.7 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 156&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 14.06 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(168);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-153px; top:625px;" 
    	onmouseover="updi(event,'2017-06-22 02:00 CEST (T+173:10)<br>Distances:&nbsp;2686.8nm/174.9nm<br><b>Wind:</b> 105&deg; 20.0 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 148&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 14.74 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(174);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-126px; top:631px;" 
    	onmouseover="updi(event,'2017-06-22 08:00 CEST (T+179:10)<br>Distances:&nbsp;2754.4nm/107.1nm<br><b>Wind:</b> 109&deg; 24.5 kt (<b>TWA 40&deg;</b>)<br><b>Heading:</b> 67&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 15.17 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(180);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :-98px; top:635px;" 
    	onmouseover="updi(event,'2017-06-22 14:00 CEST (T+185:10)<br>Distances:&nbsp;2825.1nm/36.7nm<br><b>Wind:</b> 102&deg; 23.3 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 141&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 15.04 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(186);">
    <img src="img/flag.png" class="abs" style="left :-82px; top:614px;">
    </div>
    <div id="friends_layer" >
     
    </div>
    <div id="track_layer"><canvas id="track_canvas"></canvas></div> 
    </div>
    <div id="help_div"></div>
    <div id="cmenu" class="contextmenu" style="display: none;">
    	<div class="menuitem" style="width:150px" onmouseover="over(event,this)"
    			onmouseout="out(event,this)" onmousedown="show_polars()">Polar graph</div>
        <div class="divider"></div> 
    	<div class="menuitem" style="width:150px" onmouseover="over(event,this)"
    			onmouseout="out(event,this)" onmousedown="set_pos(0,1)">Set as starting point</div>
    	<div class="menuitem" style="width:150px" onmouseover="over(event,this)"
    			onmouseout="out(event,this)" onmousedown="set_pos(1,1)">Set as destination</div>
        <div class="divider"></div> 
     
    	<div class="menuitem" style="width:150px; background:#E3F3FF;" onmouseover="over(event,this)"
                       onmouseout="out(event,this)" onmousedown="set_pos(1,0,-5.09781,49.9401)">
    					Go to Cap Lizard</div>
     
    	<div class="divider"></div> 
    	<div class="menuitem" style="width:150px" onmouseover="over(event,this)" onmouseout="out(event,this)" 
    			onmousedown="toggle_pro()">
    			<input type="checkbox" id="tpb" style="border:none; margin-left: 0;" onmousedown="cancel_event"
    			> Pro sails
    	</div>
    	<div class="menuitem" style="width:150px" onmouseover="over(event,this)" onmouseout="out(event,this)" 
    			onmousedown="toggle_gates()">
    			<input type="checkbox" id="tgb" style="border:none; margin-left: 0;" onmousedown="cancel_event"
    			> Ignore gates
    	</div>
    	<div class="menuitem" style="display:block; width:150px;" onmouseover="over(event,this)" onmouseout="out(event,this)" 
    			onmousedown="toggle_tacks()">
    			<input type="checkbox" id="ttb" style="border:none; margin-left: 0;" onmousedown="cancel_event"
    			> 6% extra speed 
    	</div>
    	<div class="menuitem" style="display:block; width:150px;" onmouseover="over(event,this)" onmouseout="out(event,this)" 
    			onmousedown="toggle_time()">
     
    			<input type="checkbox" id="tsb" style="border:none; margin-left: 0;" onmousedown="cancel_event"
    			> Timeshift
    	</div>
    	<div class="divider"></div> 
    		<div class="menuitem" style="width:150px" onmouseover="over(event,this)"
                            onmouseout="out(event,this)" onmousedown="find_boat()">Center chart</div>
    </div>
     
    <div style="display:block; position: fixed; z-index:15; right:0px; bottom: 20px; padding: 1px;">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Chart bottom -->
    <ins class="adsbygoogle"
         style="display:inline-block;width:728px;height:90px"
         data-ad-client="ca-pub-4306548645573687"
         data-ad-slot="4516500658"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>
     
    </div>
    <div id="statusbar">
    <div class="statusitem" style="width: 10em">DST:<span id="span_dd1"></span></div>
    <div class="statusitem" style="width: 10em"><span id="span_lat"></span>&nbsp;<span id="span_lon"></span></div>
    <div class="statusitem">Wed Jun 14 20:50 CET</div>
     
    <div class="statusitem" id="debug_div"></div>
    <div class="statusitem" style="float:right; margin-right: 1px; width:10em">DTF:<span id="span_dd2"></span></div>
    <div class="statusitem" style="float:right;" title="Last file:gfs.t12z+231h">GFS:12Z</div>
     
     
    </div>
     
     
     
    <div id="amenu" class="contextmenu" style="display:none;">
    	<div class="menuitem" style="width:150px">Router algorithm:</div>
        <div class="divider"></div> 
     
    </div>
     
    </body>
    </html>
    l'importance pour moi de cinder les valeurs est que je vais calculer la VMG / VMC après ( pour les non voileux et pour faire simple c'est de connaitre l'efficacité de l'avancement du bateau avec un angle au vent / le cap tenu vers un point ) je sais pas si c'est plus clair

  10. #10
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Citation Envoyé par rlelamer Voir le message
    Bonsoir,
    Désolé de vous répondre si tard mais trop de taf
    J'fais une modification et je post ici le code que j'utilise actuellement

    @badaze: j'ai mis en pause la création de l'extension google chrome car pu le temps je suis en saison j'reprendrais ça activement après l'été et tu m'avais dis que tu creuserais pour ta gouverne les extensions, tu l'as fais ?
    J'avais réussi à faire un truc (qui n'a rien à voir avec ton pb) puis je suis passé à autre chose.
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  11. #11
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    320
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 320
    Points : 79
    Points
    79
    Par défaut
    J'ai l'impression qu'il existe beaucoup de manière d'écrire ce que je souhaite obtenir ...

    En m'inspirant de ce que vous m'avez montré j'ai tenté de faire un code dans l'esprit de l'original, ça donne ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    // returns data from the html file content
    function data_from_file_content(_content)
    {
        var expr = /updi\(event\,\'(.*)\-(.*)\-(.*)[ ](.*)[ ](.*)\((.*) \)<br>Distances:&nbsp;(.*)\/(.*)<br><b>Wind:<\/b>(.*)[ ](.*)\(<b>TWA(.*);<\/b>\)<br><b>Heading:<\/b>(.*)<b>Sail:<\/b>(.*)<br><b>Boat Speed:<\/b>(.*)','(.*)'\)/gi;
        var value;
        var values = [];
        while(value = expr.exec(_content))
        {
            var res = [];
            res['date']=value[3]+\+value[2]+\+value[1];
            res['time']=value[4];
            res['timezone']=value[5];
            res['ttw']=value[6];
            res['dtg']=value[8];
            res['twd']=value[9];
            res['tws']=value[10];
            res['twa']=value[11];
            res['brg']=value[12];
            res['sail']=value[13];
            res['stw']=value[14];
            values.push(res);
        }
        return values;
    }
     
    // Display data in the table
    function display_data(_values)
    {
        var table_content = '<tr><td align="center">Date</td><td align="center">Time</td><td align="center">Timezone</td><td align="center">TTW</td><td align="center">DTG</td><td align="center">TWD</td><td align="center">TWS</td><td align="center">TWA</td><td align="center">BRG</td><td align="center">Sail</td><td align="center">STW</td></tr>';
        for(var l=0; l<_values.length; l++)
        {
            var twa = parseFloat(_values[l]['twa']);
            var twa_color = (twa>=0)?'green':'red';
            table_content += '<tr><td align="center">'+_values[l]['date']+'</td><td align="center">'+_values[l]['time']+'</td><td align="center">'+_values[l]['timezone']+'</td><td align="center">'+_values[l]['ttw']+'</td><td align="center">'+_values[l]['dtg']+'</td><td align="center">'+_values[l]['twd']+'</td><td align="center">'+_values[l]['tws']+'</td><td align="center" style=\'color:'+twa_color+';\'>'+Math.abs(twa)+'°</td><td align="center" style="color:blue" >'+_values[l]['brg']+'</td><td align="center">'+_values[l]['sail']+'</td><td align="center">'+_values[l]['stw']+'</td></tr>';
        }
        document.getElementById('output').innerHTML = table_content;
    }
    Et bien sur vous vous en doutez ça fonctionne ... pas du tout ...
    A partir de cette ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    res['date']=value[3]+\+value[2]+\+value[1]
    La console hurle un SyntaxError ...

  12. #12
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Il ne faut pas oublier le caractère ' quand on concatène de l'alphanumérique.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    res['date']=value[3]+'/'+value[2]+'/'+value[1];
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  13. #13
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    320
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 320
    Points : 79
    Points
    79
    Par défaut
    Citation Envoyé par badaze Voir le message
    Il ne faut pas oublier le caractère ' quand on concatène de l'alphanumérique.
    Effectivement ça fonctionne beaucoup mieux (mais pas totalement seul le 1er tableau affiche le nom de la course et la position GPS, j'ai du faire une autre bourde

    Merci badaze

  14. #14
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    320
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 320
    Points : 79
    Points
    79
    Par défaut
    Bon voilà , après une nuit de sommeil ma caboche réfléchie mieux

    Le code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
     
    // returns data from the html file content
    function data_from_file_content(_content)
    {
        var expr = /updi\(event\,\'(.*)\-(.*)\-(.*)[ ](.*)\:(.*)[ ](.*)[ ]\((.*)\)<br>Distances:&nbsp;(.*)\/(.*)<br><b>Wind:<\/b>(.*)\;(.*)\(<b>TWA(.*);<\/b>\)<br><b>Heading:<\/b>(.*)<b>Sail:<\/b>(.*)<br><b>Boat Speed:<\/b>(.*)','(.*)'\)/gi;
        var value;
        var values = [];
        while(value = expr.exec(_content))
        {
            var res = [];
            res['date']=value[3]+'-'+value[2]+'-'+value[1];
            res['time']=value[4]+':'+value[5];
            res['timezone']=value[6];
            res['ttw']=value[7];
            res['dtg']=value[9];
            res['twd']=value[10];
            res['tws']=value[11];
            res['twa']=value[12];
            res['brg']=value[13];
            res['sail']=value[14];
            res['stw']=value[15];
            values.push(res);
        }
        return values;
    }
    Me retourne :
    Nom : Capture d’écran 2017-06-15 à 08.26.21.png
Affichages : 82
Taille : 246,3 Ko

    Le rendu final est celui que je souhaite merci à vous de m'avoir aiguillé je continue l'amélioration de mon tableau, merci encore

  15. #15
    Expert éminent
    Avatar de Watilin
    Homme Profil pro
    En recherche d'emploi
    Inscrit en
    Juin 2010
    Messages
    3 093
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : En recherche d'emploi

    Informations forums :
    Inscription : Juin 2010
    Messages : 3 093
    Points : 6 754
    Points
    6 754
    Par défaut
    Salut,

    quelques petites remarques.

    1. Ton script est fonctionnel en mode strict, ce qui veut dire que tu peux bénéficier des avantages du mode strict (meilleur signalement des erreurs, meilleure optimisation dans les moteurs d’exécution JavaScript) sans fournir aucun effort, c’est complètement gratuit !

    2. Les tableaux de JS ne sont pas associatifs comme en PHP ! Si tu leur attaches des propriétés (ex. res['course']), ça marche mais ça n’a pas grand chose à voir avec une fonctionnalité de tableau. Tu peux attacher des propriétés à n’importe quel objet JS, et c’est d’ailleurs recommandé d’utiliser un objet plutôt qu’un tableau dans ce genre de cas.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
        var res = {};
        res['course'] = /<title>(.*)<\/title>/g.exec(_content)[1];
        res['lat'] = parseFloat(/var boat_lat = (.*);/g.exec(_content)[1]);
        res['lon'] = parseFloat(/var boat_lon = (.*);/g.exec(_content)[1]);
    Une syntaxe équivalente :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
        var res = {};
        res.course = /<title>(.*)<\/title>/g.exec(_content)[1];
        res.lat = parseFloat(/var boat_lat = (.*);/g.exec(_content)[1]);
        res.lon = parseFloat(/var boat_lon = (.*);/g.exec(_content)[1]);
    Une autre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
        var res = {
          course: /<title>(.*)<\/title>/g.exec(_content)[1];
          lat: parseFloat(/var boat_lat = (.*);/g.exec(_content)[1]);
          lon: parseFloat(/var boat_lon = (.*);/g.exec(_content)[1]);
        };
    Encore une autre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
        var res = {
          'course': /<title>(.*)<\/title>/g.exec(_content)[1];
          'lat': parseFloat(/var boat_lat = (.*);/g.exec(_content)[1]);
          'lon': parseFloat(/var boat_lon = (.*);/g.exec(_content)[1]);
        };
    Dans les tutos et les docs tu entendras parler d’objet littéral, objet anonyme ou parfois même objet JSON (même si cette dernière appellation est abusive).

    3. Les symboles unicode prime et double prime indiquent respectivement les minutes et les secondes. Tu peux t’en servir dans ton code, ça t’évitera un méli-mélo avec les guillemets…
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    return ad_lon + '°' + EW + ' ' + am_lon + '\u2032' + as_lon +'\u2033';
    Avec la syntaxe de « gabarits » (string templates) ES2015 :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    return `${ad_lon}°${EW} ${am_lon}\u2032 ${as_lon}\u2033`;
    Tu peux aussi les écrire directement, les coder « en dur » dans ton script, ce qui rendra le code plus lisible. JavaScript gère nativement les chaînes en UCS-2, c’est-à-dire grosso modo dit tous les caractères qui tiennent sur 16 bits. Tant que tu t’assures que ton éditeur de texte enregistre en UTF-8, ça ne cause aucun problème. En revanche, ça pose un problème sur ce forum donc je ne peux pas te donner de code en exemple

    4. Et sinon, c’est du bonus, mais tu peux ajouter de la gestion d’erreur sur les chaînes saisies par l’utilisateur. Par exemple si je saisis une chaîne vide, actuellement ton script part en TypeError à cause d’une regexp qui renvoie null.
    La FAQ JavaScript – Les cours JavaScript
    Touche F12 = la console → l’outil indispensable pour développer en JavaScript !

  16. #16
    Membre régulier
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    320
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 320
    Points : 79
    Points
    79
    Par défaut
    @Watilin:

    Bonsoir,
    Je suis désolé mais je comprends pas tout de tes bons conseils ... les cours de programmations me passionnaient pas du tout à l'époque ... je m'en mords les doigts maintenant je trouve ça génial ce que l'on peut faire avec du code ...

    Du coup ce que je comprends c'est que ce code est fonctionnel mais loin, voir très loin, d'être au top ... mes piètres connaissances ne me permettent pas de l'améliorer ...

    Pour l'instant ce fichier html me permet d'obtenir ce qui m'intéresse ou presque, je m'attaque aux colonnes TWA Moy et BRG Moy (moyenne d'un angle au vent et cap à suivre par rapport à ma position pour atteindre un point précis ) qui me permettra de 'lisser' mes trajectoires et de ne pas me connecter au taf, suivront les colonnes VMG et VMC après je pense que j'aurais toutes les infos nécessaires pour faire de belles régates virtuelles

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Modification d'une table existante
    Par marcandre dans le forum Administration
    Réponses: 2
    Dernier message: 24/04/2012, 13h23
  2. [JDialog] Modification dans une fenêtre
    Par cefabien dans le forum Agents de placement/Fenêtres
    Réponses: 3
    Dernier message: 01/10/2003, 13h18
  3. Réponses: 2
    Dernier message: 26/02/2003, 11h47
  4. Erreur lors de modification d'une table
    Par seb.49 dans le forum SQL
    Réponses: 11
    Dernier message: 13/01/2003, 17h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo