/** * Javascript for new OCS Pages */ (function designedPage($) { // Basic behavior $(document).ready(function designedPageStart() { // Remove Menu container $('.designed-pages-nav').parent().parent().removeClass('container'); var flagg = $('.designed-page').hasClass('designed-page'); if (flagg) { console.log('exists'); $('.header-top').removeClass('header-top'); } var toolbar = $('.page-node-type-designed-page').hasClass('adminimal-admin-toolbar'); if(toolbar){ $('.c-cfOZFu').addClass('designed-pages-adjust-toolbar') } var classList = $(".designed-page").attr("class"); $('.page-node-type-designed-page').addClass(classList); $('.section-bar-button').click(function(){ if ($('.section-bar-nav-inner').hasClass("section-bar-nav-inner-isOpen-true")) { $('.section-bar-nav-inner').removeClass("section-bar-nav-inner-isOpen-true"); } else { $('.section-bar-nav-inner').addClass('section-bar-nav-inner-isOpen-true'); } }); // Scrolling addClass //var modern = document.requestAnimationFrame; $(document).scroll(function() { var flag = $('.designed-pages-nav-inner').hasClass('designed-pages-nav-isScrolled-true'); if (!$(this).scrollTop()) { if (flag) { //if (modern) requestAnimationFrame(doSomething); //else doSomething(); $('.designed-pages-nav-inner').removeClass('designed-pages-nav-isScrolled-true'); } } else if (!flag) { $('.designed-pages-nav-inner').addClass('designed-pages-nav-isScrolled-true'); } }); function doSomething() { // special magic } function doMore() { // other shenanigans } }); // Basic behavior $(document).ready(function accordionInit() { // Accordion // Hiding the panel content. If JS is inactive, content will be displayed $(".c-iBScNJ").hide(); // -- Adding ID, aria-labelled-by, role and aria-labelledby attributes to panel content $(".c-iBScNJ").attr("id", function addInARIA(IDcount) { return "panel-" + IDcount; }); $(".c-iBScNJ").attr("aria-labelledby", function moreARIA(IDcount) { return "control-panel-" + IDcount; }); $(".c-iBScNJ").attr("aria-hidden", "true"); // ---- Only for accordion, add role tabpanel $(".c-iBScNJ").attr("role", "tabpanel"); // Now we can play with it $(".c-fdqeka").click(function playContent() { if ($(this).attr("aria-expanded") === "false") { // If aria expanded is false then it's not opened and we want it opened ! $(this) .find("[aria-expanded=true]") .attr("aria-expanded", false) .removeClass("c-fdqeka-frHuEq-isOpen-true") // .parent() .next(".c-iBScNJ") .slideUp(200) .attr("aria-hidden", "true"); // Finally we open the panel, set class active for styling // purpos on a and aria-expanded to "true" $(this) .attr("aria-expanded", true) .addClass("c-fdqeka-frHuEq-isOpen-true") // .parent() .next(".c-iBScNJ") .slideDown(200) .attr("aria-hidden", "false") .addClass("c-kBYYkb-hakyQ-isOpen-true"); } else { $(this) .attr("aria-expanded", false) .removeClass("c-fdqeka-frHuEq-isOpen-true") // .parent() .next(".c-iBScNJ") .slideUp(200) .attr("aria-hidden", "true"); } // No Boing Boing return false; }); }); // Basic behavior $(document).ready(function menuInit() { // MENU $(".designed-pages-menu .we-mega-menu-submenu").attr("aria-hidden", "true"); $(".c-hxyMDO").click(function playContent() { if ($(this).attr("aria-expanded") === "false") { // If aria expanded is false then it's not opened and we want it opened ! $(this) .find("[aria-expanded=true]") .attr("aria-expanded", false) .removeClass("c-hxyMDO-crIjHi-active-true") // .parent() .next(".we-mega-menu-submenu") .attr("aria-hidden", "true") .removeClass("c-hvkcID-jzQQaU-isOpen-true"); // Reset Opened Menu items $(".c-hxyMDO-crIjHi-active-true") .attr("aria-expanded", false) .removeClass("c-hxyMDO-crIjHi-active-true"); $(".c-hvkcID-jzQQaU-isOpen-true") .attr("aria-hidden", "true") .removeClass("c-hvkcID-jzQQaU-isOpen-true"); // Finally we open the panel, set class active for styling // purpos on a and aria-expanded to "true" $(this) .attr("aria-expanded", true) .addClass("c-hxyMDO-crIjHi-active-true") // .parent() .next(".we-mega-menu-submenu") .attr("aria-hidden", "false") .addClass("c-hvkcID-jzQQaU-isOpen-true"); } else { $(this) .attr("aria-expanded", false) .removeClass("c-hxyMDO-crIjHi-active-true") // .parent() .next(".we-mega-menu-submenu") .attr("aria-hidden", "true") .removeClass("c-hvkcID-jzQQaU-isOpen-true"); } if($(this).next().is('div')) { // No Boing Boing return false; } else { return true; } }); }); }(jQuery));