1var iLimit = 20, iIndex = 0, iTotalRecord = -1, iPage = 1, qCode = -1, msid = 1; 2var isPageLoad = true; 3 4$("body").click(function (e) { 5 // check that your clicked 6 // element has no id=divCreated 7 // and is not child of divCreated 8 if (e.target.id != "divCreated" && e.target.id != "spPublishDate" && e.target.id != "divPublishDateText" && e.target.id != "icArrowDown" 9 && !$("#divCreated").find(e.target).length && !$(".k-calendar").find(e.target).length && !$(e.target).hasClass("k-link") && isShowPopup) { 10 $("#divCreated").hide(); 11 isShowPopup = false; 12 } 13}); 14 15var isShowPopup = false; 16function ShowHidePopUp() { 17 if (isShowPopup) { 18 $("#divCreated").hide(); 19 isShowPopup = false; 20 } 21 else { 22 $("#divCreated").show(); 23 isShowPopup = true; 24 } 25} 26var dialog; 27$(document).ready(function () { 28 $("#lbRequireLoginHead2").html(getResourceValue("lbRequireLoginHead2", "Bạn phải ", "Login")); 29 $("#lbRequireLoginTail2").html(getResourceValue("lbRequireLoginTail2", " và liên há» Äá» xem ÄÆ°á»£c ná»i dung bản tin!", "Login")); 30 $("#lbLoginText").html(getResourceValue("lbLoginText", "ÄÄng nháºp", "Login")); 31 $("#txtKeyword").attr("placeholder", getResourceValue("lblKeywordRes", "Từ khóa tìm kiếm", "Search") + "..."); 32 $("#liDay1").html(getResourceValue("dayAgoRes", "1 ngà y trưá»c", "Search")); 33 $("#liDay2").html(getResourceValue("weekAgoRes", "1 tuần trưá»c", "Search")); 34 $("#liDay3").html(getResourceValue("monthAgoRes", "1 tháng trưá»c", "Search")); 35 $("#liDay4").html(getResourceValue("yearAgoRes", "1 nÄm trưá»c", "Search")); 36 $("#spOr").html(getResourceValue("lblOrRes", "Hoặc", "Search")); 37 $("#dtpFromDate").attr("placeholder", getResourceValue("lblFromDate", "Từ ngà y", "Search")); 38 $("#dtpToDate").attr("placeholder", getResourceValue("lblToDate", "Äến ngà y", "Search")); 39 $("#btnSelect").val(getResourceValue("lblSelect", "Chá»n", "Search")); 40 41 var dtpFromDate = $('#dtpFromDate').kendoDatePicker({ 42 format: '{0:dd/MM/yyyy}' 43 }).data('kendoDatePicker'); 44 45 var dtpToDate = $('#dtpToDate').kendoDatePicker({ 46 format: '{0:dd/MM/yyyy}' 47 }).data('kendoDatePicker'); 48 49 $(".aCode").click(function (e) { 50 $(".aCode").removeClass("active"); 51 $(this).addClass("active"); 52 qCode = $(this).data("val"); 53 if ($("#txtKeyword").val() != "") { 54 $("#btnSearch").click(); 55 } 56 if (qCode == -1) { 57 $("#divGroupListNews").show(); 58 } 59 else { 60 $("#divGroupListNews").hide(); 61 } 62 }); 63 64 $("#btnSearch").click(function (e) { 65 iIndex = 0, iTotalRecord = -1, iPage = 1; 66 BeanSearchProperty = []; 67 GetData(); 68 }); 69 70 $('#search-box').keypress(function (e) { 71 if (e.keyCode == 13) { 72 var curName = e.target.localName; 73 if (curName == 'input' || curName == 'select') { 74 $("#btnSearch").click(); 75 } 76 } 77 }); 78 79 progressbar = $("#progressbar"); 80 progressbar.progressbar({ 81 value: false 82 }); 83 84 var keyword = getQuerystring("keyword", ""); 85 if (isPageLoad) { 86 isPageLoad = false; 87 while (keyword.indexOf("+") > -1) { 88 keyword = keyword.replace("+", " "); 89 } 90 keyword = decodeURIComponent(keyword); 91 } 92 $("#txtKeyword").val(keyword); 93 qCode = getQuerystring("qcode", "-1"); 94 $('.aCode[data-val="' + qCode + '"]').addClass("active"); 95 var defaultTime = true; 96 var created = getQuerystring("created", ""); 97 if (created != "") { 98 if (created.indexOf("day") > -1) { 99 isShowPopup = true; 100 $('.liDay[data-value="' + decodeURIComponent(created) + '"]').click(); 101 defaultTime = false; 102 } 103 } 104 else { 105 var createdEnd = getQuerystring("createdend", ""); 106 if (createdEnd != "") { 107 $("#dtpToDate").data("kendoDatePicker").value(kendo.parseDate(createdEnd)); 108 } 109 110 var createdStart = getQuerystring("createdstart", ""); 111 if (createdStart != "") { 112 $("#dtpFromDate").data("kendoDatePicker").value(kendo.parseDate(createdStart)); 113 isShowPopup = true; 114 SelectDate(-1, null); 115 defaultTime = false; 116 } 117 } 118 119 if (defaultTime) { 120 isShowPopup = true; 121 $('.liDay[data-value="7 day"]').click(); 122 } 123 124 dialog = $("#request-login-dialog").kendoWindow({ 125 appendTo: "form#form1", 126 height: 100, 127 width: 500, 128 visible: false, 129 modal: true, 130 actions: [ 131 "Close" 132 ], 133 close: function (e) {
134 dialog.restore(); 135 $("body").removeClass("open-modal"); 136 } 137 }).data("kendoWindow"); 138 kendo.culture(_VNA_PORTAL.LangName); 139}); 140 141function SelectDate(day, ctrl) { 142 $(".liDay").removeClass("selected"); 143 if (day == -1) { 144 if ($("#dtpFromDate").val() == "") { 145 VuThaoNotify(getResourceValue("lblYouMustChooseFD", "Bạn phải chá»n Từ ngà y", "Search"), "none", "red"); 146 $("#dtpFromDate").focus(); 147 return; 148 } 149 150 var fromDate = $("#dtpFromDate").data("kendoDatePicker").value(); 151 if (fromDate == null) { 152 VuThaoNotify(getResourceValue("lblFromDateNotValid", "Từ ngà y không Äúng Äá»nh dạng", "Search"), "none", "red"); 153 $("#dtpFromDate").focus(); 154 return; 155 } 156 var text = $("#dtpFromDate").val(); 157 158 var toDate = $("#dtpToDate").data("kendoDatePicker").value(); 159 if (toDate == null) { 160 $("#dtpToDate").val(""); 161 text += " ~ " + getResourceValue("lblNow", "Hiá»n tại", "Search"); 162 } 163 else if (toDate != null && toDate < fromDate) { 164 VuThaoNotify(getResourceValue("lblToDateLessFromDate", "Äến ngà y không ÄÆ°á»£c nhá» hÆ¡n Từ ngà y", "Search"), "none", "red"); 165 $("#dtpToDate").focus(); 166 return; 167 } 168 else { 169 text += " ~ " + $("#dtpToDate").val(); 170 } 171 172 $("#spPublishDate").html(text); 173 $("#hdPublishDate").val(""); 174 } 175 else { 176 $(ctrl).addClass("selected"); 177 $("#spPublishDate").html($(ctrl).html().toLowerCase()); 178 $("#dtpFromDate").data("kendoDatePicker").value(null); 179 $("#dtpToDate").data("kendoDatePicker").value(null); 180 $("#hdPublishDate").val(day + " day"); 181 } 182 ShowHidePopUp(); 183 184 if ($("#txtKeyword").val() != "") { 185 $("#btnSearch").click(); 186 } 187} 188 189var BeanSearchProperty = []; 190function GetCondition() { 191 if ($("#txtKeyword").val().trim() != "") { 192 BeanSearchProperty.push(GetBeanSearchPropertyObj("text", "Keyword", "contains", $("#txtKeyword").val().trim(), "3")); 193 } 194 else { 195 VuThaoNotify(getResourceValue("lblYouMustEnterKW", "Bạn phải nháºp Từ khóa", "Search"), "none", "red"); 196 $("#txtKeyword").focus(); 197 return false; 198 } 199 200 var fromDate = $("#dtpFromDate").data("kendoDatePicker").value(); 201 var toDate = $("#dtpToDate").data("kendoDatePicker").value(); 202 203 if ($("#hdPublishDate").val() == "") { 204 if (fromDate != null) 205 fromDate = kendo.toString(fromDate, "yyyy-MM-dd"); 206 else if ($("#dtpFromDate").val() != "") { 207 VuThaoNotify(getResourceValue("lblFromDateNotValid", "Từ ngà y không Äúng Äá»nh dạng", "Search"), "none", "red"); 208 $("#dtpFromDate").focus(); 209 return false; 210 } 211 212 if (toDate != null) { 213 if (toDate < $("#dtpFromDate").data("kendoDatePicker").value()) { 214 VuThaoNotify(getResourceValue("lblToDateLessFromDate", "Äến ngà y không ÄÆ°á»£c nhá» hÆ¡n Từ ngà y", "Search"), "none", "red"); 215 $("#dtpToDate").focus(); 216 return false; 217 } 218 toDate = kendo.toString(toDate, "yyyy-MM-dd"); 219 } 220 else toDate = ""; 221 } 222 223 if ($("#hdPublishDate").val() != "") { 224 BeanSearchProperty.push(GetBeanSearchPropertyObj("date", "Created", "geq", $("#hdPublishDate").val(), "1")); 225 } 226 else { 227 if (fromDate && fromDate != "") 228 BeanSearchProperty.push(GetBeanSearchPropertyObj("date", "CreatedStart", "geq", fromDate, "1")); 229 230 if (toDate && toDate != "") 231 BeanSearchProperty.push(GetBeanSearchPropertyObj("date", "CreatedEnd", "leq", toDate, "1")); 232 } 233 234 if (typeof (_GLO_MS) != "undefined" && !isNullOrUndefined(_GLO_MS)) 235 BeanSearchProperty.push(GetBeanSearchPropertyObj("text", "MSID", "eq", _GLO_MS.MSID, "1")); 236 237 return true; 238} 239 240function GetData() { 241 VuThaoNotify("", "", ""); 242 $("#spResult").html(""); 243 $('#body-result').html(""); 244 $("#divContent_ListNewsBody_pager").html(""); 245 246 if (qCode != -1 || isPageChanged) { 247 if (BeanSearchProperty.length == 0) { 248 var flag = GetCondition(); 249 BeanSearchProperty.push(GetBeanSearchPropertyObj("combobox", "QCode", "eq", qC
249ode, "1")); 250 if (flag) { 251 LstExceptArticleId = ""; 252 var sourceUrl = window.location.href.split('?')[0]; 253 buildUrl(sourceUrl, BeanSearchProperty, true); 254 PostRequest("/API/ApiAdvanceSearch.ashx?func=searchpublic&index=" + iIndex + "&limit=" + iLimit + "&data=" + JSON.stringify(BeanSearchProperty) + "&total=" + iTotalRecord + "&lid=" + _VNA_PORTAL.LangId + "&psid=" + _VNA_PORTAL.PersonId); 255 } 256 } 257 else { 258 PostRequest("/API/ApiAdvanceSearch.ashx?func=searchpublic&index=" + iIndex + "&limit=" + iLimit + "&data=" + JSON.stringify(BeanSearchProperty) + "&total=" + iTotalRecord + "&lid=" + _VNA_PORTAL.LangId + "&psid=" + _VNA_PORTAL.PersonId + "&exid=" + LstExceptArticleId); 259 } 260 } 261 else { 262 $("#divGroupListNews").html(""); 263 var flag = GetCondition(); 264 BeanSearchProperty.push(GetBeanSearchPropertyObj("combobox", "QCode", "eq", 254, "1")); 265 if (flag) { 266 PostRequestSuggestNews("/API/ApiAdvanceSearch.ashx?func=searchpublic&index=0&limit=3&data=" + JSON.stringify(BeanSearchProperty) + "&total=0&lid=" + _VNA_PORTAL.LangId + "&psid=" + _VNA_PORTAL.PersonId); 267 } 268 } 269} 270 271var isPageChanged = false; 272function PostRequest(uri) { 273 $.ajax({
274 type: "GET", 275 url: uri, 276 scriptCharset: "utf8", 277 dataType: "json" 278 }) 279 .done(function (msg) { 280 VuThaoNotify("", "none", ""); 281 if (msg.status == "SUCCESS") { 282 if (msg.data.data && msg.data.data.length > 0) { 283 loadDataTemplate("/Scripts/JsTemplate/ListNews.html?ver=1.01", msg.data, getSearchDataCallback); 284 if (iTotalRecord == -1) { 285 iTotalRecord = msg.data.BeanMore.totalRecord; 286 } 287 $("#spResult").html(String.format(getResourceValue("lblSearchResult", "Có {0} kết quả", "Search"), iTotalRecord)); 288 var TotalPage = 1; 289 if (iTotalRecord <= iLimit) { 290 TotalPage = 1; 291 } 292 else { 293 if (iTotalRecord % iLimit > 0) { 294 TotalPage = kendo.parseInt(iTotalRecord / iLimit) + 1; 295 } 296 else { 297 TotalPage = (iTotalRecord / iLimit); 298 } 299 } 300 301 if (TotalPage > 1) { 302 $("#divContent_ListNewsBody_pager").html(BuildPager(TotalPage)); 303 $(".pageNum").click(function (e) { 304 isPageChanged = true; 305 iPage = $(this).data("val") * 1; 306 iIndex = (iPage - 1) * iLimit; 307 GetData(); 308 }); 309 if (isPageChanged) { 310 setTimeout(function () { 311 $('html, body').animate({ 312 scrollTop: $("#body-result").offset().top - 300 313 }, 500); 314 }, 200); 315 isPageChanged = false; 316 } 317 } 318 } 319 else { 320 $("#spResult").html(String.format(getResourceValue("lblSearchResult", "Có {0} kết quả", "Search"), 0)); 321 } 322 323 if (msg.data.BeanMore.partnerId > 0) { 324 PostRequestPartner("/API/ApiAdvanceSearch.ashx?func=getpartnerinfo&pnid=" + msg.data.BeanMore.partnerId); 325 } 326 else { 327 $("#divPartnerInfo").hide(); 328 } 329 } 330 }) 331 .fail(function (jqXHR, textStatus, err) { 332 333 }); 334} 335function getLanguage(LangId) { 336 var language = 'vi'; 337 switch (LangId) { 338 case 1033: { 339 language = 'en' 340 break; 341 } 342 case 1034: { 343 language = 'es' 344 break; 345 } 346 case 1036: { 347 language = 'fr' 348 break; 349 } 350 case 1049: { 351 language = 'ru' 352 break; 353 } 354 case 2052: { 355 language = 'zh' 356 break; 357 } 358 } 359 return language; 360} 361function getArticleType(QCode) { 362 var type = ''; 363 if ((QCode & 1) == 1) { 364 type = 'tin-tuc'; 365 } 366 else if (QCode == 2) { 367 type = 'anh'; 368 } 369 else if (QCode == 3 || QCode == 16) { 370 type = 'tin-anh'; 371 } 372 else if (QCode == 4) { 373 type = 'video'; 374 } 375 else if (QCode == 32) { 376 type = 'graphic'; 377 } 378 return type; 379} 380function toLowerCaseNonAccentVietnamese(str) { 381 str = str.toLowerCase(); 382 str = str.replace(/à |á|ạ|ả|ã|â|ầ|ấ|áº|ẩ|ẫ|Ä|ằ|ắ|ặ|ẳ|ẵ/g, "a"); 383 str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|á»|ế|á»|á»|á» /g, "e"); 384 str = str.replace(/ì|Ã|á»|á»|Ä©/g, "i"); 385 str = str.replace(/ò|ó|á»|á»|õ|ô|á»|á»|á»|á»|á»|Æ¡|á»|á»|ợ|á»|ỡ/g, "o"); 386 str = str.replace(/ù|ú|ụ|á»§|Å©|ư|ừ|ứ|á»±|á»|ữ/g, "u"); 387 str = str.replace(/ỳ|ý|ỵ|á»·|ỹ/g, "y"); 388 str = str.replace(/Ä/g, "d"); 389 // Some system encode vietnamese combining accent as individual utf-8 characters 390 str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ""); // Huyá»n sắc há»i ngã nặng 391 str = str.replace(/\u02C6|\u0306|\u031B/g, ""); // Ã, Ã, Ä, Æ , Ư 392 return str; 393} 394function buildArticleUrl(Url, QCode, LangId, ServiceCategoryId, ServiceCategoryTitle, ID, Title) { 395 var retUrl = Url; 396 if (Url == '' || Url == null) { 397 var lang = getLanguage(LangId); 398 var articleType = getArticleType(QCode); 399 var serviceCategory = toLowerCaseNonAccentVietnamese(ServiceCategoryTitle).replace(/[^a-zA-Z0-9 ]/g, '').replaceAll(' ', '-') + '-' + ServiceCategoryId; 400 var articleTitle = toLowerCaseNonAccentVietnamese(Title).replace(/[^a-zA-Z0-9 ]/g, '').replaceAll(' ', '-') + '-' + ID; 401 retUrl = '/' + lang + '/' + articleType + '/' + serviceCategory + '/' + articleTitle + '.html'; 402 } 403 return retUrl; 404} 405var LstExceptArticleId = ""; 406function PostRequestSuggestNews(uri) { 407 $.ajax({
408 type: "GET", 409 url: uri, 410 scriptCharset: "utf8", 411 dataType: "json" 412 }) 413 .done(function (msg) { 414 if (msg.status == "SUCCESS") { 415 LstExceptArticleId = ""; 416 if (msg.data.data && msg.data.data.length > 0) { 417 loadDataTemplate("/Scripts/JsTemplate/SuggestNews.html?ver=1.02", msg.data, getSuggestNewsCallback); 418 for (var i = 0; i < msg.data.data.length; i++) { 419 LstExceptArticleId += msg.data.data[i].ArticleID + ","; 420 } 421 } 422 423 BeanSearchProperty = []; 424 var flag = GetCondition(); 425 BeanSearchProperty.push(GetBeanSearchPropertyObj("combobox", "QCode", "eq", qCode, "1")); 426 if (flag) { 427 var sourceUrl = window.location.href.split('?')[0]; 428 buildUrl(sourceUrl, BeanSearchProperty, true); 429 PostRequest("/API/ApiAdvanceSearch.ashx?func=searchpublic&index=" + iIndex + "&limit=" + iLimit + "&data=" + JSON.stringify(BeanSearchProperty) + "&total=" + iTotalRecord + "&lid=" + _VNA_PORTAL.LangId + "&psid=" + _VNA_PORTAL.PersonId + "&exid=" + LstExceptArticleId); 430 } 431 } 432 }) 433 .fail(function (jqXHR, textStatus, err) { 434 435 }); 436} 437 438function PostRequestPartner(uri) { 439 $.ajax({
440 type: "GET", 441 url: uri, 442 scriptCharset: "utf8", 443 dataType: "json" 444 }) 445 .done(function (msg) { 446 if (msg.status == "SUCCESS") { 447 if (!isEmptyOrSpaces(msg.data.Description)) { 448 $("#divPartnerInfo").show(); 449 $("#divPartnerInfo").html(msg.data.Description); 450 } 451 else { 452 $("#divPartnerInfo").hide(); 453 $("#divPartnerInfo").html(""); 454 } 455 } 456 }) 457 .fail(function (jqXHR, textStatus, err) { 458 459 }); 460} 461 462function getSuggestNewsCallback(buildData, tmpData, ObjData) { 463 if (ObjData.length > 0) { 464 $('#divGroupListNews').append($(buildData).html()); 465 } 466} 467 468function getSearchDataCallback(buildData, tmpData, ObjData) { 469 if (ObjData.length > 0) { 470 $('#body-result').append($(buildData).html()); 471 $('.buyTopNews').click(function (e) { 472 //if (_VNA_PORTAL.IsLogon) { 473 // $.ajax({
474 // url: '/Api/ApiArticle.ashx?func=CheckArticlePermision', 475 // type: "POST", 476 // dataType: "json", 477 // data: { data: JSON.stringify({ ArticleId: $(e.target).data("artid"), UserId: _VNA_PORTAL.PersonId, LangId: _VNA_PORTAL.LangId }) }, 478 // success: function (response) { 479 // if (response.status == "SUCCESS") { 480 // if (response.data != null && response.data != '') 481 // var url = response.data; 482 483 // var created = getQuerystring("created", ""); 484 // if (created != "") { 485 // if (created.indexOf("day") > -1) { 486 // url = url + "&created=" + created; 487 // } 488 // } else { 489 // var createdEnd = getQuerystring("createdend", ""); 490 // if (createdEnd != "") { 491 // url = url + "&createdend=" + createdEnd; 492 // } 493 494 // var createdStart = getQuerystring("createdstart", ""); 495 // if (createdStart != "") { 496 // url = url + "&createdstart=" + createdStart; 497 // } 498 // } 499 500 // window.location = url; 501 // } 502 // else { 503 // $("#lbRequireLoginHead2").html(response.mess.Value); 504 // $("#lbRequireLoginTail2").html(''); 505 // $("#lbLoginText").html(''); 506 // $("body").addClass("open-modal"); 507 // dialog.center().open(); 508 // } 509 // }, 510 // error: function (response) { 511 // alert("Call api fail"); 512 // HideLoading(); 513 // } 514 // }); 515 //} 516 //else { 517 // $("body").addClass("open-modal"); 518 // dialog.center().open(); 519 //} 520 const id = $(e.target).data("artid"); 521 const qcode = $(e.target).data("qcode"); 522 if (!id) { 523 return; 524 }
525 viewArticlePopup(id, qcode); 526 }); 527 } 528} 529 530function BuildPager(iTotalPage) { 531 var strHTML = ""; 532 if (iPage != 1) { 533 strHTML += "<li class='btnFirst'><a class='pageNum' data-val='1'><i class='fa fa-angle-double-left'></i></a></li>"; 534 strHTML += "<li class='btnPrev'><a class='pageNum' href='data-val='" + (iPage - 1) + "'><i class='fa fa-angle-left'></i></a></li>"; 535 } 536 537 if (iTotalPage <= 5) 538 strHTML += PageNumber(1, iTotalPage, iPage); 539 else { 540 if (iPage <= 3) 541 strHTML += PageNumber(1, 5, iPage); 542 else { 543 if (iPage <= iTotalPage - 2) 544 strHTML += PageNumber(iPage - 2, iPage + 2, iPage); 545 else 546 strHTML += PageNumber(iTotalPage - 4, iTotalPage, iPage); 547 } 548 } 549 550 if (iPage < iTotalPage) { 551 strHTML += "<li class='btnNext'><a class='pageNum' data-val='" + (iPage + 1) + "'><i class='fa fa-angle-right'></i></a></li>"; 552 strHTML += "<li class='btnLast'><a class='pageNum' data-val='" + iTotalPage + "'><i class='fa fa-angle-double-right'></i></a></li>"; 553 } 554 return strHTML; 555} 556 557function PageNumber(intPageStart, intPageEnd, intNowPage) { 558 var strHTML = ""; 559 for (var i = intPageStart; i <= intPageEnd; i++) { 560 if (intNowPage == i) 561 strHTML += "<li class='act-paging'><a>" + i + "</a></li>"; 562 else 563 strHTML += "<li><a class='pageNum' data-val='" + i + "'> " + i + " </a></li>"; 564 } 565 return strHTML; 566} 567 568function buildUrl(url, BeanSearchProperty, isPush) { 569 var reUrl = url; 570 for (var i = 0; i < BeanSearchProperty.length; i++) { 571 if (BeanSearchProperty[i].Key != "MSID") { 572 if (reUrl.indexOf('?') == -1) reUrl += '?'; 573 else reUrl += '&'; 574 reUrl += BeanSearchProperty[i].Key.toLowerCase() + '=' + BeanSearchProperty[i].Value; 575 } 576 } 577 if (isPush) 578 window.history.pushState(document.documentElement.innerHTML, document.title, reUrl); 579 return reUrl; 580} 581 582function GetBeanSearchPropertyObj(strContentType, strKey, strLogicCon, strValue, strValueType) { 583 var bean = {}; 584 bean.ContentType = strContentType; 585 bean.Key = strKey; 586 bean.LogicCon = strLogicCon; 587 bean.Value = encodeURIComponent(strValue); 588 bean.ValueType = strValueType; 589 return bean; 590} 591 592function VuThaoNotify(mess, display, color) { 593 $("#messerror").text(mess); 594 if (display == "none") { 595 progressbar.progressbar("value", 100); 596 setTimeout(function () { progressbar.hide(); }, 1000); 597 } 598 else { 599 progressbar.show(); 600 progressbar.progressbar("value", 0); 601 progressTimer = setTimeout(progress, 10); 602 } 603 document.getElementById("messerror").style.color = "red"; 604} 605 606var progressTimer, progressbar; 607function progress() { 608 var val = progressbar.progressbar("value") || 0; 609 610 progressbar.progressbar("value", val + Math.floor(Math.random() * 3)); 611 612 if (val <= 99) { 613 progressTimer = setTimeout(progress, 50); 614 } 615} 616 617function getQuerystring(key, default_) { 618 if (default_ == null) default_ = ""; 619 key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 620 var regex = new RegExp("[\\?&]" + key + "=([^&#]*)"); 621 var qs = regex.exec(window.location.href); 622 if (qs == null) 623 return default_; 624 else 625 return qs[1]; 626} 627 628if (!String.format) { 629 String.format = function (format) { 630 var args = Array.prototype.slice.call(arguments, 1); 631 return format.replace(/{(\d+)}/g, function (match, number) { 632 return typeof args[number] != 'undefined' 633 ? args[number] 634 : match 635 ; 636 }); 637 }; 638}
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.