").html(message)
)
).append(
$("
").addClass("indexerrornub")
).
//offset({ top: (pos.top-30), left: pos.left})
attr("style", "position:absolute;top:"+(pos.top)+"px; left:"+pos.left+"px;")
.click(function(){$(this).slideUp(function(){$(this).remove();})});
if($(selector).parents("form").length > 0){
warn.appendTo($(selector).parents("form"));
}else{
warn.appendTo($(selector));
}
/*.doTimeout(5000, function(){
$(this).slideUp(function(){
$(this).remove();
});
});*/
}
function loadUrl(u){u =u.toString();if(window.location.href==u){window.location.reload();}else{window.location.href=u;}}
(function($)
{
/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
*
*
* @param f onMouseOver function || An object with configuration options
* @param g onMouseOut function || Nothing (use configuration options object)
* @author Brian Cherne
*/
$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))
').addClass('wait').prependTo(this);
}
})(jQuery);
$().ready ( function()
{
/*nav*/
/*$('#infobox-account').click(function(){$(this).find('ul').toggle();});*/
$('.infobox-container').click(function(e){
e.stopPropagation();
$(this).toggleClass("selected").find('ul').toggle();
});
$("html").click(function(){
if($(".infobox-container ul").is(":visible")){
$(".infobox-container ul").toggle(false).parents(".infobox-container").removeClass("selected");
}
if($("#invite-request").is(":visible")){
$("#invite-request").toggle(false).removeClass("activeOpen");
}
if($(".FeedActions").is(":visible")){
$(".FeedActions").toggle(false);
$(".gearIcon").removeClass("on");
}
if($("#messageDropdownBox").is(":visible")){
$("#messageDropdownBox").toggle();
$("#messageDropdown").removeClass("stayOn");
}
if($("#friendDropdownBox").is(":visible")){
$("#friendDropdownBox").toggle();
$("#friendDropdown").removeClass("stayOn");
}
$(".toBrandDropdown").each(function(){
if($(this).hasClass("show")){
$(".toBrandDropdown").removeClass("show");
$(this).siblings(".toBrandTrigger").children(".toBrandNub").removeClass("dropActive");
}
});
});
/*
submenu
*/
$('.nav').hoverIntent(function()
{
$(this).find('.subnav').stop(true,true).fadeIn(600);
},
function()
{
$(this).parent().find('.subnav').hide();
});
$('.nav').hover(function()
{
$(this).addClass('hover');
//$(this).siblings().addClass('inherit');
},
function()
{
$(this).removeClass('hover');
//$(this).siblings().removeClass('inherit');
});
/*
invite request on homepage
*/
var defnav = $('.defaultnav li');
var inviteRequest = $('#invite-request');
$(defnav).hover(function(){
if(!$(inviteRequest).is(':visible') ){
$(inviteRequest).toggle(true).addClass("activeOpen");
}
}, function(){
if($(inviteRequest).is(':visible') && !$(inviteRequest).hasClass("activeOpen")){
$(inviteRequest).toggle(false);
}
});
var inviteInput = $(inviteRequest).find('input');
$(inviteInput).click(function(){
//$(inviteRequest).find('#inviteerrorwrap').fadeOut();
});
/*
$("#invite-request form").submit(function(){
//Validate required fields
var input = $(this).find('input');
if (input.val() == "") {
input.addClass("empty");
var errorWrap = $('#inviteerrorwrap');
$(errorWrap).find('.indexerrortext').html('Please fill out all required fields');
$(errorWrap).fadeIn(750);
}
if ($(":input").hasClass("empty")) {
return false;
} else {
return true;
}
});
*/
/*
thumbs
*/
$('#page').on( 'mouseenter', '.thumb', function(){
if($(this).hasClass('active')){
// do nothing
} else {
var th = $(this);
// rollover states
$(this).find('.shade').stop(true).animate({'background-position':'120',duration:1000});
$(this).find('.fadeout').hide();
$.doTimeout(300, function(){
th.find('.popin').css("display", "block");
});
$(this).find('.fadeout:not(.popout)').hide();
$(this).find('.fadein:not(.popin)').stop(true, true).fadeIn('fast');
$(this).find('.subline span').toggle();
$(this).find('.indexlabel .indexIcon').animate({
opacity: 1,
filter: 'alpha(opacity=100)'
});
if ($(this).hasClass('completed')){
$(this).find('.icon-top').hide();
$(this).find('.action').fadeIn('fast');
}
}
});
$('#page').on( 'mouseleave', '.thumb', function(){
if($(this).hasClass('active')){
// do nothing
} else {
// rollout states
$(this).find('.popin').css("display", 'none');
$(this).find('.shade').animate({'background-position':'0',duration:300});
$(this).find('.fadein:not(.popin)').fadeOut('fast');
$(this).find('.fadeout:not(.popout)').stop(true, true).fadeIn('fast');
$(this).find('.subline span').toggle();
$(this).find('#abortError, #readyError').hide();
$(this).find('.indexlabel .indexIcon').animate({
opacity: .2,
filter: 'alpha(opacity=20)'
});
if ($(this).hasClass('completed')){
$(this).find('.action').hide();
$(this).find('.icon-top').fadeIn('fast');
}
}
});
$('.thumb.hover-block.cocreate').click(function(){
//$(this).find('.fadein').hide();
//$(this).find('.fadeout').fadeIn();
});
$('.delete-cookie').click(function()
{
$(this).hide();
$(this).siblings('div').toggle();
});
$('.delete-cookie-cancel').click(function()
{
$(this).parents('.overlay').find('div').toggle();
$(this).parents('.overlay').find('.delete-cookie').show();
});
var wrappedThumb = $('.thumbWrap .thumb');
wrappedThumb.mouseenter(function(){
$(this).parent().css('background','url(images/arrow-right-gray.gif) 214px 135px no-repeat');
});
wrappedThumb.mouseleave(function(){
$(this).parent().css('background','none');
});
/*
co-create thumbs
*/
var levelOneBlock = $('#level-1 .thumb.hover-block');
levelOneBlock.click(function(){
$('#level-1 .thumb.hover-block.active').removeClass('active');
$(this).addClass('active');
levelOneBlock.each(function(){
if ($(this).hasClass('active')){
$(this).removeClass('overlayCover');
} else {
$(this).addClass('overlayCover');
$(this).find('.shade').animate({'background-position':'0',duration:300});
}
});
});
// var levelTwoBlock = $('.request .thumbs .hover-block');
// console.log(levelTwoBlock);
$('#page').on("click", ".request .thumbs .form-thumb", function(){
$('.request .thumbs .form-thumb.active').removeClass('active');
$(this).addClass('active');
$('.request .thumbs .form-thumb').each(function(){
if ($(this).hasClass('active')){
//$(this).removeClass('overlayCover');
} else {
//$(this).addClass('overlayCover');
$(this).find('.shade').animate({'background-position':'0',duration:300});
$(this).find('.shade').animate({backgroundPosition:'0px 0px',duration:300});
$(this).find('.fadein').fadeOut('fast');
$(this).find('.fadeout').show();
$(".hideSoon").show();
$(this).find('.subline span').toggle();
}
});
});
var overlayCover = $('.cover');
overlayCover.mouseenter(function(){
$(this).stop(true, true).fadeTo("normal",0);
});
overlayCover.mouseout(function(){
$(this).stop(true, true).fadeTo("normal",.75);
});
$("#page").on("mouseenter", '.trigger', function()
{
$(this).parent().find('.shade').stop().animate({backgroundPosition:'110px 0px',duration:1000});
$(this).find('.fadeout').hide();
$(this).parent().find(".hideSoon").hide();
$(this).parent().find('.fadein').fadeIn('fast');
$(this).find('.subline span').toggle();
});
$("#page").on("mouseleave", '.trigger', function()
{
$(this).parent().find('.shade').animate({backgroundPosition:'0px 0px',duration:300});
$(this).parent().find('.fadein').fadeOut('fast');
$(this).find('.fadeout').show();
$(this).parent().find(".hideSoon").show();
$(this).find('.subline span').toggle();
});
/*
countdowns
*/
$('.countdown').each(function()
{
var cd = $(this).attr('id') * 1000;
var div = $(this);
$(this).countdown(
{
until:new Date(cd),
format:'YOWDHMS',
significant:1,
layout:'{y<}{yn} {yl} {y>}{o<}{on} {ol} {o>}{w<}{wn} {wl} {w>}{d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>} {desc}',
description:'left',
onExpiry:function(){$('#add').hide();$('#countdown').hide();div.hide().html('');}
});
});
$('#countdown').hover(function()
{
$(this).find('div').toggle();
});
$('.countup').each(function()
{
var cd = $(this).attr('id') * 1000;
var div = $(this);
$(this).countdown(
{
since:new Date(cd),
format:'YOWDHMS',
significant:1,
layout:'{y<}{yn} {yl} {y>}{o<}{on} {ol} {o>}{w<}{wn} {wl} {w>}{d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>} {desc}',
description:'ago'
});
});
/*
users
*/
/*
//no longer needed if brand/profile info no longer in popups
$('.profile').click(function()
{
var loc=$(this).attr('href');
$('
').addClass('popup-overlay').prependTo('body');
$.ajax(
{
url:loc,
dataType:'json',
data:[{name:'JSON',value:1}],
success:function(d)
{
$('#profile-popup-inner').html(d.body);
$('#profile-popup').fadeIn('fast');
}
});
return false;
});
*/
$('.selectable .portrait').hoverIntent(function()
{
$(this).addClass('portrait-selected').find('.detail').show();
//$(this).find('.remove').show();
},
function()
{
$(this).removeClass('portrait-selected').find('.detail').hide();
});
$('.remove').click(function()
{
var div = $(this);
var disp = div.parents('.row');
$.ajax(
{
url:div.attr('href'),
dataType:'json',
data:[{name:'JSON',value:1}],
success:function(d)
{
disp.fadeOut(400);
var prev = disp.prev();
if ( prev.hasClass('section') && disp.next().hasClass('section') )
{
prev.fadeOut(400);
}
$('#'+div.attr('ref')).updatecount(-1);
$('#membercount').updatecount(-1);
}
});
return false;
});
$('.invite').click(function()
{
var disp=$(this).parents('.row');
var loc=$(this).attr('href');
disp.find('.invitewrap').remove();
$.ajax(
{
url:loc,
dataType:'json',
data:[{name:'JSON',value:1}],
success:function(d)
{
disp.find('.overlay').remove();
disp.find('.username').addClass('username-selected');
$('#membercount').updatecount(1);
$('#membercount_1').updatecount(1);
}
});
return false;
});
$('.tabs-head span,.tabs-head-close').click(function()
{
var div=$(this).parent();
div.find('.tabs-head-close').toggle();
div.toggleClass('tabs-head-open');
div.next('.tabs-body').slideToggle('fast');
$('#password').focus();
return false;
});
/*
request
*/
/**
* Event handler for filter dropdown
*/
/* //@todo this was for request popup - no longer needed
$(document).on('click','.popup .filterwrap li a',function(e){
request_popup_ajax( this.href )
return false;
});
$(document).on('click','.popup #listing-switch',function(){
request_popup_ajax( this.href )
return false;
});
$(document).on('click','.popup #filter-search',function(){
search= $('#filter-search-text').val();
var url = 'request?search=' + search;
request_popup_ajax( url )
return false;
});
function request_popup_ajax( url )
{
$.ajax(
{
url:url,
dataType:'json',
data:[{name:'JSON',value:1}],
success:function(d)
{
$('#request-popup-inner').html(d.body);
$('#request-popup').fadeIn('fast');
}
});
}
//explore
$('#request').click(function()
{
$('
').addClass('popup-overlay').prependTo('body');
$('#request-popup').fadeIn('fast');
$.ajax(
{
url:'request',
dataType:'json',
data:[{name:'JSON',value:1}],
success:function(d)
{
$('#request-popup-inner').html(d.body);
$('#request-popup').fadeIn('fast');
}
});
return false;
});
*/
/*
explore
*/
/*
$('a.give-feedback').click(function(){
var loc=$(this).attr('href');
var closePopup = function(){
$('#feedback-popup').fadeOut('fast');
$('.popup-overlay').remove();
$(window).unbind('keydown', onKeyPressed);
}
var onKeyPressed = function(e) {
if (e.which == 27) {
closePopup();
}
}
$('
').addClass('popup-overlay').prependTo('body');
$.ajax(
{
url:loc,
dataType:'json',
success:function(d)
{
$('#feedback-popup-inner').html(d.body);
$('#feedback-popup').fadeIn('fast').offset({'top': 160});
$(window).scrollTop(140);
//make sure events bound to any close buttons in ajaxed html
$('.popup-close,.popup-close-button').click(closePopup);
$(window).bind('keydown', onKeyPressed);
//ensure hover animation on popup thumbnail
$('#feedback-popup .thumb').hover(function()
{
$(this).find('.shade').stop(true).animate({backgroundPosition:'110px 0px',duration:1000});
},
function()
{
$(this).find('.shade').animate({backgroundPosition:'0px 0px',duration:300});
});
/*
//enable star rating
$('.rating-area .rating-star').hover(function(){
$(this).siblings().removeClass('top on');
$(this).prevAll().addClass('on');
$(this).addClass('on top');
}).click(function(){
console.log("5");
var ix = $('.rating-area .rating-star').index($(this));
$('input.star-index').val(ix);
});
$('.rating-area').mouseleave(function(){
var idx = $('input.star-index').val();
if (idx!=null && idx>=0) {
var top = $($(this).find('.rating-star')[ idx ]);
top.nextAll().removeClass('top on');
top.prevAll().addClass('on').removeClass('top');
top.addClass('on top');
} else {
$(this).find('.rating-star').removeClass('on top');
}
});*/
/*
//set up ajax submission
$('form#feedback-submit').submit(function(e){
e.preventDefault();
var form = $(this);
var data = form.serialize();
var itemID = $('form#feedback-submit input#item-id').val();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'feedback/' + itemID,
data: data,
success: function(data, textStatus, jqXHR){
console.log('ajax success!');
//validation succeeded, close popup and remove item
if (data.validation && data.validation.success) {
console.log('validation succeeded.');
closePopup();
$('#p' + itemID + '.thumb').fadeOut('slow', function(){$(this).remove()});
}
//validation failed, insert error messages
else {
console.log('validation failed.');
$('p.validation-error').addClass('stale');
$.each(data.validation.errors, function(qid, message){
existing_msg = $('#'+qid).parent().siblings().find('p.validation-error');
if (existing_msg.length == 1) {
existing_msg.text(message).removeClass('stale');
} else {
$('#'+qid).parent().siblings('label').append($('
'+ message +'
'));
}
});
$('p.validation-error.stale').slideUp(function(){$(this).remove()});
$('p.validation-error').slideDown().removeClass('hidden');
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.log('ajax error');
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
}
});
});
}
});
return false;
});
*/
/*
generic popup/alert functions
*/
$(document).on('click','#popup-close',function()
{
$(this).parent().fadeOut('fast');
$('.popup-overlay').remove();
});
$(document).on('click','.alert-close',function()
{
$(this).parent().slideUp('fast');
});
/*
list
$('.options a').click(function()
{
var disp=$(this).parents('.status').find('.display');
var ul=$(this).parents('.options');
var loc=$(this).attr('href');
disp.html('- PLEASE WAIT -').addClass('declined');
$.ajax(
{
url:loc,
dataType:'json',
data:[{name:'JSON',value:1}],
success:function(d)
{
disp.html('- '+d.status+' -');
ul.hide();
}
});
return false;
});
$('.select').live('click',function()
{
$(this).siblings('.options').toggle();
});
$('.select').append('
');
*/
/*
forms
*/
if (document.createElement("input").placeholder == undefined) {
$('.placeholder').placeholder();
}
/*
wishlist
*/
/*
$('.wishlist').click(function()
{
var disp=$(this).parents('.row');
var loc=$(this).attr('href');
$('.lists').wait();
$.ajax(
{
url:loc,
dataType:'json',
data:[{name:'JSON',value:1}],
success:function(d)
{
disp.find('.username').toggleClass('username-selected',d.select);
$('.lists').wait(true);
}
});
return false;
});
*/
/*
messages
*/
$(document).on('click', '.new-message-container input#submit', function()
{
var messageContainer = $(this).parents('.new-message-container');
var form = messageContainer.find('form');
var textarea = form.find('textarea#new-message');
var message = textarea.val();
if ( message != null && message.length > 0 ) {
var loc= form.attr('action');
$.ajax(
{
url:loc,
dataType:'json',
data:form.serialize(),
type: 'POST',
success:function(d)
{
var msglist = messageContainer.siblings('.message-list');
msglist.prepend(d.body);
msglist.find('.hidden.message').slideDown('fast').removeClass('hidden');
textarea.val('');
}
});
}
return false;
});
});