1/*! 2 N2Local - Library - Filter 3 4 Copyright 2017, Eric Westman 5 6 Scripts for filters, 'Go Post Stuff', 'Go Find Stuff' 7 */ 8 9/* 10 Clear filter values 11 Call: nav_search - clear buttons 12*/ 13function filter_clear(pFilter){ 14 15 if (pFilter == "srctxt"){ 16 $( "#srctxt" ).val(""); 17 $( "#srctxt" ).focus(); 18 filter_clear_ck("srctxt"); 19 } 20 if (pFilter == "location"){ 21 $( "#icity" ).val(""); 22 $( "#icity" ).focus(); 23 $( "#hlocation" ).val(""); 24 $( "#dcity" ).empty(); 25 $( "#dcity" ).hide(); 26 delCookie("loc"); 27 } 28 if (pFilter == "price"){ 29 //$("#fmprice").val("0"); 30 //$("#toprice").val("0"); 31 $("#fmprice").val(""); 32 $("#toprice").val(""); 33 filter_clear_ck("fmprice"); 34 filter_clear_ck("toprice"); 35 } 36 if (pFilter == "year"){ 37 $("#fmyear").val(""); 38 $("#toyear").val(""); 39 filter_clear_ck("fmyear"); 40 filter_clear_ck("toyear"); 41 } 42 if (pFilter == "color"){ 43 $('[id^="color_"]:checked').each(function(index, element){ 44 $(this).prop("checked", false); 45 }); 46 filter_clear_ck("color"); 47 } 48 if (pFilter == "condtn"){ 49 $('[id^="condtn_"]:checked').each(function(index, element){ 50 $(this).prop("checked", false); 51 }); 52 filter_clear_ck("condtn"); 53 } 54 if (pFilter == "sqft"){ 55 //$("#fmsqft").val("0"); 56 //$("#tosqft").val("0"); 57 $("#fmsqft").val(""); 58 $("#tosqft").val(""); 59 filter_clear_ck("fmsqft"); 60 filter_clear_ck("tosqft"); 61 } 62 if (pFilter == "bedrms"){ 63 //$("#fmbedrms").val("0"); 64 //$("#tobedrms").val("0"); 65 $("#fmbedrms").val(""); 66 $("#tobedrms").val(""); 67 filter_clear_ck("fmbedrms"); 68 filter_clear_ck("tobedrms"); 69 } 70 if (pFilter == "bthrms"){ 71 //$("#fmbthrms").val("0"); 72 //$("#tobthrms").val("0"); 73 $("#fmbthrms").val(""); 74 $("#tobthrms").val(""); 75 filter_clear_ck("fmbthrms"); 76 filter_clear_ck("fmbthrms"); 77 } 78 if (pFilter == "pets"){ 79 $("$alwcats").prop("checked", false); 80 $("$alwdogs").prop("checked", false); 81 filter_clear_ck("alwcats"); 82 filter_clear_ck("alwdogs"); 83 } 84 if (pFilter == "jobtype"){ 85 $('#filter_job input:checked').each(function(index, element){ 86 $(this).prop("checked", false); 87 }); 88 filter_clear_ck("jobtype_telecommute"); 89 filter_clear_ck("jobtype_contract"); 90 filter_clear_ck("jobtype_internship"); 91 filter_clear_ck("jobtype_parttime"); 92 filter_clear_ck("jobtype_fulltime"); 93 filter_clear_ck("jobtype_nonprofit"); 94 } 95 if (pFilter == "payrange"){ 96 //$("#payfm").val("0"); 97 //$("#payto").val("0"); 98 $("#payfm").val(""); 99 $("#payto").val(""); 100 filter_clear_ck("payfm"); 101 filter_clear_ck("payto"); 102 } 103 if (pFilter == "paytype"){ 104 $('#filter_paytype input:checked').each(function(index, element){ 105 $(this).prop("checked", false); 106 }); 107 filter_clear_ck("paytype_hourly"); 108 filter_clear_ck("paytype_salary"); 109 filter_clear_ck("paytype_commission"); 110 filter_clear_ck("paytype_lumpsum"); 111 filter_clear_ck("paytype_other"); 112 } 113 if (pFilter == "day"){ 114 $("#datefm").val(""); 115 $("#datefmdsp").val(""); 116 $("#dateto").val(""); 117 $("#datetodsp").val(""); 118 $("#timefm").val(""); 119 $("#timehh").val(""); 120 loadHours('',''); 121 filter_clear_ck("datefm"); 122 filter_clear_ck("dateto"); 123 filter_clear_ck("tiemfm"); 124 filter_clear_ck("timehh"); 125 } 126 if (pFilter == "mileage"){ 127 //$("#fmmileage").val("0"); 128 //$("#tomileage").val("0"); 129 $("#fmmileage").val(""); 130 $("#tomileage").val(""); 131 $("#mileagetype").val(""); 132 filter_clear_ck("fmmileage"); 133 filter_clear_ck("tomileage"); 134 filter_clear_ck("mileagetype"); 135 } 136 if (pFilter == "transportseller"){ 137 $('[id^="transportseller_"]:checked').each(function(index, element){ 138 $(this).prop("checked", false); 139 }); 140 filter_clear_ck("transportseller"); 141 } 142 if (pFilter == "propertyseller"){ 143 $('[id^="propertyseller_"]:checked').each(function(index, element){ 144 $(this).prop("checked", false); 145 }); 146 filter_clear_ck("propertyseller"); 147 } 148 if (pFilter == "propertyrenter"){ 149 $('[id^="propertyrenter_"]:checked').each(function(index, element){ 150 $(this).prop("checked", false); 151 }); 152 filter_clear_ck("propertyrenter"); 153 } 154 if (pFilter == "myage"){ 155 $("#age").val(""); 156 filter_clear_ck("age"); 157 } 158 if (pFilter == "idgender"){ 159 $('[id^="idgender_"]:checked').each(function(index, element){ 160 $(this).prop("checked", false); 161 }); 162 filter_clear_ck("idgender"); 163 } 164 if (pFilter == "idagender"){ 165 $('[id^="idagender_"]:checked').each(function(index, element){ 166 $(this).prop("checked", false); 167 }); 168 filter_clear_ck("idagender"); 169 } 170 if (pFilter == "ages"){ 171 $("#agefm").val(""); 172 $("#ageto").val(""); 173 filter_clear_ck("agefm"); 174 filter_clear_ck("ageto"); 175 } 176 if (pFilter == "skgender"){ 177 $('[id^="skgender_"]:checked').each(function(index, element){ 178 $(this).prop("checked", false); 179 }); 180 filter_clear_ck("skgender"); 181 } 182 if (pFilter == "skagender"){ 183 $('[id^="skagender_"]:checked').each(function(index, element){ 184 $(this).prop("checked", false); 185 }); 186 filter_clear_ck("skagender"); 187 } 188 189 /* New Post */ 190 if (pFilter == "address"){ 191 $("#address").val(""); 192 } 193 if (pFilter == "fees"){ 194 $("#fees").val(""); 195 } 196 if (pFilter == "feesdsc"){ 197 $("#feesdsc").val(""); 198 } 199 if (pFilter == "compensation"){ 200 $("#compensation").val(""); 201 } 202 203} 204/* 205 Clear cookie filter json attribute 206 Call: nav_search - document.ready 207*/ 208function filter_load_ck(){ 209 210 /* load and parse json filter */ 211 var ft = getCookie("ft"); 212 var ft_json = JSON.parse(ft); 213 214 var loc = getCookie("loc"); 215 if (loc){ 216 /* cookie.loc - speical case, list of saved cities.. load first one only */ 217 alocs = loc.split(","); 218 if (alocs.length > 0){ 219 aloc = alocs[0].split("|"); 220 setLocation(aloc[0], aloc[1], URLDecode(aloc[2])); 221 } 222 } 223 224 var lsub1 = getCookie("lsub1"); 225 if (lsub1){ 226 selectSub1(URLDecode(lsub1)); 227 } 228 var lsub2 = getCookie("lsub2"); 229 if (lsub2){ 230 selectSub2(URLDecode(lsub2)); 231 } 232 233 if (ft_json["srctxt"]){$("#srctxt").val(URLDecode(ft_json["srctxt"]));} 234 235 var dt = getCookie("dt"); 236 if (dt){ 237 if (dt == "9999"){ $("#dt").append('<option value="9999" selected>9999</option>'); } 238 $("#dt").val(dt); 239 } 240 241 if (ft_json["fmprice"]){$("#fmprice").val(ft_json["fmprice"]);}
242 if (ft_json["toprice"]){$("#toprice").val(ft_json["toprice"]);} 243 244 if (ft_json["fmyear"]){$("#fmyear").val(ft_json["fmyear"]);} 245 if (ft_json["toyear"]){$("#toyear").val(ft_json["toyear"]);} 246 247 if (ft_json["color"]){ 248 var aflt = String(ft_json["color"]).split(","); 249 for (var i in aflt){ 250 $('#color_' + aflt[i]).prop("checked", true); 251 } 252 } 253 254 if (ft_json["condtn"]){ 255 var aflt = String(ft_json["condtn"]).split(","); 256 for (var i in aflt){ 257 $('#condtn_' + aflt[i]).prop("checked", true); 258 } 259 } 260 261 if (ft_json["fmsqft"]){$("#fmsqft").val(ft_json["fmsqft"]);} 262 if (ft_json["tosqft"]){$("#tosqft").val(ft_json["tosqft"]);} 263 264 if (ft_json["fmbedrms"]){$("#fmbedrms").val(ft_json["fmbedrms"]);} 265 if (ft_json["tobedrms"]){$("#tobedrms").val(ft_json["tobedrms"]);} 266 267 if (ft_json["fmbthrms"]){$("#fmbthrms").val(ft_json["fmbthrms"]);} 268 if (ft_json["tobthrms"]){$("#tobthrms").val(ft_json["tobthrms"]);} 269 270 if (ft_json["alwcat"]){ 271 $("#alwcat").prop("checked", true); 272 } 273 if (ft_json["alwdog"]){ 274 $("#alwdog").prop("checked", true); 275 } 276 277 /* Job */ 278 if (ft_json["jobtype_telecommute"]){$("#jobtype_telecommute").val(ft_json["jobtype_telecommute"]);} 279 if (ft_json["jobtype_contract"]){$("#jobtype_contract").val(ft_json["jobtype_contract"]);} 280 if (ft_json["jobtype_internship"]){$("#jobtype_internship").val(ft_json["jobtype_internship"]);} 281 if (ft_json["jobtype_parttime"]){$("#jobtype_parttime").val(ft_json["jobtype_parttime"]);} 282 if (ft_json["jobtype_fulltime"]){$("#jobtype_fulltime").val(ft_json["jobtype_fulltime"]);} 283 if (ft_json["jobtype_nonprofit"]){$("#jobtype_nonprofit").val(ft_json["jobtype_nonprofit"]);} 284 285 /* Pay */ 286 if (ft_json["payfm"]){$("#payfm").val(ft_json["payfm"]);} 287 if (ft_json["payto"]){$("#payto").val(ft_json["payto"]);} 288 289 if (ft_json["paytype_hourly"]){$("#paytype_hourly").val(ft_json["paytype_hourly"]);} 290 if (ft_json["paytype_salary"]){$("#paytype_salary").val(ft_json["paytype_salary"]);} 291 if (ft_json["paytype_commission"]){$("#paytype_commission").val(ft_json["paytype_commission"]);} 292 if (ft_json["paytype_lumpsum"]){$("#paytype_lumpsum").val(ft_json["paytype_lumpsum"]);} 293 if (ft_json["paytype_other"]){$("#paytype_other").val(ft_json["paytype_other"]);} 294 295 /* Day */ 296 if (ft_json["datefm"] && ft_json["dateto"]){ 297 if (ft_json["datefm"]){$("#datefm").val(ft_json["datefm"]);} 298 $("#datefmdsp").val(formatDate(ft_json["datefm"])); 299 if (ft_json["dateto"]){$("#dateto").val(ft_json["dateto"]);} 300 $("#datetodsp").val(formatDate(ft_json["dateto"])); 301 } 302 if (ft_json["timefm"]){ 303 loadTimes(ft_json["timefm"], ft_json["timehh"]); 304 }else{ 305 loadTimes('',''); 306 } 307 308 if (ft_json["fmmileage"]){$("#fmmileage").val(ft_json["fmmileage"]);} 309 if (ft_json["tomileage"]){$("#tomileage").val(ft_json["tomileage"]);} 310 if (ft_json["mileagetype"]){$("#mileagetype").val(ft_json["mileagetype"]);} 311 312 if (ft_json["transportseller"]){ 313 var aflt = String(ft_json["transportseller"]).split(","); 314 for (var i in aflt){ 315 $('#transportseller_' + aflt[i]).prop("checked", true); 316 } 317 } 318 if (ft_json["propertyseller"]){ 319 var aflt = String(ft_json["propertyseller"]).split(","); 320 for (var i in aflt){ 321 $('#propertyseller_' + aflt[i]).prop("checked", true); 322 } 323 } 324 if (ft_json["propertyrenter"]){ 325 var aflt = String(ft_json["propertyrenter"]).split(","); 326 for (var i in aflt){ 327 $('#propertyrenter_' + aflt[i]).prop("checked", true); 328 } 329 } 330 331 if (ft_json["age"]){$("#age").val(ft_json["age"]);} 332 if (ft_json["agefm"]){$("#agefm").val(ft_json["agefm"]);} 333 if (ft_json["ageto"]){$("#ageto").val(ft_json["ageto"]);} 334 if (ft_json["idgender"]){ 335 var aflt = String(ft_json["idgender"]).split(","); 336 for (var i in aflt){ 337 $('#idgender' + aflt[i]).prop("checked", true); 338 } 339 } 340 if (ft_json["idagender"]){ 341 var aflt = String(ft_json["idagender"]).split(","); 342 for (var i in aflt){ 343 $('#idagender_' + aflt[i]).prop("checked", true); 344 } 345 } 346 if (ft_json["skgender"]){ 347 var aflt = String(ft_json["skgender"]).split(","); 348 for (var i in aflt){ 349 $('#skgender_' + aflt[i]).prop("checked", true); 350 } 351 } 352 if (ft_json["skagender"]){ 353 var aflt = String(ft_json["skagender"]).split(","); 354 for (var i in aflt){ 355 $('#skagender_' + aflt[i]).prop("checked", true); 356 } 357 } 358 359} 360/* 361 Clear cookie filter json attribute 362*/ 363function filter_clear_ck(pFilter){ 364 365 /* load and parse json filter */ 366 var ft = getCookie("ft"); 367 var ft_json = JSON.parse(ft); 368 369 /* remove json attribute */ 370 if (ft_json[pFilter]){ 371 delete ft_json[pFilter]; 372 } 373 374 /* set session cookie */ 375 document.cookie = "ft" + "=" + escape(JSON.stringify(ft_json)) + "; expires=0'; path=/"; 376 377} 378/*
379 Load filter options 380 Call: cats.js - selectSub1, selectSub2 381*/ 382function filter_load(pSub1, pSub2){ 383 384 var filter_vflag = false; 385 386 if (pSub1){ 387 388 if (arrcats[pSub1]['price'] == 1){ 389 $("#filter_price").css("display", "block"); 390 filter_vflag = true; 391 }else{ 392 $("#filter_price").css("display", "none"); 393 } 394 if (arrcats[pSub1]['year'] == 1){ 395 $("#filter_year").css("display", "block"); 396 filter_vflag = true; 397 }else{ 398 $("#filter_year").css("display", "none"); 399 } 400 if (arrcats[pSub1]['color'] == 1){ 401 $("#filter_color").css("display", "block"); 402 filter_vflag = true; 403 }else{ 404 $("#filter_color").css("display", "none"); 405 } 406 if (arrcats[pSub1]['condtn'] == 1){ 407 $("#filter_condtn").css("display", "block"); 408 filter_vflag = true; 409 }else{ 410 $("#filter_condtn").css("display", "none"); 411 } 412 if (arrcats[pSub1]['sqft'] == 1){ 413 $("#filter_sqft").css("display", "block"); 414 filter_vflag = true; 415 }else{ 416 $("#filter_sqft").css("display", "none"); 417 } 418 if (arrcats[pSub1]['bedrms'] == 1){ 419 $("#filter_bedrms").css("display", "block"); 420 filter_vflag = true; 421 }else{ 422 $("#filter_bedrms").css("display", "none"); 423 } 424 if (arrcats[pSub1]['bthrms'] == 1){ 425 $("#filter_bthrms").css("display", "block"); 426 filter_vflag = true; 427 }else{ 428 $("#filter_bthrms").css("display", "none"); 429 } 430 if (arrcats[pSub1]['alwcat'] == 1 || arrcats[pSub1]['alwdog'] == 1){ 431 $("#filter_pets").css("display", "block"); 432 filter_vflag = true; 433 }else{ 434 $("#filter_pets").css("display", "none"); 435 } 436 if (arrcats[pSub1]['job'] == 1){ 437 $("#filter_job").css("display", "block"); 438 filter_vflag = true; 439 }else{ 440 $("#filter_job").css("display", "none"); 441 } 442 if (arrcats[pSub1]['pay'] == 1){ 443 $("#filter_pay").css("display", "block"); 444 filter_vflag = true; 445 }else{ 446 $("#filter_pay").css("display", "none"); 447 } 448 if (arrcats[pSub1]['day'] == 1){ 449 $("#filter_day").css("display", "block"); 450 filter_vflag = true; 451 }else{ 452 $("#filter_day").css("display", "none"); 453 } 454 if (arrcats[pSub1]['mileage'] == 1){ 455 $("#filter_mileage").css("display", "block"); 456 filter_vflag = true; 457 }else{ 458 $("#filter_mileage").css("display", "none"); 459 } 460 if (arrcats[pSub1]['transportseller'] == 1){ 461 $("#filter_transportseller").css("display", "block"); 462 filter_vflag = true; 463 }else{ 464 $("#filter_transportseller").css("display", "none"); 465 } 466 if (arrcats[pSub1]['propertyseller'] == 1){ 467 $("#filter_propertyseller").css("display", "block"); 468 filter_vflag = true; 469 }else{ 470 $("#filter_propertyseller").css("display", "none"); 471 } 472 if (arrcats[pSub1]['propertyrenter'] == 1){ 473 $("#filter_propertyrenter").css("display", "block"); 474 filter_vflag = true; 475 }else{ 476 $("#filter_propertyrenter").css("display", "none"); 477 } 478 if (arrcats[pSub1]['age'] == 1){ 479 $("#filter_myage").css("display", "block"); 480 $("#filter_skage").css("display", "block"); 481 filter_vflag = true; 482 }else{ 483 $("#filter_myage").css("display", "none"); 484 $("#filter_skage").css("display", "none"); 485 } 486 if (arrcats[pSub1]['gender'] == 1){ 487 $("#filter_idgender").css("display", "block"); 488 $("#filter_skgender").css("display", "block"); 489 filter_vflag = true; 490 }else{ 491 $("#filter_idgender").css("display", "none"); 492 $("#filter_skgender").css("display", "none"); 493 } 494 if (arrcats[pSub1]['agender'] == 1){ 495 $("#filter_idagender").css("display", "block"); 496 $("#filter_skagender").css("display", "block"); 497 filter_vflag = true; 498 }else{ 499 $("#filter_idagender").css("display", "none"); 500 $("#filter_skagender").css("display", "none"); 501 } 502 503 /* 504 New Post filters 505 */
506 if (arrcats[pSub1]['address'] == 1){ 507 $("#filter_address").css("display", "block"); 508 filter_vflag = true; 509 }else{ 510 $("#filter_address").css("display", "none"); 511 } 512 if (arrcats[pSub1]['fees'] == 1){ 513 $("#filter_fees").css("display", "block"); 514 filter_vflag = true; 515 }else{ 516 $("#filter_fees").css("display", "none"); 517 } 518 if (arrcats[pSub1]['feesdsc'] == 1){ 519 $("#filter_feesdsc").css("display", "block"); 520 filter_vflag = true; 521 }else{ 522 $("#filter_feesdsc").css("display", "none"); 523 } 524 if (arrcats[pSub1]['compensation'] == 1){ 525 $("#filter_compensation").css("display", "block"); 526 filter_vflag = true; 527 }else{ 528 $("#filter_compensation").css("display", "none"); 529 } 530 531 }else{ 532 533 $("#filter_price").css("display", "none"); 534 $("#filter_year").css("display", "none"); 535 $("#filter_color").css("display", "none"); 536 $("#filter_condtn").css("display", "none"); 537 $("#filter_sqft").css("display", "none"); 538 $("#filter_bedrms").css("display", "none"); 539 $("#filter_bthrms").css("display", "none"); 540 $("#filter_pets").css("display", "none"); 541 $("#filter_job").css("display", "none"); 542 $("#filter_pay").css("display", "none"); 543 $("#filter_day").css("display", "none"); 544 $("#filter_mileage").css("display", "none"); 545 $("#filter_transportseller").css("display", "none"); 546 $("#filter_propertyseller").css("display", "none"); 547 $("#filter_propertyrenter").css("display", "none"); 548 $("#filter_age").css("display", "none"); 549 $("#filter_idgender").css("display", "none"); 550 $("#filter_idagender").css("display", "none"); 551 $("#filter_skgender").css("display", "none"); 552 $("#filter_skagender").css("display", "none"); 553 554 $("#filter_address").css("display", "none"); 555 $("#filter_fees").css("display", "none"); 556 $("#filter_feesdsc").css("display", "none"); 557 $("#filter_compensation").css("display", "none"); 558 559 } 560 /* 561 Special case - some sub categories allow address, day filters 562 */ 563 if (pSub2){ 564 // Loop through all 'data' - match dscurl then [i] on address, day... only update if set to 1 565 if (arrcats[pSub1]){ 566 for (var i in arrcats[pSub1]['data']){ 567 if (arrcats[pSub1]['data'][i]['dscurl'] == pSub2){ 568 if (arrcats[pSub1]['data'][i]['address'] == 1){ 569 $("#filter_address").css("display", "block"); 570 filter_vflag = true; 571 } 572 if (arrcats[pSub1]['data'][i]['day'] == 1){ 573 $("#filter_day").css("display", "block"); 574 filter_vflag = true; 575 } 576 break; 577 } 578 } 579 } 580 } 581 /* 582 New Post filter container 583 */ 584 if (filter_vflag){ 585 $("#filter_vflag").css("display", "block"); 586 }else{ 587 $("#filter_vflag").css("display", "none"); 588 } 589} 590 591/* 592 Go Find Stuff! 593*/ 594function goFindStuff(){ 595 596 objHLocation = $("#hlocation" ); 597 objCatSub1 = $("#icatsub01"); 598 objCatSub2 = $("#icatsub02"); 599 600 if (objHLocation.length && objCatSub1.length && objCatSub2.length){ 601 602 if (objHLocation.val()){ 603 alocation = objHLocation.val().split("|"); 604 if (alocation.length == 3){ 605 var strLoc = alocation[0]; 606 strLoc += "/" + alocation[1]; 607 strLoc += "/" + URLEncode(alocation[2]); 608 } 609 } 610 611 var strCat = ""; 612 if (objCatSub1.val()){ 613 strCat += "/" + URLEncode(objCatSub1.val()); 614 } 615 if (objCatSub2.val()){ 616 strCat += "/" + URLEncode(objCatSub2.val()); 617 } 618 619 if (strLoc){ 620 var strURL = strLoc + strCat + buildURI(); 621 window.location = "/" + strURL.toLowerCase(); 622 }else{ 623 if (confirm('Would you like us to find your location?')) { 624 getLocation(function() { 625 goFindStuff(); 626 }); 627 } else { 628 $('#icity').val(''); 629 $('#err_icity').css('display', 'block'); 630 $('#err_icity').html('Enter your city, neighborhood or borough'); 631 $('html, body').animate({ 632 scrollTop: $("#icity").offset().top - 50 633 }, 1000); 634 } 635 } 636 } 637} 638 639/* 640 Go POST Stuff 641*/ 642function goPostStuff(){ 643 644 objHLocation = $("#hlocation" ); 645 objCatSub1 = $("#icatsub01"); 646 objCatSub2 = $("#icatsub02"); 647 648 if (objHLocation.length && objCatSub1.length && objCatSub2.length){ 649 650 if (objHLocation.val()){ 651 alocation = objHLocation.val().split("|"); 652 if (alocation.length == 3){ 653 var strLoc = alocation[0]; 654 strLoc += "/" + alocation[1]; 655 strLoc += "/" + URLEncode(alocation[2]); 656 } 657 } 658 659 var strCat = ""; 660 if (objCatSub1.val()){ 661 strCat += "/" + URLEncode(objCatSub1.val()); 662 } 663 if (objCatSub2.val()){ 664 strCat += "/" + URLEncode(objCatSub2.val()); 665 } 666 667 if (strLoc){ 668 var strURL = strLoc + strCat + "/adsnew.php"; 669 console.log("goPostStuff strURL:" + strURL); 670 window.location = "/" + strURL.toLowerCase(); 671 }else{ 672 window.location = "/adsnew.php"; 673 } 674 } 675} 676 677/* 678 URI querystring 679*/ 680function buildURI(){ 681 682 var arrURI = new Array(); 683 684 arrURI.push("dt=" + URLEncode($("#dt").val().trim())); 685 686 if ($("#hasimage").checked){ 687 arrURI.push("hasimage=true"); 688 }else{ 689 arrURI.push("hasimage=false"); 690 } 691 692 //if ($("#islocal").checked){ 693 // arrURI.push("islocal=true"); 694 //}else{ 695 // arrURI.push("islocal=false"); 696 //} 697 698 if ($.trim($("#srctxt").val())){ 699 arrURI.push("srctxt=" + URLEncode($.trim($("#srctxt").val()))); 700 } 701 702 /* General Stuff */ 703 if ($.trim($("#fmprice").val())){ 704 arrURI.push("fmprice=" + URLEncode($.trim($("#fmprice").val()))); 705 } 706 if ($.trim($("#toprice").val())){ 707 arrURI.push("toprice=" + URLEncode($.trim($("#toprice").val()))); 708 } 709 710 if ($.trim($("#fmyear").val())){ 711 arrURI.push("fmyear=" + URLEncode($.trim($("#fmyear").val()))); 712 } 713 if ($.trim($("#toyear").val())){ 714 arrURI.push("toyear=" + URLEncode($.trim($("#toyear").val()))); 715 } 716 717 if ($('[id^="color_"]:checked').length){ 718 var color = []; 719 $('[id^="color_"]:checked').each(function(index, element){ 720 color.push($(this).val()); 721 });
722 arrURI.push("color=" + color.join(",")); 723 } 724 725 if ($('[id^="condtn_"]:checked').length){ 726 var condtn = []; 727 $('[id^="condtn_"]:checked').each(function(index, element){ 728 condtn.push($(this).val()); 729 }); 730 arrURI.push("condtn=" + condtn.join(",")); 731 } 732 733 /* Real Estate - Rentals */ 734 if ($.trim($("#fmsqft").val())){ 735 arrURI.push("fmsqft=" + URLEncode($.trim($("#fmsqft").val()))); 736 } 737 if ($.trim($("#tosqft").val())){ 738 arrURI.push("tosqft=" + URLEncode($.trim($("#tosqft").val()))); 739 } 740 741 if ($.trim($("#fmbedrms").val())){ 742 arrURI.push("fmbedrms=" + URLEncode($.trim($("#fmbedrms").val()))); 743 } 744 if ($.trim($("#tobedrms").val())){ 745 arrURI.push("tobedrms=" + URLEncode($.trim($("#tobedrms").val()))); 746 } 747 748 if ($.trim($("#fmbthrms").val())){ 749 arrURI.push("fmbthrms=" + URLEncode($.trim($("#fmbthrms").val()))); 750 } 751 if ($.trim($("#tobthrms").val())){ 752 arrURI.push("tobthrms=" + URLEncode($.trim($("#tobthrms").val()))); 753 } 754 755 if ($("#alwcat").prop("checked")){ 756 arrURI.push("alwcat=1"); 757 } 758 if ($("#alwdog").prop("checked")){ 759 arrURI.push("alwdog=1"); 760 } 761 762 /* Jobs */ 763 if ($("#jobtype_telecommute").prop("checked")){ 764 arrURI.push("jobtype_telecommute=1"); 765 } 766 if ($("#jobtype_contract").prop("checked")){ 767 arrURI.push("jobtype_contract=1"); 768 } 769 if ($("#jobtype_internship").prop("checked")){ 770 arrURI.push("jobtype_internship=1"); 771 } 772 if ($("#jobtype_parttime").prop("checked")){ 773 arrURI.push("jobtype_parttime=1"); 774 } 775 if ($("#jobtype_fulltime").prop("checked")){ 776 arrURI.push("jobtype_fulltime=1"); 777 } 778 if ($("#jobtype_nonprofit").prop("checked")){ 779 arrURI.push("jobtype_nonprofit=1"); 780 } 781 782 /* Pay */ 783 if ($.trim($("#payfm").val())){ 784 arrURI.push("payfm=" + URLEncode($.trim($("#payfm").val()))); 785 } 786 if ($.trim($("#payto").val())){ 787 arrURI.push("payto=" + URLEncode($.trim($("#payto").val()))); 788 } 789 790 if ($("#paytype_hourly").prop("checked")){ 791 arrURI.push("paytype_hourly=1"); 792 } 793 if ($("#paytype_salary").prop("checked")){ 794 arrURI.push("paytype_salary=1"); 795 } 796 if ($("#paytype_commission").prop("checked")){ 797 arrURI.push("paytype_commission=1"); 798 } 799 if ($("#paytype_lumpsum").prop("checked")){ 800 arrURI.push("paytype_lumpsum=1"); 801 } 802 if ($("#paytype_other").prop("checked")){ 803 arrURI.push("paytype_other=1"); 804 } 805 806 /* Day */ 807 if ($.trim($("#datefm").val())){ 808 arrURI.push("datefm=" + URLEncode($.trim($("#datefm").val()))); 809 } 810 if ($.trim($("#dateto").val())){ 811 arrURI.push("dateto=" + URLEncode($.trim($("#dateto").val()))); 812 } 813 if ($.trim($("#timefm").val())){ 814 arrURI.push("timefm=" + URLEncode($.trim($("#timefm").val()))); 815 } 816 if ($.trim($("#timehh").val())){ 817 arrURI.push("timehh=" + URLEncode($.trim($("#timehh").val()))); 818 } 819 820 /* Transportation */ 821 if ($.trim($("#fmmileage").val())){ 822 arrURI.push("fmmileage=" + URLEncode($.trim($("#fmmileage").val()))); 823 } 824 if ($.trim($("#tomileage").val())){ 825 arrURI.push("tomileage=" + URLEncode($.trim($("#tomileage").val()))); 826 } 827 if ($.trim($("#mileagetype").val())){ 828 arrURI.push("mileagetype=" + URLEncode($.trim($("#mileagetype").val()))); 829 } 830 831 if ($('[id^="transportseller_"]:checked').length){ 832 var transportseller = []; 833 $('[id^="transportseller_"]:checked').each(function(index, element){ 834 transportseller.push($(this).val()); 835 }); 836 arrURI.push("transportseller=" + transportseller.join(",")); 837 } 838 839 /* Real Estate */ 840 if ($('[id^="propertyseller_"]:checked').length){ 841 var propertyseller = []; 842 $('[id^="propertyseller_"]:checked').each(function(index, element){ 843 propertyseller.push($(this).val()); 844 }); 845 arrURI.push("propertyseller=" + propertyseller.join(",")); 846 } 847 if ($('[id^="propertyrenter_"]:checked').length){ 848 var propertyrenter = []; 849 $('[id^="propertyrenter_"]:checked').each(function(index, element){ 850 propertyrenter.push($(this).val()); 851 }); 852 arrURI.push("propertyrenter=" + propertyrenter.join(",")); 853 } 854 855 /* Personals */ 856 if ($.trim($("#age").val())){ 857 arrURI.push("age=" + URLEncode($.trim($("#age").val()))); 858 } 859 if ($('[id^="idgender_"]:checked').length){ 860 var idgender = []; 861 $('[id^="idgender_"]:checked').each(function(index, element){ 862 idgender.push($(this).val()); 863 }); 864 arrURI.push("idgender=" + idgender.join(",")); 865 } 866 if ($('[id^="idagender_"]:checked').length){ 867 var idagender = []; 868 $('[id^="idagender_"]:checked').each(function(index, element){ 869 idagender.push($(this).val()); 870 }); 871 arrURI.push("idagender=" + idagender.join(",")); 872 } 873 if ($.trim($("#agefm").val())){ 874 arrURI.push("agefm=" + URLEncode($.trim($("#agefm").val()))); 875 } 876 if ($.trim($("#ageto").val())){ 877 arrURI.push("ageto=" + URLEncode($.trim($("#ageto").val()))); 878 } 879 if ($('[id^="skgender_"]:checked').length){ 880 var skgender = []; 881 $('[id^="skgender_"]:checked').each(function(index, element){ 882 skgender.push($(this).val()); 883 }); 884 arrURI.push("skgender=" + skgender.join(",")); 885 } 886 if ($('[id^="skagender_"]:checked').length){ 887 var skagender = []; 888 $('[id^="skagender_"]:checked').each(function(index, element){ 889 skagender.push($(this).val()); 890 }); 891 arrURI.push("skagender=" + skagender.join(",")); 892 } 893 894 /* 895 cookie.ft 896 setting here because I need a button to set the cookie 897 */
898 setCookie("ft", JSON.stringify(arrURI)); 899 900 /* 901 Wrap it up and return URI 902 */ 903 var outURI = ""; 904 var firstElement = false; 905 for (var i in arrURI){ 906 if (firstElement){ 907 outURI += "&" + arrURI[i]; 908 }else{ 909 outURI += "?" + arrURI[i]; 910 firstElement = true; 911 } 912 } 913 return outURI; 914 915}
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.