jQuery.noConflict(); /* * TYPOGRAPHY */ Cufon.set('fontFamily', 'ColaborateLight'); Cufon.replace('h2, #main h3, h4, h5, h6, #slogan, .label', { hover: true }); Cufon.set('fontFamily', 'Colaborate-Medium'); Cufon.replace('#main_home h3', { hover: true }); /* * WE CALL PK_ FUNCTIONS */ jQuery(document).ready(function(){ jQuery(".main_menu").pk_menu(); jQuery("#options_wrapper").pk_options_menu(); /* GALLERIES */ if(jQuery("#project_details").length == 0) { jQuery(".big_gallery").pk_gallery({ photos: ".item", thumbs: ".gallery_navigation a", buttonNext: ".gallery_button_next", buttonPrev: ".gallery_button_prev", buttonPlayPause: ".button_play_pause", easing: "easeInOutQuad", speedIn: 400, speedOut: 600 }); jQuery(".small_gallery").pk_gallery({ photos: ".item", thumbs: ".gallery_navigation a", buttonNext: ".gallery_button_next", buttonPrev: ".gallery_button_prev", buttonPlayPause: ".button_play_pause", easing: "easeInOutQuad", speedIn: 400, speedOut: 600 }); } jQuery("#project_details").pk_gallery({ photos: ".project", thumbs: "#grid div.box_one_third .small_shadow", buttonNext: "#portfolio_navigation .next", buttonPrev: "#portfolio_navigation .prev", buttonClose: ".button_close", firstClick: true, autoStart: false, toogle: true }); /* TWITTER */ //Not applicable /* jQuery(".twitter_list").each(function(){ if(!$(this).hasClass('widget')){ $(this).pk_twitter({ user: "parkerandkent", count: 3 }); } });*/ /**/ jQuery("#grid").pk_portfolio(); jQuery("#categories_dropdown").pk_dropdown(); jQuery("input:text, input:password, textarea").pk_input(); jQuery("#contact_form").pk_form({'submit' : '#contact_submit', 'response' : '#contact_response'}); jQuery("#quick_contact_form").pk_form({'submit' : '#quickcontact_submit', 'response' : '#quick_response', 'formid' : '#quick_contact_form'}); jQuery("body").pk_improvements(); }); /* * PK_MENU *** */ (function($) { $.fn.pk_menu = function(options) { var defaults = { autoPosition: false, limitValue: "wrapper", easing: "easeOutQuint", speedIn: 400, speedOut: 100 }; var settings = $.extend({}, defaults, options); /**/ return this.each(function () { var $root = $(this); var $mainmenu = $(">ul", this); var $headers = $mainmenu.find("ul").parent(); var $limitValue = (settings.limitValue == "document") ? $(window).width() : 960; /**/ $headers.each(function () { var $curobj = $(this); var $subul = $(this).find('ul:first'); var $ul = $("ul", $curobj); $("ul ul", $root).css({"display": "none", "paddingTop": "0px"}).find("li:first").css({"marginTop": "15px"}); $("ul ul ul", $root).find("li:first").css({"marginTop": "5px"}); /**/ function getProperty($li, $ul) { $li.dimensions = { w: $li.offsetWidth, h: $li.offsetHeight, subulw: $ul.outerWidth(), subulh: $ul.outerHeight() } return $li.dimensions; } function showMenu ($element) { $element.css({visibility:'visible'}).slideDown(settings.speedIn); } function hideMenu ($element, $current) { $element.slideUp(settings.speedIn, function() { $element.hide(); }); setTimeout(function() { $current.stop().animate({ borderBottomWidth: "5px" }, settings.speedIn + 100, "easeInOutSine"); }, 100); } /**/ $curobj.click(function() { var $targetul = $(this).find("ul:first"); $targetul.hide(); }); $curobj.hoverIntent(function() { closeOptionsMenu(); getProperty(this, $subul); if($(this).find("current")) { $(this).stop().animate({borderBottomWidth: "0px"}, 1, "easeInOutSine"); } var $targetul = $(this).find("ul:first"); var $offset = $(this).offset(); if($curobj.parents("ul").length == 1) { $ul.css({visibility:'hidden'}); this.firstLevel = true; $subul.css({top: 30 + "px"}); } else { this.firstLevel = false; $subul.css({top: -5 + "px"}); } if(this.firstLevel) { var menuleft = 0; } else { var menuleft = this.dimensions.w; } if(($offset.left + menuleft + this.dimensions.subulw) > $limitValue && !this.firstLevel) { menuleft = -(this.dimensions.w); } if(settings.autoPosition == true) { $targetul.css({left:menuleft + "px"}); } showMenu($targetul); }, function() { var $targetul = $(this).find("ul:first"); hideMenu($targetul, $(this)); }); }); }); }; })(jQuery); /* * PK_OPTIONS_MENU *** */ function closeOptionsMenu(speed) { jQuery("#options_wrapper div").filter(":visible").stop().slideUp(speed, function() { jQuery("#options_wrapper").hide(); }); } (function($) { $.fn.pk_options_menu = function(options) { var defaults = { easing: "easeOutExpo", speedIn: 400, speedOut: 100 } var settings = $.extend({}, defaults, options); /**/ return this.each(function() { var $root = $(this); var $items = $("div", $root); $root.hide(); $("#options_menu .search").hoverIntent(function() { if($root.css("display") == "none") { $root.show(); $("#search").slideDown(settings.speedIn); } else { $("#login").slideUp(settings.speedOut, function() { $("#search").slideDown(settings.speedIn); }); } $("#search").bind("mouseleave", function() { closeOptionsMenu(400); }); }, function(){}); $("#options_menu .login").hoverIntent(function() { if($root.css("display") == "none") { $root.show(); $("#login").slideDown(settings.speedIn); } else { $("#search").slideUp(settings.speedOut, function() { $("#login").slideDown(settings.speedIn); }); } $("#login").bind("mouseleave", function() { closeOptionsMenu(400); }); }, function(){}); $("#options_menu .feed").hoverIntent(function() { closeOptionsMenu(200); }, function(){}); }); }; })(jQuery); /* * PK_PORTFOLIO *** */ function closeProjects() { jQuery("#project_details .project").filter(":visible").fadeOut(400); jQuery('#portfolio_navigation').fadeOut(200); jQuery("#project_details").animate({ "height" : "0px" }, 400, "easeInOutQuad"); jQuery('.breadcrumb').animate({"paddingTop": "70px"}, 400, "easeInOutQuad"); } (function($) { $.fn.pk_portfolio = function(options) { var defaults = { easing: "easeInOutQuad", speedIn: 400, speedOut: 200 }; var settings = $.extend({}, defaults, options); /**/ return this.each(function() { var $root = $(this); if($("body").find(".portfolio_big_gallery").length > 0) { $("#project_details .project").each(function(i) { $("#p" + (i + 1) + " .big_gallery").pk_gallery({ photos: ".item", thumbs: "#gn" + (i + 1) + " a", buttonNext: "#gbn" + (i + 1), buttonPrev: "#gbp" + (i + 1), buttonPlayPause: "#pp" + (i + 1), autoStart: false, speedIn: 400, speedOut: 600 }); }); } if($("body").find(".portfolio_small_gallery").length > 0) { $("#project_details .project").each(function(i) { $("#p" + (i + 1) + " .small_gallery").pk_gallery({ photos: ".item", thumbs: "#gn" + (i + 1) + " a", buttonNext: "#gbn" + (i + 1), buttonPrev: "#gbp" + (i + 1), buttonPlayPause: "#pp" + (i + 1), autoStart: false, speedIn: 400, speedOut: 600 }); }); } $(".box_one_third", $root).css("background-image" , "url('"+wp_theme_url+"/images/"+skin+"/preview_icon.png')"); $(".small_shadow", $root).find("img").hover(function(){ $(this).stop().animate({ "opacity" : 0.3 }, 400, "easeInOutQuad"); }, function() { $(this).stop().animate({ "opacity" : 1 }, 400, "easeInOutQuad"); }); }); }; })(jQuery); /* * PK_GALLERY *** */ (function($) { $.fn.pk_gallery = function(options) { var defaults = { photos: "", thumbs: "", buttonNext: "", buttonPrev: "", buttonPlayPause: "", buttonClose: "", /**/ autoStart: true, firstClick: true, toogle: false, /**/ timer: slider_timeout, easing: "", speedIn: 400, speedOut: 200 }; var settings = $.extend({}, defaults, options); /**/ return this.each(function() { var $root = $(this); var $items = $(settings.photos , $root); var $thumbs = $(settings.thumbs); var $totItems = $items.length; var $movies = []; var $status = ""; var $index = 0; var $interval = ""; /**/ function slideshow(index) { if(index){ var id = index; } else { var id = 0; } $interval = setInterval( function() { play(id, "next"); }, settings.timer ); } function play(index, verse) { var id = index; if(verse == "next" || verse == undefined) { if(id < ($thumbs.length - 1)) { id++; } else { id = 0; } } else { if(id > 0) { id--; } else { id = ($thumbs.length - 1); } } $thumbs.filter(":eq("+ id +")").trigger("click", [true]); } function positionNavigation(next, prev, nav, gallery) { var left = (gallery.width() / 2) - (nav.width() / 2); var top = (gallery.height() / 2) - (next.height() / 2); next.css("margin-top", top); prev.css("margin-top", top); nav.css("margin-left", left); } function changeThumbs($current) { for(i = 0; i < $thumbs.length; i++) { $thumbs.filter(":eq("+ i +")").removeClass("current"); } $current.addClass("current"); } if(settings.autoStart == true) { $status = "play"; $(settings.buttonPlayPause + " img").attr('src', wp_theme_url+'/images/'+skin+'/button_pause.png'); } else { $status = "pause"; } if($("body").find("#project_details").length > 0) { $thumbs.css("cursor", "pointer"); } /**/ $thumbs.each(function(i) { $movies[i] = $items.filter(":eq(" + i + ")").find(".movie").html(); $(this).click(function() { var $new_item = $items.filter(":eq(" + i + ")"); var $media = $items.filter(":eq(" + i + ")").find(".movie").length; var $new_height = $new_item.height(); this.id = i; $index = this.id; if($interval) { clearInterval($interval); } if($media == 0 && $status == "play" && $totItems > 1) { slideshow(this.id); } if($new_item.css("display") == "none") { if($items.filter(":visible").find(".movie")) { $items.find(".movie").empty(); } if($media > 0) { $new_item.find(".movie").html($movies[this.id]); } $items.filter(":visible").fadeOut(settings.speedOut, settings.easing); $new_item.fadeIn(settings.speedIn, settings.easing); if($("#project_details").length > 0) { var tot = $new_item.find(".item").length; var width = (15 * tot) + 80; $new_item.find(".gallery_navigation").css("width", width); if($("body").find(".portfolio_big_gallery").length > 0) { positionNavigation($new_item.find(".gallery_button_next"), $new_item.find(".gallery_button_prev"), $new_item.find(".gallery_navigation"), $new_item.find(".big_gallery")); } if($("body").find(".portfolio_small_gallery").length > 0) { positionNavigation($new_item.find(".gallery_button_next"), $new_item.find(".gallery_button_prev"), $new_item.find(".gallery_navigation"), $new_item.find(".small_gallery")); } } } if(settings.toogle == true) { $root.show().animate({ "height" : $new_height }, settings.speedIn, settings.easing, function() { $('#portfolio_navigation').slideDown(settings.speedIn); }); $('html:not(:animated),body:not(:animated)').animate({ scrollTop: 0 }, settings.speedIn, settings.easing); $('.breadcrumb').animate({ "paddingTop": "0px"}, settings.speedIn, settings.easing); } changeThumbs($(this)); return false; }); }); if($totItems > 1) { var width = (15 * $totItems) + 80; $root.find(".gallery_navigation").css("width", width); var left = ($root.width() / 2) - ($root.find(".gallery_navigation").width() / 2); var top = ($root.height() / 2) - ($(settings.buttonNext).height() / 2); /* NAVIGATION */ $root.find(".gallery_navigation").show().css("margin-left", left); /* BUTTON PLAY/PAUSE */ $(settings.buttonPlayPause, $(this)).click(function() { if($status == "play") { $status = "pause"; clearInterval($interval); $("img", $(this)).attr('src', wp_theme_url+'/images/'+skin+'/button_play.png'); } else { $status = "play"; play($index, "next"); $("img", $(this)).attr('src', wp_theme_url+'/images/'+skin+'/button_pause.png'); } }); /* BUTTONS NEXT / PREV / CLOSE */ $(settings.buttonNext).show().css("margin-top", top).click(function() { play($index, "next"); }); $(settings.buttonPrev).show().css("margin-top", top).click(function() { play($index, "prev"); }); } else { $root.find(".gallery_navigation").hide(); } /* BUTTON CLOSE */ $(settings.buttonClose, $items).click(function() { closeProjects(); }); /* FIRST CLICK */ if(settings.firstClick) { setTimeout(function() { $thumbs.filter(":eq(0)").trigger("click", [true]); }, 500); } }); } })(jQuery); /* * PK_DROPDOWN *** */ (function($) { $.fn.pk_dropdown = function(options) { var defaults = { menu: ".dropdown", button: ".dropdown_button", easing: "easeOutQuad", speedIn: 400, speedOut: 400 }; var settings = $.extend({}, defaults, options); return this.each(function() { var $root = $(this); var $menu = $(settings.menu); var $button = $(settings.button); $menu.hide(); $root.hoverIntent(function() { $menu.animate({ "height": "show" },settings.speedIn, settings.easing); $button.find("img").attr("src", wp_theme_url+'/images/'+skin+'/button_close_categories.png'); }, function() { $menu.animate({ "height": "hide" }, settings.speedIn, settings.easing); $button.find("img").attr("src", wp_theme_url+'/images/'+skin+'/button_open_categories.png'); }); }); } })(jQuery); /* * PK_INPUT *** */ (function($) { $.fn.pk_input = function() { return this.each(function() { var $root = $(this); var inputValue = $root.val(); function reset() { var value = $root.val(); if(inputValue == value) { $root.val(""); } } function blur() { var value = $root.val(); if(value == "") { $root.val(inputValue); } } $root.focus(function() { reset(); }); $root.blur(function() { blur(); }); }); } })(jQuery); /* * PK_FORM *** */ (function($) { $.fn.pk_form = function(options) { var defaults = { php: ajaxurl, text: "Your message has been sent. Thanks.", response: "#response", submit: "#submit", formid: "#contact_form", timer: 4000, easing: "", speedIn: 400, speedOut: 400 }; var settings = $.extend({}, defaults, options); return this.each(function () { var $root = $(this); var $response = $(settings.response); var $submit = $(settings.submit); var $formid = $(settings.formid); var interval = undefined; var main = undefined; /**/ if(settings.formid == "#contact_form") { main = true; } else { main = false; } /**/ function showResponse($timer) { if(interval) { clearInterval(interval); } $submit.fadeOut(5, function() {; $response.css("opacity", 0); $response.show().stop().animate({ opacity: 1 }, settings.speedIn, settings.easing, function(){ interval = setInterval(hideResponse, $timer); }); }); } function hideResponse() { clearInterval(interval); $response.stop().animate({ opacity:0 }, settings.speedIn, settings.easing, function() { $response.hide(); $submit.fadeIn(400); }); } /**/ $root.submit(function(){ $.ajax({ type: "POST", url: settings.php, data: $(this).serialize(), success: function(output) { if(output == 'ok') { if(main == true) { $(".contact_name", $root).val(''); $(".contact_email", $root).val(''); $(".contact_message", $root).val(''); } else { $(".contact_name", $root).val('Name'); $(".contact_email", $root).val('Email'); $(".contact_message", $root).val('Message'); } $response.html("
" + settings.text + "
"); showResponse(settings.timer * 2); } else { $response.html(output); showResponse(settings.timer); } } }); return false; }); }); } })(jQuery); /*(function($) { $.fn.pk_form = function(options) { var defaults = { php: ajaxurl, text: "Your message has been sent. Thanks.", response: "#response", submit: "#submit", formid: "#contact_form", timer: 4000, easing: "", speedIn: 400, speedOut: 400 }; var settings = $.extend({}, defaults, options); return this.each(function () { var $root = $(this); var $response = $(settings.response); var $submit = $(settings.submit); var $formid = $(settings.formid); // function showResponse($timer) { $submit.fadeOut(5, function() {; $response.css("opacity", 0); $response.show().stop().animate({ opacity: 1 }, settings.speedIn, settings.easing, function(){ interval = setInterval(hideResponse, $timer); }); }); } function hideResponse() { clearInterval(interval); $response.stop().animate({ opacity:0 }, settings.speedIn, settings.easing, function() { $response.hide(); $submit.fadeIn(400); }); } // $root.submit(function(){ $.ajax({ type: "POST", url: settings.php, data: $(this).serialize(), success: function(output) { $response.ajaxComplete(function() { if(output == 'ok') { if($($formid).length > 0) { $(".contact_name", $root).val(''); $(".contact_email", $root).val(''); $(".contact_message", $root).val(''); } else { $(".contact_name", $root).val('Name'); $(".contact_email", $root).val('Email'); $(".contact_message", $root).val('Message'); } $(this).html("" + settings.text + "
"); showResponse(settings.timer * 2); } else { $(this).html(output); showResponse(settings.timer); } }); } }); return false; }); }); } })(jQuery);*/ /* * PK_TWITTER *** */ (function($) { $.fn.pk_twitter = function(options) { var defaults = { user: "parkerandkent", count: 1 }; var settings = $.extend({}, defaults, options); String.prototype.linkify = function() { return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) { return m.link(m); }); }; function get_time(time_value) { var values = time_value.split(" "); time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3]; var parsed_date = Date.parse(time_value); var relative_to = (arguments.length > 1) ? arguments[1] : new Date(); var delta = parseInt((relative_to.getTime() - parsed_date) / 1000); delta = delta + (relative_to.getTimezoneOffset() * 60); var r = ''; if (delta < 60) { r = 'a minute ago'; } else if(delta < 120) { r = 'couple of minutes ago'; } else if(delta < (45*60)) { r = (parseInt(delta / 60)).toString() + ' minutes ago'; } else if(delta < (90*60)) { r = 'an hour ago'; } else if(delta < (24*60*60)) { r = '' + (parseInt(delta / 3600)).toString() + ' hours ago'; } else if(delta < (48*60*60)) { r = '1 day ago'; } else { r = (parseInt(delta / 86400)).toString() + ' days ago'; } return r; }; return this.each(function () { var $root = $(this); $.getJSON('http://twitter.com/status/user_timeline/' + settings.user + '.json?count=' + settings.count + '&callback=?', function(data){ $root.find("li").remove(); $.each(data, function(index, item){ $root.append('