Google Map 中混淆和压缩代码的简单示例

首先我们要有以下几个函数:
function  z(a,b){
    window[a]
= b;
}
function  ha(a,b,c){
    a[b]
= c;
}
function  p(a,b,c)
{
    a.prototype[b] 
=  c;  
}


现在我要定义一个实体类,通常的代码是这样:
function  Info(name, image)
{
    
this ._name  =  name;
    
this ._image  =  image;
}
// 属性
Info.prototype.GetName  =   function (){  return   this ._name; }
Info.prototype.GetImage 
=   function (){  return   this ._image; }

经混淆变成这样
var  a; // 定义一个变量来代替某个对象的prototype
function  i(a,b){ this .aa = a; this .bb = b;}]
i.prototype.ab
=   function (){  return   this .aa; }
i.prototype.ac
=   function (){  return   this .bb; }
a
= i.prototype; // 给a赋值
//
下面用函数p把i的属性替换成有意义的名称
p(i, " GetName " ,a.ab);p(i, " GetImage " ,a.ac);
// 下面用函数z为window对象添加该实体对象
z( " Info " ,i)



转载于:https://www.cnblogs.com/downfly/archive/2007/02/28/658933.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值