$('#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); var searchTerm = $('.searchListField').val(); var html = data.html; if (searchTerm != '') { html = highlightWordsNoCase(html, searchTerm); // html = html.replace(searchTerm, "" + searchTerm + ""); } $('#bottomRight').html(html); // console.log(data); }); return false; }); $('.thumbsDetails').live("click", function(e) { // alert($(this).attr("data-bigimage")); var that = this; var bigImage = $(this).attr("data-bigimage"); var $img = $('').attr("src", bigImage); showLightbox($img); var title = $(this).hasAttr("title") ? $(this).attr("title") : ''; if (title != '') { var $caption = $('
').addClass("lightboxCaption").text(title).appendTo($('#lightboxPanel')); } }); function hideLightbox() { $('#lightbox, #lightboxPanel').fadeOut(400); } function showLightbox($content) { $('#lightbox, #lightboxPanel').fadeIn(400); $('#lightboxPanel').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 ').val(s.operator + s.field_name).text(s.friendly_name); } /* Get a Jquery List Row object for an item - requires item.id and item.title*/ function getLi(item) { var titleLength = 30; var $li = $('').addClass("tabListItem"); var $a = $('').attr("href", '#').attr("data-id", item.id).appendTo($li); // console.log(item.title.length); var $span = $('').text(item.title).appendTo($a); return $li; } $(function() { $('#lightbox').click(function() { hideLightbox(); }); /* search button toggle */ $('.searchInnerField').hide(); $('#searchInner').toggle(function() { $('.searchInnerField').slideDown(); }, function() { $('.searchInnerField').slideUp(); }); /* search button end */ $('#aboutBtn').click(function() { var about = $('#moduleAbout').html(); var $content = $('').addClass("aboutLightbox").html(about); showLightbox($content); }); $('#addBtn').click(function() { var add = $('#moduleAdd').html(); var $content = $('').addClass("addLightbox").html(add); showLightbox($content); }); // $('#listLeft ul li a').eq(0).click(); // alert("hi"); $('.tabCategory').click(function() { var $this = $(this); if ($this.hasClass('.innerSelected')) { return false; } $('.innerSelected').removeClass("innerSelected"); $this.addClass("innerSelected"); $('.displayedTab').removeClass("displayedTab"); var tab = $this.attr("data-slug"); var tabId = $this.attr("data-id"); $('#tabText_' + tabId).addClass("displayedTab"); doListLoading(); $.getJSON("/m/get_tab", { 'tab': tab, // 'page_no': 1 }, function(data) { // $('#loadingList').hide(); // stopListLoading(data.page); /* begin if for has_list, ideally make into separate render function */ if (data.has_list) { /* handle sort options on list */ $select = $('#orderBySelect'); $select.empty(); var sorts = data.sorts; if (sorts.length == 0) { $select.hide(); } else { $select.show(); } for (var j=0; j