1/// <reference path="src/jquery-1.6.2-vsdoc.js" /> 2/// <reference path="constants.js" /> 3/// <reference path="bootstrapper.js" /> 4(function (window, jQuery, undefined) { 5 "use strict"; 6 var document = window.document; 7 var navigator = window.navigator; 8 window.Tchatche = { 9 DebugLevel: Constants.LogLevel.Warning | Constants.LogLevel.Error, 10 SearchParams: { 11 s_pageIndex: 1, 12 s_selectedRegion: -1, 13 s_pseudo: '', 14 s_gender: -1, 15 s_ageRange: -1, 16 s_country: -1, 17 s_region: -1, 18 s_city: '', 19 s_photo: -1, 20 s_blog: -1, 21 s_albumPhoto: -1, 22 s_albumVideo: -1 23 }, 24 SearchEngineParams: { 25 s_pageIndex: 1, 26 s_searchingText: '', 27 s_searchType: 0, 28 s_decaFirstPage: 1, 29 s_selectedRegion: -1, 30 s_pseudo: '', 31 s_gender: -1, 32 s_ageRange: -1, 33 s_country: -1, 34 s_region: -1, 35 s_city: '', 36 s_photo: -1, 37 s_blog: -1, 38 s_albumPhoto: -1, 39 s_albumVideo: -1 40 }, 41 SearchUsersParams: { 42 s_searchingUsers: '', 43 s_selectedUsers: '', 44 s_body: '', 45 s_urlParams: '', 46 s_title: '', 47 s_rurl: '', 48 s_buddies: true 49 }, 50 ResetEngineParam: function () { 51 try { 52 jQuery("#s_pseudo").val(""); 53 jQuery("#s_gender").val(-1); 54 jQuery("#s_ageRange").val(-1); 55 jQuery("#s_country").val(-1); 56 if (Tchatche.SearchEngineParams.s_country != undefined) { Tchatche.FillLocalizationList(Tchatche.SearchEngineParams.s_country, Tchatche.SearchEngineParams.s_region); } 57 jQuery("#s_city").val(""); 58 jQuery("#s_photo").get(0).checked = false; 59 jQuery("#s_blog").get(0).checked = false; 60 jQuery("#s_albumPhoto").get(0).checked = false; 61 jQuery("#s_albumVideo").get(0).checked = false; 62 } 63 catch (e) 64 { } 65 }, 66 ResetSearchUsersParams: function () { 67 Tchatche.s_pageIndex = 1; 68 Tchatche.s_searchingUsers = ""; 69 Tchatche.s_selectedUsers = ""; 70 Tchatche.s_body = ""; 71 Tchatche.s_urlParams = ""; 72 Tchatche.s_title = ""; 73 Tchatche.s_rurl = ""; 74 Tchatche.s_buddies = ""; 75 }, 76 SetSearchParameters: function () { 77 jQuery("#s_pseudo").val(Tchatche.SearchParams.s_pseudo); 78 jQuery("#s_gender").val(Tchatche.SearchParams.s_gender); 79 jQuery("#s_ageRange").val(Tchatche.SearchParams.s_ageRange); 80 jQuery("#s_country").val(Tchatche.SearchParams.s_country); 81 if (Tchatche.SearchParams.s_country != undefined) { Tchatche.FillLocalizationList(Tchatche.SearchParams.s_country, Tchatche.SearchParams.s_region); } 82 jQuery("#s_city").val(Tchatche.SearchParams.s_city); 83 jQuery("#s_photo").get(0).checked = Tchatche.SearchParams.s_photo == '1'; 84 jQuery("#s_blog").get(0).checked = Tchatche.SearchParams.s_blog == '1'; 85 jQuery("#s_albumPhoto").get(0).checked = Tchatche.SearchParams.s_albumPhoto == '1'; 86 jQuery("#s_albumVideo").get(0).checked = Tchatche.SearchParams.s_albumVideo == '1'; 87 }, 88 89 SetSearchEngineParameters: function () { 90 jQuery("#s_searchingText").val(Tchatche.SearchEngineParams.s_searchingText); 91 try { 92 jQuery("#s_pseudo").val(Tchatche.SearchEngineParams.s_pseudo); 93 jQuery("#s_gender").val(Tchatche.SearchEngineParams.s_gender); 94 jQuery("#s_ageRange").val(Tchatche.SearchEngineParams.s_ageRange); 95 jQuery("#s_country").val(Tchatche.SearchEngineParams.s_country); 96 if (Tchatche.SearchEngineParams.s_country != undefined) { Tchatche.FillLocalizationList(Tchatche.SearchEngineParams.s_country, Tchatche.SearchEngineParams.s_region); } 97 jQuery("#s_city").val(Tchatche.SearchEngineParams.s_city); 98 jQuery("#s_photo").get(0).checked = Tchatche.SearchEngineParams.s_photo == '1'; 99 jQuery("#s_blog").get(0).checked = Tchatche.SearchEngineParams.s_blog == '1'; 100 jQuery("#s_albumPhoto").get(0).checked = Tchatche.SearchEngineParams.s_albumPhoto == '1'; 101 jQuery("#s_albumVideo").get(0).checked = Tchatche.SearchEngineParams.s_albumVideo == '1'; 102 } catch (e) { 103 //window.Tchatche.WriteLog(Constants.LogLevel.Warning, "SetSearchEngineParameters", "Error on try/catch", e, null); 104 } 105 }, 106 SetSearchUsersParams: function () { 107 jQuery("#s_searchingUsers").val(Tchatche.SearchUsersParams.s_searchingUsers); 108 var requestString = jQuery("#popup_dialog_content", window.parent.document).attr("src"); 109 Tchatche.SearchUsersParams.s_body = Tchatche.GetParamValue("s_body"); 110 Tchatche.SearchUsersParams.s_buddies = Tchatche.GetParamValue("s_buddies"); 111 Tchatche.SearchUsersParams.s_rurl = Tchatche.GetParamValue("s_rurl"); 112 Tchatche.SearchUsersParams.s_searchingUsers = Tchatche.GetParamValue("s_searchingUsers"); 113 Tchatche.SearchUsersParams.s_selectedUsers = Tchatche.GetParamValue("s_selectedUsers"); 114 Tchatche.SearchUsersParams.s_title = Tchatche.GetParamValue("s_title");
115 Tchatche.SearchUsersParams.s_urlParams = Tchatche.GetParamValue("s_urlParams"); 116 }, 117 SetSearchDefaultVal: function (searchType) { 118 Tchatche.SearchEngineParams.s_searchType = searchType; 119 }, 120 GetSearchParameters: function (asUrl) { 121 var options = Tchatche.SearchParams; 122 if (options.s_topOf == undefined) { 123 try { 124 options.s_pseudo = jQuery("#s_pseudo").val(); 125 options.s_gender = jQuery("#s_gender").val(); 126 options.s_ageRange = jQuery("#s_ageRange").val(); 127 options.s_country = jQuery("#s_country").val(); 128 options.s_region = jQuery("#s_region").val(); 129 options.s_city = jQuery("#s_city").val(); 130 options.s_photo = jQuery("#s_photo").get(0).checked ? "1" : "-1"; 131 options.s_blog = jQuery("#s_blog").get(0).checked ? "1" : "-1"; 132 options.s_albumPhoto = jQuery("#s_albumPhoto").get(0).checked ? "1" : "-1"; 133 options.s_albumVideo = jQuery("#s_albumVideo").get(0).checked ? "1" : "-1"; 134 } catch (e) { 135 //window.Tchatche.WriteLog(Constants.LogLevel.Warning, "GetSearchParameters", "Error on try/catch", e, null); 136 } 137 } 138 if (asUrl) { 139 var asString = ""; 140 jQuery.each(options, function (name, value) { 141 asString += name + "=" + value + "&"; 142 }); 143 options = asString; 144 } 145 return options; 146 }, 147 GetSearchEngineParameters: function (asUrl) { 148 var optionsEngine = Tchatche.SearchEngineParams; 149 try { 150 151 if (document.getElementById("s_searchingText") == null) { 152 Tchatche.SearchEngineParams.s_searchingText = ""; 153 } else { 154 optionsEngine.s_searchingText = jQuery("#s_searchingText").val(); 155 } 156 optionsEngine.s_pseudo = jQuery("#s_pseudo").val(); 157 optionsEngine.s_gender = jQuery("#s_gender").val(); 158 optionsEngine.s_ageRange = jQuery("#s_ageRange").val(); 159 optionsEngine.s_country = jQuery("#s_country").val(); 160 optionsEngine.s_region = jQuery("#s_region").val() != undefined ? jQuery("#s_region").val() : ""; 161 optionsEngine.s_city = jQuery("#s_city").val() != undefined ? jQuery("#s_city").val() : ""; 162 optionsEngine.s_photo = jQuery("#s_photo").get(0).checked ? "1" : "-1"; 163 optionsEngine.s_blog = jQuery("#s_blog").get(0).checked ? "1" : "-1"; 164 optionsEngine.s_albumPhoto = jQuery("#s_albumPhoto").get(0).checked ? "1" : "-1"; 165 optionsEngine.s_albumVideo = jQuery("#s_albumVideo").get(0).checked ? "1" : "-1"; 166 } catch (e) { 167 //window.Tchatche.WriteLog(Constants.LogLevel.Warning, "GetSearchEngineParameters", "Error on try/catch", e, null); 168 } 169 if (asUrl) { 170 var asString = ""; 171 jQuery.each(optionsEngine, function (name, value) { 172 asString += name + "=" + value + "&"; 173 }); 174 optionsEngine = asString; 175 } 176 return optionsEngine; 177 }, 178 Encode: function (s) { 179 return s.toString().replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); 180 }, 181 SelectCheckBoxes: function (items, check) { 182 items.each(function () { 183 this.checked = (check == undefined) ? !this.checked : check; 184 }); 185 }, 186 GetParamValue: function (param) { 187 var u; 188 if (window.location.href != null) { 189 u = document.location.href; 190 } 191 else { 192 u = window.parent.location.href; 193 } 194 var reg = new RegExp('(\\?|&|^)' + param + '=(.*?)(&|$)'); 195 var matches = u.match(reg); 196 return ((matches != null) && (matches[2] != undefined)) ? decodeURIComponent(matches[2]).replace(/\+/g, ' ') : ''; 197 }, 198 CreateFrame: function (id, src, data, width, height) { 199 var ifrm = document.createElement("iframe"); 200 ifrm.setAttribute("name", id); 201 ifrm.setAttribute("id", id); 202 ifrm.setAttribute("src", src + data); 203 ifrm.style.width.value = width + "px"; 204 ifrm.style.height.value = height + "px"; 205 return ifrm; 206 }, 207 HidePopup: function () { 208 jQuery("#dialog-modal").dialog("destroy"); 209 }, 210 DisplayPopup: function (height, width, onCloseMethode) { 211 212 var onCloseCallback = onCloseMethode || function () { }; 213 214 jQuery("#dialog-modal").dialog({ modal: true, height: height, width: width, resizable: false, close: onCloseCallback }); 215 }, 216 ExecuteMethode: function (e, searchMethod) { 217 if (e.keyCode === 13) { 218 e.cancelBubble = true; 219 e.returnValue = false; 220 if (searchMethod != "") { 221 eval(searchMethod); 222 } 223 return false; 224 } 225 }, 226 UnPropagateEvent: function (e) { 227 e.stopPropagation ? e.stopPropagation() : window.event.cancelBubble = true; 228 }, 229 Enable: function (ele, readOnly) { 230 jQuery(ele).attr("readonly", readOnly); 231 },
232 SendRequest: function (url, data, callBack) { 233 jQuery.ajax({ 234 type: "POST", 235 url: url, 236 data: data, 237 cache: false, 238 contentType: "application/json; charset=utf-8", 239 dataType: "json", 240 success: function (res, textStatus) { 241 callBack(res); 242 } 243 }); 244 }, 245 DisplayLoadingPanel: function (message) { 246 $("#loading-panel span").css("top", jQuery(parent).scrollTop() + 260); 247 if (message) { 248 $("#loading-panel p").text(message); 249 } 250 jQuery("#loading-panel").show(); 251 }, 252 HideLoadingPanel: function () { 253 jQuery("#loading-panel").hide(); 254 }, 255 Random: function (nb) { 256 return Math.floor(Math.random() * nb) + 1; 257 }, 258 DisplayUserPicture: function (imgSrc) { 259 jQuery('#picture-panel').show().find("img").attr({ src: imgSrc }); 260 }, 261 SelectingUser: function (ele) { 262 var val = jQuery(ele).attr("userid"); 263 var index = jQuery.inArray(val, window.userTab); 264 265 if (index > -1) { 266 window.userTab.splice(index, 1); 267 } else { 268 window.userTab.push(val); 269 } 270 jQuery(ele).toggleClass("ui-selected"); 271 272 Tchatche.SearchUsersParams.s_selectedUsers = ""; 273 for (var i = 0; i < window.userTab.length; i++) { 274 if (Tchatche.SearchUsersParams.s_selectedUsers == "") { 275 Tchatche.SearchUsersParams.s_selectedUsers = window.userTab[i].toString(); 276 } else { 277 Tchatche.SearchUsersParams.s_selectedUsers = Tchatche.SearchUsersParams.s_selectedUsers + "|" + window.userTab[i].toString(); 278 } 279 } 280 }, 281 ChangeTab: function (tab, ele) { 282 Tchatche.DisplayLoadingPanel(); 283 jQuery("#profil-accueil-bloc-haut-contenu").load("/elements/profil-toplist.aspx", { s_photo: 1, s_topOf: tab, s_shuffle: 50 }, Tchatche.HideLoadingPanel); 284 jQuery("#profil-accueil-bloc-haut-footer a").attr("href", "/profil-results.aspx?s_photo=1&s_topOf=" + tab); 285 jQuery("#tablist li").removeClass("highlight").find("a").removeClass("highlight"); 286 jQuery(ele).addClass("highlight").find("a").addClass("highlight"); 287 }, 288 LoadList: function (loadingDivId, ele, loadedPage, url) { 289 jQuery("#" + loadingDivId + "List").load(loadedPage, null, Tchatche.HideLoadingPanel); 290 jQuery("ul[id=" + loadingDivId + "-ul] li").removeClass("dashboardTitle-selected"); 291 if (url != undefined) { 292 jQuery("#" + loadingDivId + "-ul-url").attr("href", url); 293 } 294 jQuery(ele).addClass("dashboardTitle-selected"); 295 }, 296 ChangeActivityTab: function (tab, ele) { 297 jQuery("#dashboard-activity").load("/elements/profil-activity.aspx", { s_topOf: tab }, Tchatche.HideLoadingPanel); 298 if (tab == "MyActivity") { 299 jQuery("#tabactivitygauche").removeClass("gaucheOn"); 300 jQuery("#tabactivitygauche").addClass("gaucheOff"); 301 jQuery("#tabactivitydroite").removeClass("droiteOff"); 302 jQuery("#tabactivitydroite").addClass("droiteOn"); 303 jQuery("#my-activity-footer").show(); 304 jQuery("#buddies-activity-footer").hide(); 305 } else if (tab == "BuddiesActivity") { 306 jQuery("#tabactivitygauche").removeClass("gaucheOff"); 307 jQuery("#tabactivitygauche").addClass("gaucheOn"); 308 jQuery("#tabactivitydroite").removeClass("droiteOn"); 309 jQuery("#tabactivitydroite").addClass("droiteOff"); 310 jQuery("#my-activity-footer").hide(); 311 jQuery("#buddies-activity-footer").show(); 312 } 313 }, 314 NextActivityStreams: function (userId, top, pageIndex, buddy) { 315 Tchatche.DisplayLoadingPanel(); 316 jQuery("#activistystreams-suite-container").append('<div id="msg-detail-activistystreams-' + pageIndex + '"> </div>'); 317 var data = "userId=" + userId + "&top=" + top + "&pageIndex=" + pageIndex + "&buddy=" + buddy; 318 jQuery(".moreActivities").hide(); 319 jQuery("#msg-detail-activistystreams-" + pageIndex).load("/elements/activityStreams.aspx", data, Tchatche.HideLoadingPanel); 320 jQuery("#moreActivities-" + pageIndex).show(); 321 }, 322 Search: function (pageIndex, url) { 323 Tchatche.DisplayLoadingPanel(); 324 Tchatche.SearchParams.s_pageIndex = pageIndex || 1; 325 if (url != undefined) { 326 document.location.href = url + "?" + Tchatche.GetSearchParameters(true); 327 return; 328 } 329 jQuery("#profil-recherche-bloc-centre-fd").load("/elements/profil-results.aspx", Tchatche.GetSearchParameters(), Tchatche.HideLoadingPanel); 330 }, 331 SearchEngine: function (pageIndex, url, searchType, byPassReset) { 332 if (((Tchatche.SearchEngineParams.s_searchType == 3) && (!byPassReset)) || (Tchatche.SearchEngineParams.s_searchType != 3)) { 333 Tchatche.ResetEngineParam(); 334 } 335 if (document.getElementById("s_searchingText") == null) { 336 Tchatche.SearchEngineParams.s_searchingText = ""; 337 document.location.href = url + "?" + Tchatche.GetSearchEngineParameters(true); 338 return; 339 } else { 340 var inputText = jQuery("#s_searchingText").val(); 341 var pseudo = jQuery("#s_pseudo").val(); 342 if (Tchatche.SearchEngineParams.s_searchType != 3) { 343 if ((inputText.length <= 2) && (inputText != "")) { 344 jQuery("#search-profil-error").html("3 caractères minimum!!"); 345 jQuery("#search-profil-error").slideDown(); 346 return; 347 } 348 } else { 349 if (typeof pseudo != 'undefined') { 350 if ((pseudo.length <= 2) && (pseudo != "") && (inputText != "")) { 351 jQuery("#search-profil-error").html("le pseudo doit contenir au moins 3 caractères!!"); 352 jQuery("#search-profil-error").slideDown(); 353 return; 354 } 355 } 356 } 357 } 358 Tchatche.SearchEngineParams.s_pageIndex = pageIndex; 359 var evalDecaPage = parseInt(Tchatche.SearchEngineParams.s_decaFirstPage); 360 if ((pageIndex == 1) || (evalDecaPage == undefined)) { 361 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex; 362 } else if (pageIndex == evalDecaPage + 9) { 363 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex; 364 } else if (pageIndex == evalDecaPage) { 365 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex - 9; 366 } else if (pageIndex == evalDecaPage - 1) { 367 Tchatche.SearchEngineParams.s_decaFirstPage = evalDecaPage - 9; 368 } else if (pageIndex == evalDecaPage + 1) { 369 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex - 1; ; 370 } 371 Tchatche.DisplayLoadingPanel(); 372 if (url != undefined) { 373 document.location.href = url + "?" + Tchatche.GetSearchEngineParameters(true); 374 return; 375 } 376 }, 377 AdminSearchEngine: function (pageIndex, url, searchType, byPassReset) { 378 if (document.getElementById("s_searchingText") == null) { 379 Tchatche.SearchEngineParams.s_searchingText = ""; 380 } else { 381 var inputText = jQuery("#s_searchingText").val(); 382 //var pseudo = jQuery("#s_pseudo").val(); 383 } 384 Tchatche.SearchEngineParams.s_pageIndex = pageIndex; 385 var evalDecaPage = parseInt(Tchatche.SearchEngineParams.s_decaFirstPage); 386 if ((pageIndex == 1) || (evalDecaPage == undefined)) { 387 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex; 388 } else if (pageIndex == evalDecaPage + 9) { 389 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex; 390 } else if (pageIndex == evalDecaPage) { 391 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex - 9; 392 } else if (pageIndex == evalDecaPage - 1) { 393 Tchatche.SearchEngineParams.s_decaFirstPage = evalDecaPage - 9; 394 } else if (pageIndex == evalDecaPage + 1) { 395 Tchatche.SearchEngineParams.s_decaFirstPage = pageIndex - 1; ; 396 } 397 Tchatche.DisplayLoadingPanel(); 398 if (url != undefined) { 399 document.location.href = url + "?" + Tchatche.GetSearchEngineParameters(true); 400 return; 401 } 402 }, 403 SearchByType: function (pageIndex, url, page, orderBy, type) { 404 Tchatche.SearchParams.s_pageIndex = pageIndex || 1; 405 if (url != undefined) { 406 document.location.href = url + "&s_pageIndex=" + Tchatche.SearchParams.s_pageIndex; 407 return; 408 } 409 jQuery("div[searchType=" + type + "]").load("/" + page, null, Tchatche.HideLoadingPanel); 410 411 }, 412 NextFiveTweet: function (userId, url, pageIndex) { 413 var urlFormat = url + "?s_targetId=" + userId + "&s_pageIndex=" + pageIndex; 414 if (url != undefined) { 415 jQuery("#wisp-suite-container").append('<div id="msg-detail-wisp-' + pageIndex + '"> </div>'); 416 jQuery("#msg-detail-wisp-" + pageIndex).addClass("msg-detail"); 417 jQuery("#msg-detail-wisp-" + pageIndex).load(urlFormat, null, Tchatche.HideLoadingPanel); 418 } 419 }, 420 ResizeComment: function (commentId) { 421 jQuery("#content-text-" + commentId).toggleClass("context-text-resize"); 422 }, 423 DisplayChildComment: function (parentId) { 424 jQuery("div[parentid=" + parentId + "]").slideToggle("fast"); 425 jQuery("div[displayparentid=" + parentId + "]").toggleClass("message-hide"); 426 }, 427 DisplayChildCommentNew: function (parentId) { 428 jQuery("li[parentid=" + parentId + "]").slideToggle("fast"); 429 jQuery("li[displayparentid=" + parentId + "]").toggleClass("message-hide"); 430 }, 431 InsertComment: function (content, threadId, parentId, targetId, typeId, title, targetPseudo) { 432 if (content.length > 200) { 433 content = content.substr(0, 200); 434 } 435 var data = "{content:'" + Tchatche.Encode(content) + "', threadId:" + threadId + ", parentId:" + parentId + ", targetId:" + targetId + ", typeId:" + typeId + ", title:'" + title + "', targetPseudo:'" + targetPseudo + "'}"; 436 var callBack = function (msg) { 437 if (msg.d == true) { 438 document.location = "/profil-messagerie.aspx?s_recieved=False"; 439 } 440 }; 441 Tchatche.SendRequest("/webservices/webmethods.aspx/InsertComment", data, callBack); 442 }, 443 DeleteComment: function (commentId, deleteInline) { 444 if (confirm('Es-tu sûr de vouloir supprimer ce commentaire ?') === false) { 445 return; 446 } 447 var data = "{commentId:" + commentId + "}"; 448 var text = "Supression ok"; 449 var callBack = function (msg) { 450 if (msg.d == true) { 451 if (deleteInline) { 452 jQuery("#comment-item-" + commentId).remove(); 453 } 454 else { 455 document.location.reload(); 456 } 457 } 458 }; 459 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteComment", data, callBack); 460 }, 461 DeleteMediaComment: function (commentId, deleteInline) { 462 if (confirm('Es-tu sûr de vouloir supprimer ce commentaire ?') === false) { 463 return; 464 } 465 var data = "{commentId:" + commentId + "}"; 466 var text = "Supression ok"; 467 var callBack = function (msg) { 468 if (msg.d == true) { 469 if (deleteInline) { 470 jQuery("#comment-item-" + commentId).remove(); 471 } 472 else { 473 document.location.reload(); 474 } 475 } 476 }; 477 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteMediaComment", data, callBack); 478 }, 479 DeleteCommentChild: function (commentId, deleteInline) { 480 if (confirm('Es-tu sûr de vouloir supprimer ce commentaire ?') === false) { 481 return; 482 } 483 var data = "{commentId:" + commentId + ",withChild:" + "true" + "}"; 484 var text = "Supression ok"; 485 var callBack = function (msg) { 486 if (msg.d == true) { 487 if (deleteInline) { 488 jQuery("#comment-item-" + commentId).remove(); 489 } 490 else { 491 document.location.reload(); 492 } 493 } 494 }; 495 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteCommentChild", data, callBack); 496 }, 497 DeleteUniqueConversation: function (targetId) { 498 if (confirm("Es-tu sûr de vouloir supprimer la conversation ?") === false) { 499 return; 500 } 501 var callBack = function () { 502 document.location.reload(); 503 }; 504 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteUniqueConversation", "{targetId:" + targetId + "}", callBack); 505 }, 506 DeleteConversation: function (targetId, deleteInline, applicationId) { 507 if (confirm("Es-tu sûr de vouloir supprimer la conversation ?") === false) { 508 return; 509 } 510 var data = "{targetId:" + targetId; 511 if (applicationId != null) { 512 data = data + ", applicationId: " + applicationId; 513 } 514 data = data + "}"; 515 var callBack = function (msg) { 516 if (msg.d == true) { 517 if (deleteInline) { 518 jQuery("#comment-item-" + CommentId).remove(); 519 } else { 520 document.location.reload(); 521 } 522 } 523 }; 524 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteConversation", data, callBack); 525 }, 526 DeleteAllConversations: function (targetIds, application) { 527 if (targetIds.length == 0) { 528 return; 529 } 530 if (confirm("Es-tu sûr de vouloir supprimer toutes les conversations sélectionnées ?") === false) { 531 return; 532 } 533 Tchatche.DisplayLoadingPanel(); 534 var data = "{targetIds:[" + targetIds + "]}"; 535 var callBack = function (msg) { 536 if (msg.d == true) { 537 document.location.reload(); 538 } 539 Tchatche.HideLoadingPanel(); 540 }; 541 if (application) { 542 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteAllApplicationConversations", data, callBack); 543 } 544 else { 545 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteAllConversations", data, callBack); 546 } 547 }, 548 wispContentControl: function (focusStatus) { 549 var inputText = document.getElementsByName('wispContent')[0]; 550 if (focusStatus == "lost") { 551 if (inputText.value == "") { 552 inputText.value = "Humour, info du jo
552ur, coup de gueule: fais passer ton message sur Babel"; 553 } 554 // Clean intenet addresses 555 var val = inputText.value; 556 val = val.replace(/"/gi, ''); 557 val = val.replace(/</gi, ''); 558 val = val.replace(/>/gi, ''); 559 val = val.replace(/'/gi, ''); 560 val = val.replace(/\//g, ''); 561 val = val.replace(/http/gi, ''); 562 val = val.replace(/www/gi, ''); 563 val = val.replace(/htm/gi, ''); 564 val = val.replace(/aspx/gi, ''); 565 val = val.replace(/php/gi, ''); 566 if (val != inputText.value) { 567 inputText.value = "Humour, info du jour, coup de gueule: fais passer ton message sur Babel"; 568 } 569 } else { 570 if (inputText.value == "Humour, info du jour, coup de gueule: fais passer ton message sur Babel") { 571 inputText.value = ""; 572 } 573 } 574 }, 575 InsertTweet: function (threadId, targetId, targetPseudo) { 576 var val = Tchatche.Encode(jQuery("#tweet-" + targetId).val()); 577 val = val.replace(/(\r\n|\n|\r)/gm, ""); 578 var currentWisp = Tchatche.Encode(jQuery("#tweetCurrent-" + targetId).val()); 579 580 if (val != "Humour, info du jour, coup de gueule: fais passer ton message sur Babel" && val != "" && val != currentWisp) { 581 if (confirm("Es-tu sûr de vouloir valider ce wisp?") === false) { 582 return; 583 } 584 jQuery("#wisp-validation").hide("fast"); 585 if (val.length <= 140) { 586 var data = "{content:'" + val 587 + "',threadId:" + threadId 588 + ",parentId:0" 589 + ",targetId:" + targetId 590 + ",typeId:6" 591 + ",userId:" + targetId 592 + ",targetPseudo:'" + targetPseudo 593 + "',title:''" 594 + "}"; 595 596 var text = "Insert ok"; 597 var callBack = function (msg) { 598 if (msg.d == false) { 599 } 600 document.location.reload(); 601 602 jQuery("#wisp-validation").show("fast"); 603 }; 604 Tchatche.SendRequest("/webservices/webmethods.aspx/InsertTweet", data, callBack); 605 606 } else { 607 jQuery("#wisp-validation").text("le message ne doit pas depasser 140 caractères !"); 608 jQuery("#wisp-validation").show("fast"); 609 } 610 } 611 }, 612 FillLocalizationList: function (countryId, regionId) { 613 if (countryId == -1) { 614 jQuery("#s_region").val("-1"); 615 jQuery("#recherche-regions").hide(); 616 return; 617 } 618 Tchatche.SearchParams.s_selectedRegion = regionId || -1; 619 Tchatche.SearchEngineParams.s_selectedRegion = regionId || -1; 620 window.LocalizationManager.GetLocalizationDropDown(countryId, Tchatche.FillLocalizationListCallBack); 621 }, 622 FillLocalizationListCallBack: function (res) { 623 //if (Tchatche.HandleError(res, 'FillLocalizationListCallBack')) { return; }; 624 jQuery("#s_region").children().remove(); 625 jQuery("#s_region").append("<option value='-1'>--</option>"); 626 if (res.value) { 627 jQuery("#recherche-regions").show(); 628 for (var i = 0; i < res.value.length; i++) { 629 jQuery("#s_region").append("<option value='" + res.value.get(i).Value + "'>" + res.value.get(i).Text + "</option>"); 630 } 631 setTimeout(function () { // IE6fix 632 if (Tchatche.SearchParams.SelectedRegion != -1) { 633 jQuery("#s_region").val(Tchatche.SearchParams.s_selectedRegion); 634 } 635 if (Tchatche.SearchEngineParams.SelectedRegion != -1) { 636 jQuery("#s_region").val(Tchatche.SearchEngineParams.s_selectedRegion); 637 } 638 }, 200); 639 } 640 }, 641 BuddyList: function (UserId, Action, Type) { 642 var data = "{userId:" + UserId + ",action:" + Action + ",type:" + Type + "}"; 643 var callBack = function (msg) { 644 jQuery("input[buddy]").hide(); 645 var action = (Action == Constants.ActionType.Add) ? Constants.ActionType.Delete : Constants.ActionType.Add; 646 jQuery("input[buddy=" + Type + "-" + action + "]").show(); 647 var type = (Type == Constants.BuddyType.Buddy) ? Constants.BuddyType.Unwanted : Constants.BuddyType.Buddy; 648 jQuery("input[buddy=" + type + "-" + Constants.ActionType.Add + "]").show(); 649 }; 650 Tchatche.SendRequest("/webservices/webmethods.aspx/BuddyByType", data, callBack); 651 }, 652 BuddyAdd: function (UserId, Action, Type, ele) { 653 var data = "{userId:" + UserId + ",action:" + Action + ",type:" + Type + "}"; 654 var callBack = function (msg) { 655 jQuery(ele).hide(); 656 var action = (Action == Constants.ActionType.Add) ? Constants.ActionType.Delete : Constants.ActionType.Add; 657 jQuery("input[buddy=" + Type + "-" + action + "]").show(); 658 var type = (Type == Constants.BuddyType.Buddy) ? Constants.BuddyType.Unwanted : Constants.BuddyType.Buddy; 659 jQuery("input[buddy=" + type + "-" + Constants.ActionType.Add + "]").show(); 660 }; 661 Tchatche.SendRequest("/webservices/webmethods.aspx/BuddyByType", data, callBack); 662 }, 663 BuddyListImg: function (userId, action, type, from) { 664 var data = "{userId:" + userId + ",action:" + action + ",type:" + type + "}"; 665 var callBack = function (msg) { 666 jQuery("img[buddy=" + userId + "]").hide(); 667 switch (from) { 668 case "dashboard": 669 Tchatche.ChangeBuddiesTab("Buddies", this); 670 Tchatche.ChangeActivityTab("BuddiesActivity", this); 671 break; 672 case "dashboard-activity": 673 Tchatche.ChangeBuddiesTab("Buddies", this); 674 Tchatche.ChangeActivityTab("BuddiesActivity", this); 675 break; 676 case "messagerie": 677 document.location.reload(); 678 break; 679 default: 680 break; 681 } 682 }; 683 Tchatche.SendRequest("/webservices/webmethods.aspx/BuddyByType", data, callBack); 684 }, 685 BuddyAction: function (userId, action, type) { 686 if (action == 2) { 687 var message = ""; 688 switch (type) { 689 case 1: 690 message = "Es-tu sûr de vouloir supprimer ce buddy ?"; 691 break; 692 693 default: 694 message = "Es-tu sûr de vouloir supprimer ce contact ?"; 695 break; 696 } 697 if (confirm(message) === false) { 698 return; 699 } 700 } 701 var data = "{userId:" + userId + ",action:" + action + ",type:" + type + "}"; 702 var callBack = function (msg) { 703 if (msg.d == true) { 704 document.location.reload(); 705 } 706 }; 707 Tchatche.SendRequest("/webservices/webmethods.aspx/BuddyByType", data, callBack); 708 }, 709 FillBuddiesList: function (userId) { 710 if (userId == -1) { 711 return; 712 } 713 window.BuddiesManager.GetBuddiesDropDown(userId, Tchatche.FillBuddiesListCallBack); 714 }, 715 FillBuddiesListCallBack: function (res) { 716 //if (Tchatche.HandleError(res, 'FillBuddiesListCallBack')) { return; }; 717 718 if (jQuery("#selectedBuddies").get(0).options.length <= 1) { 719 jQuery("#selectedBuddies").get(0).options.length = 0; 720 jQuery("#selectedBuddies").append("<option value='-1'>--</option>"); 721 722 if (res.value) { 723 for (var i = 0; i < res.value.length; i++) { 724 jQuery("#selectedBuddies").append("<option value='" + res.value.get(i).Value + "'>" + res.value.get(i).Text + "</opt" + "ion>"); 725 } 726 } 727 } 728 }, 729 AlbumDelete: function (albumId) { 730 if (confirm('Es-tu sûr de vouloir supprimer cet album ?') === false) { 731 return; 732 } 733 var data = "{albumId:" + albumId + "}"; 734 var callBack = function (msg) { 735 if (msg.d != true) { 736 } 737 document.location.reload(); 738 Tchatche.HideLoadingPanel(); 739 }; 740 Tchatche.DisplayLoadingPanel(); 741 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteAlbum", data, callBack); 742 }, 743 MediaDelete: function (mediaId, mediaType, albumId) { 744 var currentMedia = ""; 745 if (mediaType == 1) { 746 currentMedia = "photo"; 747 } else { 748 currentMedia = "vidéo"; 749 } 750 if (confirm('Es-tu sûr de vouloir supprimer cette ' + currentMedia + ' ?') === false) { 751 return; 752 } 753 var data = "{mediaId:" + mediaId + "}"; 754 var callBack = function (msg) { 755 if (msg.d != true) { 756 } 757 Tchatche.HideLoadingPanel(); 758 document.location = '/profil-admin-media-album-update-media.aspx?AlbumId=' + albumId + '&AlbumType=' + mediaType; 759 }; 760 Tchatche.DisplayLoadingPanel(); 761 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteMedia", data, callBack); 762 }, 763 LoadActivityStream: function (userId, top, pageIndex, buddy) { 764 var topPage = (top * pageIndex); 765 jQuery("#activistystreams-suite-container").html(""); 766 var data = "userId=" + userId + "&top=" + topPage + "&pageIndex=1" + "&buddy=" + buddy; 767 jQuery("#activities-container").load("/elements/activityStreams.aspx", data, Tchatche.HideLoadingPanel); 768 769 }, 770 InsertActivityStreamResponse: function (activityId, activityVerbsId, activityObjectBase, objectId, activityType, targetUserPseudo, targetUserId, description, userId, pageIndex, top, buddy) { 771 var callBack = function (msg) { 772 if (msg.d != "") { 773 var tab = msg.d.split('|'); 774 if (tab[0] == "like") { 775 var users = jQuery("div[code=activitys-like-users-" + activityId + "]").html(); 776 777 if (users.indexOf("aime") > 0) { 778 users = ""; 779 } 780 if (users != "") { 781 jQuery("div[code=activitys-like-users-" + activityId + "]").html(""); 782 jQuery("div[code=activitys-like-users-" + activityId + "]").html(users + ", <a href='/profil.aspx?userId=" + userId + "'>" + tab[2] + "</a>"); 783 } else { 784 jQuery("div[code=activitys-like-users-" + activityId + "]").html("<a href='/profil.aspx?userId=" + userId + "'>" + tab[2] + "</a>"); 785 }
786 var nbLike = parseInt(jQuery("span[code=activitysNbLikedUsers-" + activityId + "]").html()); 787 jQuery("span[code=activitysNbLikedUsers-" + activityId + "]").html(nbLike + 1); 788 jQuery("a[code=linkLike-" + activityId + "]").removeAttr("onclick"); 789 790 } else if (tab[0] == "comment") { 791 var data1 = "activityId=" + activityId + "&activityVerbsId=" + activityVerbsId + "&activityObjectBase=" + activityObjectBase + "&objectId=" + tab[2]; 792 var url = "/ascx/dashboard/elements/comment.aspx"; 793 jQuery.ajax({ 794 type: "POST", 795 url: url, 796 data: data1, 797 cache: false, 798 success: function (html) { 799 jQuery("#activityCommentsZone-" + activityId).append(html); 800 } 801 }); 802 jQuery("textarea[code=sendingText-" + activityId + "]").val(""); 803 } 804 } 805 }; 806 var comment = Tchatche.Encode(jQuery("textarea[code=sendingText-" + activityId + "]").val()); 807 if (comment.length > 200) { 808 comment = comment.substr(0, 200); 809 } 810 811 // Internet addresses filtering 812 if (comment.indexOf("http") != -1 || comment.indexOf("www") != -1 || comment.indexOf("://") != -1 || comment.indexOf("htm") != -1 || comment.indexOf("aspx") != -1 || comment.indexOf("php") != -1) { 813 comment = ''; 814 jQuery("textarea[code=sendingText-" + activityId + "]").val(''); 815 } 816 817 var data2 = "{activityId:" + activityId + ", activityVerbsId:" + activityVerbsId + ", activityObjectBase:" + activityObjectBase + ", objectId:" + objectId + ", activityType:" + activityType + ", sendingText:'" + comment + "', targetUserPseudo:'" + targetUserPseudo + "', targetUserId:" + targetUserId + ", description:'" + Tchatche.Encode(encodeURIComponent(description)) + "'}"; 818 if (activityVerbsId == 10) { 819 // Comments case 820 if (comment != '') { 821 Tchatche.SendRequest("/webservices/webmethods.aspx/InsertActivityStreamResponse", data2, callBack); 822 } 823 } 824 else { 825 Tchatche.SendRequest("/webservices/webmethods.aspx/InsertActivityStreamResponse", data2, callBack); 826 } 827 }, 828 DeleteObjectResponse: function (activityVerb, activityObject, objectId, deleteInline) { 829 if (confirm('Es-tu sûr de vouloir supprimer ce commentaire ?') === false) { 830 return; 831 } 832 var data = "{activityVerb:" + activityVerb + ", activityObject:" + activityObject + ", objectId: " + objectId + "}"; 833 var text = "Supression ok"; 834 var callBack = function (msg) { 835 if (msg.d == true) { 836 if (deleteInline) { 837 // warning: remove() does not work on tables (tr/td)! 838 jQuery("#comment-item-" + objectId).remove(); 839 } else { 840 document.location.reload(); 841 } 842 } 843 }; 844 Tchatche.SendRequest("/webservices/webmethods.aspx/DeleteObjectResponse", data, callBack); 845 }, 846 ShowMailReminder: function () { 847 jQuery("#popup_dialog_content").attr("src", "/compte/MailConfirm.aspx"); 848 jQuery("#popup_dialog_content").css("height", 220); 849 jQuery("#popup_dialog_content").css("width", 880); 850 jQuery("#dialog-modal").attr("title", "Active ton compte pour profiter de l'ensemble des fonctionnalités !"); 851 Tchatche.DisplayPopup(265, 910); 852 }, 853 Initialize: function () { 854 jQuery.SetTemplatePath('/elements/templates/'); 855 if (typeof (BootStrapper) == "object") { 856 BootStrapper.RunCuedFunctions(); 857 } 858 Tchatche.HideLoadingPanel(); 859 } 860 , 861 WriteLog: function (level, method, message, exception, request) { 862 if (Tchatche.DebugLevel & level) { 863 Tchatche.HandleError({ error: { Message: message, Exception: exception || null, Request: request || null} }, method); 864 } 865 }, 866 ErrorCounter: 0, 867 HandleError: function (res, method) {
868 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 869 // Exception filtering (Too much shit written in HealthMonitoring's DB) 870 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 871 872 // All JS errors 873 return false; 874 875 // google Chrome fishy extension 100 000 errors / day 876 if (method.indexOf("figdphohhlffelolcabcjpikobidapnk") != -1) { 877 return false; 878 } 879 880 if (typeof (res) === 'undefined' || typeof (res.error) === 'undefined' || !res.error) { 881 return false; 882 } 883 if (method.match(/LogJsonException/i)) { 884 return false; 885 } 886 Tchatche.ErrorCounter++; 887 if (Tchatche.ErrorCounter > 100) { 888 Tchatche.ErrorCounter = 0; 889 method = "TooManyErrors"; 890 } 891 if (Tchatche.DebugLevel) { 892 var errObj = { 893 ErrorInfo: { 894 Navigator: navigator.userAgent, 895 Screen: { 896 Width: window.screen.width, 897 Height: window.screen.height 898 }, 899 Origin: window.location.href, 900 Method: method, 901 Result: res 902 } 903 }; 904 if ((Tchatche.DebugLevel & Constants.LogLevel.Info) && window.console) { 905 if (jQuery.browser.msie) { 906 console.log(JSON.stringify(errObj)); 907 } else { 908 console.log(errObj); 909 } 910 } 911 var data = { title: method.split("?")[0], jsonToString: JSON.stringify(errObj) }; 912 jQuery.ajax({ 913 type: "POST", 914 url: "/WebServices/HealthMonitoringWebService.asmx/LogJsonException", 915 data: data, 916 cache: false, 917 contentType: "application/x-www-form-urlencoded", 918 dataType: "json" 919 }); 920 } 921 return true; 922 } 923 }; 924 925 window.$t = window.Tchatche; 926} (window, jQuery)); 927// To catch any other errors 928window.onerror = function (msg, url, line) { 929 try { 930 if (line > 1 && url != "") { 931 window.Tchatche.HandleError({ error: { Message: msg, Url: url, Line: line} }, msg); 932 } 933 } catch (e) { 934 window.Tchatche.WriteLog(window.Constants.LogLevel.Warning, msg, "Error on try/catch", e, null); 935 } 936}; 937// Global jQuery handler for ajax errors 938jQuery(document).ajaxError(function (e, xhr, settings, exception) { 939 window.Tchatche.HandleError({ "error": { "data": settings.data || null, "status": xhr.status, "responseText": xhr.responseText, "exception": exception || null} }, settings.url); 940});
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.