Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All: replace TinyNav.js with collapsibe button for <nav> #452

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
located at themes/jquery/lib/normalize
and included in themes/jquery/css/base.css

- TinyNav.js
http://tinynav.com/
located at themes/jquery/js/plugins.js

- typesense-minibar
https://github.com/jquery/typesense-minibar
located at themes/jquery/lib/typesense-minibar
47 changes: 16 additions & 31 deletions themes/jquery/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1349,9 +1349,6 @@ iframe {
border-left: 1px solid rgba(0, 0, 0, 0.347656);
}

.tinynav-container { display: none; }
.tinynav { display: none; }

#global-nav nav ul.links {
float: right;
}
Expand Down Expand Up @@ -2796,11 +2793,6 @@ footer .books li a cite {
font-size: 12px;
}

#logo-events {
padding-top: 20px;
padding-bottom: 10px;
}

#logo-events aside {
display: inline-block;
position: relative;
Expand All @@ -2816,16 +2808,6 @@ footer .books li a cite {
margin-right: auto;
}

nav#main {
background-color: rgba(0, 0, 0, 0.0);
border-radius: 10px 10px 0 0;
border-right: none;
border-left: none;
border-top: none;
box-shadow: none;
padding-top: 10px;
}

nav#main .searchform {
display: block;
float: none;
Expand Down Expand Up @@ -2866,11 +2848,6 @@ footer .books li a cite {
font-size: 14px;
}

#content-wrapper {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}

.content-full.full-width #content,
.content-right #content,
.content-left #content {
Expand Down Expand Up @@ -2937,25 +2914,31 @@ footer .books li a cite {
border-top: none !important;
}

.tinynav-container {
display: block;
.menu-top-container {
display: flex;
flex-flow: column;
}

.menu-top-container .menu-trigger {
display: inline-block !important;
align-self: flex-end;
}

#menu-top {
display: none;
}

.tinynav {
#menu-top.menu-open {
display: block;
width: 100%;
margin: 0 auto 15px;
position: relative;
top: 6px;
left: 0;
background-color: rgba(0, 0, 0, 0.18);
margin-top: 6px;
}

nav#main {
padding: 0;
background: none;
border: none;
box-shadow: none;
}

nav#main .searchform {
Expand Down Expand Up @@ -2985,6 +2968,8 @@ footer .books li a cite {
}

#content-wrapper {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding-left: 25px;
padding-right: 25px;
}
Expand Down
1 change: 0 additions & 1 deletion themes/jquery/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>?v=4">

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/plugins.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/main.js"></script>
<?php
if ( get_option( 'thread_comments' ) && comments_open() ) {
Expand Down
20 changes: 13 additions & 7 deletions themes/jquery/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ $(function() {
}
});

/*
* Change navigation elements for smaller screens
*/
(function() {
// Collapse the site navigation to a select menu
$( "#menu-top" ).tinyNav({ header: "Navigate..." });
})();
// collapsible navigation for smaller screens
$('.menu-trigger').on('click', function (e) {
var $btn = $(this),
$nav = $(this).next('.menu');
if ($nav.hasClass('menu-open')) {
$btn.attr('aria-expanded', 'false');
$nav.removeClass('menu-open');
} else {
$btn.attr('aria-expanded', 'true');
$nav.addClass('menu-open');
$nav.find('a').first().focus();
}
});
});


Expand Down
3 changes: 0 additions & 3 deletions themes/jquery/js/plugins.js

This file was deleted.

3 changes: 2 additions & 1 deletion themes/jquery/menu-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ function jquery_render_menu( $items ) {
$current = trailingslashit( 'https://' . JQUERY_LIVE_SITE . $_SERVER['REQUEST_URI'] );
?>
<div class="menu-top-container">
<ul id="menu-top" class="menu">
<button hidden id="menu-trigger" class="button menu-trigger" aria-expanded="false" aria-haspopup="menu">Navigation</button>
<ul id="menu-top" class="menu" role="menu" aria-labelledby="menu-trigger">
<?php
foreach ( $items as $url => $anchor ) {
$class = 'menu-item';
Expand Down