Skip to content

Commit

Permalink
Merge branch 'release/1.6.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Mar 14, 2019
2 parents d577f73 + 3af00b8 commit bf039a4
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 42 deletions.
1 change: 1 addition & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ function siteorigin_north_scripts() {
wp_localize_script( 'siteorigin-north-script', 'siteoriginNorth', array(
'smoothScroll' => siteorigin_setting( 'navigation_smooth_scroll' ),
'logoScale' => is_numeric( $logo_sticky_scale ) ? $logo_sticky_scale : 0.755,
'collapse' => siteorigin_setting( 'responsive_menu_breakpoint' ),
) );

// jQuery FitVids.
Expand Down
1 change: 0 additions & 1 deletion inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function siteorigin_north_body_classes( $classes ) {

$classes[] = 'no-js';
$classes[] = 'css3-animations';
$classes[] = 'no-touch';
if ( siteorigin_setting( 'responsive_disabled' ) == false ) {
$classes[] = 'responsive';
}
Expand Down
8 changes: 4 additions & 4 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function siteorigin_north_custom_icon( $icon, $class ) {
function siteorigin_north_display_icon( $type ) {
switch ( $type ) {
case 'menu':
if ( siteorigin_setting( 'icons_menu' ) ) : ?>
if ( siteorigin_setting( 'icons_menu' ) && wp_attachment_is_image( siteorigin_setting( 'icons_menu' ) ) ) : ?>
<?php siteorigin_north_custom_icon( 'icons_menu', 'svg-icon-menu' ); ?>
<?php else : ?>
<div class="icon-menu">
Expand All @@ -412,7 +412,7 @@ function siteorigin_north_display_icon( $type ) {
break;

case 'close':
if ( siteorigin_setting( 'icons_close_search' ) ) : ?>
if ( siteorigin_setting( 'icons_close_search' ) && wp_attachment_is_image( siteorigin_setting( 'icons_close_search' ) ) ) : ?>
<?php siteorigin_north_custom_icon( 'icons_close_search', 'svg-icon-close' ); ?>
<?php else : ?>
<svg version="1.1" class="svg-icon-close" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="12px" y="12px"
Expand All @@ -433,7 +433,7 @@ function siteorigin_north_display_icon( $type ) {
break;

case 'up-arrow':
if ( siteorigin_setting('icons_scroll_to_top') ) : ?>
if ( siteorigin_setting( 'icons_scroll_to_top' ) && wp_attachment_is_image( siteorigin_setting( 'icons_scroll_to_top' ) ) ) : ?>
<?php siteorigin_north_custom_icon( 'icons_scroll_to_top', 'svg-icon-to-top' ); ?>
<?php else : ?>
<svg version="1.1" class="svg-icon-to-top" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
Expand All @@ -445,7 +445,7 @@ function siteorigin_north_display_icon( $type ) {
break;

case 'search':
if ( siteorigin_setting( 'icons_search' ) ) : ?>
if ( siteorigin_setting( 'icons_search' ) && wp_attachment_is_image( siteorigin_setting( 'icons_search' ) ) ) : ?>
<?php siteorigin_north_custom_icon( 'icons_search', 'svg-icon-search' ); ?>
<?php else : ?>
<svg version="1.1" class="svg-icon-search" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32">
Expand Down
50 changes: 21 additions & 29 deletions js/north.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,33 +112,32 @@ jQuery( function( $ ) {
$( '.entry-content, .entry-content .panel, .woocommerce #main' ).fitVids( { ignore: '.tableauViz' } );
}

// This this is a touch device. We detect this through ontouchstart, msMaxTouchPoints and MaxTouchPoints.
// Detect if is a touch device. We detect this through ontouchstart, msMaxTouchPoints and MaxTouchPoints.
if ( 'ontouchstart' in document.documentElement || window.navigator.msMaxTouchPoints || window.navigator.MaxTouchPoints ) {
$('body').removeClass('no-touch');
}
if ( !$( 'body' ).hasClass( 'no-touch' ) ) {
if ( /iPad|iPhone|iPod/.test( navigator.userAgent ) && ! window.MSStream ) {
$( 'body' ).css( 'cursor', 'pointer' );
$( 'body' ).addClass( 'ios' );
}
$( '.main-navigation #primary-menu').find('.menu-item-has-children > a' ).each( function() {
$( this ).click( function( e ) {

$( '.main-navigation #primary-menu' ).find( '.menu-item-has-children > a' ).each( function() {
$( this ).on( 'click touchend', function( e ) {
var link = $( this );
e.stopPropagation();
link.parent().addClass( 'touch-drop' );

if ( e.type == 'click' ) {
return;
}

if ( link.hasClass( 'hover' ) ) {
link.unbind( 'click' );
} else {
link.addClass( 'hover' );
if ( ! link.parent().hasClass( 'hover' ) ) {
// Remove .hover from all other sub menus
$( '.menu-item.hover' ).removeClass( 'hover' );
link.parents('.menu-item').addClass( 'hover' );
e.preventDefault();
}

$( '.main-navigation #primary-menu > .menu-item-has-children:not(.touch-drop) > a' ).click( function() {
link.removeClass('hover').parent().removeClass('touch-drop');
} );

$( document ).click( function() {
link.removeClass( 'hover' ).parent().removeClass( 'touch-drop' );
// Remove .hover class when user clicks outside of sub menu
$( document ).one( 'click', function() {
link.parent().removeClass( 'hover' );
} );

} );
Expand All @@ -154,18 +153,6 @@ jQuery( function( $ ) {
container: ".search-form"
} );

var resetMenu = function() {
$( '.main-navigation ul ul' ).each( function() {
var $$ = $( this );
var width = Math.max.apply( Math, $$.find( '> li > a' ).map( function() {
return $( this ).width();
} ).get() );
$$.find( '> li > a' ).width( width );
} );
};
resetMenu();
$( window ).resize( resetMenu );

var alignMenu = function() {
$( '#primary-menu > li > ul.sub-menu' ).each( function() {
var $$ = $( this );
Expand Down Expand Up @@ -427,6 +414,11 @@ jQuery( function( $ ) {
$( window ).scroll( smShadow );

var smSetup = function() {

if ( $( 'body' ).hasClass( 'mobile-header-ns' ) && ( $( window ).width() < siteoriginNorth.collapse ) ) {
return;
}

if ( ! $( 'body' ).hasClass( 'page-layout-menu-overlap' ) ) {
$mhs.css( 'height', $mh.outerHeight() );
}
Expand Down
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ Original design files are available on [Google Drive](https://drive.google.com/f

== Changelog ==

= 1.6.8 - 14 March 2019 =
* Added a fallback to the default theme icon if a custom icon is missing.
* Allow main menu hovers when Touch UI Layout is enabled.
* Added a body class option to disable the sticky header on mobile.

= 1.6.7 - 27 February 2019 =
* Removed Jetpack Responsive Videos support in favour of FitVids.

Expand Down
4 changes: 2 additions & 2 deletions sass/navigation/_menus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
}
}

@at-root body.no-touch & {
@at-root body:not(.ios) & {

li:hover,
li.focus {
Expand All @@ -114,7 +114,7 @@
}
}

.touch-drop {
li.hover {

> ul {
opacity: 1;
Expand Down
12 changes: 6 additions & 6 deletions style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf039a4

Please sign in to comment.