Skip to content

Commit

Permalink
Merge branch 'release/1.17.15'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Oct 24, 2020
2 parents 2b121ed + d2cc871 commit 11231e3
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 93 deletions.
2 changes: 1 addition & 1 deletion inc/settings
Submodule settings updated 1 files
+0 −3 settings.php
12 changes: 6 additions & 6 deletions inc/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ function siteorigin_north_page_settings( $settings, $type, $id ){
$settings['page_title'] = array(
'type' => 'checkbox',
'label' => __( 'Page Title', 'siteorigin-north' ),
'checkbox_label' => __( 'display', 'siteorigin-north' ),
'checkbox_label' => __( 'Display', 'siteorigin-north' ),
'description' => __( 'Display the page title on this page.', 'siteorigin-north' )
);

Expand All @@ -1320,36 +1320,36 @@ function siteorigin_north_page_settings( $settings, $type, $id ){
$settings['featured_image'] = array(
'type' => 'checkbox',
'label' => __( 'Page Featured Image', 'siteorigin-north' ),
'checkbox_label' => __( 'display', 'siteorigin-north' ),
'checkbox_label' => __( 'Display', 'siteorigin-north' ),
'description' => __( 'Display the page featured image on this page.', 'siteorigin-north' )
);
}

$settings['masthead_margin'] = array(
'type' => 'checkbox',
'label' => __( 'Masthead Bottom Margin', 'siteorigin-north' ),
'checkbox_label' => __( 'enable', 'siteorigin-north' ),
'checkbox_label' => __( 'Enable', 'siteorigin-north' ),
'description' => __( 'Include the margin below the masthead (top area) of your site.', 'siteorigin-north' )
);

$settings['footer_margin'] = array(
'type' => 'checkbox',
'label' => __( 'Footer Top Margin', 'siteorigin-north' ),
'checkbox_label' => __( 'enable', 'siteorigin-north' ),
'checkbox_label' => __( 'Enable', 'siteorigin-north' ),
'description' => __( 'Include the margin above your footer.', 'siteorigin-north' )
);

$settings['hide_masthead'] = array(
'type' => 'checkbox',
'label' => __( 'Hide Masthead', 'siteorigin-north' ),
'checkbox_label' => __( 'hide', 'siteorigin-north' ),
'checkbox_label' => __( 'Hide', 'siteorigin-north' ),
'description' => __( 'Hide the masthead on this page.', 'siteorigin-north' )
);

$settings['hide_footer_widgets'] = array(
'type' => 'checkbox',
'label' => __( 'Hide Footer Widgets', 'siteorigin-north' ),
'checkbox_label' => __( 'hide', 'siteorigin-north' ),
'checkbox_label' => __( 'Hide', 'siteorigin-north' ),
'description' => __( 'Hide the footer widgets on this page.', 'siteorigin-north' )
);

Expand Down
2 changes: 1 addition & 1 deletion inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function siteorigin_north_lazy_load_exclude( $attr, $attachment ) {
}
if ( ! empty( $custom_logo_id ) && $attachment->ID == $custom_logo_id ) {
// Jetpack Lazy Load
if ( class_exists( 'Jetpack_Lazy_Images' ) ) {
if ( class_exists( 'Jetpack_Lazy_Images' ) || class_exists( 'Automattic\\Jetpack\\Jetpack_Lazy_Images' ) ) {
$attr['class'] .= ' skip-lazy';
}
// Smush Lazy Load
Expand Down
197 changes: 112 additions & 85 deletions js/north.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,99 +4,101 @@
* Handles the primary JavaScript functions for the theme.
*/

// Burst animation plugin.
(
function( $ ) {

var mousePos = {x: 0, y: 0};
$( document ).mousemove( function( e ) {
mousePos = {
x: e.pageX,
y: e.pageY
};
} );

$.fn.burstAnimation = function( options ) {
var settings = $.extend( {
event: "click",
container: "parent"
}, options );

return $( this ).each( function() {
var $$ = $( this ),
$p = settings.container === 'parent' ? $$.parent() : $$.closest( settings.container ),
$o = $( '<div class="burst-animation-overlay"></div>' ),
$c = $( '<div class="burst-circle"></div>' ).appendTo( $o );

$$.on( settings.event, function() {
$o.appendTo( $p );
$c
.css( {
top: mousePos.y - $p.offset().top,
left: mousePos.x - $p.offset().left,
opacity: 0.1,
scale: 1
} )
.transition( {
opacity: 0,
scale: $p.width()
}, 500, 'ease', function() {
$o.detach();
} );
} );
( function( $ ) {

} );
// Burst animation plugin.
var mousePos = {x: 0, y: 0};
$( document ).mousemove( function( e ) {
mousePos = {
x: e.pageX,
y: e.pageY
};
} );

// Check if an element is visible in the viewport.
$.fn.northIsVisible = function() {
var rect = this[0].getBoundingClientRect();
return (
rect.bottom >= 0 &&
rect.right >= 0 &&
rect.top <= ( window.innerHeight || document.documentElement.clientHeight ) &&
rect.left <= ( window.innerWidth || document.documentElement.clientWidth )
);
};
$.fn.burstAnimation = function( options ) {
var settings = $.extend( {
event: "click",
container: "parent"
}, options );

return $( this ).each( function() {
var $$ = $( this ),
$p = settings.container === 'parent' ? $$.parent() : $$.closest( settings.container ),
$o = $( '<div class="burst-animation-overlay"></div>' ),
$c = $( '<div class="burst-circle"></div>' ).appendTo( $o );

$$.on( settings.event, function() {
$o.appendTo( $p );
$c
.css( {
top: mousePos.y - $p.offset().top,
left: mousePos.x - $p.offset().left,
opacity: 0.1,
scale: 1
} )
.transition( {
opacity: 0,
scale: $p.width()
}, 500, 'ease', function() {
$o.detach();
} );
} );

$.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 );

if ( $target.length ) {

var height = 0;
if ( $( '#masthead' ).hasClass( 'sticky-menu' ) && $( '#masthead' ).data( 'scale-logo' ) ) {
if ( $target.offset().top < 48 ) {
height += $( '#masthead' ).outerHeight();
} else if ( $( '.site-branding' ).outerHeight() > $( '#site-navigation' ).outerHeight() ) {
height += $( '#masthead' ).outerHeight() * siteoriginNorth.logoScale;
} else {
height += $( '#masthead' ).height() + ( $( '#masthead' ).innerHeight() - $( '#masthead' ).height() );
}
} else if ( $( '#masthead' ).hasClass( 'sticky-menu' ) ) {
height += $( '#masthead' ).outerHeight();
}
} );
};

if ( $( 'body' ).hasClass( 'admin-bar' ) ) {
height += $( '#wpadminbar' ).outerHeight();
}
// Check if an element is visible in the viewport.
$.fn.northIsVisible = function() {
var rect = this[0].getBoundingClientRect();
return (
rect.bottom >= 0 &&
rect.right >= 0 &&
rect.top <= ( window.innerHeight || document.documentElement.clientHeight ) &&
rect.left <= ( window.innerWidth || document.documentElement.clientWidth )
);
};

$( 'html, body' ).animate( {
scrollTop: $target.offset().top - height
}, 1000 );
var headerHeight = function( $target, load ) {
var height = 0;

if ( $( '#masthead' ).hasClass( 'sticky-menu' ) && $( '#masthead' ).data( 'scale-logo' ) ) {
if ( typeof $target != 'undefined' && $target.offset().top < 48 ) {
height += $( '#masthead' ).outerHeight();
} else if (
$( '.site-branding' ).outerHeight() > $( '#site-navigation' ).outerHeight() ||
(
typeof $target != 'undefined' && load && $target.offset().top > 48
)
) {
height += $( '#masthead' ).outerHeight() * siteoriginNorth.logoScale;
} else {
height += $( '#masthead' ).height() + ( $( '#masthead' ).innerHeight() - $( '#masthead' ).height() );
}
} else if ( $( '#masthead' ).hasClass( 'sticky-menu' ) ) {
height += $( '#masthead' ).outerHeight();
}

return false;
}
// Scroll to the position of the item, minus the header size.
} );
if ( $( 'body' ).hasClass( 'admin-bar' ) ) {
height += $( '#wpadminbar' ).outerHeight();
}

}
)( jQuery );
return height;
};

$.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 );
if ( $target.length ) {
$( 'html, body' ).animate( {
scrollTop: $target.offset().top - headerHeight( $target )
}, 1000 );

jQuery( function( $ ) {
return false;
}
// Scroll to the position of the item, minus the header size.
} );
}

$( '.entry-meta a' ).hover(
function() {
Expand Down Expand Up @@ -318,9 +320,14 @@ jQuery( function( $ ) {
}
} );

} );
// Detect potential page jump on load and prevent it.
if ( location.pathname.replace( /^\//,'' ) == window.location.pathname.replace( /^\//,'' ) && location.hostname == window.location.hostname ) {
setTimeout( function() {
window.scrollTo( 0, 0 );
}, 1 );
var scrollOnLoad = true;
}

( function( $ ) {
$( window ).load( function() {
siteoriginNorth.logoScale = parseFloat( siteoriginNorth.logoScale );

Expand Down Expand Up @@ -454,5 +461,25 @@ jQuery( function( $ ) {
smSetup();
$( window ).resize( smSetup ).scroll( smSetup );
}

// Adjust for sticky header when linking from external anchors.
if ( typeof scrollOnLoad != "undefined" ) {
var $target = $( window.location.hash );
if ( $target.length ) {
setTimeout( function() {
$( 'html, body' ).animate( {
scrollTop: $target.offset().top - headerHeight( $target, true )
},
0,
function() {
if ( $( '#masthead' ).hasClass( 'sticky-menu' ) ) {
// Avoid a situation where the logo can be incorrectly sized due to the page jump.
smSetup();
}
} );
}, 100 );
}
}
} );

} )( jQuery );
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ Original design files are available on [Google Drive](https://drive.google.com/f

== Changelog ==

= 1.7.15 - 24 October 2020 =
* Updated Jetpack Lazy Loading logo exclusion function.
* Improved one page smooth scrolling.
* Updated SiteOrigin Settings.

= 1.7.14 - 07 September 2020 =
* Updated lazy load exclusion functionality for the logo.
* Fixed the Page Template Settings Page Title setting for WooCommerce archive pages.
Expand Down

0 comments on commit 11231e3

Please sign in to comment.