var scroll = false;
(function($) {
videojs.options.flash.swf = '/video-js/video-js.swf';
function wpboxOff() {
$('#wpbox').animate({
opacity: 0
}, 150, function() {
$(this).hide();
});
}
$(document).ready(function() {
$('#main').wpShowerResponsiveVideos();
$('.wpbox').on('click', function(e) {
e.preventDefault();
var box = $('#wpbox');
box.find('img').remove();
box.find('.helper').remove();
$('#wpbox .image').append('
');
box.show().animate({
opacity: 1
}, 150).on('mousewheel', function() {
$(this).off('mousewheel');
wpboxOff();
});
});
$('#wpbox').on('click', wpboxOff);
$('#show_who_we_are').on('click', function() {
$('#content').hide();
$('#colophon').hide();
$('#content_who_we_are').show();
$('body').addClass('with_color');
});
$('#close_who_we_are').on('click', function() {
$('#content_who_we_are').hide();
$('body').removeClass('with_color');
$('#content').show();
$('#colophon').show();
});
if ($('.theme-videos').length == 1) {
scroll = {
window: $(window),
body: $('body'),
footer: $('#colophon'),
body_height: 0,
window_height: 0,
footer_height: 0,
fixed_top: 0,
el: false,
offset: 0,
with_color: false,
updateHeight: function() {
this.body_height = this.body.height();
this.window_height = this.window.height();
this.footer_height = this.footer.height() + parseInt(this.footer.css('padding-top')) + parseInt(this.footer.css('padding-bottom'));
},
init: function() {
scroll.el = $('.content-separator.for-video');
this.process();
if ($('#wpadminbar').length != 0) {
this.fixed_top = $('#wpadminbar').height();
}
this.window.on('resize load', scroll.process);
this.window.on('scroll', scroll.updateScroll);
},
process: function() {
scroll.updateHeight();
scroll.offset = scroll.el.offset().top - scroll.fixed_top;
},
updateScroll: function() {
var top = scroll.window.scrollTop();
if (top > scroll.offset || top + scroll.window_height - scroll.fixed_top >= scroll.body_height - scroll.footer_height) {
if (!scroll.with_color) scroll.enable();
}
else if (scroll.with_color) scroll.disable();
},
enable: function() {
scroll.with_color = true;
$('body').addClass('with_color');
},
disable: function() {
scroll.with_color = false;
$('body').removeClass('with_color');
}
};
scroll.init();
}
});
})(jQuery);