2013-02-27 15:39:05 +00:00
( function ( $ , undefined ) {
/ * v a r W 3 C D O M = ( d o c u m e n t . c r e a t e E l e m e n t & & d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ) ;
function initFileUploads ( ) {
if ( ! W3CDOM ) return ;
var fakeFileUpload = document . createElement ( 'div' ) ;
fakeFileUpload . className = 'fakefile' ;
fakeFileUpload . appendChild ( document . createElement ( 'input' ) ) ;
var image = document . createElement ( 'img' ) ;
image . src = 'pix/button_select.gif' ;
fakeFileUpload . appendChild ( image ) ;
var x = document . getElementsByTagName ( 'input' ) ;
for ( var i = 0 ; i < x . length ; i ++ ) {
if ( x [ i ] . type != 'file' ) continue ;
if ( x [ i ] . parentNode . className != 'fileinputs' ) continue ;
x [ i ] . className = 'file hidden' ;
var clone = fakeFileUpload . cloneNode ( true ) ;
x [ i ] . parentNode . appendChild ( clone ) ;
x [ i ] . relatedElement = clone . getElementsByTagName ( 'input' ) [ 0 ] ;
x [ i ] . onchange = x [ i ] . onmouseout = function ( ) {
this . relatedElement . value = this . value ;
}
}
} * /
$ ( function ( ) {
$ ( '.fileinputs .file-cv' ) . prepend ( '<input class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required wpcf7-use-title-as-watermark watermark fakefile" name="fakefile" type="text" title="Curriculum Vitae" size="40"/>' ) ;
//$('.fileinputs .file-cv').append('<img class="fakebutton" src="http://www.rodax-software.ws/wp-content/uploads/2012/04/english_flag.jpg"/>');
/ * $ ( ' . f i l e i n p u t s . f a k e f i l e . w p c f 7 - f o r m - c o n t r o l ' ) . c l i c k ( f u n c t i o n ( ) {
//$('.fileinputs .file.hidden').click();
//$('.fileinputs .file.hidden').trigger('click');
//$('.fileinputs .fakefile .wpcf7-form-control').val($('.fileinputs .file.hidden').val());
} ) ; * /
$ ( '.fileinputs .filepdf' ) . change ( function ( ) {
$ ( 'input[name=fakefile]' ) . val ( $ ( '.fileinputs .filepdf' ) . val ( ) ) ;
} ) ;
var portfolioImages = $ ( '.portfolios.sortable img.lazy' ) ;
if ( portfolioImages . length ) {
portfolioImages . jail ( {
speed : 1400 ,
event : "load" ,
callback : function ( ) {
setTimeout ( function ( ) {
$ ( ".portfolios.sortable" ) . each ( function ( ) {
var list = $ ( 'ul' , this ) ;
var items = $ ( "li" , list ) ;
var links = $ ( '.sort_by_cat a' , this ) ;
list . css ( {
width : list . width ( ) ,
height : list . height ( ) ,
position : "relative"
} ) ;
var places = [ ] ;
items . each ( function ( i , item ) {
var box = {
top : item . offsetTop ,
left : item . offsetLeft
} ;
$ ( this ) . css ( box ) ;
box . height = $ ( item ) . height ( ) ;
box . width = $ ( item ) . width ( ) ;
places . push ( box ) ;
} ) ;
var columns = {
portfolio _two _columns : 2 ,
portfolio _three _columns : 3 ,
portfolio _four _columns : 4
} ;
items . css ( {
position : "absolute"
} ) ;
fixRowHeights ( items ) ;
function getNumColumns ( ) {
for ( var c in columns ) {
if ( list . hasClass ( c ) ) {
return columns [ c ] ;
}
}
return 1 ;
}
function fixRowHeights ( items ) {
var cols = getNumColumns ( ) ;
if ( cols > 1 ) {
var h = 0 ,
bottomLine = 0 ,
last = items [ 0 ] ;
items . each ( function ( j ) {
$ ( this ) . css ( {
height : "auto"
} ) ;
h = Math . max ( h , $ ( this ) . outerHeight ( ) ) ;
$ ( this ) . css ( {
top : bottomLine
} )
if ( ( j + 1 ) % cols === 0 || j == items . length - 1 ) {
$ ( this ) . prevUntil ( last ) . andSelf ( ) . css ( {
height : h ,
marginTop : 0 ,
marginBottom : 0
} ) ;
bottomLine += h + 20 ;
h = 0 ;
last = this ;
}
} ) ;
}
}
links . each ( function ( i , link ) {
var cat = $ ( this ) . attr ( 'data-value' ) ;
var toShow = cat == 'all' ? items : items . filter ( '[data-type*=' + cat + ']' ) ;
var toHide = cat == 'all' ? $ ( ) : items . not ( '[data-type*=' + cat + ']' ) ;
$ ( this ) . click ( function ( e ) {
links . removeClass ( 'active' ) ;
$ ( this ) . addClass ( 'active' ) ;
var cols = getNumColumns ( ) ;
var H = 0 ,
L = toShow . length ,
curH = 0 ,
$img , bottomLine = 0 ,
last = toShow [ 0 ] ;
toShow . each ( function ( j ) {
$img = $ ( this ) . stop ( 1 , 0 ) . css ( "zIndex" , 2 ) ;
if ( ! $img . is ( ":visible" ) ) {
$img . css ( {
opacity : 0 ,
display : "block"
} ) ;
}
$img . css ( {
height : "auto"
} ) . data ( "targetPositionTop" , places [ j ] . top ) ;
curH = Math . max ( curH , $img . outerHeight ( ) ) ;
if ( cols > 1 ) {
if ( ( j + 1 ) % cols === 0 || j == L - 1 ) {
var coll = $img . prevUntil ( last ) . andSelf ( ) ;
if ( toShow . index ( last ) === 0 ) {
coll . add ( last ) ;
}
coll . data ( "targetPositionTop" , bottomLine ) . css ( {
height : curH
} ) ;
bottomLine += curH + 20 ;
curH = 0 ;
last = this ;
}
}
} ) . each ( function ( j ) {
$ ( this ) . delay ( j * 100 ) . animate ( {
opacity : [ 1 , "linear" ] ,
top : $ . data ( this , "targetPositionTop" ) ,
left : places [ j ] . left
} , 800 , "easeInOutExpo" , function ( ) {
$ ( this ) . addClass ( "no-filter" ) ;
} ) ;
H = Math . max ( H , places [ j ] . top + $ ( this ) . height ( ) ) ;
} ) ;
list . animate ( {
height : bottomLine || H
} , 600 , "easeInOutExpo" , function ( ) {
$ ( window ) . trigger ( "scroll" ) ;
} ) ;
toHide . filter ( ":visible" ) . each ( function ( j ) {
$ ( this ) . stop ( 1 , 0 ) . delay ( j * 100 ) . queue ( function ( ) {
$ ( this )
. css ( { zIndex : 1 } )
. removeClass ( "no-filter" )
. animate ( { opacity : "hide" } , 800 , "linear" ) ;
} ) . dequeue ( ) ;
} ) ;
return false ;
} ) ;
} ) ;
} ) ;
} , 0 ) ;
}
} ) ;
}
// Fullwidth slider is without rounded corners
if ( ! $ ( ".header-slider-wrapper" ) . hasClass ( "fullwidth" ) ) {
$ ( ".wpv-wrapper" ) . corner ( ) ;
}
$ ( '#commentform, .searchform' ) . validator ( ) ;
$ ( "nav > div > ul > li:last" ) . css ( "paddingRight" , 0 ) ;
2013-04-15 16:55:42 +00:00
$ ( "nav.main-nav ul li" ) . each ( function ( i , o ) {
2013-02-27 15:39:05 +00:00
$ ( this ) . find ( "ul" ) . css ( {
visibility : "hidden" ,
display : "none" ,
opacity : 0
} ) ;
$ ( this ) . hover (
function ( ) {
$ ( 'ul:first' , this ) . stop ( 1 , 1 ) . delay ( 200 ) . queue ( function ( ) {
if ( $ ( o ) . is ( ".hover" ) ) {
return ;
}
var submenu = $ ( 'ul:first' , o ) ;
var thisOffset = $ ( o ) . offset ( ) ;
var vw = $ ( window ) . width ( ) ;
var isFirst = submenu . is ( "nav > div > ul > li > ul" ) ;
submenu . css ( {
visibility : "hidden" ,
display : "inline-block"
} ) ;
$ ( o ) . addClass ( "hover" ) ;
if ( thisOffset . left + $ ( o ) . outerWidth ( { margin : true } ) + submenu . outerWidth ( { margin : true } ) > vw ) {
submenu . css ( {
right : isFirst ? 0 : "100%" ,
left : "auto"
} ) ;
} else {
submenu . css ( {
left : isFirst ? 0 : "100%" ,
right : "auto"
} ) ;
}
$ ( this ) . css ( {
opacity : 0 ,
visibility : "visible"
} ) . animate ( {
opacity : 1
} , 200 , "linear" ) . dequeue ( ) ;
} ) ;
} , function ( ) {
$ ( 'ul:first' , this ) . stop ( 1 , 0 ) . delay ( 200 ) . queue ( function ( ) {
$ ( this ) . animate ( {
opacity : 0
} , 100 , "linear" , function ( ) {
$ ( this ) . css ( {
display : "none"
} ) ;
$ ( o ) . removeClass ( "hover" ) ;
} ) . dequeue ( ) ;
} ) ;
} ) ;
} ) ;
2013-04-15 16:55:42 +00:00
$ ( "nav.section-nav ul li" ) . each ( function ( i , o ) {
$ ( this ) . find ( "ul" ) . css ( {
visibility : "hidden" ,
display : "none" ,
opacity : 0
} ) ;
} ) ;
$ ( "nav.section-nav ul li.current-menu-item, nav.section-nav ul li.current-page-ancestor" ) . each ( function ( i , o ) {
$ ( this ) . find ( "ul" ) . css ( {
visibility : "visible" ,
display : "inline" ,
opacity : 1
} ) ;
} ) ;
2013-02-27 15:39:05 +00:00
$ ( "nav ul li ul li:has(ul)" ) . find ( "a:first" ) . append ( " » " ) ;
$ ( '.post-head a img' ) . parent ( ) . addClass ( 'a-reset' ) ;
$ ( '.sitemap li:not(:has(.children))' ) . addClass ( 'single' ) ;
var tooltip _animation = 250 ;
$ ( '.shortcode-tooltip' ) . hover ( function ( ) {
$ ( this ) . find ( '.tooltip' ) . fadeIn ( tooltip _animation ) . animate ( {
bottom : 25
} , tooltip _animation ) ;
} , function ( ) {
$ ( this ) . find ( '.tooltip' ) . animate ( {
bottom : 35
} , tooltip _animation ) . fadeOut ( tooltip _animation ) ;
} ) ;
// hover effects -------------------------------------------------------------
$ ( ".thumbnail" ) . live ( {
mouseenter : function ( e ) {
$ ( ".info-pad" , this ) . each ( function ( ) {
if ( $ ( this ) . css ( "position" ) == "absolute" ) {
$ ( this ) . stop ( 1 , 0 ) . delay ( 100 ) . queue ( function ( ) {
$ ( this ) . css ( "zIndex" , 2 ) . animate ( {
opacity : 1
} , 400 , "linear" ) ;
} ) . dequeue ( ) ;
}
} ) ;
} ,
mouseleave : function ( e ) {
$ ( ".info-pad" , this ) . each ( function ( ) {
if ( $ ( this ) . css ( "position" ) == "absolute" ) {
$ ( this ) . stop ( 1 , 0 ) . delay ( 100 ) . animate ( {
opacity : 0
} , 400 , "linear" , function ( ) {
$ ( this ) . css ( "zIndex" , - 1 ) ;
} ) ;
}
} ) ;
}
} ) ;
// adds the 'carved' button arrow
$ ( 'a.button.carved, .button.carved a' ) . append ( function ( ) {
return $ ( '<div></div>' ) . css ( {
bottom : - 5 ,
left : 0 ,
right : 0
} ) . append ( function ( ) {
return $ ( '<div></div>' ) . css ( {
margin : 'auto' ,
width : 0 ,
height : 0 ,
borderLeft : '10px solid transparent' ,
borderRight : '10px solid transparent' ,
borderBottom : '5px solid #fff'
} ) ;
} ) ;
} ) ;
// scroll to top button
$ ( window ) . bind ( 'resize scroll' , function ( ) {
if ( window . pageYOffset > 0 ) $ ( '#scroll-to-top' ) . fadeIn ( 'normal' ) ;
else $ ( '#scroll-to-top' ) . fadeOut ( 'normal' ) ;
} ) ;
$ ( '#scroll-to-top' ) . click ( function ( ) {
$ ( 'html,body' ) . animate ( {
scrollTop : 0
} , 300 ) ;
} ) ;
/* header slider */
function getThumbSrc ( dir , slider ) {
var src = "about:blank" ;
var nextSlide = slider . wpvSlider ( dir == "next" ? "getNextSlide" : "getPreviousSlide" ) ;
if ( nextSlide . length ) {
src = nextSlide = nextSlide . find ( "> .wpv-slide" ) . data ( "thumb" ) || "" ;
}
return src ;
}
function setThumb ( dir , slider ) {
var btn = $ ( dir == "next" ? ".wpv-nav-next" : ".wpv-nav-prev" , slider . parent ( ) ) ;
var thumb = btn . find ( "> img.wpv-preview-thumb" ) ;
var thumbSrc = getThumbSrc ( dir , slider ) ;
if ( thumbSrc ) {
if ( ! thumb . length ) {
thumb = $ ( '<img class="wpv-preview-thumb" />' ) . appendTo ( btn ) ;
}
thumb . attr ( "src" , thumbSrc ) . css ( {
visibility : "visible"
} ) ;
} else {
thumb . css ( {
visibility : "hidden"
} ) ;
}
}
$ ( "#header-slider, .slider-shortcode" ) . bind ( "afterChange sliderload" , function ( ) {
setThumb ( "next" , $ ( this ) ) ;
setThumb ( "prev" , $ ( this ) ) ;
} ) ;
// slide the nav buttons with the navigation-preview design
$ ( ".style-navigation-preview .wpv-nav-next, .style-gallery .wpv-nav-next" ) . live ( "mouseenter" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
marginLeft : - $ ( this ) . outerWidth ( ) ,
opacity : 1
} ) ;
} ) . live ( "mouseleave" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
marginLeft : - 40 ,
opacity : 0.3
} ) ;
} ) ;
$ ( ".style-navigation-preview .wpv-nav-prev, .style-gallery .wpv-nav-prev" ) . live ( "mouseenter" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
marginRight : - $ ( this ) . outerWidth ( ) ,
opacity : 1
} ) ;
} ) . live ( "mouseleave" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
marginRight : - 40 ,
opacity : 0.3
} ) ;
} ) ;
// helpers for the peek slider design
$ ( ".style-peek .wpv-nav-next" ) . live ( "mouseenter" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
width : 50
} , 130 ) ;
} ) . live ( "mouseleave" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
width : 40
} , 130 ) ;
} ) ;
$ ( ".style-peek .wpv-nav-prev" ) . live ( "mouseenter" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
marginLeft : 0
} , 130 ) ;
} ) . live ( "mouseleave" , function ( ) {
$ ( this ) . stop ( 1 , 0 ) . animate ( {
marginLeft : - 10
} , 130 ) ;
} ) ;
$ ( ".style-peek #header-slider" ) . one ( "sliderload" , function ( e , slider ) {
$ ( ".wpv-slide-wrapper" , slider . view ) . each ( function ( i , o ) {
$ . data ( o , "Slide" ) . getCaption ( ) ;
// Click to scroll
$ ( o ) . click ( function ( ) {
if ( ! $ ( o ) . is ( ".active" ) ) {
slider . goTo ( i ) ;
return false ;
}
} )
} ) ;
$ ( "#header-slider-caption-wrapper" ) . show ( ) ;
} ) ;
$ ( ".style-peek #header-slider" ) . one ( "beforeChange" , function ( e , slider , slideToShow , slideToHide ) {
var cur = slideToHide || slideToShow ;
var next = cur . next ( ".wpv-slide-wrapper" ) ;
if ( ! next . length ) {
next = cur . parent ( ) . find ( ".wpv-slide-wrapper:first" ) ;
}
next . show ( ) . css ( {
left : cur . position ( ) . left + cur . width ( ) + 20
} ) ;
} ) ;
} ) ;
// Internet Explorer fixes
if ( $ . browser . msie && $ . browser . version == 8 ) {
/ *
if ( WPV _THEME _URI ) {
// Shadows fix
$ ( '.shadow, .sep-3' ) . hide ( ) ;
$ ( '.dark .shadow, .dark .sep-3' ) . after ( '<img src="' + WPV _THEME _URI + 'images/dark/shadow.png" width="100%" class="ie-shadow" alt="" />' ) ;
$ ( '.light .shadow, .light .sep-3' ) . after ( '<img src="' + WPV _THEME _URI + 'images/light/shadow.png" width="100%" class="ie-shadow" alt="" />' ) ;
$ ( 'body' ) . bind ( 'wpv-class-change' , function ( ) {
$ ( '.ie-shadow' ) . show ( ) ;
$ ( '.classic .ie-shadow' ) . hide ( ) ;
} ) ;
}
* /
$ ( 'p:empty' ) . hide ( ) ;
// Last child elements
$ ( 'p:last-child, ul li:last-child, ol li:last-child, .widget:last-child, .accordion:last-child, .toggle:last-child, .toggle_content:last-child' ) . addClass ( 'last' ) ;
}
} ) ( jQuery ) ;