1/* Base javascript functions 2 * --------------------------------------------------------------------------- 3 4 */ 5 6 7function gonow(url) 8 { 9 document.location=url; 10 } 11 12 13function modify_acc(it){ 14 document.formadmin.submit(); 15 } 16 17function modify(it){ 18 document.formadmin.elements['status_' + it].value=1; 19 //alert ('result is ' + document.formadmin.elements[itx].name) 20 } 21 22function modifydelfile(it){ 23 document.formadmin.elements['cbxdel_' + it].value=1; 24 } 25 26 27function sel(it){ 28 if (document.formadmin.elements['status_' + it].value==0){ 29 document.formadmin.elements['status_' + it].value=1; 30 } 31 else { 32 document.formadmin.elements['status_' + it].value=0; 33 } 34 } 35 36function creerf(url,larg,haut){ 37 var options = "toolbar=no,location=no,directories=no,status=no," 38 + "menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes," 39 + "width=" + larg + ",height=" + haut; 40 mafenetre= window.open(url,"DWU",options); 41 } 42 43/* Secure Authentication using MD5 hashing */ 44 45//history.go(1); // disable the browser's back button 46 47function md5auth(seed) { 48 var password = document.formauth.password.value; 49 var hash = MD5(seed+password); 50 document.formauth.password.value=''; 51 document.formauth.velo.value=hash; 52 //alert('source = ' +seed+password +',data sent = '+hash); 53 return true; 54 } 55// 06/11/2009 : on donne la possibilite de specifier l'id. Si il n'est pas specifie, on prend news pour compatibilite 56function showHide(IDObj,MaxItems,TimeOut,Item) 57{ 58 if (Item == undefined) Item="news"; 59 60 if (IDObj != 0){ 61 var IDObj_prec=IDObj-1; 62 monObjPrec = document.getElementById(Item + "_"+IDObj_prec+""); 63 } 64 else{ 65 var IDObj_prec=MaxItems-1; 66 monObjPrec = document.getElementById(Item + "_"+IDObj_prec+""); 67 } 68 69 if (document.getElementById(Item + "_"+IDObj+"")){ 70 monObj = document.getElementById(Item + "_"+IDObj+""); 71 monObj.style.display = "block"; 72 monObjPrec.style.display = "none"; 73 } 74 var nextit=IDObj+1; 75 if (IDObj == (MaxItems-1)) nextit=0; 76 self.setTimeout('showHide('+nextit+','+MaxItems+','+TimeOut+',\''+Item+'\')',TimeOut); 77} 78 79 80function addLoadListener(fn) 81{ 82 if (typeof window.addEventListener != 'undefined') 83 { 84 window.addEventListener('load', fn, false); 85 } 86 else if (typeof document.addEventListener != 'undefined') 87 { 88 document.addEventListener('load', fn, false); 89 } 90 else if (typeof window.attachEvent != 'undefined') 91 { 92 window.attachEvent('onload', fn); 93 } 94 else 95 { 96 var oldfn = window.onload; 97 if (typeof window.onload != 'function') 98 { 99 window.onload = fn; 100 } 101 else 102 { 103 window.onload = function() 104 { 105 oldfn(); 106 fn(); 107 }; 108 } 109 } 110} 111// fonction qui charge les images dans le cache 112function ant_preload_images(a,txt,mode){ 113 // imgObjects est une variable globale 114 var imgNames=a; 115 for (var i = 0; i < imgNames.length; i++) 116 { 117 imgObjects[i] = new Image(); 118 imgObjects[i].src = 'data/' + mode + imgNames[i]; 119 imgObjects[i].alt = txt[i]; 120 } 121 } 122 123function ant_next_img(IDObj,IDClass,MaxItems,Color,TimeOut,Index) 124{ 125 126 if (Mode == 'start') { // controle le demarrage et l'arret de l'animation 127 128 var nextit=IDObj+1; 129 if (IDObj == (MaxItems-1)) nextit=Index; 130 131 if (document.getElementById(IDClass + "Large")){ 132 monObj = document.getElementById(IDClass + "Large"); 133 monObj.src = imgObjects[nextit].src; 134 monObj.alt = imgObjects[nextit].alt; 135 monObj.title = imgObjects[nextit].alt; 136 if (document.getElementById(IDClass + "Text")){ 137 monObjTxt = document.getElementById(IDClass + "Text"); 138 monObjTxt.innerHTML = imgObjects[nextit].alt; 139 } 140 } 141 142 if (document.getElementById(IDClass + "Small" + IDObj)){ 143 // on remet tous à 0 144 for (a=Index;a<MaxItems;a++){ 145 monObjSmallPrec = document.getElementById(IDClass + "Small" + a);
146 monObjSmallPrec.style.border = "0px solid rgb(102,102,102)"; 147 monObjSmallPrec.style.margin = "5px"; 148 monObjSmallPrec.style.padding = "0px"; 149 } 150 monObjSmall = document.getElementById(IDClass + "Small" + nextit); 151 monObjSmall.style.border = "1px solid #" + Color; 152 monObjSmall.style.margin = "3px"; 153 monObjSmall.style.padding = "1px"; 154 } 155 156 self.setTimeout('ant_next_img('+nextit+',"'+IDClass+'",'+MaxItems+',"'+Color+'",'+TimeOut+','+Index+')',TimeOut); 157 } 158 159 else if (Mode == 'stop') { 160 var nextit=IDObj; 161 self.setTimeout('ant_next_img('+nextit+',"'+IDClass+'",'+MaxItems+',"'+Color+'",'+TimeOut+','+Index+')',TimeOut); 162 } 163 164} 165 166function submitenter(myfield,e) 167{ 168var keycode; 169if (window.event) keycode = window.event.keyCode; 170else if (e) keycode = e.which; 171else return true; 172 173if (keycode == 13) 174 { 175 myfield.form.submit(); 176 return false; 177 } 178else 179 return true; 180} 181 182 183// idem recherche avancée 184function submitenter2(myfield,e) 185{ 186var keycode; 187if (window.event) keycode = window.event.keyCode; 188else if (e) keycode = e.which; 189else return true; 190 191if (keycode == 13) 192 { 193 myfield.form.elements['ant_index'].value=0; 194 myfield.form.adminop.value='advanced_search'; 195 myfield.form.submit(); 196 return false; 197 } 198else 199 return true; 200} 201 202// 12/01/2008 : mise à jour champ texte (quantite dans transactions par ex) 203function submitenter_text(myfield,e,it) 204{ 205var keycode; 206if (window.event) keycode = window.event.keyCode; 207else if (e) keycode = e.which; 208else return true; 209 210if (keycode == 13) 211 { 212 myfield.form.adminop.value='save'; 213 // alert ('quant ' + myfield.value); 214 myfield.form.elements['status_' + it].value=1; 215 myfield.form.submit(); 216 return false; 217 } 218else 219 return true; 220} 221 222// Permet de vider le contenu d'une boite de sélection 223function antCleanSelectBox(selectid){ 224 for (x = document.getElementById(selectid).length; x >= 0; x = x - 1) { 225 document.getElementById(selectid)[x] = null; 226 } 227 } 228 229function getXYPosition(e){ 230 myMouseX=(e||event).clientX; 231 myMouseY=(e||event).clientY; 232 if (document.documentElement.scrollTop > 0) { 233 myMouseY = myMouseY + document.documentElement.scrollTop; 234 } 235 return myMouseX; 236 } 237 238 239// Permet de posisition le cursor a la fin d'un champ 240 241function ant_move_cursor(el){ 242 if (el.createTextRange) { 243 var v = el.value; 244 var r = el.createTextRange(); 245 r.moveStart('character', v.length); 246 r.select(); 247 } 248 } 249 250/* ------------- 19/10/2007 defilement de texte ------------- */ 251 252// Declaration des variables 253var brOK=false; 254var mie=false; 255var vitesse=50; 256var loop, timer; 257 258function Navigateur(){ 259 if (navigator.appName.indexOf("Netscape") > -1) {return "Netscape";} 260 if (navigator.appName.indexOf("Explorer") > -1) {return "Explorer";} 261 return "Unknown"; 262} 263 264function Version(){ 265 return parseFloat(navigator.appVersion) 266 } 267 268function checkbrOK(){ 269 var nav=Navigateur(); 270 var ver=Version(); 271 if(nav=="Explorer"){ 272 mie=true; 273 } 274 if (ver>=4){ 275 brOK=true; 276 } 277 } 278 279// Fonction de creation des objets 280function creerObj(obj,cont){ 281 if (mie) { 282 //this.el=document.all[obj]; 283 this.css=document.all[obj].style; 284 this.scrollHeight=document.all[obj].offsetHeight; 285 this.clipHeight=document.all[obj].offsetHeight; 286 } 287 else { 288 if (cont!='') { 289 cont='document.'+cont+'.'; 290 } 291 this.css=eval(cont+'document.'+obj); 292 this.scrollHeight=this.css.document.height; 293 this.clipHeight=this.css.clip.height; 294 } 295 296 this.haut=haut; 297 this.bas=bas; 298 this.deplace=deplace; 299 this.x=0; 300 this.y=0; 301 eval(this.obj+'=this'); 302 return this; 303 } 304function deplace(x,y){ 305 this.x=x; 306 this.y=y; 307 this.css.left=this.x 308 this.css.top=this.y 309 } 310function bas(v){ 311 if(this.y>Container.clipHeight-this.scrollHeight){ 312 this.deplace(0,this.y-v) 313 if(loop) setTimeout(this.obj+".bas("+v+")",vitesse) 314 } 315 } 316function haut(v){ 317 if(this.y<0){ 318 this.deplace(0,this.y-v) 319 if(loop) setTimeout(this.obj+".haut("+v+")",vitesse) 320 } 321 } 322 323// Fonction lancant le defilement 324function go(vitesse){ 325 loop=true; 326 if(vitesse>0) Texte.bas(vitesse); 327 else Texte.haut(vitesse); 328 } 329 330// Fonction stoppant le defilement 331function stop(){ 332 loop=false; 333 if(timer) clearTimeout(timer); 334 } 335 336// Initialisation 337function Init(){ 338 checkbrOK(); 339 Container=new creerObj('divContainer',''); 340 Texte=new creerObj('divTexte','divContainer'); 341 Texte.deplace(0,0); 342 } 343 344/* ------------- 19/10/2007 defilement de texte ------------- */ 345 346/* -------------- Optimisation curseurs suggest --------------*/ 347 348function key_arrow_down(myfield,e) 349{ 350var keycode; 351if (window.event) keycode = window.event.keyCode; 352else if (e) keycode = e.which; 353else return true; 354 355if (keycode == 40) 356 { 357 var tmpfield=document.getElementById('suggestions'); 358 //var list=tmpfield.getElementsByTagName('span'); 359 var list=tmpfield.childNodes; 360 var curhighlight=0; 361 var nexthighlight=0; 362 for (a=0;a<list.length;a++){ 363 if (list.item(a).className == 'highlight'){ 364 curhighlight=a; 365 nexthighlight=a+1; 366 } 367 } 368 // alert(list.length); 369 // alert(list.item(0).antkey); 370 if (curhighlight < (list.length-1)){ 371 list.item(curhighlight).className = ''; 372 list.item(nexthighlight).className = 'highlight'; 373 } 374 else if (curhighlight == 0) list.item(curhighlight).className = 'highlight'; 375 // alert(list.item(0).innerHTML); 376 return false; 377 } 378 379else if (keycode == 38) 380 { 381 var tmpfield=document.getElementById('suggestions'); 382 //var list=tmpfield.getElementsByTagName('span'); 383 var list=tmpfield.childNodes; 384 var curhighlight=0; 385 var previoushighlight=0; 386 for (a=0;a<list.length;a++){ 387 if (list.item(a).className == 'highlight'){ 388 curhighlight=a; 389 previoushighlight=a-1; 390 } 391 } 392 // alert(list.length); 393 // alert(list.item(0).antkey); 394 if (curhighlight > 0){ 395 list.item(curhighlight).className = ''; 396 list.item(previoushighlight).className = 'highlight'; 397 } 398 // alert(list.item(0).innerHTML); 399 return false; 400 } 401 402else if (keycode == 13) 403 { 404 var tmpfield=document.getElementById('suggestions'); 405 //var list=tmpfield.getElementsByTagName('span'); 406 var list=tmpfield.childNodes; 407 var curhighlight=0; 408 for (a=0;a<list.length;a++){ 409 if (list.item(a).className == 'highlight'){ 410 curhighlight=a; 411 } 412 } 413 //alert (list.item(curhighlight).antkey); 414 if (list.item(curhighlight).className == 'highlight'){ 415 extSelectEntry(list.item(curhighlight)); 416 } 417 418 // alert(list.item(0).innerHTML); 419 return false; 420 } 421else 422 return true; 423} 424 425function extSelectEntry (elem) { 426 document.getElementById('string').value = elem.innerHTML; 427 document.getElementById('datalink').value = elem.antkey; 428 429 ant_move_cursor(document.getElementById('string')); 430 //remoteSuggest.antGetSizes(elem.antkey,<?php echo $cle_langue;?>); 431 // 6/02/2008 : specific Kilobye on lance automatiquement ajout des items que dans le cas des prix 432 // updateOp('addallcustom'); 433 // idem que dans admin-object-header: il faut traiter l'affichage des réductions 434 updateOp('search'); 435 } 436 437// fonction pour écrire des textes verticalement 438function writeDown(text) { 439 for(i=0; i < text.length; i++) 440 document.write(text.charAt(i) + "<br>" ) 441} 442 443// fonction pour récupérer les positions d'éléments div, ou autre ... 444 445getOffsetPosition = function(inID, inTYPE) 446{ 447 var iVal = 0; 448 var oObj = document.getElementById(inID); 449 var sType = 'oObj.offset' + inTYPE; 450 while (oObj && oObj.tagName != 'BODY') { 451 iVal += eval(sType); 452 oObj = oObj.offsetParent; 453 } 454 return iVal; 455} 456 457 458// fonction pour le menus dynamique 459 460function antShowSubmenu(id,posleft){ 461 // on rend tous les menus invisibles et on montre celui qui est selectionne 462 var list=document.getElementsByTagName('div'); 463 for (a=0;a<list.length;a++){ 464 if (list[a].className == 'antdynsub'){ 465 list[a].style.visibility='hidden'; 466 } 467 } 468 var antlink=document.getElementById('antlink' + id); 469 470 var target=document.getElementById('anttarget' + id); 471 if (posleft) { 472 var curpos=getOffsetPosition('antlink' + id, 'Left'); 473 //alert (curpos); 474 posleft=posleft + curpos; 475 //alert (posleft); 476 target.style.left=posleft+'px'; 477 } 478 target.style.visibility='visible'; 479 } 480 481function antHideSubmenu(id){
482 // on rend invisible le menu selectionne 483 var target=document.getElementById('anttarget' + id); 484 //alert('test'+id); 485 target.style.visibility='hidden'; 486 } 487 488function antalysProcedure1(string){ 489 var tabl= string.split(';'); 490 var antelem1 = document.formauth.antelem1.value; 491 var antelem2 = document.formauth.antelem2.value; 492 var val1= Utf8.encode(antelem1) + Utf8.encode(antelem2); 493 var val2= Qqchose.bout(MD5(tabl[1]+val1,false)+tabl[0]); 494 document.formauth.antelem2.value=''; 495 document.formauth.lila.value=val2; 496 return true; 497 } 498
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.