mirror of
https://github.com/10h30/ycb.vn.git
synced 2026-06-05 15:10:02 +09:00
Init
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
(function (document, $, undefined) {
|
||||
|
||||
/**
|
||||
* Add shrink class to header on scroll.
|
||||
*/
|
||||
$(window).scroll(function () {
|
||||
var scroll = $(window).scrollTop();
|
||||
var height = $('.hero-section').outerHeight();
|
||||
var header = $('.site-header').outerHeight();
|
||||
if (scroll >= header) {
|
||||
$(".site-header").addClass("shrink");
|
||||
} else {
|
||||
$(".site-header").removeClass("shrink");
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Show/hide video lightbox.
|
||||
*/
|
||||
$('.front-page-4 .wp-video').append('<button class="hide-video">×</button>');
|
||||
$('.front-page-4 .wp-video').prepend('<div class="before"></div>');
|
||||
$('.show-video').on('click', function () {
|
||||
$('.widget_media_video').toggleClass('visible');
|
||||
});
|
||||
$('.hide-video, .before').on('click', function () {
|
||||
$('.front-page-4 .widget_media_video').toggleClass('visible');
|
||||
});
|
||||
|
||||
// Append icon for enews footer widget.
|
||||
$('.footer-widgets .enews form').append('<i class="fa fa-send-o"></i>');
|
||||
|
||||
// Add back to top button.
|
||||
$('.site-footer > .wrap').append('<a href="#top" class="back-to-top"></a>');
|
||||
|
||||
// Add id to top of page for scrolling target.
|
||||
$('html').attr('id', 'top');
|
||||
|
||||
/**
|
||||
* Smooth scrolling.
|
||||
*/
|
||||
// Select all links with hashes
|
||||
$('a[href*="#"]')
|
||||
// Remove links that don't actually link to anything
|
||||
.not('[href="#"]')
|
||||
.not('[href="#0"]')
|
||||
// Remove WooCommerce tabs
|
||||
.not('[href*="#tab-"]')
|
||||
.click(function (event) {
|
||||
// On-page links
|
||||
if (
|
||||
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &&
|
||||
location.hostname == this.hostname
|
||||
) {
|
||||
// Figure out element to scroll to
|
||||
var target = $(this.hash);
|
||||
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
|
||||
// Does a scroll target exist?
|
||||
if (target.length) {
|
||||
// Only prevent default if animation is actually gonna happen
|
||||
event.preventDefault();
|
||||
$('html, body').animate({
|
||||
scrollTop: target.offset().top
|
||||
}, 1000, function () {
|
||||
// Callback after animation
|
||||
// Must change focus!
|
||||
var $target = $(target);
|
||||
$target.focus();
|
||||
if ($target.is(":focus")) { // Checking if the target was focused
|
||||
return false;
|
||||
} else {
|
||||
$target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable
|
||||
$target.focus(); // Set focus again
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(document, jQuery);
|
||||
@@ -0,0 +1,267 @@
|
||||
/**
|
||||
* Alpha Color Picker JS
|
||||
*
|
||||
* This file includes several helper functions and the core control JS.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Override the stock color.js toString() method to add support for
|
||||
* outputting RGBa or Hex.
|
||||
*/
|
||||
Color.prototype.toString = function( flag ) {
|
||||
|
||||
// If our no-alpha flag has been passed in, output RGBa value with 100% opacity.
|
||||
// This is used to set the background color on the opacity slider during color changes.
|
||||
if ( 'no-alpha' == flag ) {
|
||||
return this.toCSS( 'rgba', '1' ).replace( /\s+/g, '' );
|
||||
}
|
||||
|
||||
// If we have a proper opacity value, output RGBa.
|
||||
if ( 1 > this._alpha ) {
|
||||
return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
|
||||
}
|
||||
|
||||
// Proceed with stock color.js hex output.
|
||||
var hex = parseInt( this._color, 10 ).toString( 16 );
|
||||
if ( this.error ) { return ''; }
|
||||
if ( hex.length < 6 ) {
|
||||
for ( var i = 6 - hex.length - 1; i >= 0; i-- ) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
}
|
||||
|
||||
return '#' + hex;
|
||||
};
|
||||
|
||||
/**
|
||||
* Given an RGBa, RGB, or hex color value, return the alpha channel value.
|
||||
*/
|
||||
function acp_get_alpha_value_from_color( value ) {
|
||||
var alphaVal;
|
||||
|
||||
// Remove all spaces from the passed in value to help our RGBa regex.
|
||||
value = value.replace( / /g, '' );
|
||||
|
||||
if ( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ ) ) {
|
||||
alphaVal = parseFloat( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ )[1] ).toFixed(2) * 100;
|
||||
alphaVal = parseInt( alphaVal );
|
||||
} else {
|
||||
alphaVal = 100;
|
||||
}
|
||||
|
||||
return alphaVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Force update the alpha value of the color picker object and maybe the alpha slider.
|
||||
*/
|
||||
function acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, update_slider ) {
|
||||
var iris, colorPicker, color;
|
||||
|
||||
iris = $control.data( 'a8cIris' );
|
||||
colorPicker = $control.data( 'wpWpColorPicker' );
|
||||
|
||||
// Set the alpha value on the Iris object.
|
||||
iris._color._alpha = alpha;
|
||||
|
||||
// Store the new color value.
|
||||
color = iris._color.toString();
|
||||
|
||||
// Set the value of the input.
|
||||
$control.val( color );
|
||||
|
||||
// Update the background color of the color picker.
|
||||
colorPicker.toggler.css({
|
||||
'background-color': color
|
||||
});
|
||||
|
||||
// Maybe update the alpha slider itself.
|
||||
if ( update_slider ) {
|
||||
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
||||
}
|
||||
|
||||
// Update the color value of the color picker object.
|
||||
$control.wpColorPicker( 'color', color );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the slider handle position and label.
|
||||
*/
|
||||
function acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ) {
|
||||
$alphaSlider.slider( 'value', alpha );
|
||||
$alphaSlider.find( '.ui-slider-handle' ).text( alpha.toString() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization trigger.
|
||||
*/
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
||||
// Loop over each control and transform it into our color picker.
|
||||
$( '.alpha-color-control' ).each( function() {
|
||||
|
||||
// Scope the vars.
|
||||
var $control, startingColor, paletteInput, showOpacity, defaultColor, palette,
|
||||
colorPickerOptions, $container, $alphaSlider, alphaVal, sliderOptions;
|
||||
|
||||
// Store the control instance.
|
||||
$control = $( this );
|
||||
|
||||
// Get a clean starting value for the option.
|
||||
startingColor = $control.val().replace( /\s+/g, '' );
|
||||
|
||||
// Get some data off the control.
|
||||
paletteInput = $control.attr( 'data-palette' );
|
||||
showOpacity = $control.attr( 'data-show-opacity' );
|
||||
defaultColor = $control.attr( 'data-default-color' );
|
||||
|
||||
// Process the palette.
|
||||
if ( paletteInput.indexOf( '|' ) !== -1 ) {
|
||||
palette = paletteInput.split( '|' );
|
||||
} else if ( 'false' == paletteInput ) {
|
||||
palette = false;
|
||||
} else {
|
||||
palette = true;
|
||||
}
|
||||
|
||||
// Set up the options that we'll pass to wpColorPicker().
|
||||
colorPickerOptions = {
|
||||
change: function( event, ui ) {
|
||||
var key, value, alpha, $transparency;
|
||||
|
||||
key = $control.attr( 'data-customize-setting-link' );
|
||||
value = $control.wpColorPicker( 'color' );
|
||||
|
||||
// Set the opacity value on the slider handle when the default color button is clicked.
|
||||
if ( defaultColor == value ) {
|
||||
alpha = acp_get_alpha_value_from_color( value );
|
||||
$alphaSlider.find( '.ui-slider-handle' ).text( alpha );
|
||||
}
|
||||
|
||||
// Send ajax request to wp.customize to trigger the Save action.
|
||||
wp.customize( key, function( obj ) {
|
||||
obj.set( value );
|
||||
});
|
||||
|
||||
$transparency = $container.find( '.transparency' );
|
||||
|
||||
// Always show the background color of the opacity slider at 100% opacity.
|
||||
$transparency.css( 'background-color', ui.color.toString( 'no-alpha' ) );
|
||||
},
|
||||
palettes: palette // Use the passed in palette.
|
||||
};
|
||||
|
||||
// Create the colorpicker.
|
||||
$control.wpColorPicker( colorPickerOptions );
|
||||
|
||||
$container = $control.parents( '.wp-picker-container:first' );
|
||||
|
||||
// Insert our opacity slider.
|
||||
$( '<div class="alpha-color-picker-container">' +
|
||||
'<div class="min-click-zone click-zone"></div>' +
|
||||
'<div class="max-click-zone click-zone"></div>' +
|
||||
'<div class="alpha-slider"></div>' +
|
||||
'<div class="transparency"></div>' +
|
||||
'</div>' ).appendTo( $container.find( '.wp-picker-holder' ) );
|
||||
|
||||
$alphaSlider = $container.find( '.alpha-slider' );
|
||||
|
||||
// If starting value is in format RGBa, grab the alpha channel.
|
||||
alphaVal = acp_get_alpha_value_from_color( startingColor );
|
||||
|
||||
// Set up jQuery UI slider() options.
|
||||
sliderOptions = {
|
||||
create: function( event, ui ) {
|
||||
var value = $( this ).slider( 'value' );
|
||||
|
||||
// Set up initial values.
|
||||
$( this ).find( '.ui-slider-handle' ).text( value );
|
||||
$( this ).siblings( '.transparency ').css( 'background-color', startingColor );
|
||||
},
|
||||
value: alphaVal,
|
||||
range: 'max',
|
||||
step: 1,
|
||||
min: 0,
|
||||
max: 100,
|
||||
animate: 300
|
||||
};
|
||||
|
||||
// Initialize jQuery UI slider with our options.
|
||||
$alphaSlider.slider( sliderOptions );
|
||||
|
||||
// Maybe show the opacity on the handle.
|
||||
if ( 'true' == showOpacity ) {
|
||||
$alphaSlider.find( '.ui-slider-handle' ).addClass( 'show-opacity' );
|
||||
}
|
||||
|
||||
// Bind event handlers for the click zones.
|
||||
$container.find( '.min-click-zone' ).on( 'click', function() {
|
||||
acp_update_alpha_value_on_color_control( 0, $control, $alphaSlider, true );
|
||||
});
|
||||
$container.find( '.max-click-zone' ).on( 'click', function() {
|
||||
acp_update_alpha_value_on_color_control( 100, $control, $alphaSlider, true );
|
||||
});
|
||||
|
||||
// Bind event handler for clicking on a palette color.
|
||||
$container.find( '.iris-palette' ).on( 'click', function() {
|
||||
var color, alpha;
|
||||
|
||||
color = $( this ).css( 'background-color' );
|
||||
alpha = acp_get_alpha_value_from_color( color );
|
||||
|
||||
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
||||
|
||||
// Sometimes Iris doesn't set a perfect background-color on the palette,
|
||||
// for example rgba(20, 80, 100, 0.3) becomes rgba(20, 80, 100, 0.298039).
|
||||
// To compensante for this we round the opacity value on RGBa colors here
|
||||
// and save it a second time to the color picker object.
|
||||
if ( alpha != 100 ) {
|
||||
color = color.replace( /[^,]+(?=\))/, ( alpha / 100 ).toFixed( 2 ) );
|
||||
}
|
||||
|
||||
$control.wpColorPicker( 'color', color );
|
||||
});
|
||||
|
||||
// Bind event handler for clicking on the 'Clear' button.
|
||||
$container.find( '.button.wp-picker-clear' ).on( 'click', function() {
|
||||
var key = $control.attr( 'data-customize-setting-link' );
|
||||
|
||||
// The #fff color is delibrate here. This sets the color picker to white instead of the
|
||||
// defult black, which puts the color picker in a better place to visually represent empty.
|
||||
$control.wpColorPicker( 'color', '#ffffff' );
|
||||
|
||||
// Set the actual option value to empty string.
|
||||
wp.customize( key, function( obj ) {
|
||||
obj.set( '' );
|
||||
});
|
||||
|
||||
acp_update_alpha_value_on_alpha_slider( 100, $alphaSlider );
|
||||
});
|
||||
|
||||
// Bind event handler for clicking on the 'Default' button.
|
||||
$container.find( '.button.wp-picker-default' ).on( 'click', function() {
|
||||
var alpha = acp_get_alpha_value_from_color( defaultColor );
|
||||
|
||||
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
||||
});
|
||||
|
||||
// Bind event handler for typing or pasting into the input.
|
||||
$control.on( 'input', function() {
|
||||
var value = $( this ).val();
|
||||
var alpha = acp_get_alpha_value_from_color( value );
|
||||
|
||||
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
||||
});
|
||||
|
||||
// Update all the things when the slider is interacted with.
|
||||
$alphaSlider.slider().on( 'slide', function( event, ui ) {
|
||||
var alpha = parseFloat( ui.value ) / 100.0;
|
||||
|
||||
acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, false );
|
||||
|
||||
// Change value shown on slider handle.
|
||||
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
jQuery(function($){
|
||||
$(window).load(function() {
|
||||
|
||||
// Main function.
|
||||
function portfolioIsotope() {
|
||||
var $container = $('.portfolio-content');
|
||||
$container.isotope({
|
||||
itemSelector: '.portfolio-item',
|
||||
masonry: {
|
||||
itemSelector: ".portfolio-item",
|
||||
columnWidth: ".portfolio-item",
|
||||
gutter: 20
|
||||
}
|
||||
});
|
||||
} portfolioIsotope();
|
||||
|
||||
// Filter.
|
||||
$('.filter a').click(function(){
|
||||
var selector = $(this).attr('data-filter');
|
||||
$('.portfolio-content').isotope({ filter: selector });
|
||||
$(this).parent().find('a').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
return false;
|
||||
});
|
||||
|
||||
// Resize.
|
||||
var isIE8 = $.browser.msie && +$.browser.version === 8;
|
||||
if (isIE8) {
|
||||
document.body.onresize = function () {
|
||||
portfolioIsotope();
|
||||
};
|
||||
} else {
|
||||
$(window).resize(function () {
|
||||
portfolioIsotope();
|
||||
});
|
||||
}
|
||||
|
||||
// Orientation change.
|
||||
window.addEventListener("orientationchange", function() {
|
||||
portfolioIsotope();
|
||||
});
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,419 @@
|
||||
/**
|
||||
* This script adds the accessibility-ready responsive menus Genesis Framework child themes.
|
||||
*
|
||||
* @author StudioPress
|
||||
* @link https://github.com/copyblogger/responsive-menus
|
||||
* @version 1.1.3
|
||||
* @license GPL-2.0+
|
||||
*/
|
||||
|
||||
( function ( document, $, undefined ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$('body').removeClass('no-js');
|
||||
|
||||
var genesisMenuParams = typeof genesis_responsive_menu === 'undefined' ? '' : genesis_responsive_menu,
|
||||
genesisMenusUnchecked = genesisMenuParams.menuClasses,
|
||||
genesisMenus = {},
|
||||
menusToCombine = [];
|
||||
|
||||
/**
|
||||
* Validate the menus passed by the theme with what's being loaded on the page,
|
||||
* and pass the new and accurate information to our new data.
|
||||
* @param {genesisMenusUnchecked} Raw data from the localized script in the theme.
|
||||
* @return {array} genesisMenus array gets populated with updated data.
|
||||
* @return {array} menusToCombine array gets populated with relevant data.
|
||||
*/
|
||||
$.each( genesisMenusUnchecked, function( group ) {
|
||||
|
||||
// Mirror our group object to populate.
|
||||
genesisMenus[group] = [];
|
||||
|
||||
// Loop through each instance of the specified menu on the page.
|
||||
$.each( this, function( key, value ) {
|
||||
|
||||
var menuString = value,
|
||||
$menu = $(value);
|
||||
|
||||
// If there is more than one instance, append the index and update array.
|
||||
if ( $menu.length > 1 ) {
|
||||
|
||||
$.each( $menu, function( key, value ) {
|
||||
|
||||
var newString = menuString + '-' + key;
|
||||
|
||||
$(this).addClass( newString.replace('.','') );
|
||||
|
||||
genesisMenus[group].push( newString );
|
||||
|
||||
if ( 'combine' === group ) {
|
||||
menusToCombine.push( newString );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else if ( $menu.length == 1 ) {
|
||||
|
||||
genesisMenus[group].push( menuString );
|
||||
|
||||
if ( 'combine' === group ) {
|
||||
menusToCombine.push( menuString );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Make sure there is something to use for the 'others' array.
|
||||
if ( typeof genesisMenus.others == 'undefined' ) {
|
||||
genesisMenus.others = [];
|
||||
}
|
||||
|
||||
// If there's only one menu on the page for combining, push it to the 'others' array and nullify our 'combine' variable.
|
||||
if ( menusToCombine.length == 1 ) {
|
||||
genesisMenus.others.push( menusToCombine[0] );
|
||||
genesisMenus.combine = null;
|
||||
menusToCombine = null;
|
||||
}
|
||||
|
||||
var genesisMenu = {},
|
||||
mainMenuButtonClass = 'menu-toggle',
|
||||
subMenuButtonClass = 'sub-menu-toggle',
|
||||
responsiveMenuClass = 'genesis-responsive-menu';
|
||||
|
||||
// Initialize.
|
||||
genesisMenu.init = function() {
|
||||
|
||||
// Exit early if there are no menus to do anything.
|
||||
if ( $( _getAllMenusArray() ).length == 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var menuIconClass = typeof genesisMenuParams.menuIconClass !== 'undefined' ? genesisMenuParams.menuIconClass : 'dashicons-before dashicons-menu',
|
||||
subMenuIconClass = typeof genesisMenuParams.subMenuIconClass !== 'undefined' ? genesisMenuParams.subMenuIconClass : 'dashicons-before dashicons-arrow-down-alt2',
|
||||
toggleButtons = {
|
||||
menu : $( '<button />', {
|
||||
'class' : mainMenuButtonClass,
|
||||
'aria-expanded' : false,
|
||||
'aria-pressed' : false,
|
||||
'role' : 'button',
|
||||
'text' : 'Menu'
|
||||
} )
|
||||
.append( $( '<span />' ) ),
|
||||
submenu : $( '<button />', {
|
||||
'class' : subMenuButtonClass,
|
||||
'aria-expanded' : false,
|
||||
'aria-pressed' : false,
|
||||
'text' : ''
|
||||
} )
|
||||
.append( $( '<span />', {
|
||||
'class' : 'screen-reader-text',
|
||||
'text' : genesisMenuParams.subMenu
|
||||
} ) )
|
||||
};
|
||||
|
||||
// Add the responsive menu class to the active menus.
|
||||
_addResponsiveMenuClass();
|
||||
|
||||
// Add the main nav button to the primary menu, or exit the plugin.
|
||||
_addMenuButtons( toggleButtons );
|
||||
|
||||
// Setup additional classes.
|
||||
$( '.' + mainMenuButtonClass ).addClass( menuIconClass );
|
||||
$( '.' + subMenuButtonClass ).addClass( subMenuIconClass );
|
||||
$( '.' + mainMenuButtonClass ).on( 'click.genesisMenu-mainbutton', _mainmenuToggle ).each( _addClassID );
|
||||
$( '.' + subMenuButtonClass ).on( 'click.genesisMenu-subbutton', _submenuToggle );
|
||||
$( window ).on( 'resize.genesisMenu', _doResize ).triggerHandler( 'resize.genesisMenu' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Add menu toggle button to appropriate menus.
|
||||
* @param {toggleButtons} Object of menu buttons to use for toggles.
|
||||
*/
|
||||
function _addMenuButtons( toggleButtons ) {
|
||||
|
||||
// Apply sub menu toggle to each sub-menu found in the menuList.
|
||||
$( _getMenuSelectorString( genesisMenus ) ).find( '.sub-menu' ).before( toggleButtons.submenu );
|
||||
|
||||
|
||||
if ( menusToCombine !== null ) {
|
||||
|
||||
var menusToToggle = genesisMenus.others.concat( menusToCombine[0] );
|
||||
|
||||
// Only add menu button the primary menu and navs NOT in the combine variable.
|
||||
$( _getMenuSelectorString( menusToToggle ) ).before( toggleButtons.menu );
|
||||
|
||||
} else {
|
||||
|
||||
// Apply the main menu toggle to all menus in the list.
|
||||
$( _getMenuSelectorString( genesisMenus.others ) ).before( toggleButtons.menu );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the responsive menu class.
|
||||
*/
|
||||
function _addResponsiveMenuClass() {
|
||||
$( _getMenuSelectorString( genesisMenus ) ).addClass( responsiveMenuClass );
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute our responsive menu functions on window resizing.
|
||||
*/
|
||||
function _doResize() {
|
||||
var buttons = $( 'button[id^="genesis-mobile-"]' ).attr( 'id' );
|
||||
if ( typeof buttons === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
_maybeClose( buttons );
|
||||
_superfishToggle( buttons );
|
||||
_changeSkipLink( buttons );
|
||||
_combineMenus( buttons );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the nav- class of the related navigation menu as
|
||||
* an ID to associated button (helps target specific buttons outside of context).
|
||||
*/
|
||||
function _addClassID() {
|
||||
var $this = $( this ),
|
||||
nav = $this.next( 'nav' ),
|
||||
id = 'class';
|
||||
|
||||
$this.attr( 'id', 'genesis-mobile-' + $( nav ).attr( id ).match( /nav-\w*\b/ ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine our menus if the mobile menu is visible.
|
||||
* @params buttons
|
||||
*/
|
||||
function _combineMenus( buttons ){
|
||||
|
||||
// Exit early if there are no menus to combine.
|
||||
if ( menusToCombine == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Split up the menus to combine based on order of appearance in the array.
|
||||
var primaryMenu = menusToCombine[0],
|
||||
combinedMenus = $( menusToCombine ).filter( function(index) { if ( index > 0 ) { return index; } });
|
||||
|
||||
// If the responsive menu is active, append items in 'combinedMenus' object to the 'primaryMenu' object.
|
||||
if ( 'none' !== _getDisplayValue( buttons ) ) {
|
||||
|
||||
$.each( combinedMenus, function( key, value ) {
|
||||
$(value).find( '.menu > li' ).addClass( 'moved-item-' + value.replace( '.','' ) ).appendTo( primaryMenu + ' ul.genesis-nav-menu' );
|
||||
});
|
||||
$( _getMenuSelectorString( combinedMenus ) ).hide();
|
||||
|
||||
} else {
|
||||
|
||||
$( _getMenuSelectorString( combinedMenus ) ).show();
|
||||
$.each( combinedMenus, function( key, value ) {
|
||||
$( '.moved-item-' + value.replace( '.','' ) ).appendTo( value + ' ul.genesis-nav-menu' ).removeClass( 'moved-item-' + value.replace( '.','' ) );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to happen when the main menu button is clicked.
|
||||
*/
|
||||
function _mainmenuToggle() {
|
||||
var $this = $( this );
|
||||
_toggleAria( $this, 'aria-pressed' );
|
||||
_toggleAria( $this, 'aria-expanded' );
|
||||
$this.toggleClass( 'activated' );
|
||||
$this.next( 'nav' ).fadeToggle( 'fast' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Action for submenu toggles.
|
||||
*/
|
||||
function _submenuToggle() {
|
||||
|
||||
var $this = $( this ),
|
||||
others = $this.closest( '.menu-item' ).siblings();
|
||||
_toggleAria( $this, 'aria-pressed' );
|
||||
_toggleAria( $this, 'aria-expanded' );
|
||||
$this.toggleClass( 'activated' );
|
||||
$this.next( '.sub-menu' ).slideToggle( 'fast' );
|
||||
|
||||
others.find( '.' + subMenuButtonClass ).removeClass( 'activated' ).attr( 'aria-pressed', 'false' );
|
||||
others.find( '.sub-menu' ).slideUp( 'fast' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate/deactivate superfish.
|
||||
* @params buttons
|
||||
*/
|
||||
function _superfishToggle( buttons ) {
|
||||
var _superfish = $( '.' + responsiveMenuClass + ' .js-superfish' ),
|
||||
$args = 'destroy';
|
||||
if ( typeof _superfish.superfish !== 'function' ) {
|
||||
return;
|
||||
}
|
||||
if ( 'none' === _getDisplayValue( buttons ) ) {
|
||||
$args = {
|
||||
'delay': 0,
|
||||
'animation': {'opacity': 'show'},
|
||||
'dropShadows': false,
|
||||
'speed': 0,
|
||||
'disableHI': true
|
||||
};
|
||||
}
|
||||
_superfish.superfish( $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify skip link to match mobile buttons.
|
||||
* @param buttons
|
||||
*/
|
||||
function _changeSkipLink( buttons ) {
|
||||
|
||||
// Start with an empty array.
|
||||
var menuToggleList = _getAllMenusArray();
|
||||
|
||||
// Exit out if there are no menu items to update.
|
||||
if ( ! $( menuToggleList ).length > 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.each( menuToggleList, function ( key, value ) {
|
||||
|
||||
var newValue = value.replace( '.', '' ),
|
||||
startLink = 'genesis-' + newValue,
|
||||
endLink = 'genesis-mobile-' + newValue;
|
||||
|
||||
if ( 'none' == _getDisplayValue( buttons ) ) {
|
||||
startLink = 'genesis-mobile-' + newValue;
|
||||
endLink = 'genesis-' + newValue;
|
||||
}
|
||||
|
||||
var $item = $( '.genesis-skip-link a[href="#' + startLink + '"]' );
|
||||
|
||||
if ( menusToCombine !== null && value !== menusToCombine[0] ) {
|
||||
$item.toggleClass( 'skip-link-hidden' );
|
||||
}
|
||||
|
||||
if ( $item.length > 0 ) {
|
||||
var link = $item.attr( 'href' );
|
||||
link = link.replace( startLink, endLink );
|
||||
|
||||
$item.attr( 'href', link );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Close all the menu toggles if buttons are hidden.
|
||||
* @param buttons
|
||||
*/
|
||||
function _maybeClose( buttons ) {
|
||||
if ( 'none' !== _getDisplayValue( buttons ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$( '.' + mainMenuButtonClass + ', .' + responsiveMenuClass + ' .sub-menu-toggle' )
|
||||
.removeClass( 'activated' )
|
||||
.attr( 'aria-expanded', false )
|
||||
.attr( 'aria-pressed', false );
|
||||
|
||||
$( '.' + responsiveMenuClass + ', .' + responsiveMenuClass + ' .sub-menu' )
|
||||
.attr( 'style', '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic function to get the display value of an element.
|
||||
* @param {id} $id ID to check
|
||||
* @return {string} CSS value of display property
|
||||
*/
|
||||
function _getDisplayValue( $id ) {
|
||||
var element = document.getElementById( $id ),
|
||||
style = window.getComputedStyle( element );
|
||||
return style.getPropertyValue( 'display' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle aria attributes.
|
||||
* @param {button} $this passed through
|
||||
* @param {aria-xx} attribute aria attribute to toggle
|
||||
* @return {bool} from _ariaReturn
|
||||
*/
|
||||
function _toggleAria( $this, attribute ) {
|
||||
$this.attr( attribute, function( index, value ) {
|
||||
return 'false' === value;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to return a comma separated string of menu selectors.
|
||||
* @param {itemArray} Array of menu items to loop through.
|
||||
* @param {ignoreSecondary} boolean of whether to ignore the 'secondary' menu item.
|
||||
* @return {string} Comma-separated string.
|
||||
*/
|
||||
function _getMenuSelectorString( itemArray ) {
|
||||
|
||||
var itemString = $.map( itemArray, function( value, key ) {
|
||||
return value;
|
||||
});
|
||||
|
||||
return itemString.join( ',' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to return a group array of all the menus in
|
||||
* both the 'others' and 'combine' arrays.
|
||||
* @return {array} Array of all menu items as class selectors.
|
||||
*/
|
||||
function _getAllMenusArray() {
|
||||
|
||||
// Start with an empty array.
|
||||
var menuList = [];
|
||||
|
||||
// If there are menus in the 'menusToCombine' array, add them to 'menuList'.
|
||||
if ( menusToCombine !== null ) {
|
||||
|
||||
$.each( menusToCombine, function( key, value ) {
|
||||
menuList.push( value.valueOf() );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Add menus in the 'others' array to 'menuList'.
|
||||
$.each( genesisMenus.others, function( key, value ) {
|
||||
menuList.push( value.valueOf() );
|
||||
});
|
||||
|
||||
if ( menuList.length > 0 ) {
|
||||
return menuList;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
if ( _getAllMenusArray() !== null ) {
|
||||
|
||||
genesisMenu.init();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
})( document, jQuery );
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(e,o,t){o(window).scroll(function(){var e=o(window).scrollTop();o(".hero-section").outerHeight();e>=o(".site-header").outerHeight()?o(".site-header").addClass("shrink"):o(".site-header").removeClass("shrink")}),o(".front-page-4 .wp-video").append('<button class="hide-video">×</button>'),o(".front-page-4 .wp-video").prepend('<div class="before"></div>'),o(".show-video").on("click",function(){o(".widget_media_video").toggleClass("visible")}),o(".hide-video, .before").on("click",function(){o(".front-page-4 .widget_media_video").toggleClass("visible")}),o(".footer-widgets .enews form").append('<i class="fa fa-send-o"></i>'),o(".site-footer > .wrap").append('<a href="#top" class="back-to-top"></a>'),o("html").attr("id","top"),o('a[href*="#"]').not('[href="#"]').not('[href="#0"]').not('[href*="#tab-"]').click(function(e){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var t=o(this.hash);(t=t.length?t:o("[name="+this.hash.slice(1)+"]")).length&&(e.preventDefault(),o("html, body").animate({scrollTop:t.offset().top},1e3,function(){var e=o(t);if(e.focus(),e.is(":focus"))return!1;e.attr("tabindex","-1"),e.focus()}))}})}(document,jQuery);
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
function acp_get_alpha_value_from_color(a){var o;return(a=a.replace(/ /g,"")).match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)?(o=100*parseFloat(a.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)[1]).toFixed(2),o=parseInt(o)):o=100,o}function acp_update_alpha_value_on_color_control(a,o,l,e){var t,r,i;t=o.data("a8cIris"),r=o.data("wpWpColorPicker"),t._color._alpha=a,i=t._color.toString(),o.val(i),r.toggler.css({"background-color":i}),e&&acp_update_alpha_value_on_alpha_slider(a,l),o.wpColorPicker("color",i)}function acp_update_alpha_value_on_alpha_slider(a,o){o.slider("value",a),o.find(".ui-slider-handle").text(a.toString())}Color.prototype.toString=function(a){if("no-alpha"==a)return this.toCSS("rgba","1").replace(/\s+/g,"");if(1>this._alpha)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var o=parseInt(this._color,10).toString(16);if(this.error)return"";if(o.length<6)for(var l=6-o.length-1;l>=0;l--)o="0"+o;return"#"+o},jQuery(document).ready(function(a){a(".alpha-color-control").each(function(){var o,l,e,t,r,i,c,n,p;o=a(this),l=o.val().replace(/\s+/g,""),e=o.attr("data-palette"),t=o.attr("data-show-opacity"),r=o.attr("data-default-color"),i={change:function(a,l){var e,t,i;e=o.attr("data-customize-setting-link"),t=o.wpColorPicker("color"),r==t&&(i=acp_get_alpha_value_from_color(t),n.find(".ui-slider-handle").text(i)),wp.customize(e,function(a){a.set(t)}),c.find(".transparency").css("background-color",l.color.toString("no-alpha"))},palettes:-1!==e.indexOf("|")?e.split("|"):"false"!=e},o.wpColorPicker(i),c=o.parents(".wp-picker-container:first"),a('<div class="alpha-color-picker-container"><div class="min-click-zone click-zone"></div><div class="max-click-zone click-zone"></div><div class="alpha-slider"></div><div class="transparency"></div></div>').appendTo(c.find(".wp-picker-holder")),n=c.find(".alpha-slider"),p={create:function(o,e){var t=a(this).slider("value");a(this).find(".ui-slider-handle").text(t),a(this).siblings(".transparency ").css("background-color",l)},value:acp_get_alpha_value_from_color(l),range:"max",step:1,min:0,max:100,animate:300},n.slider(p),"true"==t&&n.find(".ui-slider-handle").addClass("show-opacity"),c.find(".min-click-zone").on("click",function(){acp_update_alpha_value_on_color_control(0,o,n,!0)}),c.find(".max-click-zone").on("click",function(){acp_update_alpha_value_on_color_control(100,o,n,!0)}),c.find(".iris-palette").on("click",function(){var l,e;acp_update_alpha_value_on_alpha_slider(e=acp_get_alpha_value_from_color(l=a(this).css("background-color")),n),100!=e&&(l=l.replace(/[^,]+(?=\))/,(e/100).toFixed(2))),o.wpColorPicker("color",l)}),c.find(".button.wp-picker-clear").on("click",function(){var a=o.attr("data-customize-setting-link");o.wpColorPicker("color","#ffffff"),wp.customize(a,function(a){a.set("")}),acp_update_alpha_value_on_alpha_slider(100,n)}),c.find(".button.wp-picker-default").on("click",function(){acp_update_alpha_value_on_alpha_slider(acp_get_alpha_value_from_color(r),n)}),o.on("input",function(){acp_update_alpha_value_on_alpha_slider(acp_get_alpha_value_from_color(a(this).val()),n)}),n.slider().on("slide",function(l,e){acp_update_alpha_value_on_color_control(parseFloat(e.value)/100,o,n,!1),a(this).find(".ui-slider-handle").text(e.value)})})});
|
||||
+1
@@ -0,0 +1 @@
|
||||
jQuery(function(t){t(window).load(function(){function o(){t(".portfolio-content").isotope({itemSelector:".portfolio-item",masonry:{itemSelector:".portfolio-item",columnWidth:".portfolio-item",gutter:20}})}o(),t(".filter a").click(function(){var o=t(this).attr("data-filter");return t(".portfolio-content").isotope({filter:o}),t(this).parent().find("a").removeClass("active"),t(this).addClass("active"),!1}),t.browser.msie&&8==+t.browser.version?document.body.onresize=function(){o()}:t(window).resize(function(){o()}),window.addEventListener("orientationchange",function(){o()})})});
|
||||
+1
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e,n,s){"use strict";function a(e){if(n(m(C)).find(".sub-menu").before(e.submenu),null!==y){var s=C.others.concat(y[0]);n(m(s)).before(e.menu)}else n(m(C.others)).before(e.menu)}function t(){n(m(C)).addClass(k)}function i(){var e=n('button[id^="genesis-mobile-"]').attr("id");void 0!==e&&(f(e),d(e),c(e),u(e))}function o(){var e=n(this),s=e.next("nav");e.attr("id","genesis-mobile-"+n(s).attr("class").match(/nav-\w*\b/))}function u(e){if(null!=y){var s=y[0],a=n(y).filter(function(e){if(e>0)return e});"none"!==p(e)?(n.each(a,function(e,a){n(a).find(".menu > li").addClass("moved-item-"+a.replace(".","")).appendTo(s+" ul.genesis-nav-menu")}),n(m(a)).hide()):(n(m(a)).show(),n.each(a,function(e,s){n(".moved-item-"+s.replace(".","")).appendTo(s+" ul.genesis-nav-menu").removeClass("moved-item-"+s.replace(".",""))}))}}function r(){var e=n(this);h(e,"aria-pressed"),h(e,"aria-expanded"),e.toggleClass("activated"),e.next("nav").fadeToggle("fast")}function l(){var e=n(this),s=e.closest(".menu-item").siblings();h(e,"aria-pressed"),h(e,"aria-expanded"),e.toggleClass("activated"),e.next(".sub-menu").slideToggle("fast"),s.find("."+M).removeClass("activated").attr("aria-pressed","false"),s.find(".sub-menu").slideUp("fast")}function d(e){var s=n("."+k+" .js-superfish"),a="destroy";"function"==typeof s.superfish&&("none"===p(e)&&(a={delay:0,animation:{opacity:"show"},dropShadows:!1,speed:0,disableHI:!0}),s.superfish(a))}function c(e){var s=g();!n(s).length>0||n.each(s,function(s,a){var t=a.replace(".",""),i="genesis-"+t,o="genesis-mobile-"+t;"none"==p(e)&&(i="genesis-mobile-"+t,o="genesis-"+t);var u=n('.genesis-skip-link a[href="#'+i+'"]');if(null!==y&&a!==y[0]&&u.toggleClass("skip-link-hidden"),u.length>0){var r=u.attr("href");r=r.replace(i,o),u.attr("href",r)}})}function f(e){if("none"!==p(e))return!0;n("."+w+", ."+k+" .sub-menu-toggle").removeClass("activated").attr("aria-expanded",!1).attr("aria-pressed",!1),n("."+k+", ."+k+" .sub-menu").attr("style","")}function p(n){var s=e.getElementById(n);return window.getComputedStyle(s).getPropertyValue("display")}function h(e,n){e.attr(n,function(e,n){return"false"===n})}function m(e){return n.map(e,function(e,n){return e}).join(",")}function g(){var e=[];return null!==y&&n.each(y,function(n,s){e.push(s.valueOf())}),n.each(C.others,function(n,s){e.push(s.valueOf())}),e.length>0?e:null}n("body").removeClass("no-js");var v="undefined"==typeof genesis_responsive_menu?"":genesis_responsive_menu,b=v.menuClasses,C={},y=[];n.each(b,function(e){C[e]=[],n.each(this,function(s,a){var t=a,i=n(a);i.length>1?n.each(i,function(s,a){var i=t+"-"+s;n(this).addClass(i.replace(".","")),C[e].push(i),"combine"===e&&y.push(i)}):1==i.length&&(C[e].push(t),"combine"===e&&y.push(t))})}),void 0===C.others&&(C.others=[]),1==y.length&&(C.others.push(y[0]),C.combine=null,y=null);var x={},w="menu-toggle",M="sub-menu-toggle",k="genesis-responsive-menu";x.init=function(){if(0!=n(g()).length){var e=void 0!==v.menuIconClass?v.menuIconClass:"dashicons-before dashicons-menu",s=void 0!==v.subMenuIconClass?v.subMenuIconClass:"dashicons-before dashicons-arrow-down-alt2",u={menu:n("<button />",{class:w,"aria-expanded":!1,"aria-pressed":!1,role:"button",text:"Menu"}).append(n("<span />")),submenu:n("<button />",{class:M,"aria-expanded":!1,"aria-pressed":!1,text:""}).append(n("<span />",{class:"screen-reader-text",text:v.subMenu}))};t(),a(u),n("."+w).addClass(e),n("."+M).addClass(s),n("."+w).on("click.genesisMenu-mainbutton",r).each(o),n("."+M).on("click.genesisMenu-subbutton",l),n(window).on("resize.genesisMenu",i).triggerHandler("resize.genesisMenu")}},n(e).ready(function(){null!==g()&&x.init()})}(document,jQuery);
|
||||
Reference in New Issue
Block a user