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 :

Extraire des données du code source d'une page web


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 Extraire des données du code source d'une page web
    Bonjour,
    Je cherche à extraire la route de ma page zezo ( Routeur Web pour Virtual Regatta )
    Toutes les données sont présentes dans le code source de la page qui ressemble à ça :
    Code html : 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
    <!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>Down Under</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 = 512;
    var session_id = "1780a7c519bb011e4b83663dc1fbc35d";
    var days = 7;
    var boat_lat = -38.79974;
    var boat_lon = 147.4903;
    var goal_lat = -38.2883;
    var goal_lon = 144.641;
    var scroll_x = -75000; 
    var scroll_y = -65888; 
    var boat_heading = 246.629424089483;
    var iso_id = 'ec/b0aebdfe9a9b01a7ca276e03fe498168512'; 
    var iso_minx = 205; 
    var iso_miny = 181; 
    var iso_maxx = 210; 
    var iso_maxy = 185;
    var wind_time = 0;
    var grib_steps = 1;
    var windbase = 1487592000;
    var datastamp = '06+237';
    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>Down Under</b>
    <a style="text-decoration:underline;" href="http://sail.zezo.org/sodebo/chart.pl">Sodebo</a>
    <a style="text-decoration:underline;" target="_blank" 
    href="http://pacotool.fr/zezo.php5?lati_zezo=-38.79974&longi_zezo=147.4903&course=vendeeglobe">PACOTOOL</a>
    <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" >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" selected>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  selected>7d</option>
     
    	<option >8d</option>
     
    	<option >9d</option>
     
    	<option >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="1780a7c519bb011e4b83663dc1fbc35d">
    		<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="147">&deg
    	<input type="tel" name="lon_min" size="2" maxlength="2" style="width: 2ch;" value="29">'
    	<input type="tel" name="lon_sec" size="2" maxlength="2" style="width: 2ch;" value="25">"
    	<select name="lon_ew">
    		<option selected>E</option>
    		<option >W</option>
    	<select>
    	<input type="tel" name="lat_deg" size="3" maxlength="3" style="width: 3ch;" value="38">&deg
    	<input type="tel" name="lat_min" size="2" maxlength="2" style="width: 2ch;" value="47">'
    	<input type="tel" name="lat_sec" size="2" maxlength="2" style="width: 2ch;" value="59">"
    	<select name="lat_ns">
    		<option >N</option>
    		<option selected>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 :75513px; top:65943px;" 
    	onmouseover="updi(event,'2017-02-20 13:10 CEST (T+ 0:00)<br>Distances:&nbsp;0.0nm/137.4nm<br><b>Wind:</b> 261&deg; 19.2 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 304&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 10.25 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(0);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :75376px; top:65870px;" 
    	onmouseover="updi(event,'2017-02-20 14:40 CEST (T+ 1:30)<br>Distances:&nbsp;15.2nm/123.4nm<br><b>Wind:</b> 266&deg; 15.4 kt (<b>TWA 45&deg;</b>)<br><b>Heading:</b> 226&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 10.50 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(0);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :75325px; top:65909px;" 
    	onmouseover="updi(event,'2017-02-20 15:20 CEST (T+ 2:10)<br>Distances:&nbsp;17.7nm/119.7nm<br><b>Wind:</b> 267&deg; 15.8 kt (<b>TWA 40&deg;</b>)<br><b>Heading:</b> 227&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 9.92 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(0);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :75027px; top:66122px;" 
    	onmouseover="updi(event,'2017-02-20 19:00 CEST (T+ 5:50)<br>Distances:&nbsp;49.1nm/103.0nm<br><b>Wind:</b> 265&deg; 17.0 kt (<b>TWA 40&deg;</b>)<br><b>Heading:</b> 224&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 10.04 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(6);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74976px; top:66163px;" 
    	onmouseover="updi(event,'2017-02-20 19:40 CEST (T+ 6:30)<br>Distances:&nbsp;55.4nm/101.5nm<br><b>Wind:</b> 262&deg; 16.4 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 302&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 9.97 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(6);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74508px; top:65932px;" 
    	onmouseover="updi(event,'2017-02-21 01:00 CEST (T+11:50)<br>Distances:&nbsp;92.0nm/51.0nm<br><b>Wind:</b> 259&deg; 8.4 kt (<b>TWA -50&deg;</b>)<br><b>Heading:</b> 308&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 8.89 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(12);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74323px; top:65819px;" 
    	onmouseover="updi(event,'2017-02-21 03:40 CEST (T+14:30)<br>Distances:&nbsp;110.1nm/29.5nm<br><b>Wind:</b> 247&deg; 5.0 kt (<b>TWA -60&deg;</b>)<br><b>Heading:</b> 302&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 7.70 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(12);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74276px; top:65796px;" 
    	onmouseover="updi(event,'2017-02-21 04:20 CEST (T+15:10)<br>Distances:&nbsp;114.8nm/24.4nm<br><b>Wind:</b> 231&deg; 4.6 kt (<b>TWA -70&deg;</b>)<br><b>Heading:</b> 292&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 7.82 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(15);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74250px; top:65787px;" 
    	onmouseover="updi(event,'2017-02-21 04:40 CEST (T+15:30)<br>Distances:&nbsp;117.3nm/21.8nm<br><b>Wind:</b> 217&deg; 4.4 kt (<b>TWA -75&deg;</b>)<br><b>Heading:</b> 281&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 7.74 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(15);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74222px; top:65783px;" 
    	onmouseover="updi(event,'2017-02-21 05:00 CEST (T+15:50)<br>Distances:&nbsp;119.8nm/19.5nm<br><b>Wind:</b> 202&deg; 4.3 kt (<b>TWA -80&deg;</b>)<br><b>Heading:</b> 272&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 7.66 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(15);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74195px; top:65782px;" 
    	onmouseover="updi(event,'2017-02-21 05:20 CEST (T+16:10)<br>Distances:&nbsp;122.4nm/17.5nm<br><b>Wind:</b> 189&deg; 4.2 kt (<b>TWA -115&deg;</b>)<br><b>Heading:</b> 294&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 6.75 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(15);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74174px; top:65775px;" 
    	onmouseover="updi(event,'2017-02-21 05:40 CEST (T+16:30)<br>Distances:&nbsp;124.3nm/15.6nm<br><b>Wind:</b> 176&deg; 4.1 kt (<b>TWA -130&deg;</b>)<br><b>Heading:</b> 296&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 5.98 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(15);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74136px; top:65761px;" 
    	onmouseover="updi(event,'2017-02-21 06:20 CEST (T+17:10)<br>Distances:&nbsp;128.2nm/11.9nm<br><b>Wind:</b> 158&deg; 4.3 kt (<b>TWA -135&deg;</b>)<br><b>Heading:</b> 288&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 5.80 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(15);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74115px; top:65755px;" 
    	onmouseover="updi(event,'2017-02-21 06:40 CEST (T+17:30)<br>Distances:&nbsp;130.1nm/10.3nm<br><b>Wind:</b> 151&deg; 4.5 kt (<b>TWA -135&deg;</b>)<br><b>Heading:</b> 282&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 6.02 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(15);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74093px; top:65752px;" 
    	onmouseover="updi(event,'2017-02-21 07:00 CEST (T+17:50)<br>Distances:&nbsp;132.2nm/8.9nm<br><b>Wind:</b> 145&deg; 4.8 kt (<b>TWA -130&deg;</b>)<br><b>Heading:</b> 270&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 6.79 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(18);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74067px; top:65752px;" 
    	onmouseover="updi(event,'2017-02-21 07:20 CEST (T+18:10)<br>Distances:&nbsp;134.5nm/8.3nm<br><b>Wind:</b> 138&deg; 5.0 kt (<b>TWA 136&deg;</b>)<br><b>Heading:</b> 356&deg;<b>Sail:</b> Spi<br><b>Boat Speed:</b> 6.41 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(18);">
    <img src="img/dot.png" class="abs" style="z-index: 1; left :74062px; top:65692px;" 
    	onmouseover="updi(event,'2017-02-21 08:20 CEST (T+19:10)<br>Distances:&nbsp;136.5nm/1.4nm<br><b>Wind:</b> 129&deg; 6.2 kt (<b>TWA 0&deg;</b>)<br><b>Heading:</b> 358&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 0.00 kts','220px')" onmouseout="cleari()" 
    	onmousedown="show_wind(18);">
    <img src="img/flag.png" class="abs" style="left :74056px; top:65657px;">
    </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;" onmouseover="over(event,this)"
                       onmouseout="out(event,this)" onmousedown="set_pos(1,0,174.531,-41.455)">
    					Go to Derek's Buoy</div>
     
    	<div class="menuitem" style="width:150px; background:#E3F3FF;" onmouseover="over(event,this)"
                       onmouseout="out(event,this)" onmousedown="set_pos(1,0,144.641,-38.2883)">
    					Go to Melbourne</div>
     
    	<div class="menuitem" style="width:150px;" onmouseover="over(event,this)"
                       onmouseout="out(event,this)" onmousedown="set_pos(1,0,146.727,-43.4605)">
    					Go to Tasmania</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">Mon Feb 20 13:10 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.t06z+237h">GFS:06Z</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>

    le but étant via une extension chrome de générer un tableau dans un nouvel onglet comme ceci :

    Down Under : dans la balise <title></title> du code source de la page

    GeGaX : je demanderais à Cvetan de réactiver name = 'boat'

    147° 52' 30" E / 38° 59' 15" S : dans var boat_lon / var boat_lat du code source de la page mais en version décimale

    Pour remplir le tableau comme ci dessus : les valeur se trouvent sur les lignes de ce type :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    onmouseover="updi(event,'2017-02-20 11:10 CEST (T+ 0:00)<br>Distances:&nbsp;0.0nm/157.5nm<br><b>Wind:</b>						
    258&deg; 23.3 kt (<b>TWA -40&deg;</b>)<br><b>Heading:</b> 299&deg;<b>Sail:</b> Jib<br><b>Boat Speed:</b> 10.59 kts						
    ','220px')"
    Pour la coloration des valeurs TWA: les valeurs sont données en négatives pour l'angle Babord normalisé en rouge ( Gauche )
    et en positives pour l'angle Tribord normalisé en vert ( Droit )

    Je ne possède aucunes connaissances en javascript , y'aurait il une âme charitable pour m'aiguiller ?
    Pour l'extension chrome je me débrouille à la mettre en place ça je devrais en être capable

    cdlt

    GeGaX

  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
    Voici un exemple pour la seconde partie en .... PHP qui peut servir de base à qui connaît très bien JavaScript.

    Le code de la page html que tu as postée est mis dans le fichier test9104b.html.

    Code php : 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
    <?php
     $string = file_get_contents('test9104b.html');
     
     $pattrn = "/updi\(event\,\'(.*)'\)/m";
     preg_match_all($pattrn,$string,$array);
     
     $arrResultat = array();
     
     foreach($array[1] as $value) {
       $str2   = str_replace("<br>Distances:&nbsp;"     ,"|",$value);
       $str2   = str_replace("<br><b>Wind:</b>"         ,"|",$str2);
       $str2   = str_replace("(<b>TWA"                  ,"|",$str2);
       $str2   = str_replace("</b>)<br><b>Heading:</b>" ,"|",$str2); 
       $str2   = str_replace("<b>Sail:</b>"             ,"|",$str2); 
       $str2   = str_replace("<br><b>Boat Speed:</b>"   ,"|",$str2); 
       $str2   = str_replace("','"                      ,"|",$str2); 
     
       $arrResultat[] = $str2;
     }?>
     <table border="1">
          <tr>
              <td>Date et heure</td><td>Distances</td><td>Wind</td><td>TWA</td><td>Heading</td><td>Sail</td><td>Boat Speed</td>
          </tr><?php
      foreach($arrResultat as $value) {
       $arrInfo = explode('|',$value);
       $TWA     = (int) $arrInfo[3];
       $color   = $TWA >= 0 ? 'green' : 'red';?>
       <tr>
        <td><?php print $arrInfo[0];?></td>
        <td><?php print $arrInfo[1];?></td>
        <td><?php print $arrInfo[2];?></td>
        <td style="color:<?php print $color;?>"><?php print abs($TWA);?></td>
        <td><?php print $arrInfo[4];?></td>
        <td><?php print $arrInfo[5];?></td>
        <td><?php print $arrInfo[6];?></td>
     
       </tr><?php
      }?>
     </table>

    Donne.
    Nom : 170220-001.JPG
Affichages : 2564
Taille : 160,3 Ko
    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
    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
    Alors là ... comment dire ... chapeau l'artiste ou tout simplement un grand merci !!!
    J'ai une base de départ solide pour a mon tour travailler sur le sujet j'vais m'y atteler
    Merci beaucoup badaze

  4. #4
    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
    le rendu est juste parfait ... en revanche tant que j'ai le nez dans les réseaux électroniques ou électriques des bateaux tout va bien ... la je pêche grave ... je maitrise pas du tout la programmation ...

  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
    On ne peut pas être bon de partout !
    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
    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
    C'est pas faux ...
    J'ai installé xampp pour mac puis créer un dossier route dans htdocs
    Avec un raccourci dans safari de localhost/route/index.php
    J'ai juste à copier le code source et l'enregistrer en route.html ( j'ai changé le nom dans ton script )
    Et ça fait le taf
    Merci

  7. #7
    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,
    Je remonte ce post car mes recherches ont avancées ( non sans mal et avec beaucoup d'aide )

    Le script que j'exécute n'est plus en php mais en JavaScript ( youpi )

    Le voici :

    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
     
    <html>
        <head>
            <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;
    }
     
    function dms(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);
      return Math.abs(d_lon) + '°' + EW + ' ' + Math.abs(m_lon) + "'" + Math.abs(s_lon) +'"'; 
    }
     
    function dms(lat) {
      var NS = (lat>=0)?'N':'S'
      var d_lat = Math.trunc(lat); 
      var x_lat = (lat - d_lat) * 60; // minutes
      var m_lat = Math.trunc(x_lat);
      var y_lat = (x_lat - m_lat) * 60; // secondes
      s_lat = Math.trunc(y_lat);
      return Math.abs(d_lat) + '°' + NS + ' ' + Math.abs(m_lat) + "'" + Math.abs(s_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">Bateau</td><td align="center">Position</td></tr><tr><td align="center">'+_values['course']+'</td><td align="center">'+_values['bateau']+'</td><td align="center">'+_values['lon']+' / '+_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 = [];
        while(value = expr.exec(_content))
        {
            var res = [];
            res['date']=value[1];
            res['distance']=value[2];
            res['wind']=value[3];
            res['twa']=value[4];
            res['heading']=value[5];
            res['sail']=value[6];
            res['speed']=value[7];
            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">Distances</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></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></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 style="background-color:grey;">
    File&nbsp;content&nbsp;:<br />
    <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">Bateau</td><td align="center">Position</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">Distances</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></tr></table>
    </body>
    </html>
    Et donne ceci : ( en me basant sur le code source en haut de page )
    Nom : Capture d’écran 2017-03-17 à 21.20.03.png
Affichages : 2489
Taille : 205,6 Ko

    Les coordonnées GPS de la position du bateau sont au format décimales, c'est pas très parlant ...
    Dans le code en JS, il y a 2 fonctions de conversions " dms(lat) et dms(lon) " qui convertissent de décimales a degrés - minutes - secondes.
    Ces 2 fonctions sont opérationnelles mais tout mes essais pour les afficher dans le tableau se solde systématiquement par un échec

    - Ma question est : comment les afficher en lieu et place des coordonnées décimales ?

    Merci
    Cdlt

    PS: si des choses vous choque dans le code, n'hésitez pas a me le faire savoir

  8. #8
    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
    Essaie ça.

    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
    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);
      return Math.abs(d_lon) + '°' + EW + ' ' + Math.abs(m_lon) + "'" + Math.abs(s_lon) +'"'; 
    }
     
    function dms_lat(lat) {
      var NS = (lat>=0)?'N':'S'
      var d_lat = Math.trunc(lat); 
      var x_lat = (lat - d_lat) * 60; // minutes
      var m_lat = Math.trunc(x_lat);
      var y_lat = (x_lat - m_lat) * 60; // secondes
      s_lat = Math.trunc(y_lat);
      return Math.abs(d_lat) + '°' + NS + ' ' + Math.abs(m_lat) + "'" + Math.abs(s_lat) +'"'; 
    }
    Puis
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    <td align="center">'+dms_lon(_values['lon'])+' / '+dms_lat(_values['lat'])+'</td></tr>';
    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.

  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
    Comment dire ... Merci badaze ... t'es un chef !

    dms_lon(lon) et dms_lat(lat) je me demande comment j'ai pu passer à coté sachant que j'ai bien fait le truc après pour pas qu'il y ai d'erreurs...
    quant à la façon de retourner la valeur dans le tableau ça me semble tellement logique en le voyant écrit comme ça ...

    Merci encore, je continue de progresser vers mon but final et t'y es pour beaucoup
    maintenant le but va être d'arrêter la copie du code source et de taper direct sur l'adresse du site ( j'y vais par étapes comme ça j'apprends au fur et à mesure )

    La suite au prochain épisode mais avant j'ai quelques heures de lecture



    PS: je ne passe pas le sujet en résolu il est pas encore finalisé donc pas besoin de m'avertir une seconde fois merci

  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
    Tu t'es renseigné auprès du site pour savoir s'ils ne proposent pas un service type flux RSS ou de données ?
    AHMA ce serait plus pérenne que l'analyse de leur code html. En effet, il suffit qu'ils changent leur manière d'afficher les lignes pour ce que tu as fait ne fonctionne plus.
    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
    Bonjour,

    @badaze : Heu je ne pense pas qu'il y ai tout ça sur ce site ..., voila le lien si tu veux y jeter un oeil : http://zezo.org/900nq/chart.pl?

    Question, dans un esprit purement pointilleux, les coordonnées GPS s'affichent comme ceci 150°W 1'3" par exemple, si je souhaitais les avoir sous la forme 150°W 01'03" ( ce qui serait purement esthétique j'en conviens ) y'aurais pas quelque chose de simple pour définir que l'entier doit être de minimum 2 chiffres ?
    J'ai tenté d'indiquer dans la fonction dms que si les variables d, m et s étaient supérieures ou égales à 10 alors elles restaient inchangées sinon je forçais un 0 devant mais mon éditeur de code m'a insulté alors j'ai laissé couler.

  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
    Poste le code que tu avais écrit.
    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
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    function dms_lat(lat) {
      var NS = (lat>=0)?'N':'S'
      var d_lat = (lat>=10)?'Math.trunc(lat)';''0'Math.trunc(lat)'
      var x_lat = (lat - d_lat) * 60; // minutes
      var m_lat = (x_lat>=10)?'Math.trunc(x_lat)';''0'Math.trunc(x_lat)';
      var y_lat = (x_lat - m_lat) * 60; // secondes
      s_lat = (y_lat>=10)?'Math.trunc(y_lat)';''0'Math.trunc(y_lat)';
      return Math.abs(d_lat) + '°' + NS + ' ' + Math.abs(m_lat) + "'" + Math.abs(s_lat) +'"'; 
    }

    La réflexion est dans le vrai ( je pense ) mais la mise en oeuvre laisse à désirer ...

  14. #14
    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
    ....lat =(lat>=10) ? Math.trunc(lat) : '0'+Math.trunc(lat);
    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.

  15. #15
    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
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    var d_lon = (lon>=10) ? Math.trunc(lon) : '0'+Math.trunc(lon);
    Ca fonctionne pas docteur

  16. #16
    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
    Effectivement. Je ne me souvenais plus que les variables étaient réutilisées dans la suite du code. Ce que j'ai posté est correct sauf que c'était mal placé.

    J'ai repris le code de la fonction posté sur ton autre discussion.

    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
     
    function dms_lat(lat) {
      var NS = (lat>=0)?'N':'S'
      var d_lat = Math.trunc(lat); 
      var x_lat = (lat - d_lat) * 60; // minutes
      var m_lat = Math.trunc(x_lat);
      var y_lat = (x_lat - m_lat) * 60; // secondes
      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 ad_lat = d_lat >= 10 ? d_lat : '0'+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 +'"'; 
    }
     
    alert(dms_lat(15.000910));
    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.

  17. #17
    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
    Super ça fonctionne parfaitement badaze , merci

    J'ai même poussé l'exactitude en ajoutant une autre variable pour les degrées qui ont 3 chiffres ( de 0 à 180 )
    Le code donne :
    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
     
    function dms_lat(lat) {
      var NS = (lat>=0)?'N':'S'
      var d_lat = Math.trunc(lat); 
      var x_lat = (lat - d_lat) * 60; // minutes
      var m_lat = Math.trunc(x_lat);
      var y_lat = (x_lat - m_lat) * 60; // secondes
      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 +'"'; 
    }
     
    alert(dms_lat(9.000910));
    Testé et approuvé merci beaucoup pour ton aide

  18. #18
    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,
    Il y a un truc qui m'échappe la ... il sort d'ou ce 'Â' devant '°' ?
    J'ai rien touché au script aujourd'hui ...

    Nom : Capture d’écran 2017-03-19 à 20.46.00.png
Affichages : 2406
Taille : 227,5 Ko

  19. #19
    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
    Je me réponds tout seul

    Il suffit d'ajouter dans Par contre j'ai pas la moindre idée du pourquoi du comment ...

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

Discussions similaires

  1. [Toutes versions] Extraire des données en ciblant des ID, dans le code source d'une page web ?
    Par Dan.exe dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 19/10/2014, 05h32
  2. Réponses: 7
    Dernier message: 02/11/2010, 13h36
  3. comment charger le code source d'une page web avec dotnet ?
    Par gizgoz dans le forum Général Dotnet
    Réponses: 1
    Dernier message: 14/05/2007, 20h51
  4. Ouvrir le code source d'une page WEB
    Par jacques13 dans le forum Général VBA
    Réponses: 1
    Dernier message: 17/12/2006, 08h01
  5. Récupérer le code source d'une page web
    Par glRaZ dans le forum C++Builder
    Réponses: 4
    Dernier message: 08/12/2004, 09h16

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