jQuery(document).ready(function($) { /** * Add hovers to the navigation, and other items. * * @since 1.0.0 */ /*$( '#navigation a' ).hover(function() { var original = $( this ).children().children( 'img' ).attr( 'src' ).split( '_n.' ); $( this ).children().children( 'img' ).attr( 'src', original[0] + '_h.' + original[1] ); }, function() { var original = $( this ).children().children( 'img' ).attr( 'src' ).split( '_h' ); $( this ).children().children( 'img' ).attr( 'src', original[0] + '_n' + original[1] ); });*/ $( '#talked-about li, #blog-scroller .items .item' ).live( 'hover', function() { $( this ).toggleClass( 'hover' ); }, function() { $( this ).removeClass( 'hover' ); }); /** * Create the scrollers. * * @since 1.0.0 */ $( '#progress-scroll' ).scrollable({ item: 'div', size: 1, circular: true, clickable: false, next: '.nextPage', prev: '.prevPage' }).navigator()/*.autoscroll({ interval: 8000 })*/; if( $( '#progress-scroll' ).length ){ var api = $( '#progress-scroll' ).data( 'scrollable' ); api.move( random(1,6) ); } $( '#blog-scroll' ).scrollable({ circular: true, next: '.nextPage', prev: '.prevPage' }).navigator(); $( '#blog-scroll .item:nth-child(3)' ).clone().addClass( 'cloned' ).appendTo( '#blog-scroll .items' ); $( '#tweeted' ).scrollable({ item: 'ul', size: 1, speed: 500, circular: true, next: '.nextPage', prev: '.prevPage' }).navigator().autoscroll({ interval: 30000 }); $( '.prevPage, .nextPage' ).click(function() { return false; } ); /** * Append Modals to the window. Loads a template from the * templates folder. * * @since 1.0.0 */ $( '.subscribe' ).click(function() { appendModal( 'subscribe' ); return false; }); $( '.developer-green, .support-staff, .theme-modifiers' ).click(function() { appendModal( 'developer' ); return false; }); $( '#modal .close' ).live( 'click', function() { $( '#modal' ).fadeOut( 'fast', function() { $( this ).remove(); $( '#ajax-loading' ).fadeOut(); }) }); /** * Mark the post as helpful. * * @since 1.0.0 */ $( '.likes' ).click(function() { helpful( $( this ).attr( 'rel' ) ); $( this ).addClass( 'disabled' ); return false; }); /** * Show share links when hovered. * * @since 1.0.0 */ $( '.share' ).hover(function() { $( this ).children( '.text' ).hide(); $( this ).children( '.images' ).show(); $( this ).addClass( 'hovered' ); }, function() { $( this ).children( '.images' ).hide(); $( this ).children( '.text' ).show(); $( this ).removeClass( 'hovered' ); }); /** * Slide to the top. * * @since 1.0.0 */ $( '.back-to-top' ).click(function() { $( 'html' ).animate({ scrollTop: 0 }, 'slow' ); return false; }); jQuery(".ago").timeago(); $( '#iktldy-iktldy' ).focus(); }); /** * Update teh tweets in the twitter area. * * @since 1.0.0 */ function updatetweets(){ jQuery( '#tweeted .items' ).animate( { opacity: 0.2 }, 1000 ); var data = { action : 'WPB_refresh_tweets' }; jQuery.post( load_ajax, data, function( data ) { jQuery( '#tweeted .items' ).html( data.substring( 0, data.length - 2 ) ).animate( { opacity: 1.0 }, 1000 ); }); } //window.setInterval( updatetweets, 90000 ); /** * Mark the post as helpful. * * @since 1.0.0 */ function helpful( id ) { var data = { action : 'WPB_helpful_post', id : id }; jQuery.post( load_ajax, data, function( datas ) { jQuery( '.likes[rel=' + id + ']' ).html( datas.count ).fadeIn(); jQuery( '.likes[rel=' + id + ']' ).next( 'span' ).html( datas.message ); }, "json"); }; /** * Append Modals to the window. Loads a template from the * templates folder. * * @since 1.0.0 */ function appendModal( url ){ jQuery( '#ajax-loading' ).fadeIn(); data = { action : 'WPB_modal_box', template : url }; jQuery.post( load_ajax, data, function( data ) { jQuery( '#ajax-loading' ).append( data.substring( 0, data.length - 2 ) ); }); } /*function animate_bot() { jQuery("#bundlebot").animate({ top:"+=10px", right:"+=5px" }, 1200 ).animate({ top:"-=10px", right:"-=5px" //right:"-=20px" }, 1200 ) setTimeout("animate_bot()",2400); }*/ function random( low, high ) { var numLow = low; var numHigh = high; var adjustedHigh = (parseFloat(numHigh) - parseFloat(numLow)) + 1; var numRand = Math.floor(Math.random()*adjustedHigh) + parseFloat(numLow); if ((IsNumeric(numLow)) && (IsNumeric(numHigh)) && (parseFloat(numLow) <= parseFloat(numHigh)) && (numLow != '') && (numHigh != '')) { return numRand; } else { return 1 } } function IsNumeric(n){ return !isNaN(n); }