主要是选自《Ext js 权威指南》描述的是Extjs4的版本
模板代码如下:(略有改动,原因是当前文件目录下放置了extjs的包)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="./extjs/resources/css/ext-all.css"/>
<script type="text/javascript" src="./extjs/bootstrap.js"></script>
<script type="text/javascript" src="./extjs/locale/Ext-lang-zh_CN.js"></script>
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function() {
if (Ext.BLANK_IMAGE_URL.substr(0, 4) != "data") {
Ext.BLANK_IMAGE_URL = "./images/s.gif";
}
});
</script>
</body>
</html>
最后,转载一个查看extjs的工具类
这个注册工具来源于http://userscripts.org/scripts/show/103823本人稍作修改,以便工具能够独立运行。
并且修改C:\Documents and Settings\Administrator\Application Data\Mozilla\Firefox\Profiles\b4fc8mmf.default\extensions \[email protected]\content\native\mozilla \IlluminationModule.js里面的illumination_isTrial函数为
illumination_isTrial = function() {
return false;
}
将以下内容保存为keygen.html
<html>
<head>
<script>1:
2: var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */3: var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */4: var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */5:
6: /*7: * These are the functions you'll usually want to call8: * They take string arguments and return either hex or base-64 encoded strings9: */10: function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}11: function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}12: function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}13: function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}14: function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}15: function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}16:
17: /*18: * Perform a simple self-test to see if the VM is working19: */20: function sha1_vm_test()21: {
22: return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";23: }
24:
25: /*26: * Calculate the SHA-1 of an array of big-endian words, and a bit length27: */28: function core_sha1(x, len)29: {
30: /* append padding */31: x[len >> 5] |= 0x80 << (24 - len % 32);
32: x[((len + 64 >> 9) << 4) + 15] = len;
33:
34: var w = Array(80);35: var a = 1732584193;36: var b = -271733879;37: var c = -1732584194;38: var d = 271733878;39: var e = -1009589776;40:
41: for(var i = 0; i < x.length; i += 16)42: {
43: var olda = a;44: var oldb = b;45: var oldc = c;46: var oldd = d;47: var olde = e;48:
49: for(var j = 0; j < 80; j++)50: {
51: if(j < 16) w[j] = x[i + j];52: else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);53: var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),54: safe_add(safe_add(e, w[j]), sha1_kt(j)));
55: e = d;
56: d = c;
57: c = rol(b, 30);
58: b = a;
59: a = t;
60: }
61:
62: a = safe_add(a, olda);
63: b = safe_add(b, oldb);
64: c = safe_add(c, oldc);
65: d = safe_add(d, oldd);
66: e = safe_add(e, olde);
67: }
68: return Array(a, b, c, d, e);69:
70: }
71:
72: /*73: * Perform the appropriate triplet combination function for the current74: * iteration75: */76: function sha1_ft(t, b, c, d)77: {
78: if(t < 20) return (b & c) | ((~b) & d);79: if(t < 40) return b ^ c ^ d;80: if(t < 60) return (b & c) | (b & d) | (c & d);81: return b ^ c ^ d;82: }
83:
84: /*85: * Determine the appropriate additive constant for the current iteration86: */87: function sha1_kt(t)88: {
89: return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :90: (t < 60) ? -1894007588 : -899497514;
91: }
92:
93: /*94: * Calculate the HMAC-SHA1 of a key and some data95: */96: function core_hmac_sha1(key, data)97: {
98: var bkey = str2binb(key);99: if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);100:
101: var ipad = Array(16), opad = Array(16);102: for(var i = 0; i < 16; i++)103: {
104: ipad[i] = bkey[i] ^ 0x36363636;
105: opad[i] = bkey[i] ^ 0x5C5C5C5C;
106: }
107:
108: var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);109: return core_sha1(opad.concat(hash), 512 + 160);110: }
111:
112: /*113: * Add integers, wrapping at 2^32. This uses 16-bit operations internally114: * to work around bugs in some JS interpreters.115: */116: function safe_add(x, y)117: {
118: var lsw = (x & 0xFFFF) + (y & 0xFFFF);119: var msw = (x >> 16) + (y >> 16) + (lsw >> 16);120: return (msw << 16) | (lsw & 0xFFFF);121: }
122:
123: /*124: * Bitwise rotate a 32-bit number to the left.125: */126: function rol(num, cnt)127: {
128: return (num << cnt) | (num >>> (32 - cnt));129: }
130:
131: /*132: * Convert an 8-bit or 16-bit string to an array of big-endian words133: * In 8-bit function, characters >255 have their hi-byte silently ignored.134: */135: function str2binb(str)136: {
137: var bin = Array();138: var mask = (1 << chrsz) - 1;139: for(var i = 0; i < str.length * chrsz; i += chrsz)140: bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
141: return bin;142: }
143:
144: /*145: * Convert an array of big-endian words to a string146: */147: function binb2str(bin)148: {
149: var str = "";150: var mask = (1 << chrsz) - 1;151: for(var i = 0; i < bin.length * 32; i += chrsz)152: str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);
153: return str;154: }
155:
156: /*157: * Convert an array of big-endian words to a hex string.158: */159: function binb2hex(binarray)160: {
161: var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";162: var str = "";163: for(var i = 0; i < binarray.length * 4; i++)164: {
165: str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
166: hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);
167: }
168: return str;169: }
170:
171: /*172: * Convert an array of big-endian words to a base-64 string173: */174: function binb2b64(binarray)175: {
176: var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";177: var str = "";178: for(var i = 0; i < binarray.length * 4; i += 3)179: {
180: var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16)181: | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
182: | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
183: for(var j = 0; j < 4; j++)184: {
185: if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;186: else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);187: }
188: }
189: return str;190: }
191: function stringify(obj) {192: var tmp = [];193: for(var p in obj){194: tmp.push(p+":"+obj[p]);195: }
196: return "{"+tmp.join(",")+"}";197: }
198:
199:
200:
201: var obj = {};202: function makeLicense() {203: var defaultname = "wing";204:
205: if (!confirm("这个注册工具来源于http://userscripts.org/scripts/show/103823\n本人稍作修改,以便工具能够独立运行。")) return;206: obj.name = prompt("注册名?", defaultname);207:
208: obj.domainid = prompt("输入你的域名(随便)", (obj.name + ".com"));209: if (!obj.domainid) {210: alert("请输入你的域名");211: return212: }
213: obj.accountid = obj.name;
214: obj.expiration = new Date().getTime() + 100 * 24 * 356 * 3600;215: }
216: makeLicense();
217:
218: var crcstr = "return:" + obj.name + ":" + obj.expiration + ":" + obj.accountid + ":" + obj.domainid;219: obj.h2 = hex_sha1(crcstr);
220: var license = stringify(obj);221: prompt("请将下列内容复制到Illumination-License.json并保存到%firefoxprofile%\/firebug\/",license);222:
223:
</script>
</head>
<body>
</body>
</html>