Created
May 8, 2014 17:02
-
-
Save viyatb/5e9603a27992cc866ab6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.clickbox = $.fn.clickbox || function () { | |
return this | |
}; | |
var shareListingOnFacebook = function () { | |
var c = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(window.location.href + "ts/fb/"); | |
window.open(c, "_blank", "resizable=1,toolbar=0,status=0,width=626,height=436") | |
}; | |
$(document).ready(function () { | |
$("#jsListView", "#listings-forsale-page").click(function (a) { | |
return !1 | |
}); | |
$("#searchtype").change(function () { | |
$(this).closest("form").submit() | |
}); | |
$("#slide-img").click(function (a) { | |
a.preventDefault(); | |
a = $("a[@rel=gallery-listing-images]", "#listingSlideShow").get(0); | |
tb_show(a.title || a.name || null, a.href || a.alt, a.rel || !1) | |
}); | |
$("#addListing", ".view-listing-buttons").click(function (a) { | |
a.preventDefault(); | |
$("body").append('<form id="jsAddListingForm" action ="' + this.href + '" method="post"><input type="hidden" name="formredirect" value="' + | |
(window.location.pathname + window.location.hash) + '" /></form>').find("#jsAddListingForm").submit() | |
}); | |
if (0 < $("#listingCarousel").length) { | |
var c = function (a) { | |
var b = 1; | |
a = a ? $("div img", a) : []; | |
a.length && (b = a.attr("id").split("_")[1]); | |
$("#imagePagerIndex").text(b) | |
}; | |
c(); | |
$.fn.jCarouselLite && setTimeout(function () { | |
$("#listingCarousel").jCarouselLite({ | |
btnNext: "#nextImageControl", | |
btnPrev: "#prevImageControl", | |
visible: 1, | |
circular: !1, | |
afterEnd: c | |
}) | |
}, 300); | |
$("img.carouselImg", "#listingCarousel").click(function (a) { | |
a.preventDefault(); | |
a = this.src || this.href || null; | |
var b = this.rel || !1; | |
a = a.replace(/\/FEATURED\/([A-Za-z0-9]+)\//g, "/FEATURED/$1/f_"); | |
tb_show(null, a, b) | |
}) | |
} | |
$("#resultSortControls #filterLaunchButton").click(function (a) { | |
a.preventDefault(); | |
a = "/featuredlistings/"; | |
var b = $("#propertytypeSelect").val(); | |
b && (a += "propertytype/" + b + "/"); | |
window.location.href = "http://" + location.host + a | |
}); | |
var l = function (a) { | |
a.preventDefault(); | |
a.stopPropagation(); | |
a = $(a.currentTarget); | |
var b = a.closest(".property-actions"), | |
c = b.data("property"); | |
$("#signInLink").length ? | |
c && ($("body").find("#jsAddListingForm").remove().end().append('<form id="jsAddListingForm" action ="/forms/prospectlisting/save/' + c + '" method="post"><input type="hidden" name="formredirect" value="' + window.location.href + '" /></form>'), $(window).trigger("open_regform", { | |
trigger: "resvpr", | |
property: c, | |
triggerAfterSignin: !0 | |
}, a)) : $("#signOutLink").length && $.post("/ajax/prospectlisting/save/" + c, function (a) { | |
a = new Envelope(a); | |
var c = b.find(".saveProp, .savedProp, .rateProp").hide(); | |
if (a.payload && "infoMessage" == | |
a.payload["class"]) { | |
3 == c.length ? c.filter(".savedProp").show() : c.filter(".rateProp").show().find(".selected").removeClass("selected"); | |
var s = $("#messageWrapper").find(".message:last").find(".js-delete-uimessage"); | |
setTimeout(function () { | |
s.trigger("click") | |
}, 5E3) | |
} else c.filter(".saveProp").show() | |
}) | |
}, | |
f = function (a) { | |
a.preventDefault(); | |
a.stopPropagation(); | |
var b = $(a.currentTarget).closest(".property-actions"); | |
a = b.data("property"); | |
$("#signOutLink").length && a && $.post("/ajax/prospectlisting/delete/" + a, function (a) { | |
a = | |
new Envelope(a); | |
var c = b.find(".saveProp, .savedProp, .rateProp").hide(); | |
if (a.payload && "infoMessage" == a.payload["class"]) { | |
c.filter(".saveProp").show(); | |
var m = $("#messageWrapper").find(".message:last").find(".js-delete-uimessage"); | |
setTimeout(function () { | |
m.trigger("click") | |
}, 5E3) | |
} else c.filter(".savedProp").show() | |
}) | |
}, | |
e = function (a) { | |
a.preventDefault(); | |
a.stopPropagation(); | |
var b = $(a.currentTarget); | |
if (b.hasClass("unsave")) f(a); | |
else { | |
a = b.index() + 1; | |
var c = b.closest(".property-actions"), | |
g = c.data("property"), | |
m = c.find(".rateProp"), | |
d = m.find(".selected").removeClass("selected").length; | |
m.find("div:lt(" + a + ")").addClass("selected"); | |
$("#signOutLink").length && g && $.ajax({ | |
type: "POST", | |
url: "/ajax/prospectlisting/save/" + g + "rating/" + (1 + b.index()) + "/", | |
success: function (a) { | |
a = new Envelope(a); | |
if (a.payload && "infoMessage" == a.payload["class"]) { | |
var b = $("#messageWrapper").find(".message:last").find(".js-delete-uimessage"); | |
setTimeout(function () { | |
b.trigger("click") | |
}, 5E3) | |
} else m.find(".selected").removeClass("selected").end().find("div:lt(" + d + ")").addClass("selected") | |
} | |
}) | |
} | |
}, | |
h = function (a) { | |
a = $(a.currentTarget); | |
var b = a.index(); | |
a.hasClass("unsave") || a.parent().find("div").each(function (a, c) { | |
a < b ? $(c).addClass("hvr") : $(c).removeClass("hvr") | |
}) | |
}, | |
k = function (a) { | |
$(a.currentTarget).parent().find(".hvr").removeClass("hvr") | |
}; | |
$.fn.hook_up_controls = function () { | |
return this.find(".saveProp > a").unbind("click.ls").bind("click.ls", l).end().find(".savedProp > a").unbind("click.ls").bind("click.ls", f).end().find(".rateProp > a > div").unbind("click.ls").bind("click.ls", e).unbind("mouseenter.ls").bind("mouseenter.ls", | |
h).unbind("mouseleave.ls").bind("mouseleave.ls", k).end().find(".saveProp, .savedProp, .rateProp, .rateProp > a").unbind("click.ls").bind("click.ls", function (a) { | |
$(this).find("a").trigger("click"); | |
return !1 | |
}).end() | |
}; | |
$(".view-listing-titledetails").hook_up_controls(); | |
if (0 < $("#resultsListContainer").length) { | |
var d = function (a) { | |
a.preventDefault(); | |
a = encodeString($("#resultSortBySelect").val()); | |
var b = ("" + window.location.href).split("?"), | |
c = (b[1] || "").replace(/(^|&)conv=[^&]*/, "").replace(/^&+/, ""), | |
b = b[0].replace(/\/+$/, | |
"").replace(/\/pgn\/[^\/]+/, "").replace(/\/sort\/[^\/]+/, "").replace(/\/*$/, "/"); | |
"price+desc" !== a && (b += "sort/" + a + "/"); | |
c && (b += "?" + c); | |
$(window).location({ | |
url: b, | |
delay: 0 | |
}) | |
}; | |
$("#resultSortControls #sortLaunchButton").click(d).length || $("#resultSortControls #resultSortBySelect").change(d); | |
d = { | |
div: '<div class="clickbox" style=""> <div class="x" style="float:right; cursor:pointer; display:inline-block;"><span>X</span></div> <div class="view-details-btn" style="float:right; cursor:pointer; display:inline-block;"><span>View Details</span></div> <div class="y" style=""/></div>', | |
margin_middle: -140, | |
margin_left: 110, | |
show_cb: function (a, b, c) { | |
var g = $(b); | |
b = g.attr("id"); | |
var d = RegExp(b, "g"), | |
n = g.attr("src"), | |
f = RegExp(n, "g"), | |
e = g.clone().removeAttr("data-count").removeAttr("class").removeAttr("alt").wrap("<p>").parent().html(), | |
h = parseInt(g.attr("data-count") || 0, 10) - 1, | |
k = $('<div class="ad-gallery-no-thumbs"><div class="ad-image-wrapper frame"/><div class="photo-count"/><div class="ad-controls"/><div class="ad-nav frame"><div class="ad-thumbs"/></div></div>'), | |
l = k.find(".ad-thumbs").append('<ul class="ad-thumb-list"/>').find("ul"); | |
$("<li/>").append("<a/>").find("a").attr("href", n).append(e.replace(d, b + "-00")).end().appendTo(l); | |
for (var p = 0; p < h; p++) { | |
var q = (9 > p ? "0" : "") + (p + 1), | |
r = n.match(/no_listing_image\.jpg$/) ? n : n.replace(/\.([^.]+)$/, "_" + q + ".$1"), | |
q = b + "-" + q; | |
$("<li/>").append("<a/>").find("a").attr("href", r).append(e.replace(d, q).replace(f, r)).end().appendTo(l) | |
} | |
$(a).find(".view-details-btn").unbind("click.cb").bind("click.cb", function (a) { | |
$(window).location(c, a) | |
}).end().find(".x").unbind("click.cb").bind("click.cb", function (a) { | |
g.trigger("hide.clickbox") | |
}).end().find(".y").empty().append(k).find(".ad-gallery-no-thumbs").adGallery({ | |
height_padding: 2, | |
width_padding: 2 | |
}) | |
} | |
}; | |
$(".jsListingSummary").unbind("click.ls").bind("click.ls", function (a) { | |
a.preventDefault(); | |
a.stopPropagation(); | |
var b = $(a.currentTarget), | |
c = b.data("searchtype"), | |
d = b.offset(), | |
d = Math.round(a.pageX - d.left), | |
e = b.find(".photo img:first"), | |
f = parseInt(e.attr("data-count") || 0, 10), | |
b = b.find(".jsListingSummaryLink").attr("href"); | |
1 > f || 130 < d || "forsale" != c ? (a = "forsale" != c || a.ctrlKey || a.metaKey || a.button, $(window).trigger("listing_summary_click").location({ | |
url: b, | |
open: a | |
})) : e.trigger("show.clickbox", [b]) | |
}).find(".photo img:first").clickbox(d); | |
d.margin_left = 200; | |
$(".jsMyProperties > li").find(".photo img:first").clickbox(d).unbind("click.ls").bind("click.ls", function (a) { | |
a.preventDefault(); | |
var b = $(a.currentTarget).parent().attr("href"); | |
b && $(a.currentTarget).trigger("show.clickbox", [b]) | |
}); | |
$("#resultsList").find(".listing").unbind("mouseenter.ls").bind("mouseenter.ls", function () { | |
$(this).addClass("selected") | |
}).unbind("mouseleave.ls").bind("mouseleave.ls", function () { | |
$(this).removeClass("selected") | |
}).hook_up_controls() | |
} | |
$("#saveSearch").bind("after_regform", | |
function () { | |
openSaveSearch() | |
}) | |
}); | |
function openSaveSearch() { | |
var c = "/savesearch/", | |
l = $("#REAreaSearch").val().replace(/ /g, "+").replace(/\(/g, "%28").replace(/\)/g, "%29"), | |
f = $("#listings-property-type").val(), | |
e = $("#minprice").val().replace(/[^0-9]+/g, ""), | |
h = $("#maxprice").val().replace(/[^0-9]+/g, ""), | |
k = $("#listings-beds").val(), | |
d = $("#listings-baths").val(), | |
a = $("#listings-acreage").val(), | |
b = $("#listings-sqft").val(), | |
c = c + "location/" + l + "/"; | |
"" != f && (c = c + "propertytype/" + f + "/"); | |
"" != e && 0 < e && (c = c + "minprice/" + e + "/"); | |
"" != h && 0 < h && (c = c + "maxprice/" + | |
h + "/"); | |
"" != k && (c = c + "beds/" + k + "/"); | |
"" != d && (c = c + "bathstotal/" + d + "/"); | |
"" != a && (c = c + "minacres/" + a + "/"); | |
"" != b && (c = c + "minsqft/" + b + "/"); | |
tb_show("", c + "?TB_iframe=true&height=450&width=625", null) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment