I am using Google Closure Compiler in "SIMPLE_OPTIMIZATIONS" mode. The JavaScript uses an "Eval" statement with the variable "_u" embedded in the string. When Google Closure Compiler obfuscates the code, the variable name is changed to "a" and I get an error that "_u" is not defined in the console. My understanding is that an Extern will solve this problem, but I'm not sure how to write it. Thoughts?
Code Snippet:
var FuncName = (function(){
var ht=escape(_w.location.href)
function _fC(_u){
_aT=_sp+',\\/,\\.,-,_,'+_rp+',%2F,%2E,%2D,%5F';
_aA=_aT.split(',');
for(i=0;i<5;i++){
eval('_u=_u.replace(/'+_aA[i]+'/g,_aA[i+5])')
}
return _u
};
return {
O_LC:function(){
_w.open('https://someurl?referer='+_fC(_ht))
}
};
})();
After Google Closure Compiler modifies the code:
var FuncName = function() {
function a(a) {
_aT = _sp + ",\\/,\\.,-,_," + _rp + ",%2F,%2E,%2D,%5F";
_aA = _aT.split(",");
for (i = 0;5 > i;i++) {
eval("_u=_u.replace(/" + _aA[i] + "/g,_aA[i+5])");
}
return a;
}
escape(_w.location.href);
return {O_LC:function() {
_w.open("https://someurl?referer=" + a(_ht));
}};
}();