我刚刚遇到了一些代码,我的理解可以帮助我解码代码。
var _0x98fd = ["\x2E\x6F\x76\x65\x72\x6C\x61\x70\x62\x6C\x61\x63\x6B\x62\x67\x2C\x20\x2E\x73\x6C\x69\x64\x65\x4C\x65\x66\x74", "\x2E\x77\x73\x6D\x65\x6E\x75\x63\x6F\x6E\x74\x65\x6E\x74", "\x6D\x65\x6E\x75\x6F\x70\x65\x6E", "\x61\x64\x64\x43\x6C\x61\x73\x73", "\x6D\x65\x6E\x75\x63\x6C\x6F\x73\x65", "\x72\x65\x6D\x6F\x76\x65\x43\x6C\x61\x73\x73", "\x68\x61\x73\x43\x6C\x61\x73\x73", "\x63\x6C\x69\x63\x6B", "\x23\x6E\x61\x76\x54\x6F\x67\x67\x6C\x65", "\x6D\x72\x67\x69\x6E\x6C\x65\x66\x74", "\x74\x6F\x67\x67\x6C\x65\x43\x6C\x61\x73\x73", "\x2E\x77\x73\x6D\x65\x6E\x75\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72", "\x6F\x6E", "\x23\x6E\x61\x76\x54\x6F\x67\x67\x6C\x65\x2C\x2E\x6F\x76\x65\x72\x6C\x61\x70\x62\x6C\x61\x63\x6B\x62\x67", "\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x77\x73\x6D\x65\x6E\x75\x2D\x63\x6C\x69\x63\x6B\x22\x3E\x3C\x69\x20\x63\x6C\x61\x73\x73\x3D\x22\x77\x73\x6D\x65\x6E\x75\x2D\x61\x72\x72\x6F\x77\x20\x66\x61\x20\x66\x61\x2D\x61\x6E\x67\x6C\x65\x2D\x64\x6F\x77\x6E\x22\x3E\x3C\x2F\x69\x3E\x3C\x2F\x73\x70\x61\x6E\x3E", "\x70\x72\x65\x70\x65\x6E\x64", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x73\x75\x62\x6D\x65\x6E\x75\x2C\x20\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x73\x75\x62\x6D\x65\x6E\x75\x2D\x73\x75\x62\x2C\x20\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x73\x75\x62\x6D\x65\x6E\x75\x2D\x73\x75\x62\x2D\x73\x75\x62", "\x68\x61\x73", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x6C\x69\x73\x74\x20\x6C\x69", "\x2E\x6D\x65\x67\x61\x6D\x65\x6E\x75", "\x73\x6C\x6F\x77", "\x73\x6C\x69\x64\x65\x54\x6F\x67\x67\x6C\x65", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x6C\x69\x73\x74", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x6D\x6F\x62\x69\x6C\x65", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x73\x75\x62\x6D\x65\x6E\x75", "\x73\x69\x62\x6C\x69\x6E\x67\x73", "\x77\x73\x6D\x65\x6E\x75\x2D\x72\x6F\x74\x61\x74\x65", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x61\x72\x72\x6F\x77", "\x63\x68\x69\x6C\x64\x72\x65\x6E", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x73\x75\x62\x6D\x65\x6E\x75\x2D\x73\x75\x62", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x73\x75\x62\x6D\x65\x6E\x75\x2D\x73\x75\x62\x2D\x73\x75\x62", "\x2E\x77\x73\x6D\x65\x6E\x75\x2D\x63\x6C\x69\x63\x6B"];
$(function() {
var _0x5c8dx1 = $(_0x98fd[0]);
var _0x5c8dx2 = $(_0x98fd[1]);
var _0x5c8dx3 = function() {
$(_0x5c8dx1)[_0x98fd[5]](_0x98fd[4])[_0x98fd[3]](_0x98fd[2])
};
var _0x5c8dx4 = function() {
$(_0x5c8dx1)[_0x98fd[5]](_0x98fd[2])[_0x98fd[3]](_0x98fd[4])
};
$(_0x98fd[8])[_0x98fd[7]](function() {
if (_0x5c8dx2[_0x98fd[6]](_0x98fd[2])) {
$(_0x5c8dx4)
} else {
$(_0x5c8dx3)
}
});
_0x5c8dx2[_0x98fd[7]](function() {
if (_0x5c8dx2[_0x98fd[6]](_0x98fd[2])) {
$(_0x5c8dx4)
}
});
$(_0x98fd[13])[_0x98fd[12]](_0x98fd[7], function() {
$(_0x98fd[11])[_0x98fd[10]](_0x98fd[9])
});
$(_0x98fd[18])[_0x98fd[17]](_0x98fd[16])[_0x98fd[15]](_0x98fd[14]);
$(_0x98fd[18])[_0x98fd[17]](_0x98fd[19])[_0x98fd[15]](_0x98fd[14]);
$(_0x98fd[23])[_0x98fd[7]](function() {
$(_0x98fd[22])[_0x98fd[21]](_0x98fd[20])
});
$(_0x98fd[31])[_0x98fd[7]](function() {
$(this)[_0x98fd[25]](_0x98fd[24])[_0x98fd[21]](_0x98fd[20]);
$(this)[_0x98fd[28]](_0x98fd[27])[_0x98fd[10]](_0x98fd[26]);
$(this)[_0x98fd[25]](_0x98fd[29])[_0x98fd[21]](_0x98fd[20]);
$(this)[_0x98fd[25]](_0x98fd[30])[_0x98fd[21]](_0x98fd[20]);
$(this)[_0x98fd[25]](_0x98fd[19])[_0x98fd[21]](_0x98fd[20]);
});
});
我不是Javascript的新手,对我来说很困惑
答案 0 :(得分:3)
这是混淆的&缩小Javascript。十六进制字符数组解码为方法名,类名和jQuery选择器数组:
".overlapblackbg, .slideLeft"
".wsmenucontent"
"menuopen"
"addClass"
"menuclose"
"removeClass"
"hasClass"
"click"
"#navToggle"
"mrginleft"
"toggleClass"
".wsmenucontainer"
"on"
"#navToggle,.overlapblackbg"
"<span class="wsmenu-click"><i class="wsmenu-arrow fa fa-angle-down"></i></span>"
"prepend"
".wsmenu-submenu, .wsmenu-submenu-sub, .wsmenu-submenu-sub-sub"
"has"
".wsmenu-list li"
".megamenu"
"slow"
"slideToggle"
".wsmenu-list"
".wsmenu-mobile"
".wsmenu-submenu"
"siblings"
"wsmenu-rotate"
".wsmenu-arrow"
"children"
".wsmenu-submenu-sub"
".wsmenu-submenu-sub-sub"
".wsmenu-click"
我还在JSFiddle中编写了一个快速解码器 ,
提出了这个:
$(function() {
var $menu = $(".overlapblackbg, .slideLeft");
var $wsmenucontent = $(".wsmenucontent");
var openMenu = function() {
$($menu).removeClass("menuclose").addClass("menuopen")
};
var closeMenu = function() {
$($menu).removeClass("menuopen").addClass("menuclose")
};
$("#navToggle").click(function() {
if ($wsmenucontent.hasClass("menuopen")) {
$(closeMenu)
} else {
$(openMenu)
}
});
$wsmenucontent.click(function() {
if ($wsmenucontent.hasClass("menuopen")) {
$(closeMenu)
}
});
$("#navToggle,.overlapblackbg").on(click, function() {
$(".wsmenucontainer").toggleClass("mrginleft")
});
$(".wsmenu-list li").has(".wsmenu-submenu, .wsmenu-submenu-sub, .wsmenu-submenu-sub-sub").prepend("<span class="wsmenu-click"><i class="wsmenu-arrow fa fa-angle-down"></i></span>");
$(".wsmenu-list li").has(".megamenu").prepend("<span class="wsmenu-click"><i class="wsmenu-arrow fa fa-angle-down"></i></span>");
$(".wsmenu-mobile").click(function() {
$(".wsmenu-list").slideToggle("slow")
});
$(".wsmenu-click").click(function() {
$(this).siblings(".wsmenu-submenu").slideToggle("slow");
$(this).children(".wsmenu-arrow").toggleClass("wsmenu-rotate");
$(this).siblings(".wsmenu-submenu-sub").slideToggle("slow");
$(this).siblings(".wsmenu-submenu-sub-sub").slideToggle("slow");
$(this).siblings(".megamenu").slideToggle("slow");
});
});
解码器的优点当然是你可以不断调整它来做更多的解码,而不必手动重做。
有趣的是,解码后的版本实际上表明它们已经出错了,就像第二次包装jQuery对象一样!
e.g。
var _0x5c8dx1 = $(".overlapblackbg, .slideLeft");
然后
$(_0x5c8dx1).removeClass("menuclose").addClass("menuopen")
它还使用模糊的副作用来运行如下函数:
$(closeMenu)
$(document).ready(closeMenu)
的快捷方式会立即触发该功能。
答案 1 :(得分:0)
这可以让你开始:
var _0x98fd = [".overlapblackbg, .slideLeft",
".wsmenucontent",
"menuopen",
"addClass",
"menuclose",
"removeClass",
"hasClass",
"click",
"#navToggle",
"mrginleft",
"toggleClass",
".wsmenucontainer",
"on",
"#navToggle,.overlapblackbg",
'<span class="wsmenu-click"><i class="wsmenu-arrow fa fa-angle-down"></i></span>',
"prepend.wsmenu-submenu, .wsmenu-submenu-sub, .wsmenu-submenu-sub-sub",
"has",
".wsmenu-list li",
".megamenu",
"slow",
"slideToggle",
".wsmenu-list",
".wsmenu-mobile",
".wsmenu-submenu",
"siblings",
"wsmenu-rotate",
".wsmenu-arrow",
"children",
".wsmenu-submenu-sub",
".wsmenu-submenu-sub-sub",
".wsmenu-click"
];
这意味着:var _0x5c8dx1 = $(_0x98fd[0]);
是var _0x5c8dx1 = $(".overlapblackbg, .slideLeft");
答案 2 :(得分:0)
这是一种方法:
var _0x98fd = [".overlapblackbg, .slideLeft", ".wsmenucontent", "menuopen", "addClass", "menuclose", "removeClass", "hasClass", "click", "#navToggle", "mrginleft", "toggleClass", ".wsmenucontainer", "on", "#navToggle,.overlapblackbg", '<span class="wsmenu-click"><i class="wsmenu-arrow fa fa-angle-down"></i></span>', "prepend", ".wsmenu-submenu, .wsmenu-submenu-sub, .wsmenu-submenu-sub-sub", "has", ".wsmenu-list li", ".megamenu", "slow", "slideToggle", ".wsmenu-list", ".wsmenu-mobile", ".wsmenu-submenu",
"siblings", "wsmenu-rotate", ".wsmenu-arrow", "children", ".wsmenu-submenu-sub", ".wsmenu-submenu-sub-sub", ".wsmenu-click"
];
$(function() {
var headings = $(_0x98fd[0]);
var emptyJ = $(_0x98fd[1]);
var backdrop = function() {
$(headings)[_0x98fd[5]](_0x98fd[4])[_0x98fd[3]](_0x98fd[2]);
};
var _element = function() {
$(headings)[_0x98fd[5]](_0x98fd[2])[_0x98fd[3]](_0x98fd[4]);
};
/**
* equivalent to: $("#navToggle").click(function(){
* just follow the array and is positions
*/
$(_0x98fd[8])[_0x98fd[7]](function() {
if (emptyJ[_0x98fd[6]](_0x98fd[2])) {
$(_element);
} else {
$(backdrop);
}
});
emptyJ[_0x98fd[7]](function() {
if (emptyJ[_0x98fd[6]](_0x98fd[2])) {
$(_element);
}
});
$(_0x98fd[13])[_0x98fd[12]](_0x98fd[7], function() {
$(_0x98fd[11])[_0x98fd[10]](_0x98fd[9]);
});
$(_0x98fd[18])[_0x98fd[17]](_0x98fd[16])[_0x98fd[15]](_0x98fd[14]);
$(_0x98fd[18])[_0x98fd[17]](_0x98fd[19])[_0x98fd[15]](_0x98fd[14]);
$(_0x98fd[23])[_0x98fd[7]](function() {
$(_0x98fd[22])[_0x98fd[21]](_0x98fd[20]);
});
$(_0x98fd[31])[_0x98fd[7]](function() {
$(this)[_0x98fd[25]](_0x98fd[24])[_0x98fd[21]](_0x98fd[20]);
$(this)[_0x98fd[28]](_0x98fd[27])[_0x98fd[10]](_0x98fd[26]);
$(this)[_0x98fd[25]](_0x98fd[29])[_0x98fd[21]](_0x98fd[20]);
$(this)[_0x98fd[25]](_0x98fd[30])[_0x98fd[21]](_0x98fd[20]);
$(this)[_0x98fd[25]](_0x98fd[19])[_0x98fd[21]](_0x98fd[20]);
});
});