GreedyNav.js script error

This topic contains 13 replies, has 4 voices, and was last updated by  Kiran 4 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #528830

    Barbara Magee
    Expired Member
    Post count: 146

    We have a persistent JS error. Looks like it’s related to something that uses a custom script for “An AUI bootstrap adaptation of GreedyNav.js – Simply add the class

    greedy

    to any <nav> menu and it will do the rest.”

    Can you advise on what the problem is?

    Thanks!

    #528867

    Kor
    Moderator
    Post count: 16516

    Hi Barbara,

    Thanks for your post. This doesn’t look like it’s related to GD but I’ll get a developer to take a second look. In the meantime, please share the URL of the page in question of where we can see the issue and also WP and FTP access in private reply.

    #528907

    Alex Rollin
    Moderator
    Post count: 27815

    Can you please share a link to a page where this is happening?

    Thanks

    #528955

    Barbara Magee
    Expired Member
    Post count: 146

    I’m not able to send you a page link because I’m not sure what it’s affecting on our site. My webhost sent me the script error, which I copied into a pdf and attached to my original support post in this thread. Did the pdf make it through? Were you able to open it?

    #528959

    Barbara Magee
    Expired Member
    Post count: 146
    This reply has been marked as private.
    #529156

    Alex Rollin
    Moderator
    Post count: 27815

    Can you share where the logs with this error are located?

    #529192

    Barbara Magee
    Expired Member
    Post count: 146
    This reply has been marked as private.
    #529228

    Kiran
    Moderator
    Post count: 7069

    Hi Barbara,

    We have released new version of UsersWP plugin with some similar JavaScript errors fix occurred because of plugin conflict.

    Please update UsersWP and let us how it goes.

    Regards,
    Kiran

    #529237

    Barbara Magee
    Expired Member
    Post count: 146

    Thanks very much! Will do.

    #533186

    Barbara Magee
    Expired Member
    Post count: 146

    Hello,
    I’m circling back on the subject of GreedyNav.js error. We did update UserWP, but we are not sure the problem is resolved. Attached is a screenshot of what happens when I clicked back button on our Cities page. The page doesn’t complete the redirect and we get a page displaying 2 logos in the header and 5 representations of our navigation menu on the left, etc. Here’s a link to the page:

    Here is some code from the inspector that includes GreedyNav language, etc. We appreciate your taking a look at this. Thanks!

    <html class=”avada-html-layout-wide avada-html-header-position-top avada-is-100-percent-template ua-chrome ua-chrome-80 ua-chrome-80-0 ua-chrome-80-0-3987 ua-chrome-80-0-3987-122 ua-desktop ua-desktop-macintosh ua-mac_os_x ua-mac_os_x-10 ua-mac_os_x-10-13 ua-mac_os_x-10-13-6 ua-webkit ua-webkit-537 ua-webkit-537-36 js applicationcache geolocation history postmessage websockets localstorage sessionstorage websqldatabase webworkers hashchange audio canvas canvastext video webgl cssgradients multiplebgs opacity rgba inlinesvg hsla supports svgclippaths smil no-touchevents fontface generatedcontent textshadow cssanimations backgroundsize borderimage borderradius boxshadow flexbox cssreflections csstransforms csstransforms3d csstransitions” lang=”en-US” prefix=”og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#” data-useragent=”Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36″ style=””><head><meta http-equiv=”X-UA-Compatible” content=”IE=edge”><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><meta name=”viewport” content=”width=device-width, initial-scale=1″><link media=”all” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_17fd726454b6d3a399b87fa014164a14.css” rel=”stylesheet”><link media=”only screen and (max-width: 640px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_eaae2f4f83c8bc8db278d312d552c53a.css” rel=”stylesheet”><link media=”only screen and (max-width: 712px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_9db2f4ca89275b9d56d30f5119c0e6b8.css” rel=”stylesheet”><link media=”only screen and (min-width: 712px) and (max-width: 784px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_886ffc42640c4a53af5ff844129b38e5.css” rel=”stylesheet”><link media=”only screen and (min-width: 784px) and (max-width: 856px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_1d5c0dfa3013e5265445cc285f9652fc.css” rel=”stylesheet”><link media=”only screen and (min-width: 856px) and (max-width: 928px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_831128cc4343c5eb771b0ab2c071aa51.css” rel=”stylesheet”><link media=”only screen and (min-width: 928px) and (max-width: 1000px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_49c145298c027cf44ee66d31860139a2.css” rel=”stylesheet”><link media=”only screen and (min-width: 801px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_cd1741ec3077f8ce134d30f194a1b924.css” rel=”stylesheet”><link media=”only screen and (max-width: 800px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_74c77ac73cadaaad1a08a7479b024c0a.css” rel=”stylesheet”><link media=”only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_4f7177b3ac2a361d2db6736f39b377c7.css” rel=”stylesheet”><link media=”only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_126bfdd08dc0ecbfa691f2f6bc2f8cf2.css” rel=”stylesheet”><link media=”only screen and (max-width: 782px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_2cc4ccc3584bfaefd212eb3d84c1885c.css” rel=”stylesheet”><style media=”only screen and (max-width: 768px)”>.fusion-tabs.vertical-tabs .tab-pane{max-width:none!important}</style><link media=”only screen and (min-width: 800px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_2fb5de34335d46f87d4b03cb6c80b506.css” rel=”stylesheet”><link media=”only screen and (max-device-width: 640px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_1c5f6209e3872dd0cee3d451b0df125b.css” rel=”stylesheet”><link media=”only screen and (max-width: 1000px)” href=”https://thelocaldish.com/wp-content/cache/autoptimize/css/autoptimize_7c539e15a1a473699426668115de738f.css” rel=”stylesheet”><style media=”print”>#wpadminbar{display:none}</style><style media=”screen”>html{margin-top:32px !important}* html body{margin-top:32px !important}@media screen and (max-width:782px){html{margin-top:46px !important}* html body{margin-top:46px !important}}</style><title>Cities | The Local Dish</title><meta name=”description” content=”W2dkX3NlYXJjaCBwb3N0X3R5cGVfaGlkZT0iMSIgY3VzdG9taXplX2ZpbHRlcnM9ImRlZmF1bHQiXQpbZ2RfbG9jYXRpb25fbmVhcl9tZV0=”><meta name=”robots” content=”follow,index,max-snippet:-1,max-video-preview:-1,max-image-preview:large”><link rel=”canonical” href=”https://thelocaldish.com/cities/”><meta property=”og:locale” content=”en_US”><meta property=”og:type” content=”article”><meta property=”og:title” content=”Cities | The Local Dish”><meta property=”og:description” content=”W2dkX3NlYXJjaCBwb3N0X3R5cGVfaGlkZT0iMSIgY3VzdG9taXplX2ZpbHRlcnM9ImRlZmF1bHQiXQpbZ2RfbG9jYXRpb25fbmVhcl9tZV0=”><meta property=”og:url” content=”https://thelocaldish.com/cities/”><meta property=”og:site_name” content=”The Local Dish”><meta property=”article:publisher” content=”https://www.facebook.com/thelocaldish1″><meta property=”article:author” content=”http://www.facebook.com/thelocaldish1″><meta property=”article:published_time” content=”2019-09-04T14:21:28-07:00″><meta property=”article:modified_time” content=”2020-02-28T12:14:37-08:00″><meta property=”og:updated_time” content=”2020-02-28T12:14:37-08:00″><meta name=”twitter:card” content=”summary_large_image”><meta name=”twitter:title” content=”Cities | The Local Dish”><meta name=”twitter:description” content=”W2dkX3NlYXJjaCBwb3N0X3R5cGVfaGlkZT0iMSIgY3VzdG9taXplX2ZpbHRlcnM9ImRlZmF1bHQiXQpbZ2RfbG9jYXRpb25fbmVhcl9tZV0=”><meta name=”twitter:site” content=”@thelocaldish”><meta name=”twitter:creator” content=”@thelocaldish”> <script async=”” src=”https://www.google-analytics.com/analytics.js”></script><script type=”application/ld+json”>{“@context”:”https:\/\/schema.org”,”@type”:”Article”,”headline”:”Cities”,”description”:”W2dkX3NlYXJjaCBwb3N0X3R5cGVfaGlkZT0iMSIgY3VzdG9taXplX2ZpbHRlcnM9ImRlZmF1bHQiXQpbZ2RfbG9jYXRpb25fbmVhcl9tZV0=”,”datePublished”:”2019-09-04T14:21:28-07:00″,”dateModified”:”2020-02-28T12:14:37-08:00″,”publisher”:{“@type”:”Organization”,”name”:”The Local Dish, LLC”,”logo”:{“@type”:”ImageObject”,”url”:”https:\/\/thelocaldish.com\/wp-content\/uploads\/2019\/12\/The-Local-Dish-logo.mark_.png”}},”mainEntityOfPage”:{“@type”:”WebPage”,”@id”:”https:\/\/thelocaldish.com\/cities\/”},”author”:{“@type”:”Person”,”name”:”The Local Dish”}}</script> <script type=”application/ld+json”>{“@context”:”https:\/\/schema.org”,”@type”:”BreadcrumbList”,”itemListElement”:[{“@type”:”ListItem”,”position”:1,”item”:{“@id”:”https:\/\/thelocaldish.com”,”name”:”Home”}},{“@type”:”ListItem”,”position”:2,”item”:{“@id”:”https:\/\/thelocaldish.com\/cities\/”,”name”:”Cities”}}]}</script> <link rel=”dns-prefetch” href=”//maps.google.com”><link rel=”dns-prefetch” href=”//cdnjs.cloudflare.com”><link rel=”dns-prefetch” href=”//use.fontawesome.com”><link rel=”alternate” type=”application/rss+xml” title=”The Local Dish » Feed” href=”https://thelocaldish.com/feed/”><link rel=”alternate” type=”application/rss+xml” title=”The Local Dish » Comments Feed” href=”https://thelocaldish.com/comments/feed/”><meta property=”og:title” content=”Cities”><meta property=”og:type” content=”article”><meta property=”og:url” content=”https://thelocaldish.com/cities/”><meta property=”og:site_name” content=”The Local Dish”><meta property=”og:description” content=”Applegate Ashland Bandon Bend Carlton Cave Junction Central Point Dayton Elmira Eugene Gold Hill Grants Pass Hood River Idleyld Jacksonville Medford McMinnville Newberg Newport Philomath Phoenix Roseburg Portland Salem Springfield Talent”><meta property=”og:image” content=”https://thelocaldish.com/wp-content/uploads/2019/11/The-Local-Dish-logo.mark_.png”><link rel=”stylesheet” id=”dashicons-css” href=”https://thelocaldish.com/wp-includes/css/dashicons.min.css” type=”text/css” media=”all”><link rel=”stylesheet” id=”admin-bar-css” href=”https://thelocaldish.com/wp-includes/css/admin-bar.min.css” type=”text/css” media=”all”> <!–[if IE]><link rel=’stylesheet’ id=’avada-IE-css’ href=’https://thelocaldish.com/wp-content/themes/Avada/assets/css/ie.min.css’ type=’text/css’ media=’all’ /><style id=’avada-IE-inline-css’ type=’text/css’>.avada-select-parent .select-arrow{background-color:#ffffff}
    .select-arrow{background-color:#ffffff}</style><![endif]–><link rel=”stylesheet” id=”fusion-dynamic-css-css” href=”https://thelocaldish.com/wp-content/uploads/fusion-styles/843370cf33804c92c27ce0f2d7738712.min.css” type=”text/css” media=”all”><link rel=”stylesheet” id=”font-awesome-css” href=”https://use.fontawesome.com/releases/v5.12.1/css/all.css?wpfas=true” type=”text/css” media=”all”><link rel=”stylesheet” id=”font-awesome-shims-css” href=”https://use.fontawesome.com/releases/v5.12.1/css/v4-shims.css?wpfas=true” type=”text/css” media=”all”> <script type=”text/javascript” src=”https://thelocaldish.com/wp-includes/js/jquery/jquery.js”></script> <script type=”text/javascript”>/**
    * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
    *
    * Simply add the class

    greedy

    to any <nav> menu and it will do the rest.
    * Licensed under the MIT license – http://opensource.org/licenses/MIT
    * @ver 0.0.1
    */
    function aui_init_greedy_nav(){
    jQuery(‘nav.greedy’).each(function(i, obj) {

    // Check if already initialized, if so continue.
    if(jQuery(this).hasClass(“being-greedy”)){return true;}

    // Make sure its always expanded
    jQuery(this).addClass(‘navbar-expand’);

    // vars
    var $vlinks = jQuery(this).find(‘.navbar-nav’).addClass(“being-greedy w-100”);
    jQuery($vlinks).append(‘<li class=”nav-item list-unstyled ml-auto greedy-btn d-none “>’ +
    <i class=”fas fa-ellipsis-h”></i> <span class=”greedy-count badge badge-dark badge-pill”></span>‘ +
    ‘<div class=”dropdown”><ul class=”greedy-links dropdown-menu dropdown-menu-right”></div>’ +
    ‘‘);
    var $hlinks = jQuery(this).find(‘.greedy-links’);
    var $btn = jQuery(this).find(‘.greedy-btn’);

    var numOfItems = 0;
    var totalSpace = 0;
    var closingTime = 1000;
    var breakWidths = [];

    // Get initial state
    $vlinks.children().outerWidth(function(i, w) {
    totalSpace += w;
    numOfItems += 1;
    breakWidths.push(totalSpace);
    });

    var availableSpace, numOfVisibleItems, requiredSpace, buttonSpace ,timer;

    /*
    The check function.
    */
    function check() {

    // Get instant state
    buttonSpace = $btn.width();
    availableSpace = $vlinks.width() – 10;
    numOfVisibleItems = $vlinks.children().length;
    requiredSpace = breakWidths[numOfVisibleItems – 1];

    // There is not enough space
    if (numOfVisibleItems > 1 && requiredSpace > availableSpace) {
    $vlinks.children().last().prev().prependTo($hlinks);
    numOfVisibleItems -= 1;
    check();
    // There is more than enough space
    } else if (availableSpace > breakWidths[numOfVisibleItems]) {
    $hlinks.children().first().insertBefore($btn);
    numOfVisibleItems += 1;
    check();
    }
    // Update the button accordingly
    jQuery($btn).find(“.greedy-count”).html( numOfItems – numOfVisibleItems);
    if (numOfVisibleItems === numOfItems) {
    $btn.addClass(‘d-none’);
    } else $btn.removeClass(‘d-none’);
    }

    // Window listeners
    jQuery(window).resize(function() {
    check();
    });

    // do initial check
    check();
    });
    }

    /**
    * Initiate Select2 items.
    */
    function aui_init_select2(){
    jQuery(“select.aui-select2”).select2();
    }

    /**
    * A function to convert a time value to a “ago” time text.
    *
    * @param selector string The .class selector
    */
    function aui_time_ago(selector) {

    var templates = {
    prefix: “”,
    suffix: ” ago”,
    seconds: “less than a minute”,
    minute: “about a minute”,
    minutes: “%d minutes”,
    hour: “about an hour”,
    hours: “about %d hours”,
    day: “a day”,
    days: “%d days”,
    month: “about a month”,
    months: “%d months”,
    year: “about a year”,
    years: “%d years”
    };
    var template = function (t, n) {
    return templates[t] && templates[t].replace(/%d/i, Math.abs(Math.round(n)));
    };

    var timer = function (time) {
    if (!time)
    return;
    time = time.replace(/\.\d+/, “”); // remove milliseconds
    time = time.replace(/-/, “/”).replace(/-/, “/”);
    time = time.replace(/T/, ” “).replace(/Z/, ” UTC”);
    time = time.replace(/([\+\-]\d\d)\:?(\d\d)/, ” $1$2″); // -04:00 -> -0400
    time = new Date(time * 1000 || time);

    var now = new Date();
    var seconds = ((now.getTime() – time) * .001) >> 0;
    var minutes = seconds / 60;
    var hours = minutes / 60;
    var days = hours / 24;
    var years = days / 365;

    return templates.prefix + (
    seconds < 45 && template(‘seconds’, seconds) ||
    seconds < 90 && template(‘minute’, 1) ||
    minutes < 45 && template(‘minutes’, minutes) ||
    minutes < 90 && template(‘hour’, 1) ||
    hours < 24 && template(‘hours’, hours) ||
    hours < 42 && template(‘day’, 1) ||
    days < 30 && template(‘days’, days) ||
    days < 45 && template(‘month’, 1) ||
    days < 365 && template(‘months’, days / 30) ||
    years < 1.5 && template(‘year’, 1) ||
    template(‘years’, years)
    ) + templates.suffix;
    };

    var elements = document.getElementsByClassName(selector);
    for (var i in elements) {
    var $this = elements[i];
    if (typeof $this === ‘object’) {
    $this.innerHTML = ‘<i class=”far fa-clock”></i> ‘ + timer($this.getAttribute(‘title’) || $this.getAttribute(‘datetime’));
    }
    }
    // update time every minute
    setTimeout(aui_time_ago, 60000);

    }

    /**
    * Initiate tooltips on the page.
    */
    function aui_init_tooltips(){
    jQuery(‘[data-toggle=”tooltip”]’).tooltip();
    jQuery(‘[data-toggle=”popover”]’).popover();
    jQuery(‘[data-toggle=”popover-html”]’).popover({
    html: true
    });
    }

    // run on window loaded
    jQuery(window).load(function() {
    // init tooltips
    aui_init_tooltips();

    // init select2
    aui_init_select2();

    // init Greedy nav
    aui_init_greedy_nav();

    // Set times to time ago
    aui_time_ago(‘timeago’);

    #533254

    Alex Rollin
    Moderator
    Post count: 27815

    Please share WP Admin in a private reply and a link to the specific page along with instructions of each step we should take to recreate the issue.

    #533710

    Kiran
    Moderator
    Post count: 7069

    Hi Barbara,

    Can you provide more details on which page you seen this error? How to replicate issue from our side?

    Kiran

    #534108

    Barbara Magee
    Expired Member
    Post count: 146
    This reply has been marked as private.
    #534856

    Kiran
    Moderator
    Post count: 7069

    Hi,

    I followed steps:
    1. Login – DONE
    2. Navigate to the Support page – DONE
    3. Wait for the page to load completely – DONE
    4. Hit the back button in your browser. – DONE

    Page is loading fine for me, i don’t see any error on page. Can you try after clearing browser cache?

    If possible provide us video capture, so can check what exact happening there.

    Kiran

Viewing 14 posts - 1 through 14 (of 14 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket