$('#listLeft ul li a').live("click", function() { if ($(this).hasClass("listLeftSelected")) { return false; } $('.listLeftSelected').removeClass("listLeftSelected"); $(this).addClass('listLeftSelected'); var objId = $(this).attr("data-id"); var tab = $('.innerSelected').attr("data-slug"); var formData = getSearchFormJSON(); $('#textRight').text("Loading..."); $('#bottomRight').text("Loading..."); formData.object_id = objId; var urlString = JSONtoQueryString(formData); History.pushState(formData, "", urlString); $.getJSON("/m/get_details", { 'tab': tab, 'object_id': objId }, function(data) { $('#imageInside').css({'backgroundImage': 'url(' + data.main_image.thumb + ')'}); $('#textRight').text(data.title).formatTitle(); var url = location.protocol + "//" + location.hostname + location.pathname + "?tab=" + $('.innerSelected').attr("data-slug") + "&object_id=" + objId; var fb_url = url.replace("&", "&"); $('#fb_like').attr("data-href", fb_url); $('#permalinkBtn').attr("href", url); var searchTerm = $('.searchListField').val(); var html = data.html; if (searchTerm != '') { for (var i=0; i" + searchTerm + ""); } $('#bottomRight').html(html); // console.log(data); }); return false; }); $('.lightboxNext').live("click", function(e) { var $i = $(this).data("image"); $i.click(); }); $('.lightboxPrev').live("click", function(e) { var $i = $(this).data("image"); $i.click(); }); $('.thumbsDetails').live("click", function(e) { // alert($(this).attr("data-bigimage")); var that = this; var totalImages = $(this).parent().find(".thumbsDetails").length; var thisIndex = $(this).index(); if (thisIndex < (totalImages - 1)) { var hasNext = true; var nextImage = $(this).parent().find(".thumbsDetails").eq(thisIndex + 1); } if (thisIndex > 0 && totalImages > 1) { var hasPrev = true; var prevImage = $(this).parent().find(".thumbsDetails").eq(thisIndex - 1); } var bigImage = $(this).attr("data-bigimage"); var $img = $('').attr("src", bigImage); showLightbox($img); var title = $(this).hasAttr("title") ? $(this).attr("title") : ''; var $c = $('#lightboxContent'); var $cont = $('
').addClass("lightboxContainer").appendTo($c); if (title != '') { var $caption = $('
').addClass("lightboxCaption").text(title).appendTo($cont); } if (hasNext) { var $next = $('
').addClass("lightboxNext").text("next").data("image", nextImage).appendTo($cont); } if (hasPrev) { var $prev = $('
').addClass("lightboxPrev").text("prev").data("image", prevImage).appendTo($cont); } }); function hideLightbox() { $('#lightbox, #lightboxPanel').fadeOut(400); } function showLightbox($content) { if (!$('#lightbox').is("visible")) { $('#lightbox, #lightboxPanel').fadeIn(400); } $('#lightboxContent').empty().append($content); } $('.toggleNext').live("click", function(e) { e.preventDefault(); var $next = $(this).next(); if (!$next.is(":visible")) { $next.slideDown(); } else { $next.slideUp(); } }); function highlightWordsNoCase(data, word) { var regex = new RegExp("(" + word + ")", "gi"); return data.replace(regex, "$1"); } /* Get a jquery