/* jQuery Plugins */ (function($) { $.fn.longClick = function(callback, timeout) { var timer; timeout = timeout || 500; $(this).mousedown(function() { timer = setTimeout(function() { callback(); }, timeout); return false; }); $(document).mouseup(function() { clearTimeout(timer); return false; }); }; })(jQuery); /* EXTRA FUCKING VIEW */ function keepThePageAwesome() { if ($(window).width() < 1020) { keepTheFuckingSidebarOnTheScreenOkay = true; $(document.body).addClass('tinyscreen'); } else { keepTheFuckingSidebarOnTheScreenOkay = false; $(document.body).removeClass('tinyscreen'); } } /* AWESOMENESS */ $(document).ready(function() { // Mobile view if ((navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) ? true : false)) $(document.body).addClass('tinyscreen'); else if (userdata) $('header').append(''+userdata[3]+''); // User miniprofile $(window).resize(function() { keepThePageAwesome(); }).resize(); // TWEET ANIMS $("article.tweet").hover(function() { $(this).find("p.readmore").stop().slideDown(); }, function(){ $(this).find("p.readmore").stop().slideUp(); }); // Sub-page detection if (/entry|\/p\/|tag|page|user|admin/.test(window.location.href) && !headerimg) $(window).scrollTop($('#page').offset().top); // Scroll down button $('#arrowDown').click(function() { $("html, body").animate({scrollTop: $('#page').offset().top}, '500', function() { window.location.hash = '#content'; }); }).longClick(function() { $("html, body").animate({scrollTop: $(document).height()-$(window).height()}, '1800'); }); // Scroll to the top button $('#scroll-up').click(function() { $("html, body").animate({scrollTop: 0}, '2000'); return false; }); });