Commit ab67bc41334a1839219f96f7bd417c5216fbf7c2

Authored by Edmar Moretti
1 parent cf279846

Validação com JSLint

Showing 1 changed file with 129 additions and 121 deletions   Show diff stats
classesjs/classe_barradebotoes.js
... ... @@ -192,73 +192,79 @@ i3GEO.barraDeBotoes = {
192 192 ativaIcone: function(icone){
193 193 i3GEO.barraDeBotoes.BOTAOCLICADO = icone;
194 194 var ko = i3GEO.barraDeBotoes.LISTABOTOES.length-1;
  195 + var estilo,temp,ist,cor;
195 196 if(i3GEO.barraDeBotoes.COMPORTAMENTO == "padrao"){
196   - if(ko >= 0){do{
197   - var temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
198   - if (i3GEO.barraDeBotoes.LISTABOTOES[ko].tipo=="dinamico" && temp)
199   - {
200   - var ist = temp.style;
201   - ist.borderWidth="1px";
202   - ist.borderColor='white';
203   - ist.borderLeftColor='rgb(50,50,50)';
204   - ist.borderBottomColor='rgb(50,50,50)';
  197 + if(ko >= 0){
  198 + do{
  199 + temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
  200 + if (i3GEO.barraDeBotoes.LISTABOTOES[ko].tipo=="dinamico" && temp){
  201 + ist = temp.style;
  202 + ist.borderWidth="1px";
  203 + ist.borderColor='white';
  204 + ist.borderLeftColor='rgb(50,50,50)';
  205 + ist.borderBottomColor='rgb(50,50,50)';
  206 + }
205 207 }
206   - }while(ko--)}
  208 + while(ko--);
  209 + }
207 210 //ativa o icone
208   - if($i(icone))
209   - {with ($i(icone).style){
210   - if(i3GEO.barraDeBotoes.SOICONES == false){
211   - borderColor='white';
212   - borderWidth="1px";
  211 + if($i(icone)){
  212 + estilo = $i(icone).style;
  213 + if(i3GEO.barraDeBotoes.SOICONES === false){
  214 + estilo.borderColor='white';
  215 + estilo.borderWidth="1px";
213 216 }
214   - }}
  217 + }
215 218 }
216 219 if(i3GEO.barraDeBotoes.COMPORTAMENTO == "destacado"){
217   - if(ko >= 0){do{
218   - var temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
219   - if (temp)
220   - {
221   - var ist = temp.style;
222   - ist.borderWidth="1px";
223   - ist.borderColor='white';
  220 + if(ko >= 0){
  221 + do{
  222 + temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
  223 + if (temp){
  224 + ist = temp.style;
  225 + ist.borderWidth="1px";
  226 + ist.borderColor='white';
  227 + }
224 228 }
225   - }while(ko--)}
  229 + while(ko--);
  230 + }
226 231 //ativa o icone
227   - if($i(icone))
228   - {with ($i(icone).style){
229   - if(i3GEO.barraDeBotoes.SOICONES == false){
230   - borderColor='black';
231   - borderWidth="1px";
  232 + if($i(icone)){
  233 + estilo = $i(icone).style;
  234 + if(i3GEO.barraDeBotoes.SOICONES === false){
  235 + estilo.borderColor='black';
  236 + estilo.borderWidth="1px";
232 237 }
233   - }}
  238 + }
234 239 }
235 240 if(i3GEO.barraDeBotoes.COMPORTAMENTO == "laranja" || i3GEO.barraDeBotoes.COMPORTAMENTO == "vermelho" || i3GEO.barraDeBotoes.COMPORTAMENTO == "cinza"){
236   - if(ko >= 0){do{
237   - var temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
238   - if (temp)
239   - {
240   - var ist = temp.style;
241   - if(i3GEO.barraDeBotoes.SOICONES == false){
242   - ist.borderWidth="1px";
243   - ist.borderColor='white';
244   - ist.backgroundColor='white';
  241 + if(ko >= 0){
  242 + do{
  243 + temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
  244 + if (temp){
  245 + ist = temp.style;
  246 + if(i3GEO.barraDeBotoes.SOICONES === false){
  247 + ist.borderWidth="1px";
  248 + ist.borderColor='white';
  249 + ist.backgroundColor='white';
  250 + }
  251 + else{ist.backgroundColor='';}
245 252 }
246   - else{ist.backgroundColor='';}
247   -
248 253 }
249   - }while(ko--)}
250   - if(i3GEO.barraDeBotoes.COMPORTAMENTO == "laranja"){var cor = "orange";}
251   - if(i3GEO.barraDeBotoes.COMPORTAMENTO == "vermelho"){var cor = "red";}
252   - if(i3GEO.barraDeBotoes.COMPORTAMENTO == "cinza"){var cor = "gray";}
  254 + while(ko--);
  255 + }
  256 + if(i3GEO.barraDeBotoes.COMPORTAMENTO == "laranja"){cor = "orange";}
  257 + if(i3GEO.barraDeBotoes.COMPORTAMENTO == "vermelho"){cor = "red";}
  258 + if(i3GEO.barraDeBotoes.COMPORTAMENTO == "cinza"){cor = "gray";}
253 259 //ativa o icone
254   - if($i(icone))
255   - {with ($i(icone).style){
256   - if(i3GEO.barraDeBotoes.SOICONES == false){
257   - borderColor='black';
258   - borderWidth="1px";
  260 + if($i(icone)){
  261 + estilo = $i(icone).style;
  262 + if(i3GEO.barraDeBotoes.SOICONES === false){
  263 + estilo.borderColor='black';
  264 + estilo.borderWidth="1px";
259 265 }
260 266 backgroundColor=cor;
261   - }}
  267 + }
262 268 }
263 269 },
264 270 /*
... ... @@ -275,8 +281,8 @@ i3GEO.barraDeBotoes = {
275 281 O nome do botao deve estar em LISTABOTOES na propriedade iddiv
276 282 */
277 283 ativaBotoes:function(padrao){
278   - if(arguments.length == 0)
279   - {var padrao = i3GEO.barraDeBotoes.BOTAOPADRAO;}
  284 + if(arguments.length === 0)
  285 + {padrao = i3GEO.barraDeBotoes.BOTAOPADRAO;}
280 286 i3GEO.barraDeBotoes.BOTAOCLICADO = padrao;
281 287 var l = i3GEO.barraDeBotoes.LISTABOTOES;
282 288 var b = l.length-1;
... ... @@ -334,12 +340,13 @@ i3GEO.barraDeBotoes = {
334 340 y {Numeric} - posição y (pixels) da barra em relação ao mapa
335 341 */
336 342 inicializaBarra:function(idconteudo,idconteudonovo,barraZoom,x,y){
  343 + var numerobotoes,i,temp,elementos,nelementos,e;
337 344 var wj = "36px";
338 345 var recuo = "0px";
339 346 var novoel = document.createElement("div");
340 347 novoel.id = idconteudonovo;
341 348 novoel.style.display="block";
342   - if(i3GEO.barraDeBotoes.SOICONES == false){
  349 + if(i3GEO.barraDeBotoes.SOICONES === false){
343 350 novoel.style.border="1px solid gray";
344 351 novoel.style.background="white";
345 352 }
... ... @@ -349,10 +356,10 @@ i3GEO.barraDeBotoes = {
349 356 }
350 357 else{
351 358 if (navm){novoel.style.filter='alpha(opacity=90)';}
352   - else{novoel.style.opacity= .85;}
  359 + else{novoel.style.opacity= 0.85;}
353 360 }
354   - var temp = "";
355   - if (barraZoom == true)
  361 + temp = "";
  362 + if (barraZoom === true)
356 363 {temp += i3GEO.navega.barraDeZoom.cria();}
357 364 temp += '<div id="'+idconteudonovo+'_" style="left:'+recuo+';top:-6px;" ></div>';
358 365 novoel.innerHTML = temp;
... ... @@ -364,7 +371,7 @@ i3GEO.barraDeBotoes = {
364 371 if (navm)
365 372 {novoel.style.filter='alpha(opacity=90)';}
366 373 else
367   - {novoel.style.opacity= .85;}
  374 + {novoel.style.opacity = 0.85;}
368 375 }
369 376 };
370 377 novoel.onmouseout = function(){
... ... @@ -385,25 +392,25 @@ i3GEO.barraDeBotoes = {
385 392 $i(idconteudo).innerHTML = "";
386 393 //faz o cálculo do número de botões que devem ficar visíveis em função do tamanho da barra
387 394 if(i3GEO.barraDeBotoes.AUTOALTURA){
388   - var elementos = $i(idconteudonovo+"_").getElementsByTagName("img");
  395 + elementos = $i(idconteudonovo+"_").getElementsByTagName("img");
389 396 if(elementos[0].id == "sobeferramentas"){
390 397 try{
391   - var elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
  398 + elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
392 399 var alturadisponivel = i3GEO.parametros.h - 4;
393   - var numerobotoes = parseInt(alturadisponivel / 30);
394   - var nelementos = elementos.length;
395   - var i = 0;
  400 + numerobotoes = parseInt(alturadisponivel / 30,10);
  401 + nelementos = elementos.length;
  402 + i = 0;
396 403 do{
397 404 elementos[i].style.display = "none";
398   - var i = i + 1;
  405 + i = i + 1;
399 406 }
400   - while(i < nelementos)
401   - var i = 0;
  407 + while(i < nelementos);
  408 + i = 0;
402 409 do{
403 410 elementos[i].style.display = "inline";
404   - var i = i + 1;
  411 + i = i + 1;
405 412 }
406   - while(i < numerobotoes)
  413 + while(i < numerobotoes);
407 414 }catch(e){}
408 415 //alert(i+" "+numerobotoes)
409 416 if(i <= numerobotoes){
... ... @@ -414,58 +421,60 @@ i3GEO.barraDeBotoes = {
414 421 }
415 422 }
416 423 YAHOO.namespace("janelaBotoes.xp");
417   - if(i3GEO.barraDeBotoes.AUTOALTURA == false || barraZoom == true )
418   - YAHOO.janelaBotoes.xp.panel = new YAHOO.widget.Panel(idconteudonovo, {width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );
  424 + if(i3GEO.barraDeBotoes.AUTOALTURA === false || barraZoom === true )
  425 + {YAHOO.janelaBotoes.xp.panel = new YAHOO.widget.Panel(idconteudonovo, {width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );}
419 426 else
420   - YAHOO.janelaBotoes.xp.panel = new YAHOO.widget.Panel(idconteudonovo, {height:i3GEO.parametros.h - 4,width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );
  427 + {YAHOO.janelaBotoes.xp.panel = new YAHOO.widget.Panel(idconteudonovo, {height:i3GEO.parametros.h - 4,width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );}
421 428  
422   - if(i3GEO.barraDeBotoes.SOICONES == true){
423   - var temp = $i("i3geo_barra2");
424   - if(temp){temp.style.borderWidth="0 0 0 0";}
425   - var temp = $i("i3geo_barra1");
426   - if(temp){temp.style.borderWidth="0 0 0 0";}
  429 + if(i3GEO.barraDeBotoes.SOICONES === true){
  430 + temp = $i("i3geo_barra2");
  431 + if(temp)
  432 + {temp.style.borderWidth="0 0 0 0";}
  433 + temp = $i("i3geo_barra1");
  434 + if(temp)
  435 + {temp.style.borderWidth="0 0 0 0";}
427 436 }
428   - if((barraZoom == true) && i3GEO.Interface.ATUAL == "padrao")
  437 + if((barraZoom === true) && i3GEO.Interface.ATUAL == "padrao")
429 438 {i3GEO.navega.barraDeZoom.ativa();}
430 439 YAHOO.janelaBotoes.xp.panel.render();
431   - if(i3GEO.barraDeBotoes.AUTOALTURA == true){
432   - var y = y - i3GEO.Interface.BARRABOTOESTOP + 2;
433   - var x = x - 3;
  440 + if(i3GEO.barraDeBotoes.AUTOALTURA === true){
  441 + y = y - i3GEO.Interface.BARRABOTOESTOP + 2;
  442 + x = x - 3;
434 443 }
435 444 YAHOO.janelaBotoes.xp.panel.moveTo(x,y);
436 445 if($i("sobeferramentas")){
437 446 $i("sobeferramentas").onclick = function(){
438   - var elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
439   - var nelementos = elementos.length;
440   - if(elementos[0].style.display == "inline" && elementos[0].id == "")
  447 + elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
  448 + nelementos = elementos.length;
  449 + if(elementos[0].style.display == "inline" && elementos[0].id === "")
441 450 {return;}
442   - if(elementos[1].style.display == "inline" && elementos[1].id == "")
  451 + if(elementos[1].style.display == "inline" && elementos[1].id === "")
443 452 {return;}
444 453 if(nelementos > 0){
445 454 var mostra = elementos[0];
446 455 var i = 0;
447 456 do{
448 457 if(elementos[i].style){
449   - if(elementos[i].style.display == "inline" && elementos[i].id == "")
  458 + if(elementos[i].style.display == "inline" && elementos[i].id === "")
450 459 {break;}
451   - if(elementos[i].style.display == "none" && elementos[i].id == "")
452   - {var mostra = elementos[i];}
  460 + if(elementos[i].style.display == "none" && elementos[i].id === "")
  461 + {mostra = elementos[i];}
453 462 }
454   - var i = i + 1;
  463 + i = i + 1;
455 464 }
456   - while(i < nelementos)
  465 + while(i < nelementos);
457 466 mostra.style.display="inline";
458 467 //esconde o último botao
459   - var i = nelementos - 1;
460   - var mostra = elementos[i];
  468 + i = nelementos - 1;
  469 + mostra = elementos[i];
461 470 do{
462 471 if(elementos[i].style){
463 472 if(elementos[i].style.display == "inline")
464   - {var mostra = elementos[i];break;}
  473 + {mostra = elementos[i];break;}
465 474 }
466   - var i = i - 1;
  475 + i = i - 1;
467 476 }
468   - while(i >= 0)
  477 + while(i >= 0);
469 478 mostra.style.display="none";
470 479 }
471 480 };
... ... @@ -474,38 +483,38 @@ i3GEO.barraDeBotoes = {
474 483 $i("desceferramentas").onclick = function(){
475 484 var tipo = "inline";
476 485 if($i(idconteudonovo+"_")){
477   - var elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
  486 + elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
478 487 if(elementos[elementos.length - 1].style.display == tipo)
479 488 {return;}
480   - var nelementos = elementos.length;
  489 + nelementos = elementos.length;
481 490 if(nelementos > 0){
482 491 //esconde o primeiro botao
483   - var i = 0;
  492 + i = 0;
484 493 do{
485   - var e = elementos[i];
  494 + e = elementos[i];
486 495 if(e.style){
487   - if((e.style.display == "block") || (e.style.display == "inline") || (e.style.display == "")){
488   - if(e.id == "")
  496 + if((e.style.display == "block") || (e.style.display == "inline") || (e.style.display === "")){
  497 + if(e.id === "")
489 498 {e.style.display="none";break;}
490 499 }
491 500 }
492   - var i = i + 1;
  501 + i = i + 1;
493 502 }
494   - while(i < nelementos)
  503 + while(i < nelementos);
495 504 //mostra o último botao
496   - var i = nelementos-1;
  505 + i = nelementos-1;
497 506 var mostra = elementos[i];
498 507 do{
499   - var e = elementos[i];
  508 + e = elementos[i];
500 509 if(e.style){
501 510 if(e.style.display == tipo)
502 511 {break;}
503 512 if(e.style.display == "none")
504   - {var mostra = e;}
  513 + {mostra = e;}
505 514 }
506   - var i = i - 1;
  515 + i = i - 1;
507 516 }
508   - while(i >= 0)
  517 + while(i >= 0);
509 518 mostra.style.display=tipo;
510 519 }
511 520 }
... ... @@ -520,7 +529,7 @@ i3GEO.barraDeBotoes = {
520 529 i3GEO.barraDeBotoes.ativaMenuContexto(idconteudonovo);
521 530 }
522 531 if($i(idconteudonovo+"_h"))
523   - $i(idconteudonovo+"_h").className = "hd2";
  532 + {$i(idconteudonovo+"_h").className = "hd2";}
524 533 },
525 534 /*
526 535 Function: ativaMenuContexto
... ... @@ -532,9 +541,8 @@ i3GEO.barraDeBotoes = {
532 541 idbarra - {string} id da barra de botões onde o evento será ativado
533 542 */
534 543 ativaMenuContexto: function(idbarra){
535   - function executar(a,b,c){
536   - eval(c)
537   - };
  544 + function executar(a,b,c)
  545 + {eval(c);}
538 546 var oFieldContextMenuItemData = [
539 547 { text: "&nbsp;<span class='container-close'></span>"},
540 548 { text: "Fechar barra", onclick: { fn: executar, obj: "i3GEO.barraDeBotoes.fecha('"+idbarra+"')" } },
... ... @@ -572,12 +580,11 @@ i3GEO.barraDeBotoes = {
572 580 */
573 581 reativa: function(indice){
574 582 if(arguments.length == 1)
575   - i3GEO.barraDeBotoes.BARRAS[indice].show();
  583 + {i3GEO.barraDeBotoes.BARRAS[indice].show();}
576 584 else{
577 585 var n = i3GEO.barraDeBotoes.BARRAS.length;
578   - for(i=0;i<n;i++){
579   - i3GEO.barraDeBotoes.BARRAS[i].show();
580   - }
  586 + for(i=0;i<n;i++)
  587 + {i3GEO.barraDeBotoes.BARRAS[i].show();}
581 588 }
582 589 },
583 590 /*
... ... @@ -604,16 +611,17 @@ i3GEO.barraDeBotoes = {
604 611 document.body.appendChild(novoel);
605 612 //verifica se tem o slide de zoom
606 613 var barraZoom = false;
607   - var temp = $i("vertMaisZoom");
  614 + temp = $i("vertMaisZoom");
608 615 if(temp){
609 616 if(navm)
610   - var temp = temp.parentNode;
  617 + {temp = temp.parentNode;}
611 618 else
612   - var temp = temp.parentNode.parentNode;
613   - if(temp.id == id){var barraZoom = true;}
  619 + {temp = temp.parentNode.parentNode;}
  620 + if(temp.id == id)
  621 + {barraZoom = true;}
614 622 }
615   - var x = parseInt($i(i3GEO.barraDeBotoes.BARRAS[i].id+"_c").style.left);
616   - var y = parseInt($i(i3GEO.Interface.IDCORPO).style.top)+10;//parseInt($i(i3GEO.barraDeBotoes.BARRAS[i].id+"_c").style.top);
  623 + var x = parseInt($i(i3GEO.barraDeBotoes.BARRAS[i].id+"_c").style.left,10);
  624 + var y = parseInt($i(i3GEO.Interface.IDCORPO).style.top,10)+10;//parseInt($i(i3GEO.barraDeBotoes.BARRAS[i].id+"_c").style.top);
617 625 i3GEO.barraDeBotoes.BARRAS[i].destroy();
618 626 i3GEO.barraDeBotoes.inicializaBarra(novoel.id,i3GEO.barraDeBotoes.BARRAS[i].id+"x",barraZoom,x,y);
619 627 }
... ...