// welcome ! // i'm a javascript developer as well as an mp3 blogger // the infinite scroll is in a diff file, but i have its config set up here. // everything else in here is pretty clever and groovy // if you have any questions, hit me on the contact form // cheers- paul. window.AURGASM = { context : document.body, cats : [ 'dance', 'electronic', 'experimental', 'folk', 'french', 'funk', 'global', 'hip-hop', 'israeli', 'jazz', 'other', 'pop', 'rock', 'scandinavian', 'singer-songwriter', 'soul', 'reggae', 'reflex reaction', 'hey dj friday', 'aurgasm interview', 'aurgasm news', 'aurgasm special', 'classical'], genrecolors : ['magenta', 'pink', 'kellygreen', 'cactus', 'deepblue', 'teal', 'lime', 'basket', 'purple', 'turquoise', 'grey', 'puse', 'burntsienna', 'midnight', 'rouge', 'acloudman', 'purplered'], treatPosts : function(elem){ if (elem) AURGASM.context = elem; AURGASM.imageryPrep(); AURGASM.genrePrep(); AURGASM.buyLinkPrep(); }, // fix any post images. imageryPrep : function(){ $('div.reviewtext img',AURGASM.context).each(function(){ var wid = $(this).width(); if (wid == 600){ return true; } else if (wid < 165 ){ $(this).css('background','url('+$(this).attr('src')+') repeat-x 0 0' ).css('paddingRight',(600-wid)+'px'); } else { $(this).css('padding','0 '+(600-wid)/2+'px'); } }); }, // coloring the genres genrePrep : function(){ $('div.post',AURGASM.context).each(function(){ if (!$(this).attr('category')) return false; // if we dont have a genre var primarycat = $(this).attr('category').split(',')[0]; $(this).find('span.genre').addClass( AURGASM.genrecolors[ $.inArray(primarycat,AURGASM.cats) ] ); }); // getting that super pretty 1px gap between the things. $('strong.boldline',AURGASM.context).each(function(){ $(this).width( 559 - $(this).parents('div.post').find('span.genre').width() ) }); }, // move the buylink outside of the post. // hook up click buyLinkPrep : function(){ $('a.buy',AURGASM.context) .html('+ Purchase / Visit') .each(function(){ $(this).appendTo( $(this).parents('div.post') ) }).hoverIntent( { sensitivity: 7, // number = sensitivity threshold (must be 1 or higher) interval: 50, // number = milliseconds for onMouseOver polling interval timeout: 200, // number = milliseconds delay before onMouseOut out: function(){ }, over: AURGASM.showBuy }) .click(AURGASM.showBuy); $('#buyVisit').bind('mouseleave',function(){ $(this).hide() }); }, showBuy : function(){ var off = $(this).offset(); $('#buyVisit').css({ top: off.top -4 + 'px' , left: off.left-14 + 'px' }).show(); AURGASM.setUpBuyLinks( this, $('#buyVisit') ); }, // set the amazon, itunes, google links setUpBuyLinks : function(origLink,buyVisit){ var src = origLink.href, zon = null, itunes = null, web = null; var artist = $(origLink).parents('.post').find("h2").text(); artist = encodeURIComponent(artist); var affiliateID = 'aurgasm-20'; var country = navigator.language || navigator.systemLanguage; country = country.split('-')[1]; // detect link we got if ( src.match(/amazon/) ) zon = src; else if ( src.match(/itunes|apple|phobos/) ) itunes = src; else web = src; // set amazon zon = zon || "http://www.amazon.com/gp/search?ie=UTF8&tag=" + affiliateID + "&index=blended&keywords=" + artist; //set itunes // http://pipes.yahoo.com/pipes/pipe.run?Artist=bonobo&Country=us&_id=Rsuwwcbk3RGpKIt0rbQIDg&_render=json&_callback=AURGASM.itunesData /* $.getJSON('http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearch?WOURLEncoding=ISO8859_1&lang=1&output=json&country='+country+'&term='+artist+'&media=music&jsonp=?',function(data){ itunes = itunes || (data.results[0] && data.results[0].artistLinkUrl); buyVisit.find('a.itunes').attr('href',itunes); }); */ //set artist web = web || 'http://google.com/search?btnI=1&q='+artist+'+ music'; buyVisit.find('dd.web a').attr('href',web); buyVisit.find('a.amazon').attr('href',zon); }, // end of setupbuylinks infScrollSetup : function(){ jQuery(function($){ $('#content').infinitescroll({ debug : false, nextSelector : "div.navigation a:first", loadingImg : "http://www.infinite-scroll.com/wp-content/plugins/infinite-scroll/ajax-loader.gif", text : "Loading the next posts...", donetext : "Nice! You've hit the end.", navSelector : "div.navigation", contentSelector : "#content", itemSelector : "#content > div.post" },function(){ AURGASM.treatPosts(this); YAHOO.MediaPlayer.addTracks(this); AURGASM.dots(); }); }); }, fixHeights : function(){ if ($('#content').height() < $('#sidebar').height()) $('#content,#sidebar').setAllToMaxHeight(); }, colorSideGenres : function(){ $('li.categories li').each(function(){ var cat = $(this).text().match(/(.*?) \(/)[1]; $(this).addClass( AURGASM.genrecolors[ $.inArray(cat,AURGASM.cats) ] ); }); }, dots : function(){ $('#dots').height( $(document).height() ); }, contactPage : function(){ if (!$('#contact').length) return; $('#contact p:gt(0)').css({'height':'400px'}); }, resourcesPage : function(){ if (!$('#resources').length) return; var favurl = ['http://', '/favicon.ico']; $('#resources a').each(function(){ var domain = $(this).attr('href').match(/\/\/(.*?)(\/|$)/)[1]; $(this).css('background', 'url('+ favurl.join(domain)+ ') no-repeat'); }); } // eo resources() }; // end of AURGASM{} $(function(){ AURGASM.treatPosts(); AURGASM.colorSideGenres(); AURGASM.dots(); AURGASM.setUpCommentTogglesInside( $('#content') ); AURGASM.contactPage(); //AURGASM.resourcesPage(); $.browser.msie && $('#sidebar > div').css('zoom',1); // triger haslayout $(window).load(AURGASM.fixHeights); }); AURGASM.setUpCommentTogglesInside = function($elem){ if ($.browser.msie) return; // dont apply for IE users. $elem.find('a.comment-link').click( function(){ if ($(this).hasClass('open')){ $(this).removeClass('open'); $(this).parent().parent().removeClass('open').find('div.comment-wrap').hide(); } else{ var ref = $(this).addClass('open').attr('href'); $(this) .parent() .parent().addClass('open') .find('div.comment-wrap') .show() .html('
' + comment + '
'; var theol = $elem.find('ol:first'); $('').html(str).appendTo(theol); $elem.parent().find('div.comment-loading,form').remove(); }}); }); } // legacy function popup(mylink, animation){ if (! window.focus) {return true;} var href; if (typeof(mylink) == 'string'){ href=mylink;} else{ href=mylink.href;} window.open(href, animation, 'width=290,height=237,resizable=no,scrollbars=no'); return false; } // http://www.malsup.com/jquery/form/ (function($){$.fn.ajaxSubmit=function(options){if(typeof options=='function')options={success:options};options=$.extend({url:this.attr('action')||window.location.toString(),type:this.attr('method')||'GET'},options||{});var veto={};$.event.trigger('form.pre.serialize',[this,options,veto]);if(veto.veto)return this;var a=this.formToArray(options.semantic);if(options.data){for(var n in options.data)a.push({name:n,value:options.data[n]})}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false)return this;$.event.trigger('form.submit.validate',[a,this,options,veto]);if(veto.veto)return this;var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null}else options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm()});if(options.clearForm)callbacks.push(function(){$form.clearForm()});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){if(this.evalScripts)$(options.target).attr("innerHTML",data).evalScripts().each(oldSuccess,arguments);else $(options.target).html(data).each(oldSuccess,arguments)})}else if(options.success)callbacks.push(options.success);options.success=function(data,status){for(var i=0,max=callbacks.length;i