jQuery(document).ready(function($){ // get height of the body for menu(sidebar) var currentHeight = $("body").height(); /** * close search form * @return {null} */ var closeSearch = function() { $('#search').animate({top:"-150px"}, 300); $('#search').removeClass("animated bounceInDown") } /** * open search form * @return {null} */ var openSearch = function() { $('#search').animate({top:0}, 10); $('#search').addClass("animated bounceInDown"); $('.search input').focus(); } /** * close menu * @return {null} */ var closeMenu = function() { $("aside.sidebar").css({width: 0}); $(".close-menu").animate({top: "-120px"}, 300); $(".open-menu").animate({top: 0}, 300); $(".main-wrapper").animate({left: 0}, 300); } /** * open menu * @return {null} */ var openMenu = function() { $("aside.sidebar").css({width: "400px"}); $(".open-menu").animate({top: "-120px"}, 300); $(".close-menu").animate({top: 0}, 300); $(".main-wrapper").animate({left: "400px"}, 300); } // make space, half space var zwnj = function(element) { var str = $(element).html(); str = str.replace(" ", "‌"); $(element).html(str); } // replace space with half space in logo zwnj(".logo"); // default form/button $("input, textarea, select").addClass("form-control"); $("#searchform input").removeClass("form-control"); $("button").addClass("btn btn-default"); // sidebar $("aside.sidebar").css({"height": currentHeight}); // comment section $("footer.comment-meta").addClass("row"); $(".comment-author, .comment-metadata").addClass("col-md-6"); $(".comment-form-comment, .parent").addClass("col-md-12 col-xs-12"); $("#submit").addClass("animate"); $(".comment-metadata").append(' '); $(".reply a").prepend(' '); $(".comment-author-admin .comment-author").append(' '); $("#cancel-comment-reply-link").html(''); // search form $('.search-close').click(function(){ closeSearch(); }); $('.search').click(function(){ closeMenu(); openSearch(); }); // main sidebar $(".open-menu").click(function(){ closeSearch() openMenu(); }); $(".close-menu").click(function(){ closeMenu(); }); // calcute font size for post title in front page based on width and heigh of the box // and length of the post title // default font size = 20px $('.box-caption').textfill({ maxFontPixels: 41, minFontPixels: 25 }); // color boxes of front page $('.content-area .blog-post:nth-child(1n) .box-caption').css({"background":"rgba(129, 162, 87, 0.9)"}); $('.content-area .blog-post:nth-child(2n) .box-caption').css({"background":"rgba(64, 162, 175, 0.9)"}); $('.content-area .blog-post:nth-child(3n) .box-caption').css({"background":"rgba(64, 122, 175, 0.9)"}); $('.content-area .blog-post:nth-child(4n) .box-caption').css({"background":"rgba(108, 58, 196, 0.9)"}); $('.content-area .blog-post:nth-child(5n) .box-caption').css({"background":"rgba(157, 64, 175, 0.9)"}); $('.content-area .blog-post:nth-child(6n) .box-caption').css({"background":"rgba(175, 64, 100, 0.9)"}); $('.content-area .blog-post:nth-child(7n) .box-caption').css({"background":"rgba(162, 175, 64, 0.9)"}); $('.content-area .blog-post:nth-child(8n) .box-caption').css({"background":"rgba(192, 117, 57, 0.9)"}); $('.content-area .blog-post:nth-child(9n) .box-caption').css({"background":"rgba(112, 112, 112, 0.9)"}); $('.content-area .blog-post:nth-child(10n) .box-caption').css({"background":"rgba(32, 109, 106, 0.9)"}); $('.content-area .blog-post:nth-child(11n) .box-caption').css({"background":"rgba(68, 175, 64, 0.9)"}); $('.content-area .blog-post:nth-child(12n) .box-caption').css({"background":"rgba(112, 117, 173, 0.9)"}); // colorful lists for sidebars $('.widget ul li:nth-child(1n), .tagcloud a:nth-child(1n)').css({"background":"rgba(129, 162, 87, 0.9)"}); $('.widget ul li:nth-child(2n), .tagcloud a:nth-child(2n)').css({"background":"rgba(64, 162, 175, 0.9)"}); $('.widget ul li:nth-child(3n), .tagcloud a:nth-child(3n)').css({"background":"rgba(64, 122, 175, 0.9)"}); $('.widget ul li:nth-child(4n), .tagcloud a:nth-child(4n)').css({"background":"rgba(108, 58, 196, 0.9)"}); $('.widget ul li:nth-child(5n), .tagcloud a:nth-child(5n)').css({"background":"rgba(157, 64, 175, 0.9)"}); $('.widget ul li:nth-child(6n), .tagcloud a:nth-child(6n)').css({"background":"rgba(175, 64, 100, 0.9)"}); $('.widget ul li:nth-child(7n), .tagcloud a:nth-child(7n)').css({"background":"rgba(162, 175, 64, 0.9)"}); $('.widget ul li:nth-child(8n), .tagcloud a:nth-child(8n)').css({"background":"rgba(192, 117, 57, 0.9)"}); $('.widget ul li:nth-child(9n), .tagcloud a:nth-child(9n)').css({"background":"rgba(112, 112, 112, 0.9)"}); $('.widget ul li:nth-child(10n), .tagcloud a:nth-child(10n)').css({"background":"rgba(32, 109, 106, 0.9)"}); $('.widget ul li:nth-child(11n), .tagcloud a:nth-child(11n)').css({"background":"rgba(68, 175, 64, 0.9)"}); $('.widget ul li:nth-child(12n), .tagcloud a:nth-child(12n)').css({"background":"rgba(112, 117, 173, 0.9)"}); // we use our width and height in style sheet // so we don't need inline style $(".blog-thumbnail img").removeAttr("width"); $(".blog-thumbnail img").removeAttr("height"); });