From 882cd196019268ac6635ec7f051c5344fc85a3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Ko=CC=88nemann?= Date: Sat, 7 Apr 2018 16:47:15 +0200 Subject: [PATCH] Removing some legacy stuff - see https://github.com/orgs/understrap/teams/child-theme-team/discussions/3 --- gulpfile.js | 48 ---------------- js/navigation.js | 112 -------------------------------------- js/skip-link-focus-fix.js | 33 ----------- sass/theme.scss | 3 +- 4 files changed, 1 insertion(+), 195 deletions(-) delete mode 100644 js/navigation.js delete mode 100644 js/skip-link-focus-fix.js diff --git a/gulpfile.js b/gulpfile.js index 5ae22bf..b4d336b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -25,50 +25,6 @@ var autoprefixer = require( 'gulp-autoprefixer' ); var cfg = require( './gulpconfig.json' ); var paths = cfg.paths; -// Run: -// gulp sass + cssnano + rename -// Prepare the min.css for production (with 2 pipes to be sure that "theme.css" == "theme.min.css") -gulp.task( 'scss-for-prod', function() { - var source = gulp.src( paths.sass + '/*.scss' ) - .pipe( plumber({ - errorHandler: function( err ) { - console.log( err ); - this.emit( 'end' ); - } - }) ) - .pipe( sourcemaps.init({ loadMaps: true }) ) - .pipe( sass() ); - - var pipe1 = source.pipe( clone() ) - .pipe( sourcemaps.write( undefined, { sourceRoot: null } ) ) - .pipe( gulp.dest( paths.css ) ) - .pipe( rename( 'custom-editor-style.css' ) ); - - var pipe2 = source.pipe( clone() ) - .pipe( cleanCSS( { compatibility: '*' } ) ) - .pipe( rename( { suffix: '.min' } ) ) - .pipe( sourcemaps.write( './' ) ) - .pipe( gulp.dest( paths.css ) ); - return merge( pipe1, pipe2 ); -}); - -// Run: -// gulp sourcemaps + sass + reload(browserSync) -// Prepare the child-theme.css for the development environment -gulp.task( 'scss-for-dev', function() { - gulp.src( paths.sass + '/*.scss' ) - .pipe( plumber( { - errorHandler: function( err ) { - console.log( err ); - this.emit( 'end' ); - } - } ) ) - .pipe( sourcemaps.init({ loadMaps: true }) ) - .pipe( sass() ) - .pipe( sourcemaps.write( undefined, { sourceRoot: null } ) ) - .pipe( gulp.dest( paths.css ) ); -}); - gulp.task( 'watch-scss', ['browser-sync'], function() { gulp.watch( paths.sass + '/**/*.scss', ['scss-for-dev'] ); }); @@ -242,10 +198,6 @@ gulp.task( 'copy-assets', function() { gulp.src( paths.node + 'undescores-for-npm/js/skip-link-focus-fix.js' ) .pipe( gulp.dest( paths.dev + '/js' ) ); -// _s JS files into /js - gulp.src( paths.node + 'undescores-for-npm/js/skip-link-focus-fix.js' ) - .pipe( gulp.dest( paths.js + paths.vendor ) ); - // Copy Popper JS files gulp.src( paths.node + 'popper.js/dist/umd/popper.min.js' ) .pipe( gulp.dest( paths.js + paths.vendor ) ); diff --git a/js/navigation.js b/js/navigation.js deleted file mode 100644 index 6cc0af9..0000000 --- a/js/navigation.js +++ /dev/null @@ -1,112 +0,0 @@ -/** - * File navigation.js. - * - * Handles toggling the navigation menu for small screens and enables TAB key - * navigation support for dropdown menus. - */ -( function() { - var container, button, menu, links, subMenus, i, len; - - container = document.getElementById( 'site-navigation' ); - if ( ! container ) { - return; - } - - button = container.getElementsByTagName( 'button' )[0]; - if ( 'undefined' === typeof button ) { - return; - } - - menu = container.getElementsByTagName( 'ul' )[0]; - - // Hide menu toggle button if menu is empty and return early. - if ( 'undefined' === typeof menu ) { - button.style.display = 'none'; - return; - } - - menu.setAttribute( 'aria-expanded', 'false' ); - if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { - menu.className += ' nav-menu'; - } - - button.onclick = function() { - if ( -1 !== container.className.indexOf( 'toggled' ) ) { - container.className = container.className.replace( ' toggled', '' ); - button.setAttribute( 'aria-expanded', 'false' ); - menu.setAttribute( 'aria-expanded', 'false' ); - } else { - container.className += ' toggled'; - button.setAttribute( 'aria-expanded', 'true' ); - menu.setAttribute( 'aria-expanded', 'true' ); - } - }; - - // Get all the link elements within the menu. - links = menu.getElementsByTagName( 'a' ); - subMenus = menu.getElementsByTagName( 'ul' ); - - // Set menu items with submenus to aria-haspopup="true". - for ( i = 0, len = subMenus.length; i < len; i++ ) { - subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); - } - - // Each time a menu link is focused or blurred, toggle focus. - for ( i = 0, len = links.length; i < len; i++ ) { - links[i].addEventListener( 'focus', toggleFocus, true ); - links[i].addEventListener( 'blur', toggleFocus, true ); - } - - /** - * Sets or removes .focus class on an element. - */ - function toggleFocus() { - var self = this; - - // Move up through the ancestors of the current link until we hit .nav-menu. - while ( -1 === self.className.indexOf( 'nav-menu' ) ) { - - // On li elements toggle the class .focus. - if ( 'li' === self.tagName.toLowerCase() ) { - if ( -1 !== self.className.indexOf( 'focus' ) ) { - self.className = self.className.replace( ' focus', '' ); - } else { - self.className += ' focus'; - } - } - - self = self.parentElement; - } - } - - /** - * Toggles `focus` class to allow submenu access on tablets. - */ - ( function( container ) { - var touchStartFn, i, - parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); - - if ( 'ontouchstart' in window ) { - touchStartFn = function( e ) { - var menuItem = this.parentNode, i; - - if ( ! menuItem.classList.contains( 'focus' ) ) { - e.preventDefault(); - for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { - if ( menuItem === menuItem.parentNode.children[i] ) { - continue; - } - menuItem.parentNode.children[i].classList.remove( 'focus' ); - } - menuItem.classList.add( 'focus' ); - } else { - menuItem.classList.remove( 'focus' ); - } - }; - - for ( i = 0; i < parentLink.length; ++i ) { - parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); - } - } - }( container ) ); -} )(); diff --git a/js/skip-link-focus-fix.js b/js/skip-link-focus-fix.js deleted file mode 100644 index a39cefb..0000000 --- a/js/skip-link-focus-fix.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * File skip-link-focus-fix.js. - * - * Helps with accessibility for keyboard only users. - * - * Learn more: https://git.io/vWdr2 - */ -( function() { - var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, - isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, - isIe = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; - - if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) { - window.addEventListener( 'hashchange', function() { - var id = location.hash.substring( 1 ), - element; - - if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { - return; - } - - element = document.getElementById( id ); - - if ( element ) { - if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { - element.tabIndex = -1; - } - - element.focus(); - } - }, false ); - } -})(); diff --git a/sass/theme.scss b/sass/theme.scss index 2f0867d..bf03a6c 100644 --- a/sass/theme.scss +++ b/sass/theme.scss @@ -2,11 +2,10 @@ @import "assets/bootstrap4";// <--------- Loads Bootstrap3 or Bootstrap4. Change from /bootstrap3 to /bootstrap4 Watch out! just for testing in the moment! @import "understrap/understrap";// <-------- Loads the UnderStrap defaults. Just a few classes to incorporate BS in WP - //Optional files - If you dont use the corresponding scripts/fonts comment em out @import "assets/font-awesome"; // <------- Font Awesome Icon font @import "assets/underscores"; // <------- Underscores media styles // Any additional imported files // @import "theme/theme"; // <--------- That's where you can add your own design. Thats your part! -@import "theme/contact-form7"; // Contact Form 7 - Bootstrap 4 support +@import "theme/contact-form7"; // Contact Form 7 - Bootstrap 4 support \ No newline at end of file