assets/themes/j1/core/js/template.js in j1-template-2022.2.3 vs assets/themes/j1/core/js/template.js in j1-template-2022.3.0.rc0
- old
+ new
@@ -2521,34 +2521,39 @@
}); // -----------------------------------------------------------------------
// In-page smooth scroll
// -----------------------------------------------------------------------
// bind click event to all headlines generated by AsciiDoctor
// for smooth-scroll (in-page)
+ // jadams,2022-06-10: unused code - smooth scrolling managed by
+ // (page height) observer
// -----------------------------------------------------------------------
-
- $('.sect1, .sect2 .sect3, .sect4, .sect5, .sect6').on('click', function (e) {
- img_link = e.target.localName == 'img' ? true : false;
- page_link = document.querySelector('[id="' + decodeURI(anchor_id).split('#').join('') + '"]') ? true : false;
- anchor_id = e.target.hash ? e.target.hash : false;
- classname = e.target.className ? e.target.className : '';
- nav_link = typeof classname == 'string' ? classname.includes('nav-link') : false; // skip BS nav links
-
- scrollOffset = j1.getScrollOffset();
-
- if (img_link) {
- // skip scrolling if a click on an image detected
- return true;
- }
-
- if (anchor_id && !nav_link || page_link) {
- logger.debug('\n' + 'click event on headline detected: ' + anchor_id);
- $('html, body').animate({
- scrollTop: $(anchor_id).offset().top + scrollOffset
- }, scrollDuration);
- e.preventDefault ? e.preventDefault() : e.returnValue = false;
- }
- }); // bind click event to all HTML elements of class '.badge' (Bootstrap)
+ // $('.sect1, .sect2 .sect3, .sect4, .sect5, .sect6').on('click', function (e) {
+ // img_link = (e.target.localName == 'img') ? true : false;
+ // page_link = document.querySelector('[id="' + decodeURI(anchor_id).split('#').join('') + '"]') ? true : false;
+ // anchor_id = e.target.hash ? e.target.hash : false;
+ // classname = e.target.className ? e.target.className : '';
+ // nav_link = typeof classname == 'string' ? classname.includes('nav-link') : false; // skip BS nav links
+ // scrollOffset = j1.getScrollOffset();
+ // anchorTop = $(anchor_id).offset().top ? true : false;
+ //
+ // if (anchor_id && anchor_id.includes('void')) anchor_id = false;
+ //
+ // // skip scrolling if a click on an image detected
+ // if (img_link) {
+ // return true;
+ // }
+ //
+ // if (anchor_id && !nav_link || page_link) {
+ // logger.debug('\n' + 'click event on headline detected: ' + anchor_id);
+ //
+ // $('html, body').animate({
+ // scrollTop: + scrollOffset
+ // }, scrollDuration);
+ // e.preventDefault ? e.preventDefault() : e.returnValue = false;
+ // }
+ // });
+ // bind click event to all HTML elements of class '.badge' (Bootstrap)
// for smooth-scroll (in-page) to a '<div>' element
// -----------------------------------------------------------------------
$('.badge').on('click', function (e) {
anchor_id = e.target.hash ? e.target.hash : false;
@@ -2694,11 +2699,11 @@
// https://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily
// https://stackoverflow.com/questions/5963669/whats-the-difference-between-event-stoppropagation-and-event-preventdefault
// -----------------------------------------------------------------------
- $('.attr-nav').each(function () {
+ $('.quicklink-nav').each(function () {
// ---------------------------------------------------------------------
// QuickSearch
//
if ($('li.quicksearch')) {
logger.debug('register OPEN event for QuickSearch');
@@ -2747,25 +2752,36 @@
$('#' + defaultOptions.nav_bar.container_id).show();
e.stopPropagation(); // don't bubble up the event
});
} // END QuickSearch
// ---------------------------------------------------------------------
- // Translator
+ // Translator dialog
//
if ($('li.translate')) {
logger.debug('register SHOW event for J1 Translator');
$('li.translate > a', this).on('click', function (e) {
j1.translator.showDialog();
});
} // END Translator
// ---------------------------------------------------------------------
- // CookieConsent
+ // NBI Notebooks dialog
//
+ if ($('li.nbi-notebooks')) {
+ logger.debug('register SHOW event for J1 NBI');
+ $('li.nbi-notebooks > a', this).on('click', function (e) {
+ j1.adapter.nbinteract.showDialog();
+ });
+ } // END NBI Notebooks
+ // ---------------------------------------------------------------------
+ // CookieConsent dialog
+ //
+
+
if ($('li.cookie-consent')) {
logger.debug('register SHOW event for J1 CookieConsent');
$('li.cookie-consent > a', this).on('click', function (e) {
j1.cookieConsent.showDialog();
});
@@ -2909,13 +2925,13 @@
// });
$('.megamenu-fw', this).each(function () {
$('.title', this).off('click');
$('a.dropdown-toggle', this).off('click');
- $('.content').removeClass('animated');
+ $('.content').removeClass('animate__animated ');
});
- $('.dropdown-menu', this).addClass('animated');
+ $('.dropdown-menu', this).addClass('animate__animated ');
$('li.dropdown', this).on('mouseenter', function (e) {
$menu = $('.dropdown-menu', this).eq(0);
$dropDown = $(this);
$menu.removeClass($getOut);
$menu.removeClass('open');
@@ -2952,11 +2968,11 @@
var windowHeight = $(window).height(),
windowWidth = $(window).width();
$('.nav-full').css('height', windowHeight + 'px');
$('.wrap-full-menu').css('height', windowHeight + 'px');
$('.wrap-full-menu').css('width', windowWidth + 'px');
- $('.navbar-collapse').addClass('animated');
+ $('.navbar-collapse').addClass('animate__animated ');
$('.navbar-toggle').each(function () {
var getId = $(this).data('target');
$(this).off('click');
$(this).on('click', function (e) {
e.preventDefault();
@@ -3087,23 +3103,21 @@
var logger;
var logText;
logger = log4javascript.getLogger('j1.core.scrollSmooth'); // indicator|check currently NOT used
// if (isCssSmoothScrollSupported()) { }
- logText = 'run module scrollSmooth';
- logger.info(logText);
+ logText = '\n' + 'run module scrollSmooth';
+ logger.debug(logText);
var duration = options.duration;
var offset = options.offset; // var pageUrl = options.location.hash
// ? stripHash(options.location.href)
// : options.location.href;
this.scrollTo(target, {
duration: duration,
offset: offset,
callback: false
});
- logText = 'scrollSmooth finished';
- logger.info(logText);
},
// -------------------------------------------------------------------------
// scrollTo
// NOTE: Calculate the tgt (HTML heading element including the hash)
// This makes ids that start with a number to work:
\ No newline at end of file