Fix: Update minified stellarnav script for navbar redirection#2617
Fix: Update minified stellarnav script for navbar redirection#2617sm-28601 wants to merge 2 commits intomeshery:masterfrom
Conversation
Signed-off-by: Sahil Maurya <sahilmaurya5611@gmail.com>
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Deploy Preview for mesheryio-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @sm-28601, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a production issue where a previously implemented fix for desktop navbar redirection was not active on the live site. The core change involves updating the minified JavaScript file, Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a navbar redirection bug by updating the minified stellarnav.min.js file. The fix itself seems correct, however, modifying minified files directly is a significant maintainability risk. My review comment highlights this process issue, as any future minification from the source file will overwrite this fix and reintroduce the bug. It is strongly recommended to implement a build process that generates minified files from their sources.
| @@ -1 +1 @@ | |||
| !function(i){i.fn.stellarNav=function(e,s,n){nav=i(this),s=i(window).width();var t=i.extend({theme:"plain",breakpoint:768,menuLabel:"",sticky:!1,position:"static",openingSpeed:80,closingDelay:80,showArrows:!0,phoneBtn:"",phoneLabel:"Call Us",locationBtn:"",locationLabel:"Location",closeBtn:!1,closeLabel:"Close",mobileMode:!1,scrollbarFix:!1},e);return this.each(function(){if(("light"==t.theme||"dark"==t.theme)&&nav.addClass(t.theme),t.breakpoint&&(n=t.breakpoint),menuLabel=t.menuLabel?t.menuLabel:"",phoneLabel=t.phoneLabel?t.phoneLabel:"",locationLabel=t.locationLabel?t.locationLabel:"",closeLabel=t.closeLabel?t.closeLabel:"",t.phoneBtn&&t.locationBtn)var e="third";else if(t.phoneBtn||t.locationBtn)var e="half";else var e="full";if("right"==t.position||"left"==t.position?nav.prepend('<a href="#" class="menu-toggle"><span class="bars"><span></span><span></span><span></span></span></a>'):nav.prepend('<a href="#" class="menu-toggle '+e+'"><span class="bars"><span></span><span></span><span></span></span></a>'),t.phoneBtn&&!("right"==t.position||"left"==t.position)){var l='<a href="tel:'+t.phoneBtn+'" class="call-btn-mobile '+e+'"><svg id="icon-phone"></svg> <span>'+phoneLabel+"</span></a>";nav.find("a.menu-toggle").after(l)}if(t.locationBtn&&!("right"==t.position||"left"==t.position)){var l='<a href="'+t.locationBtn+'" class="location-btn-mobile '+e+'" target="_blank"><svg id="icon-location"></svg> <span>'+locationLabel+"</span></a>";nav.find("a.menu-toggle").after(l)}if(t.sticky&&(navPos=nav.offset().top,s>=n&&i(window).on("scroll",function(){i(window).scrollTop()>navPos?nav.addClass("fixed"):nav.removeClass("fixed")})),"top"==t.position&&nav.addClass("top"),"left"==t.position||"right"==t.position){var o='<a href="#" class="close-menu '+e+'"><span class="icon-close"></span>'+closeLabel+"</a>",a='<a href="tel:'+t.phoneBtn+'" class="call-btn-mobile '+e+'"><svg id="icon-phone"></svg></a>',_='<a href="'+t.locationBtn+'" class="location-btn-mobile '+e+'" target="_blank"><svg id="icon-location"></svg></i></a>';nav.find("ul:first").prepend(o),t.locationBtn&&nav.find("ul:first").prepend(_),t.phoneBtn&&nav.find("ul:first").prepend(a)}"right"==t.position&&nav.addClass("right"),"left"==t.position&&nav.addClass("left"),t.showArrows||nav.addClass("hide-arrows"),t.closeBtn&&!("right"==t.position||"left"==t.position)&&nav.find("ul:first").append('<li><a href="#" class="close-menu"><span class="icon-close"></span> '+closeLabel+"</a></li>"),t.scrollbarFix&&i("body").addClass("stellarnav-noscroll-x");var c=document.getElementById("icon-phone");if(c){c.setAttribute("viewBox","0 0 480 480");var d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d","M340.273,275.083l-53.755-53.761c-10.707-10.664-28.438-10.34-39.518,0.744l-27.082,27.076 c-1.711-0.943-3.482-1.928-5.344-2.973c-17.102-9.476-40.509-22.464-65.14-47.113c-24.704-24.701-37.704-48.144-47.209-65.257 c-1.003-1.813-1.964-3.561-2.913-5.221l18.176-18.149l8.936-8.947c11.097-11.1,11.403-28.826,0.721-39.521L73.39,8.194 C62.708-2.486,44.969-2.162,33.872,8.938l-15.15,15.237l0.414,0.411c-5.08,6.482-9.325,13.958-12.484,22.02 C3.74,54.28,1.927,61.603,1.098,68.941C-6,127.785,20.89,181.564,93.866,254.541c100.875,100.868,182.167,93.248,185.674,92.876 c7.638-0.913,14.958-2.738,22.397-5.627c7.992-3.122,15.463-7.361,21.941-12.43l0.331,0.294l15.348-15.029 C350.631,303.527,350.95,285.795,340.273,275.083z"),c.appendChild(d)}var p=document.getElementById("icon-location");if(p){p.setAttribute("viewBox","0 0 480 480");var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d","M322.621,42.825C294.073,14.272,259.619,0,219.268,0c-40.353,0-74.803,14.275-103.353,42.825 c-28.549,28.549-42.825,63-42.825,103.353c0,20.749,3.14,37.782,9.419,51.106l104.21,220.986 c2.856,6.276,7.283,11.225,13.278,14.838c5.996,3.617,12.419,5.428,19.273,5.428c6.852,0,13.278-1.811,19.273-5.428 c5.996-3.613,10.513-8.562,13.559-14.838l103.918-220.986c6.282-13.324,9.424-30.358,9.424-51.106 C365.449,105.825,351.176,71.378,322.621,42.825z M270.942,197.855c-14.273,14.272-31.497,21.411-51.674,21.411 s-37.401-7.139-51.678-21.411c-14.275-14.277-21.414-31.501-21.414-51.678c0-20.175,7.139-37.402,21.414-51.675 c14.277-14.275,31.504-21.414,51.678-21.414c20.177,0,37.401,7.139,51.674,21.414c14.274,14.272,21.413,31.5,21.413,51.675 C292.355,166.352,285.217,183.575,270.942,197.855z"),p.appendChild(r)}function h(e){e.preventDefault(),i(this).parent("li").children("ul").stop(!0,!0).slideToggle(t.openingSpeed),i(this).parent("li").toggleClass("open")}i(".menu-toggle, .stellarnav-open").on("click",function(e){e.preventDefault(),"left"==t.position||"right"==t.position?(nav.find("ul:first").stop(!0,!0).fadeToggle(t.openingSpeed),nav.toggleClass("active"),nav.hasClass("active")&&nav.hasClass("mobile")&&i(document).on("click",function(e){nav.hasClass("mobile")&&!i(e.target).closest(nav).length&&(nav.find("ul:first").stop(!0,!0).fadeOut(t.openingSpeed),nav.removeClass("active"))})):(nav.find("ul:first").stop(!0,!0).slideToggle(t.openingSpeed),nav.toggleClass("active"))}),i(".close-menu, .stellarnav-close").on("click",function(){nav.removeClass("active"),"left"==t.position||"right"==t.position?nav.find("ul:first").stop(!0,!0).fadeToggle(t.openingSpeed):nav.find("ul:first").stop(!0,!0).slideUp(t.openingSpeed).toggleClass("active")}),nav.find("li a").each(function(){i(this).next().length>0&&(i(this).addClass("sub-list"),i(this).parent("li").addClass("has-sub").append('<a class="dd-toggle" href="#"><span class="icon-plus"></span></a>'))}),nav.find("li .dd-toggle").on("click",h),nav.find("li .sub-list").on("click",h);var f=function(){nav.find("li").off("mouseenter"),nav.find("li").off("mouseleave")};parentItems=nav.find("> ul > li");var $=function(){i(parentItems).each(function(){i(this).hasClass("mega")?(i(this).on("mouseenter",function(){i(this).find("ul").first().stop(!0,!0).slideDown(t.openingSpeed)}),i(this).on("mouseleave",function(){i(this).find("ul").first().stop(!0,!0).slideUp(t.openingSpeed)})):(i(this).on("mouseenter",function(){i(this).children("ul").stop(!0,!0).slideDown(t.openingSpeed)}),i(this).on("mouseleave",function(){i(this).children("ul").stop(!0,!0).delay(t.closingDelay).slideUp(t.openingSpeed)}),i(this).find("li.has-sub").on("mouseenter",function(){i(this).children("ul").stop(!0,!0).slideDown(t.openingSpeed)}),i(this).find("li.has-sub").on("mouseleave",function(){i(this).children("ul").stop(!0,!0).delay(t.closingDelay).slideUp(t.openingSpeed)}))})};function u(){window.innerWidth<=n||t.mobileMode?(f(),nav.addClass("mobile"),nav.removeClass("desktop"),!nav.hasClass("active")&&nav.find("ul:first").is(":visible")&&nav.find("ul:first").hide(),nav.find("li.mega").each(function(){i(this).find("ul").first().removeAttr("style"),i(this).find("ul").first().children().removeAttr("style")})):(nav.addClass("desktop"),nav.removeClass("mobile"),nav.hasClass("active")&&nav.removeClass("active"),!nav.hasClass("active")&&nav.find("ul:first").is(":hidden")&&nav.find("ul:first").show(),i("li.open").removeClass("open").find("ul:visible").hide(),f(),$(),navWidth=0,i(parentItems).each(function(){navWidth+=i(this)[0].getBoundingClientRect().width,navWidth=Math.round(navWidth),i(this).hasClass("mega")&&(i(this).find("ul").first().css({left:0,right:0,margin:"0px auto"}),2==(numCols=i(this).attr("data-columns"))?i(this).find("li.has-sub").width("50%"):3==numCols?i(this).find("ul").first().children().width("33.33%"):4==numCols?i(this).find("ul").first().children().width("25%"):5==numCols?i(this).find("ul").first().children().width("20%"):6==numCols?i(this).find("ul").first().children().width("16.66%"):7==numCols?i(this).find("ul").first().children().width("14.28%"):8==numCols?i(this).find("ul").first().children().width("12.5%"):i(this).find("ul").first().children().width("25%"))}),parentItems.hasClass("mega")&&nav.find("li.mega > ul").css({"max-width":navWidth}))}u(),i(window).on("resize",function(){u()})})}}(jQuery); No newline at end of file | |||
| !function(i){i.fn.stellarNav=function(e,s,n){nav=i(this),s=i(window).width();var t=i.extend({theme:"plain",breakpoint:768,menuLabel:"",sticky:!1,position:"static",openingSpeed:80,closingDelay:80,showArrows:!0,phoneBtn:"",phoneLabel:"Call Us",locationBtn:"",locationLabel:"Location",closeBtn:!1,closeLabel:"Close",mobileMode:!1,scrollbarFix:!1},e);return this.each(function(){if(("light"==t.theme||"dark"==t.theme)&&nav.addClass(t.theme),t.breakpoint&&(n=t.breakpoint),menuLabel=t.menuLabel?t.menuLabel:"",phoneLabel=t.phoneLabel?t.phoneLabel:"",locationLabel=t.locationLabel?t.locationLabel:"",closeLabel=t.closeLabel?t.closeLabel:"",t.phoneBtn&&t.locationBtn)var e="third";else if(t.phoneBtn||t.locationBtn)var e="half";else var e="full";if("right"==t.position||"left"==t.position?nav.prepend('<a href="#" class="menu-toggle"><span class="bars"><span></span><span></span><span></span></span></a>'):nav.prepend('<a href="#" class="menu-toggle '+e+'"><span class="bars"><span></span><span></span><span></span></span></a>'),t.phoneBtn&&!("right"==t.position||"left"==t.position)){var l='<a href="tel:'+t.phoneBtn+'" class="call-btn-mobile '+e+'"><svg id="icon-phone"></svg> <span>'+phoneLabel+"</span></a>";nav.find("a.menu-toggle").after(l)}if(t.locationBtn&&!("right"==t.position||"left"==t.position)){var l='<a href="'+t.locationBtn+'" class="location-btn-mobile '+e+'" target="_blank"><svg id="icon-location"></svg> <span>'+locationLabel+"</span></a>";nav.find("a.menu-toggle").after(l)}if(t.sticky&&(navPos=nav.offset().top,s>=n&&i(window).on("scroll",function(){i(window).scrollTop()>navPos?nav.addClass("fixed"):nav.removeClass("fixed")})),"top"==t.position&&nav.addClass("top"),"left"==t.position||"right"==t.position){var o='<a href="#" class="close-menu '+e+'"><span class="icon-close"></span>'+closeLabel+"</a>",a='<a href="tel:'+t.phoneBtn+'" class="call-btn-mobile '+e+'"><svg id="icon-phone"></svg></a>',_='<a href="'+t.locationBtn+'" class="location-btn-mobile '+e+'" target="_blank"><svg id="icon-location"></svg></i></a>';nav.find("ul:first").prepend(o),t.locationBtn&&nav.find("ul:first").prepend(_),t.phoneBtn&&nav.find("ul:first").prepend(a)}"right"==t.position&&nav.addClass("right"),"left"==t.position&&nav.addClass("left"),t.showArrows||nav.addClass("hide-arrows"),t.closeBtn&&!("right"==t.position||"left"==t.position)&&nav.find("ul:first").append('<li><a href="#" class="close-menu"><span class="icon-close"></span> '+closeLabel+"</a></li>"),t.scrollbarFix&&i("body").addClass("stellarnav-noscroll-x");var c=document.getElementById("icon-phone");if(c){c.setAttribute("viewBox","0 0 480 480");var d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d","M340.273,275.083l-53.755-53.761c-10.707-10.664-28.438-10.34-39.518,0.744l-27.082,27.076 c-1.711-0.943-3.482-1.928-5.344-2.973c-17.102-9.476-40.509-22.464-65.14-47.113c-24.704-24.701-37.704-48.144-47.209-65.257 c-1.003-1.813-1.964-3.561-2.913-5.221l18.176-18.149l8.936-8.947c11.097-11.1,11.403-28.826,0.721-39.521L73.39,8.194 C62.708-2.486,44.969-2.162,33.872,8.938l-15.15,15.237l0.414,0.411c-5.08,6.482-9.325,13.958-12.484,22.02 C3.74,54.28,1.927,61.603,1.098,68.941C-6,127.785,20.89,181.564,93.866,254.541c100.875,100.868,182.167,93.248,185.674,92.876 c7.638-0.913,14.958-2.738,22.397-5.627c7.992-3.122,15.463-7.361,21.941-12.43l0.331,0.294l15.348-15.029 C350.631,303.527,350.95,285.795,340.273,275.083z"),c.appendChild(d)}var p=document.getElementById("icon-location");if(p){p.setAttribute("viewBox","0 0 480 480");var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d","M322.621,42.825C294.073,14.272,259.619,0,219.268,0c-40.353,0-74.803,14.275-103.353,42.825 c-28.549,28.549-42.825,63-42.825,103.353c0,20.749,3.14,37.782,9.419,51.106l104.21,220.986 c2.856,6.276,7.283,11.225,13.278,14.838c5.996,3.617,12.419,5.428,19.273,5.428c6.852,0,13.278-1.811,19.273-5.428 c5.996-3.613,10.513-8.562,13.559-14.838l103.918-220.986c6.282-13.324,9.424-30.358,9.424-51.106 C365.449,105.825,351.176,71.378,322.621,42.825z M270.942,197.855c-14.273,14.272-31.497,21.411-51.674,21.411 s-37.401-7.139-51.678-21.411c-14.275-14.277-21.414-31.501-21.414-51.678c0-20.175,7.139-37.402,21.414-51.675 c14.277-14.275,31.504-21.414,51.678-21.414c20.177,0,37.401,7.139,51.674,21.414c14.274,14.272,21.413,31.5,21.413,51.675 C292.355,166.352,285.217,183.575,270.942,197.855z"),p.appendChild(r)}function h(e){if(nav[0].classList.contains("desktop")&&this.classList.contains("sub-list"))return;e.preventDefault(),i(this).parent("li").children("ul").stop(!0,!0).slideToggle(t.openingSpeed),i(this).parent("li").toggleClass("open")}i(".menu-toggle, .stellarnav-open").on("click",function(e){e.preventDefault(),"left"==t.position||"right"==t.position?(nav.find("ul:first").stop(!0,!0).fadeToggle(t.openingSpeed),nav.toggleClass("active"),nav.hasClass("active")&&nav.hasClass("mobile")&&i(document).on("click",function(e){nav.hasClass("mobile")&&!i(e.target).closest(nav).length&&(nav.find("ul:first").stop(!0,!0).fadeOut(t.openingSpeed),nav.removeClass("active"))})):(nav.find("ul:first").stop(!0,!0).slideToggle(t.openingSpeed),nav.toggleClass("active"))}),i(".close-menu, .stellarnav-close").on("click",function(){nav.removeClass("active"),"left"==t.position||"right"==t.position?nav.find("ul:first").stop(!0,!0).fadeToggle(t.openingSpeed):nav.find("ul:first").stop(!0,!0).slideUp(t.openingSpeed).toggleClass("active")}),nav.find("li a").each(function(){i(this).next().length>0&&(i(this).addClass("sub-list"),i(this).parent("li").addClass("has-sub").append('<a class="dd-toggle" href="#"><span class="icon-plus"></span></a>'))}),nav.find("li .dd-toggle").on("click",h),nav.find("li .sub-list").on("click",h);var f=function(){nav.find("li").off("mouseenter"),nav.find("li").off("mouseleave")};parentItems=nav.find("> ul > li");var $=function(){i(parentItems).each(function(){i(this).hasClass("mega")?(i(this).on("mouseenter",function(){i(this).find("ul").first().stop(!0,!0).slideDown(t.openingSpeed)}),i(this).on("mouseleave",function(){i(this).find("ul").first().stop(!0,!0).slideUp(t.openingSpeed)})):(i(this).on("mouseenter",function(){i(this).children("ul").stop(!0,!0).slideDown(t.openingSpeed)}),i(this).on("mouseleave",function(){i(this).children("ul").stop(!0,!0).delay(t.closingDelay).slideUp(t.openingSpeed)}),i(this).find("li.has-sub").on("mouseenter",function(){i(this).children("ul").stop(!0,!0).slideDown(t.openingSpeed)}),i(this).find("li.has-sub").on("mouseleave",function(){i(this).children("ul").stop(!0,!0).delay(t.closingDelay).slideUp(t.openingSpeed)}))})};function u(){window.innerWidth<=n||t.mobileMode?(f(),nav.addClass("mobile"),nav.removeClass("desktop"),!nav.hasClass("active")&&nav.find("ul:first").is(":visible")&&nav.find("ul:first").hide(),nav.find("li.mega").each(function(){i(this).find("ul").first().removeAttr("style"),i(this).find("ul").first().children().removeAttr("style")})):(nav.addClass("desktop"),nav.removeClass("mobile"),nav.hasClass("active")&&nav.removeClass("active"),!nav.hasClass("active")&&nav.find("ul:first").is(":hidden")&&nav.find("ul:first").show(),i("li.open").removeClass("open").find("ul:visible").hide(),f(),$(),navWidth=0,i(parentItems).each(function(){navWidth+=i(this)[0].getBoundingClientRect().width,navWidth=Math.round(navWidth),i(this).hasClass("mega")&&(i(this).find("ul").first().css({left:0,right:0,margin:"0px auto"}),2==(numCols=i(this).attr("data-columns"))?i(this).find("li.has-sub").width("50%"):3==numCols?i(this).find("ul").first().children().width("33.33%"):4==numCols?i(this).find("ul").first().children().width("25%"):5==numCols?i(this).find("ul").first().children().width("20%"):6==numCols?i(this).find("ul").first().children().width("16.66%"):7==numCols?i(this).find("ul").first().children().width("14.28%"):8==numCols?i(this).find("ul").first().children().width("12.5%"):i(this).find("ul").first().children().width("25%"))}),parentItems.hasClass("mega")&&nav.find("li.mega > ul").css({"max-width":navWidth}))}u(),i(window).on("resize",function(){u()})})}}(jQuery); No newline at end of file | |||
There was a problem hiding this comment.
Editing minified files directly is a significant maintainability risk. While this change fixes the immediate issue, it will be overwritten and the bug will reappear the next time this file is generated from its source (stellarnav.js). The correct practice is to modify the source file and have a build process create the minified version. Please either add a build step to this PR or create a follow-up issue to implement a proper build process for JavaScript assets.
There was a problem hiding this comment.
Thanks for the review! For context, the source file (js/stellarnav.js) was already fixed and merged in PR #2613.
Since this repo currently lacks an automated minification pipeline, the live site is still serving the old .min.js file. This PR just manually syncs the minified file to get the fix into production
|
@saurabhraghuvanshii - I figured out the main issue for why the fix wasn't showing in production! The live site loads stellarnav.min.js, but I only updated the source file in PR #2613. I've synced the minified file here so it can go live. Could you please review this? |
Description
This PR acts as a follow-up to #2613.
While the previous PR successfully fixed the desktop navbar redirection issue in the source
js/stellarnav.jsfile, the production site (meshery.io) serves the minified version (js/stellarnav.min.js). This resulted in the fix working in the Netlify preview but not reflecting on the live site.Why this happened:
During debugging, I noticed the live site's Network tab loads
stellarnav.min.js, whereas local development uses the rawstellarnav.jsfile. This PR syncs the exact same conditional logic from PR #2613 into theh(e)function withinstellarnav.min.jsso the fix can take effect in production.Notes for Reviewers
stellarnav.min.jsexecutes the correct conditional bypass for desktop sub-list links.Signed commits