We help IT Professionals succeed at work.

Jquery instead of Angular

High Priority
109 Views
Last Modified: 2019-11-09
I have an angular code below. And I need re write this code to do the same using jQuery. I have no skills working with angular

insite.nav = function(n) {
    "use strict";
    var t = {};
    return t.uncheckBoxes = function(t) {
        for (var r = document.getElementsByName(t), i = 0; i < r.length; i++) r[i].checked = !1;
        n("body").removeClass("sidebar-main");
        n(".isc-primary-nav-back").addClass("isc-hidden")
    }, t.hideMenu = function() {
        n("#sub-cat").addClass("hide-item")
    }, t.activatePanel = function() {
        n("body").hasClass("sidebar-main") || (n("body").addClass("sidebar-main"), n(".isc-primary-nav ul:first").addClass("active-nav"))
    }, t.goToSubnav = function(t) {
        var i, r;
        n(".isc-primary-nav ul li .hide-item").removeClass("hide-item");
        i = n(".isc-primary-nav ul.active-nav");
        i.scrollTop(0);
        n(".isc-primary-nav ul").removeClass("active-nav");
        r = n(t);
        r.closest("li").find("ul.subnav:first").addClass("active-nav");
        n(".isc-primary-nav-back").removeClass("isc-hidden")
    }, t.goBack = function() {
        var t = n(".isc-primary-nav ul.active-nav");
        t.closest("li").find(".subnav-check:first").click();
        t.removeClass("active-nav");
        t.closest("li").closest("ul").addClass("active-nav");
        n(".isc-primary-nav ul.active-nav").hasClass("subnav") || n(".isc-primary-nav-back").addClass("isc-hidden")
    }, t.closePanel = function() {
        n("body").removePrefixedClasses("topbar-");
        n("[role='top-panel']").removeAttr("style")
    }, t.hideSubNav = function() {
        n(".isc-primary-nav ul li:hover > ul").addClass("hide-item")
    }, t.setup = function() {
        var r = "click.fndtn",
            i = n("body"),
            c, f, u, l, a, e, o, s, h;
        n(".ex, .ui-lock").on(r, function(n) {
            n.preventDefault();
            t.closePanel()
        });
       
        });

Open in new window

Comment
Watch Question

Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
this is not Angular code, it use jQuery

insite.nav = function(n) {
    "use strict";
    var t = {};

    t.uncheckBoxes = function (t) {
        for (var r = document.getElementsByName(t), i = 0; i < r.length; i++) r[i].checked = !1;
        n("body").removeClass("sidebar-main");
        n(".isc-primary-nav-back").addClass("isc-hidden");
    };

    t.hideMenu = function () {
        n("#sub-cat").addClass("hide-item");
    };

    t.activatePanel = function () {
        n("body").hasClass("sidebar-main") || (n("body").addClass("sidebar-main"), n(".isc-primary-nav ul:first").addClass("active-nav"))
    };

    t.goToSubnav = function (t) {
        var i, r;
        n(".isc-primary-nav ul li .hide-item").removeClass("hide-item");
        i = n(".isc-primary-nav ul.active-nav");
        i.scrollTop(0);
        n(".isc-primary-nav ul").removeClass("active-nav");
        r = n(t);
        r.closest("li").find("ul.subnav:first").addClass("active-nav");
        n(".isc-primary-nav-back").removeClass("isc-hidden");
    };

    t.goBack = function () {
        var t = n(".isc-primary-nav ul.active-nav");
        t.closest("li").find(".subnav-check:first").click();
        t.removeClass("active-nav");
        t.closest("li").closest("ul").addClass("active-nav");
        n(".isc-primary-nav ul.active-nav").hasClass("subnav") || n(".isc-primary-nav-back").addClass("isc-hidden");
    };

    t.hideSubNav = function () {
        n(".isc-primary-nav ul li:hover > ul").addClass("hide-item");
    };

    t.closePanel = function () {
        n("body").removePrefixedClasses("topbar-");
        n("[role='top-panel']").removeAttr("style");
    };

    t.setup = function () {
        var r = "click.fndtn",
            i = n("body"),
            c, f, u, l, a, e, o, s, h;
        n(".ex, .ui-lock").on(r, function (n) {
            n.preventDefault();
            t.closePanel();
        });
    }
    return t;
};

Open in new window