jQuery(document).ready(function($) { $('input#searchbox').example('search'); $('#menu-login').click(function(){location.href='/auth/login/'}); $('#menu-sell').click(function(){location.href='/sell/'}); $('#menu-buy').click(function(){location.href='/explore/'}); $('#menu-user').click(function(){location.href='/account/profile/'}); $('#menu-account').click(function(){location.href='/account/'}); $('#menu-messages').click(function(){location.href='/messages/'}); $('#menu-cart').click(function(){location.href='/cart/'}); $('#menu-downloads').click(function(){location.href='/download/'}); $('.topmenu .topmenulabel').hide(); $('.topmenu').each(function(idx,elem){ var $elem = $(elem); $elem.mouseenter(function(){ $elem.children('.topmenuicon').animate({ 'top':'-10' }); $elem.children('.topmenulabel').fadeIn(); }); $elem.mouseleave(function(){ $elem.children('.topmenuicon').animate({ 'top':'0' }); $elem.children('.topmenulabel').fadeOut(); }); }); $('#menu-search').click(function(event){ window.isanimating = true; event.stopPropagation(); $('.topmenu').filter("div:not(#menu-search)").animate({ 'opacity':0 },500,function(){ $('#menu-search').animate({ 'left':-277 },500,function(){ $('#searchform').fadeIn(500,function(){ $('#searchtext').focus(); window.isanimating = false; }); }); }); }); $('#search-cancel').click(function(event){ event.stopPropagation(); if (window.isanimating == true) {alert('boo');return false;} window.isanimating = true; $('#searchform').fadeOut(500,function(){ $('#menu-search').animate({ 'left':0 },500,function(){ ($('.topmenu').filter("div:not(#menu-search)")).animate({ 'opacity':100 },500,function(){ // console.log('done'); }); window.isanimating = false; return false; }); return false; }); return false; }); $('.languagechangelink').click(function(){ var ll = new Modalbox({ }); ll.ajaxcontents({ 'url':'/dialogs/choose_language.php', 'success':function(){ if ($('#changelanguagecancel').length > 0) { $('#changelanguagecancel').click(function(){ ll.close(); //$('#changecurrencycancel').parents('.modalbox_container').data('modalobj').close(); return false; }); } if ($('.changelanguagesave').length > 0){ $('.changelanguagesave').each(function(idx,elem){ $elem = $(elem); var datajson = $elem.getJsonFromClass(); var subdom = datajson.subdomain; var path = window.location.href.slice(window.location.href.indexOf('scubbly.com') + 11); var url = 'http://' + subdom + '.scubbly.com' + path; $elem.attr('href',url); }); $('.changelanguagesave').click(function(){ location.href = $(this).attr('href'); return false; }); } } }); return false; }); $('.currencychangelink').click(function(){ var cc = new Modalbox({ }); cc.ajaxcontents({ 'url':'/dialogs/choose_currency.php', 'success':function(){ if ($('#changecurrencycancel')) { $('#changecurrencycancel').click(function(){ cc.close(); //$('#changecurrencycancel').parents('.modalbox_container').data('modalobj').close(); return false; }); } if ($('#changecurrencysave')){ $('#changecurrencysave').click(function(){ $.ajax({ 'url':'/dialogs/choose_currency_ajax.php', 'data':{ 'currency':$('#modalcurrencyselect').val() }, 'type':'post', 'success':function(text,xml){ $('#footercurrencylink').html(text); cc.close(); location.href = location.href; // aka reload } }); return false; }); } } }); return false; }); $('.itemtile').each(function(idx,elem){ $(elem).click(function(e){ // console.log(e); // console.log(this); // console.log( $(this).attr('href')); location.href = $(this).attr('href'); return false; }); }); if ($('#urgentmessage').length > 0) { $('#urgentmessageclose').click(function(){ window.clearInterval(urgentmessagetimer); $('#urgentmessage').slideUp(); }); $timerelem = $('#urgentmessagecounter'); var timernum = $timerelem.html(); var urgentmessagetimer = window.setInterval( (function(){ timernum--; if (timernum == 0) { $('#urgentmessage').slideUp(); window.clearInterval(urgentmessagetimer); } $timerelem.html(timernum); }) ,1000); } $('.defaultfocus').focus(); $('.selectonfocus').focus(function(){$(this).select();}); });