1/* 2 * Bastien Veysseyre pour Nexxpix 3 * http://www.nexxpix.fr/ 4 * Version Beta 0.2 5 *//* 6 * Bastien Veysseyre pour Nexxpix 7 * http://www.nexxpix.fr/ 8 * Version Beta 0.2 9 */ 10var selectRef = function () { 11 var b, t, v; 12 return { 13 init: function (b, t, v) { 14 if (v === undefined) { 15 v = "_blank"; 16 } 17 var bul, bli, blilen, blistoption, blistvalue, bsel, bulbyid, ultosel, bopt, situ, blia, i; 18 bul = document.getElementById(b); 19 bli = bul.getElementsByTagName('li'); 20 blilen = bli.length; 21 bsel = document.createElement("select"); 22 bulbyid = document.getElementById(b); 23 ultosel = bulbyid.parentNode; 24 if (t != '') { 25 bopt = document.createElement("option"); 26 bsel.appendChild(bopt); 27 bopt.setAttribute("value", ""); 28 bopt.text = t; 29 } 30 for (i = 0; i < blilen; i++) { 31 situ = bli[i]; 32 blia = situ.getElementsByTagName('a'); 33 blistvalue = blia[0]; 34 blistoption = blistvalue.childNodes[0].nodeValue; 35 bopt[i] = document.createElement("option"); 36 bsel.appendChild(bopt[i]); 37 bopt[i].setAttribute("value", blistvalue.href); 38 bopt[i].text = blistoption; 39 } 40 bsel.setAttribute("onchange", "if(this.value != \'\'){window.open(this.value,\'" + v + "\')};"); 41 bsel.setAttribute("id", b); 42 ultosel.replaceChild(bsel, bulbyid); 43 } 44 } 45}(); 46$(document).ready(function () { 47 48 // Fermeture debug 49 $('#close_debug').click(function () { 50 $(".debug-div").slideUp(200); 51 }); 52 53 $("ul li:first-child, .texte p:first-child, .texte p:last-child").addClass("prem"); 54 $(" ul li:last-child, aside > div:last-child").addClass('dern'); 55 56 $('.simple_modal').click(function () { 57 var src = $(this).attr('href'); 58 var small = $(this).hasClass('small_modal'); 59 var normal = $(this).hasClass('normal_modal'); 60 var big = $(this).hasClass('big_modal'); 61 if (small) { 62 height = 105; 63 width = 630; 64 } 65 if (normal) { 66 height = 455; 67 width = 800; 68 } 69 if (big) { 70 height = 705; 71 width = 800; 72 } 73 $('object, embed').addClass('not_visible'); 74 $.modal('<iframe src="' + src + '" height="' + height + '" width="' + width + '" style="border:0; overflow:hidden;">', { 75 closeHTML: "", 76 containerCss: { 77 backgroundColor: "#fff", 78 borderColor: "#fff", 79 height: height + 5, 80 padding: 0, 81 width: width 82 }, 83 overlayClose: true, 84 onClose: function (dialog) { 85 $('object, embed').removeClass('not_visible'); 86 $.modal.close(); // must call this! 87 } 88 }); 89 return false; 90 }); 91 92 var duration_tooltip = 200; 93 $('.button_lock_pro').click(function () { 94 var tooltip_lock_pro = $(this).parents('li').find('.tooltip_lock_pro'); 95 if (tooltip_lock_pro.height() == 0) { 96 closeTooltipLockPro(duration_tooltip); 97 tooltip_lock_pro.animate( 98 {height: '150px'}, 99 { 100 queue: false, 101 duration: duration_tooltip, 102 specialEasing: {width: 'linear', height: 'easeOutBack'} 103 }); 104 } 105 else { 106 closeTooltipLockPro(duration_tooltip); 107 } 108 }); 109 110 $('.tooltip_lock_pro .quit').click(function () { 111 closeTooltipLockPro(duration_tooltip); 112 }); 113 114 $('[placeholder]').placeholder(); 115 // Accordéon 116 $("#accordion").accordion({ 117 heightStyle: "content", 118 collapsible: true 119 }); 120 // Tab 121 $("#tabs").tabs(); 122 $('.recapCont').removeClass('hidden'); 123 124 var typingTimer = null; //timer identifier 125 var doneTypingInterval = 300; //time in ms, 5 second for example 126 //on keyup, start the countdown 127 $('#searchIntoPage').keyup(function () { 128 clearTimeout(typingTimer); 129 if ($('#searchIntoPage').val) { 130 typingTimer = setTimeout(doneTyping, doneTypingInterval); 131 } 132 }); 133 $('#searchIntoPageReset').click(function () { 134 resetSearch(); 135 }); 136 137 $('#search_zone .inputText').keyup(function () { 138 var field = input = ''; 139 if ($(this).attr('id') == 'categorie_rech') { 140 field = 'categorie'; 141 input = 'resultats1'; 142 } 143 if ($(this).attr('id') == 'location_rech') { 144 field = 'location'; 145 input = 'resultats2'; 146 } 147 checkSearch($(this).val(), field, input); 148 }); 149 150 // auto toogle first number 151 $("#liste-coordonnees li:first .unbilled").click(); 152 153 $('.menu_qanda_head li').mouseover(function () { 154 var sub_menu = $(this).find('.sub_menu'); 155 if (sub_menu.length > 0) { 156 var container_pos = $('.contenu').offset().left + $('.contenu').width(); 157 var sub_menu_pos = sub_menu.offset().left + sub_menu.width() + 158 parseInt(sub_menu.css('padding-left')) + 159 parseInt(sub_menu.css('padding-right')); 160 var overflow = sub_menu_pos - container_pos;
161// console.log(sub_menu_pos+' - '+container_pos); 162 if (sub_menu_pos > container_pos) { 163 //console.info(overflow); 164 sub_menu.css({'margin-left': '-' + overflow + 'px'}); 165 } 166 } 167 }); 168 169 $('#print_entry').click(function () { 170 if (printWindow != null) printWindow.window.close(); 171 var printWindow = window.open('', 'Impression', config = 'height=960, width=720 toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no'); 172 if (printWindow != null) { 173 printWindow.document.open(); 174 var ficheV2 = $('#hautFiche').length > 0; 175 var infoPrinc = ''; 176 var infoPrincHtml = null; 177 var infoDetailHtml = null; 178 if (ficheV2) { 179 infoPrincHtml = $('.infoPrinc').clone(); 180 var infoBandeauHtml = $('.infoBandeau').clone(); 181 infoPrincHtml.find('.idl_audiotel, .hidden_num, a.audiotel_number').remove(); 182 infoPrincHtml.find('li').each(function () { 183 $(this).html($(this).find('a').html() + ' <br/><small>' + 184 $(this).find('a').attr('href') + '</small>'); 185 }); 186 infoBandeauHtml.find('#banner-content').remove(); 187 188 if (infoPrincHtml.html() !== null) { 189 infoPrinc += infoPrincHtml.html(); 190 } 191 if (infoBandeauHtml.html() !== null) { 192 infoPrinc += infoBandeauHtml.html(); 193 } 194 var infoDetailHtml = $('#ficheInner').clone(); 195 infoDetailHtml.find('#direction, nav, #infos-horaires, #HorairesLegende, #localisation').remove(); 196 infoDetailHtml.find('*').removeAttr('style'); 197 infoDetailHtml.find('.listeLieux li').each(function () { 198 $(this).html($(this).find('.title').html() + ' <br/><small>' + 199 $(this).find('.title').attr('href') + '</small>'); 200 }); 201 infoDetailHtml.find('.periode div:not(.ferme)').each(function () { 202 $(this).html($(this).find('.infoBulle').html()); 203 }); 204 infoDetailHtml.find('.periode div').css('marginLeft', '50px'); 205 } 206 else { 207 var infoPrincHtml = $('#ancre_contenu'); 208 var infoDetailHtml = $('span.cont').clone(); 209 infoDetailHtml.not('.adresse, .cp').remove(); 210 infoDetailHtml.find('.cp').html('<br/>' + infoDetailHtml.find('.cp a').html()); 211 } 212 var infoPrinc = infoPrincHtml !== null ? infoPrincHtml.html() : ''; 213 var infoDetail = infoDetailHtml !== null ? infoDetailHtml.html() : ''; 214 var titlePage = document.title; 215 var html = '<!DOCTYPE HTML>' + 216 '<html lang="fr">' + 217 '<head>' + 218 '<title>' + titlePage + '</title>' + 219 '<link rel="stylesheet" href="' + url_root() + 'themes/q_and_a/print.css">' + 220 '</head>' + 221 '<body>' + 222 '<div class="bloc pres">' + infoPrinc + '</div>' + 223 '<div id="article_content">' + infoDetail + '</div>' + 224 '</body>' + 225 '</html>'; 226 if (printWindow.document.body == null) { 227 printWindow.document.write(html); 228 } 229 else { 230 printWindow.focus(); 231 } 232 //printWindow.window.print(); 233 } 234 }); 235 if (typeof(magnificPopup) != undefined && typeof(magnificPopup) != 'undefined') { 236 $('.popup-with-zoom-anim').magnificPopup({ 237 type: 'iframe', 238 fixedContentPos: true, 239 fixedBgPos: false, 240 241 overflowY: 'auto', 242 preloader: true, 243 244 midClick: true, 245 removalDelay: 200, 246 mainClass: 'my-mfp-zoom-in', 247 closeOnBgClick: false, 248 closeMarkup: '<button class="mfp-close">Fermer X</button>' 249 }); 250 $('.iframe_rdv').attr('src', $('.iframe_rdv').attr('data')); 251 $('.rdv').click(function () { 252 var iframeToLoad = $(this).parent().find('.zoom-anim-dialog iframe'); 253 var url = iframeToLoad.attr('data'); 254 $('.mfp-content iframe').attr('src', url); 255 }); 256 } 257 258 /** 259 * Fonction de récupération du numéro audiotel 260 */ 261 function getAudiotelPhoneNumber(phoneNumberButton, typeOfCall) { 262 263 console.log('Data received: ', phoneNumberButton, typeOfCall); 264 265 var body = $('body'); 266 var gaActionType = 'action inconnue'; 267 var gaPageType = 'type de page inconnu'; 268 var entryId = phoneNumberButton.attr('data-entryid'); 269 var gaCategory = 'Audiotel'; 270 271 if (typeOfCall === 'click') { 272 gaActionType = 'clic'; 273 } else if (typeOfCall === 'display') { 274 gaActionType = 'affichage direct'; 275 } 276 277 if (body.hasClass('ficheV2')) { 278 gaPageType = 'fiche v2'; 279 } else if (body.attr('id') === 'fiche') { 280 gaPageType = 'fiche v1'; 281 } else if (body.attr('id') === 'liste-specialistes-ville') { 282 gaPageType = 'liste des specialistes dans une ville'; 283 } else if (body.attr('id') === 'liste-specialistes-departement') { 284 gaPageType = 'liste des specialistes dans un departement'; 285 } else if ($('h1').text() === 'Résultats de votre recherche') { 286 gaPageType = 'resultats de recherche'; 287 } 288 289 console.log(gaCategory, gaActionType, gaPageType); 290 291 if (typeof(_gaq) == 'undefined') { 292 ga('send', 'event', gaCategory, gaActionType, gaPageType); 293 } else {
294 _gaq.push(['_trackEvent', gaCategory, gaActionType, gaPageType]); 295 } 296 297 $.ajax({ 298 url: '/ajax/get_audiotel_phonenumber.php', 299 data: { 300 entryId: entryId 301 }, 302 cache: false, 303 type: 'GET', 304 contentType: "text/html;charset=windows-1252", 305 success: function(data){ 306 try { 307 var jsonReturn = JSON.parse(data); 308 } catch (e) { 309 phoneNumberButton.html('<span class="error">Numéro indisponible</span>').addClass('error'); 310 } 311 if (jsonReturn.hasOwnProperty('success') === true && jsonReturn.hasOwnProperty('message') === true) { 312 if (jsonReturn.success === true) { 313 if (jsonReturn.audiotel.match(/^08[0-9]{8}$/)) { 314 phoneNumberButton.parents('.telephone, .btns').html('<div class="audiotel_wrap"><div class="num">' + jsonReturn.audiotel.replace(/^(08)([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$/mg, "$1 $2 $3 $4 $5") + '*<div class="audiotel_price">Service 2.99 € / appel<br/>+ prix appel</div></div></div>'); 315 $('.audiotel_mentions').show(); 316 } else { 317 phoneNumberButton.html('<span class="audiotel-error">Numéro indisponible</span>').addClass('error'); 318 console.log('Unknown phone number format: ' + jsonReturn.audiotel); 319 } 320 } else { 321 if (jsonReturn.success === false) { 322 phoneNumberButton.html('<span class="audiotel-error">' + jsonReturn.realPhoneNumber + '</span>'); 323 console.log('The following error occured: ' + jsonReturn.message); 324 } else { 325 phoneNumberButton.html('<span class="audiotel-error">Numéro indisponible</span>').addClass('error'); 326 console.log('Error: Probably bad json format.'); 327 } 328 } 329 } else { 330 phoneNumberButton.html('<span class="audiotel-error">Numéro indisponible</span>').addClass('error'); 331 console.log('Error: "success" and "message" not found.'); 332 } 333 } 334 }); 335 } 336 337 /** 338 * Auto-affichage du numéro Audiotel au chargement de la page 339 */ 340 $('.audiotel-auto-display').each(function(){ 341 console.log('Auto-display'); 342 getAudiotelPhoneNumber($(this), 'display'); 343 }); 344 345 /** 346 * Fonction d'affichage du numéro audiotel + envoi des données à Google Analytics 347 */ 348 $('.audiotel-enabled').click(function() { 349 console.log('Click-display'); 350 getAudiotelPhoneNumber($(this), 'click'); 351 }); 352}); 353////////////////////// fin jquery 354 355 356function resetSearch() { 357 $('.pageSearchFound').each(function () { 358 $(this).replaceWith($(this).text()); 359 }); 360 $('#searchIntoPage').val(''); 361 $('#pageSearchLoader').hide(); 362 $('#pageSearchCountResults').hide(); 363 $('#liste-coordonnees li').show(); 364 $('#pageSearchCountResults').text(''); 365 $('#pageSearchCountResults').hide(); 366 $('#liste-coordonnees li').removeClass('showInSearchList'); 367} 368function closeTooltipLockPro(duration_tooltip) { 369 $('.tooltip_lock_pro').animate( 370 {height: '0px'}, 371 { 372 queue: false, duration: duration_tooltip, 373 specialEasing: {width: 'linear', height: 'easeInBack'} 374 }); 375} 376 377//user is "finished typing," do something 378function doneTyping() { 379 var count = 0; 380 // TODO Gérer les recherches avec/sans accents 381 if ($('#searchIntoPage').val() != '') { 382 $('#pageSearchCountResults').text(''); 383 $('#pageSearchCountResults').hide(); 384 $('#liste-coordonnees li').hide(); 385 $('#liste-coordonnees li').removeClass('showInSearchList'); 386 $('#pageSearchLoader').show(); 387 $('#liste-coordonnees li .haut h2 a strong, .adresse, .cp').each(function () { 388 389 var re = new RegExp($('#searchIntoPage').val(), "gi"); 390 var myArray = $(this).text().toString().match(re); 391 if (myArray != null) { 392 for (var i = 0; i < myArray.length; i++) { 393 $(this).html($(this).text().replace(myArray[i], '<span class="pageSearchFound">' + myArray[i] + '</span>')); 394 } 395 $(this).parents('li').addClass('showInSearchList'); 396 count++; 397 } 398 399 }); 400 $('#pageSearchLoader').hide(); 401 if (count > 1) { 402 $('#pageSearchCountResults').html('<span>' + count + ' résultats</span> ont été trouvés pour votre recherche.'); 403 } else { 404 if (count == 1) { 405 $('#pageSearchCountResults').html('<span>1 résultat</span> a été trouvé pour votre recherche.'); 406 } else { 407 $('#pageSearchCountResults').html('<span>Aucun résultat</span> n\'a été trouvé pour votre recherche.'); 408 } 409 } 410 $('#pageSearchCountResults').show(); 411 $('#liste-coordonnees .showInSearchList').show(); 412 } else { 413 resetSearch(); 414 } 415 416} 417function url_root() { 418 var l = window.location; 419 return l.protocol + "//" + l.host + "/"; 420} 421function nl2br(str, is_xhtml) { 422 var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; 423 return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'); 424}
425function removeAccents(strAccents) { 426 strAccents = strAccents.split(''); 427 strAccentsOut = new Array(); 428 strAccentsLen = strAccents.length; 429 var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñÿý'; 430 var accentsOut = ['A', 'A', 'A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a', 'a', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'o', 'o', 'o', 'o', 'o', 'o', 'E', 'E', 'E', 'E', 'e', 'e', 'e', 'e', 'e', 'C', 'c', 'D', 'I', 'I', 'I', 'I', 'i', 'i', 'i', 'i', 'U', 'U', 'U', 'U', 'u', 'u', 'u', 'u', 'N', 'n', 'y', 'y']; 431 for (var y = 0; y < strAccentsLen; y++) { 432 if (accents.indexOf(strAccents[y]) != -1) { 433 strAccentsOut[y] = accentsOut[accents.indexOf(strAccents[y])]; 434 } 435 else 436 strAccentsOut[y] = strAccents[y]; 437 } 438 strAccentsOut = strAccentsOut.join(''); 439 return strAccentsOut; 440} 441function whereismouse(obj) { 442 if (obj.id != "categorie_rech" && obj.id != "resultats1" && obj.id != "resultlist1" && obj.id != "categorie_rech" && obj.id != "resultats2" && obj.id != "resultlist2") { 443 document.getElementById('resultats1').innerHTML = ""; 444 document.getElementById('resultats1').style.display = "none"; 445 document.getElementById('resultats2').innerHTML = ""; 446 document.getElementById('resultats2').style.display = "none"; 447 } 448} 449 450function checkSearch(mot, champ, champs_result) { 451 if (mot.length > 1) { 452 var xhr; 453 try { 454 xhr = new ActiveXObject('Msxml2.XMLHTTP'); 455 } 456 catch (e) { 457 try { 458 xhr = new ActiveXObject('Microsoft.XMLHTTP'); 459 } 460 catch (e2) { 461 try { 462 xhr = new XMLHttpRequest(); 463 } 464 catch (e3) { 465 xhr = false; 466 } 467 } 468 } 469 470 xhr.onreadystatechange = function () { 471 if (xhr.readyState == 4) { 472 if (xhr.status == 200) { 473 if (xhr.responseText != '') { 474 document.getElementById(champs_result).style.display = "block"; 475 } 476 else { 477 document.getElementById(champs_result).style.display = "none"; 478 } 479 document.getElementById(champs_result).innerHTML = xhr.responseText; 480 } 481 else { 482 document.resultats = "Error code " + xhr.status; 483 } 484 } 485 }; 486 487 xhr.open("GET", url_root() + "recherche.php?type=" + champ + "&quoi=" + mot, true); 488 xhr.send(null); 489 } 490 else { 491 document.getElementById(champs_result).innerHTML = ""; 492 document.getElementById(champs_result).style.display = "none"; 493 } 494} 495 496function gotoresult(result, champ) { 497 //document.location.href="./result.php?ville="+result; 498 document.getElementById(champ).value = result; 499} 500 501function getVilles() { 502 $.ajax({ 503 contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15", 504 type: 'post', 505 url: './ajax/ajax.recup_villes.php', 506 data: 'cp=' + $('#departement').val(), 507 success: function (retour) { 508 if (retour != 'error') { 509 $('#ville').replaceWith(retour); 510 } 511 } 512 }); 513} 514 515function autoCompOff(id) { 516 if ($('#' + id).length > 0) { 517 document.getElementById(id).setAttribute("autocomplete", "off"); 518 } 519} 520 521function addEvent(obj, event, fct) { 522 if (obj.attachEvent) //Est-ce IE ? 523 obj.attachEvent("on" + event, fct); //Ne pas oublier le "on" 524 else 525 obj.addEventListener(event, fct, true); 526} 527function al4() { 528 autoCompOff("categorie_rech"); 529 autoCompOff("location_rech"); 530} 531addEvent(window, "load", al4); 532 533function setCookie(c_name, value, exdays, domain) { 534 var exdate = new Date(); 535 exdate.setDate(exdate.getDate() + exdays); 536 var c_value = escape(value) + ";expires=" + exdate.toGMTString(); 537 var new_cookie = c_name + "=" + c_value + ";domain=." + domain + ";path=/"; 538 document.cookie = new_cookie; 539} 540function trim(str, charlist) { 541 // http://kevin.vanzonneveld.net 542 var whitespace, l = 0, 543 i = 0; 544 str += ''; 545 546 if (!charlist) { 547 // default list 548 whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000"; 549 } else { 550 // preg_quote custom list 551 charlist += ''; 552 whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1'); 553 } 554 555 l = str.length; 556 for (i = 0; i < l; i++) { 557 if (whitespace.indexOf(str.charAt(i)) === -1) { 558 str = str.substring(i); 559 break; 560 } 561 } 562 563 l = str.length; 564 for (i = l - 1; i >= 0; i--) { 565 if (whitespace.indexOf(str.charAt(i)) === -1) { 566 str = str.substring(0, i + 1); 567 break; 568 } 569 } 570 571 return whitespace.indexOf(str.charAt(0)) === -1 ? str : ''; 572} 573 574function show_hidden_def() { 575 var def = document.getElementById("definition_text"); 576 var dots = document.getElementById("show_hidden_definition_text"); 577 def.style.height = "auto"; 578 dots.style.display = "none"; 579}
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.