Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript decoding webpackJsonp to readable code

there is a way to change this code into a clear and readable code ?

(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{"2wwy":function(n,t,e){n.exports=e("nhzr")},E8gZ:function(n,t,e){var o=e("jmDH"),i=e("w6GO"),r=e("NsO/"),u=e("NV0k").f;n.exports=function(n){return function(t){for(var e,c=r(t),a=i(c),f=a.length,s=0,l=[];f>s;)e=a[s++],o&&!u.call(c,e)||l.push(n?[e,c[e]]:c[e]);return l}}},f0Zw:function(n,t,e){"use strict";e.r(t);var o=e("q1tI"),i=e.n(o),r=e("/MKj"),u=e("2wwy"),c=e.n(u),a=e("G4qV"),f=Object(a.a)((function(n){return n.g_notifications}),(function(n){return c()(n)})),s=e("F7NL"),l=e("kOwS"),p=e("qNsG"),v=e("CnBM"),w=e.n(v)()({loader:function(){return Promise.all([e.e(0),e.e(6)]).then(e.bind(null,"OyQA"))},loading:function(){return null},modules:["Notification"]}),b=i.a.createElement,d=function(n){var t=n.notifications,e=n.onRemove;return b(i.a.Fragment,null,t.map((function(n){var t=n.id,o=Object(p.a)(n,["id"]);return b(w,Object(l.a)({onRemove:e},o,{key:t,id:t}))})))},O=i.a.createElement,m=Object(r.b)((function(n){return{notifications:f(n)}})),j=function(n){var t=n.dataset.id;Object(s.b)(t)},g=m((function(n){var t=n.notifications;return O(d,{onRemove:j,notifications:t})}));t.default=g},fW1p:function(n,t,e){var o=e("Y7ZC"),i=e("E8gZ")(!1);o(o.S,"Object",{values:function(n){return i(n)}})},nhzr:function(n,t,e){e("fW1p"),n.exports=e("WEpk").Object.values}}]);
like image 477
Tabam Avatar asked May 04 '26 09:05

Tabam


1 Answers

This looks like output from Webpack 4.

If the site you're looking at exposes source maps, you will see a section under sources in your browser's dev tools labelled "Webpack", which will contain the source for the scripts bundled using Webpack.

If the site doesn't expose source maps, the first step is to format the code. You can then start manually renaming variables as you figure out what they do. In this case, there must be more scripts on the site because there seem to be references to modules not defined in the file.

Passing this code through Prettier gives:

(window.webpackJsonp = window.webpackJsonp || []).push([
  [7],
  {
    "2wwy": function(n, t, e) {
      n.exports = e("nhzr");
    },
    E8gZ: function(n, t, e) {
      var o = e("jmDH"),
        i = e("w6GO"),
        r = e("NsO/"),
        u = e("NV0k").f;
      n.exports = function(n) {
        return function(t) {
          for (var e, c = r(t), a = i(c), f = a.length, s = 0, l = []; f > s; )
            (e = a[s++]), (o && !u.call(c, e)) || l.push(n ? [e, c[e]] : c[e]);
          return l;
        };
      };
    },
    f0Zw: function(n, t, e) {
      "use strict";
      e.r(t);
      var o = e("q1tI"),
        i = e.n(o),
        r = e("/MKj"),
        u = e("2wwy"),
        c = e.n(u),
        a = e("G4qV"),
        f = Object(a.a)(
          function(n) {
            return n.g_notifications;
          },
          function(n) {
            return c()(n);
          }
        ),
        s = e("F7NL"),
        l = e("kOwS"),
        p = e("qNsG"),
        v = e("CnBM"),
        w = e.n(v)()({
          loader: function() {
            return Promise.all([e.e(0), e.e(6)]).then(e.bind(null, "OyQA"));
          },
          loading: function() {
            return null;
          },
          modules: ["Notification"]
        }),
        b = i.a.createElement,
        d = function(n) {
          var t = n.notifications,
            e = n.onRemove;
          return b(
            i.a.Fragment,
            null,
            t.map(function(n) {
              var t = n.id,
                o = Object(p.a)(n, ["id"]);
              return b(w, Object(l.a)({ onRemove: e }, o, { key: t, id: t }));
            })
          );
        },
        O = i.a.createElement,
        m = Object(r.b)(function(n) {
          return { notifications: f(n) };
        }),
        j = function(n) {
          var t = n.dataset.id;
          Object(s.b)(t);
        },
        g = m(function(n) {
          var t = n.notifications;
          return O(d, { onRemove: j, notifications: t });
        });
      t.default = g;
    },
    fW1p: function(n, t, e) {
      var o = e("Y7ZC"),
        i = e("E8gZ")(!1);
      o(o.S, "Object", {
        values: function(n) {
          return i(n);
        }
      });
    },
    nhzr: function(n, t, e) {
      e("fW1p"), (n.exports = e("WEpk").Object.values);
    }
  }
]);
like image 62
Patrick Stephansen Avatar answered May 05 '26 23:05

Patrick Stephansen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!