Skip to content

Commit

Permalink
Merge branch 'release/1.6.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Feb 3, 2019
2 parents 7504219 + f7e7d6a commit 4357152
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 250 deletions.
29 changes: 16 additions & 13 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function siteorigin_north_setup() {
add_theme_support( 'wc-product-gallery-slider' );

if ( ! defined( 'SITEORIGIN_PANELS_VERSION' ) ) {
// Only include panels lite if the panels plugin doesn't exist
// Only include panels lite if the panels plugin doesn't exist.
include get_template_directory() . '/inc/panels-lite/panels-lite.php';
}

Expand All @@ -115,7 +115,7 @@ function siteorigin_north_setup() {
/**
* Add support for premium theme components
*/
function siteorigin_north_premium_setup(){
function siteorigin_north_premium_setup() {

// This theme supports the no attribution addon
add_theme_support( 'siteorigin-premium-no-attribution', array(
Expand Down Expand Up @@ -222,15 +222,15 @@ function siteorigin_north_widgets_init() {

if ( function_exists( 'is_woocommerce' ) ) {
register_sidebar( array(
'name' => esc_html__( 'Shop Sidebar', 'siteorigin-north' ),
'id' => 'sidebar-shop',
'description' => esc_html__( 'Displays on WooCommerce pages.', 'siteorigin-north' ),
'name' => esc_html__( 'Shop Sidebar', 'siteorigin-north' ),
'id' => 'sidebar-shop',
'description' => esc_html__( 'Displays on WooCommerce pages.', 'siteorigin-north' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
}

}
endif;
Expand Down Expand Up @@ -293,7 +293,7 @@ function siteorigin_north_siteorigin_premium( $themes ) {
/**
* Modify comments form - change placeholders.
*/
function siteorigin_north_filter_comment_form_default_fields( $fields ){
function siteorigin_north_filter_comment_form_default_fields( $fields ) {
$placeholders = apply_filters( 'siteorigin_north_comment_form_placeholders', array(
'author' => esc_html__( 'Enter Your Name', 'siteorigin-north' ),
'email' => esc_html__( 'Enter Your Email', 'siteorigin-north' ),
Expand Down Expand Up @@ -342,13 +342,13 @@ function siteorigin_north_filter_comment_form_default_fields( $fields ){
return $fields;
}
endif;
add_filter('comment_form_default_fields', 'siteorigin_north_filter_comment_form_default_fields');
add_filter( 'comment_form_default_fields', 'siteorigin_north_filter_comment_form_default_fields' );

if ( ! function_exists( 'siteorigin_north_filter_comment_form_defaults' ) ) :
/**
* Modify comments form - make labels screen-reader-text
*/
function siteorigin_north_filter_comment_form_defaults( $defaults ){
function siteorigin_north_filter_comment_form_defaults( $defaults ) {
$comment_placeholder = __( 'Enter your message', 'siteorigin-north' );
$default_comment = array( '<label for="comment"', '<textarea id="comment" ' );
$replace_comment = array(
Expand All @@ -368,7 +368,7 @@ function siteorigin_north_filter_comment_form_defaults( $defaults ){
return $defaults;
}
endif;
add_filter('comment_form_defaults', 'siteorigin_north_filter_comment_form_defaults');
add_filter( 'comment_form_defaults', 'siteorigin_north_filter_comment_form_defaults' );

/**
* Custom template tags for this theme.
Expand Down Expand Up @@ -403,3 +403,6 @@ function siteorigin_north_filter_comment_form_defaults( $defaults ){
if ( function_exists( 'is_woocommerce' ) ) {
require get_template_directory() . '/woocommerce/functions.php';
}

/* IMPORTANT NOTICE: Please don't edit this file; any changes made here will be lost during the theme update process.
If you need to add custom functions, use the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/) or a child theme. */
181 changes: 91 additions & 90 deletions js/north.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$o = $( '<div class="burst-animation-overlay"></div>' ),
$c = $( '<div class="burst-circle"></div>' ).appendTo( $o );

$$.on( settings.event, function () {
$$.on( settings.event, function() {
$o.appendTo( $p );
$c
.css( {
Expand All @@ -40,7 +40,7 @@
.transition( {
opacity: 0,
scale: $p.width()
}, 500, 'ease', function () {
}, 500, 'ease', function() {
$o.detach();
} );
} );
Expand All @@ -59,7 +59,7 @@
);
};

$.fn.northSmoothScroll = function () {
$.fn.northSmoothScroll = function() {
$( this ).click( function( e ) {
var $a = $( this );
var $target = $( '[name=' + this.hash.slice( 1 ) + ']' ).length ? $( '[name=' + this.hash.slice( 1 ) + ']' ) : $( $a.get( 0 ).hash );
Expand Down Expand Up @@ -102,7 +102,7 @@ jQuery( function( $ ) {
function() {
$( this ).closest( 'li' ).addClass( 'hovering' );
},
function () {
function() {
$( this ).closest( 'li' ).removeClass( 'hovering' );
}
);
Expand All @@ -121,12 +121,12 @@ jQuery( function( $ ) {
$( 'body' ).css( 'cursor', 'pointer' );
}
$( '.main-navigation #primary-menu').find('.menu-item-has-children > a' ).each( function() {
$( this ).click( function( e ){
$( this ).click( function( e ) {
var link = $( this );
e.stopPropagation();
link.parent().addClass( 'touch-drop' );

if( link.hasClass( 'hover' ) ) {
if ( link.hasClass( 'hover' ) ) {
link.unbind( 'click' );
} else {
link.addClass( 'hover' );
Expand Down Expand Up @@ -154,7 +154,7 @@ jQuery( function( $ ) {
container: ".search-form"
} );

var resetMenu = function () {
var resetMenu = function() {
$( '.main-navigation ul ul' ).each( function() {
var $$ = $( this );
var width = Math.max.apply( Math, $$.find( '> li > a' ).map( function() {
Expand All @@ -166,7 +166,7 @@ jQuery( function( $ ) {
resetMenu();
$( window ).resize( resetMenu );

var alignMenu = function () {
var alignMenu = function() {
$( '#primary-menu > li > ul.sub-menu' ).each( function() {
var $$ = $( this );
var left = - (
Expand Down Expand Up @@ -274,7 +274,7 @@ jQuery( function( $ ) {
} );

// The scroll to top button.
var sttWindowScroll = function () {
var sttWindowScroll = function() {
var top = window.pageYOffset || document.documentElement.scrollTop;

if ( top > $( '#masthead' ).outerHeight() ) {
Expand All @@ -294,73 +294,6 @@ jQuery( function( $ ) {
$( 'html,body' ).animate( { scrollTop: 0 } );
} );

// Now lets do the sticky menu.
if ( $( '#masthead' ).hasClass( 'sticky-menu' ) ) {
var $mhs = false,
mhTop = false,
$mh = $( '#masthead' ),
$tb = $( '#topbar' ),
$wpab = $( '#wpadminbar' );

// Sticky header shadow.
var smShadow = function() {
if ( $( window ).scrollTop() > 0 ) {
$( $mh ).addClass( 'floating' );
} else {
$( $mh ).removeClass( 'floating' );
}
};
smShadow();
$( window ).scroll( smShadow );

var smSetup = function() {

if ( $mhs === false ) {
$mhs = $( '<div class="masthead-sentinel"></div>' ).insertAfter( $mh );

if ( ! $( 'body' ).hasClass( 'page-layout-menu-overlap' ) ) {
$mhs.css( 'height', $mh.outerHeight() );
}
}
// Toggle .topbar-out with visibility of top-bar in the viewport.
if ( ! $( 'body' ).hasClass( 'no-topbar' ) && ! $tb.northIsVisible() ) {
$( 'body' ).addClass( 'topbar-out' );
}
if ( $tb.length && $( 'body' ).hasClass( 'topbar-out' ) && $tb.northIsVisible() ) {
$( 'body' ).removeClass( 'topbar-out' );
}

if ( $( 'body' ).hasClass( 'no-topbar' ) || ( ! $( 'body' ).hasClass( 'no-topbar' ) && $( 'body' ).hasClass( 'topbar-out' ) ) ) {
$mh.css( 'position', 'fixed' );
} else if ( ! $( 'body' ).hasClass( 'no-topbar' ) && ! $( 'body' ).hasClass( 'topbar-out' ) ) {
$mh.css( 'position', 'absolute' );
}

if ( $( 'body' ).hasClass( 'no-topbar' ) && ! $( window ).scrollTop() ) {
$( 'body' ).addClass( 'topbar-out' );
}

if ( $( window ).width() < 601 && $( 'body' ).hasClass( 'admin-bar' ) ) {
if ( ! $wpab.northIsVisible() ) {
if ( $( 'body' ).hasClass( 'no-topbar' ) || ( ! $( 'body' ).hasClass( 'no-topbar' ) && $( 'body' ).hasClass( 'topbar-out' ) ) ) {
$mh.addClass( 'mobile-sticky-menu' );
}
}
if ( $wpab.northIsVisible() ) {
$mh.removeClass( 'mobile-sticky-menu' );
}
}

if ( $( window ).width() > 600 && $mh.hasClass( 'mobile-sticky-menu' ) ) {
$mh.removeClass( 'mobile-sticky-menu' );
}

}

smSetup();
$( window ).resize( smSetup ).scroll( smSetup );
}

// Handle the header search.
var $hs = $( '#header-search' );
$( '#masthead .north-search-icon' ).click( function() {
Expand Down Expand Up @@ -422,12 +355,14 @@ jQuery( function( $ ) {

if ( $mh.data( 'scale-logo' ) ) {
var $img = $mh.find( '.site-branding img' ),
imgWidth = $img.attr( 'width' ),
imgHeight = $img.attr( 'height' ),
imgWidth = $img.width(),
imgHeight = $img.height(),
scaledWidth = imgWidth * siteoriginNorth.logoScale,
scaledHeight = imgHeight * siteoriginNorth.logoScale;

var smResizeLogo = function () {
$( ".site-branding img" ).wrap( "<div class='custom-logo-wrapper'></div>");

var smResizeLogo = function() {
var $branding = $mh.find( '.site-branding > *' ),
top = window.pageYOffset || document.documentElement.scrollTop;

Expand All @@ -446,25 +381,91 @@ jQuery( function( $ ) {
}

if ( $img.length ) {
// If Scale == siteoriginNorth.logoScale, logo is completely scaled.
if ( $img.height() != scaledHeight || $img.width() != scaledWidth ) {
var scale = siteoriginNorth.logoScale + ( Math.max( 0, 48 - top ) / 48 * ( 1 - siteoriginNorth.logoScale ) );
// Are we at the top of the page?
if ( top > 0 ) {
// Calulate scale amount based on distance from the top of the page.
var logoScale = siteoriginNorth.logoScale + ( Math.max( 0, 48 - top ) / 48 * ( 1 - siteoriginNorth.logoScale ) );
if ( $img.height() != scaledHeight || $img.width() != scaledWidth || logoScale != siteoriginNorth.logoScale ) {
$( '.site-branding img' ).css( {
width: logoScale * 100 + '%',
} );
}
} else {
// Ensure no scaling is present.
$( '.site-branding img' ).css( {
width: imgWidth * scale,
height: imgHeight * scale,
'max-width' : 'none'
width: '',
} );
}

} else if ( top > 0 ) {
$branding.css( 'transform', 'scale(' + siteoriginNorth.logoScale + ')' );

} else {
if ( top > 0 ) {
$branding.css( 'transform', 'scale(' + siteoriginNorth.logoScale + ')' );
} else {
$branding.css( 'transform', 'scale(1)' );
}
$branding.css( 'transform', 'scale(1)' );
}
};
smResizeLogo();
$( window ).scroll( smResizeLogo ).resize( smResizeLogo );
}

// Now lets do the sticky menu.
if ( $( '#masthead' ).hasClass( 'sticky-menu' ) ) {
var $mh = $( '#masthead' ),
$mhs = $( '<div class="masthead-sentinel"></div>' ).insertAfter( $mh ),
$tb = $( '#topbar' ),
$wpab = $( '#wpadminbar' );

// Sticky header shadow.
var smShadow = function() {
if ( $( window ).scrollTop() > 0 ) {
$( $mh ).addClass( 'floating' );
} else {
$( $mh ).removeClass( 'floating' );
}
};
smShadow();
$( window ).scroll( smShadow );

var smSetup = function() {
if ( ! $( 'body' ).hasClass( 'page-layout-menu-overlap' ) ) {
$mhs.css( 'height', $mh.outerHeight() );
}
// Toggle .topbar-out with visibility of top-bar in the viewport.
if ( ! $( 'body' ).hasClass( 'no-topbar' ) && ! $tb.northIsVisible() ) {
$( 'body' ).addClass( 'topbar-out' );
}
if ( $tb.length && $( 'body' ).hasClass( 'topbar-out' ) && $tb.northIsVisible() ) {
$( 'body' ).removeClass( 'topbar-out' );
}

if ( $( 'body' ).hasClass( 'no-topbar' ) || ( ! $( 'body' ).hasClass( 'no-topbar' ) && $( 'body' ).hasClass( 'topbar-out' ) ) ) {
$mh.css( 'position', 'fixed' );
} else if ( ! $( 'body' ).hasClass( 'no-topbar' ) && ! $( 'body' ).hasClass( 'topbar-out' ) ) {
$mh.css( 'position', 'absolute' );
}

if ( $( 'body' ).hasClass( 'no-topbar' ) && ! $( window ).scrollTop() ) {
$( 'body' ).addClass( 'topbar-out' );
}

if ( $( window ).width() < 601 && $( 'body' ).hasClass( 'admin-bar' ) ) {
if ( ! $wpab.northIsVisible() ) {
if ( $( 'body' ).hasClass( 'no-topbar' ) || ( ! $( 'body' ).hasClass( 'no-topbar' ) && $( 'body' ).hasClass( 'topbar-out' ) ) ) {
$mh.addClass( 'mobile-sticky-menu' );
}
}
if ( $wpab.northIsVisible() ) {
$mh.removeClass( 'mobile-sticky-menu' );
}
}

if ( $( window ).width() > 600 && $mh.hasClass( 'mobile-sticky-menu' ) ) {
$mh.removeClass( 'mobile-sticky-menu' );
}
}

smSetup();
$( window ).resize( smSetup ).scroll( smSetup );
}
} );
} )( jQuery );
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ Original design files are available on [Google Drive](https://drive.google.com/f

== Changelog ==

= 1.6.5 - 07 January 2018 =
= 1.6.6 - 1 February 2019 =
* Changed the scaling logo behaviour to only scale after scroll.
* Ensured the sticky header sentinel is responsive.

= 1.6.5 - 07 January 2019 =
* Added a class of `custom-logo` to the Branding logo. Only excluded `custom-logo` from the global `img` selector.
* Corrected WooCommerce shop sidebar widget closing header tag.

Expand Down
2 changes: 1 addition & 1 deletion sass/elements/_elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ figure {
margin-right: 0;
}

img:not(.custom-logo) {
img {
height: auto; // Make sure images are scaled correctly.
max-width: 100%; // Adhere to container width.
}
Expand Down
Loading

0 comments on commit 4357152

Please sign in to comment.