var _ = require('./underscore');
_.mixin({
count: function (mixed_var, mode) {
var key, cnt = 0;
if (mixed_var === null || typeof mixed_var === 'undefined') {
return 0;
}
else if (mixed_var.constructor !== Array && mixed_var.constructor !== Object) {
return 1;
}
if (mode === 'COUNT_RECURSIVE') {
mode = 1;
}
if (mode != 1) {
mode = 0;
}
for (key in mixed_var) {
if (mixed_var.hasOwnProperty(key)) {
cnt++;
if (mode == 1 && mixed_var[key] && (mixed_var[key].constructor === Array || mixed_var[key].constructor ===
Object)) {
cnt += this.count(mixed_var[key], 1);
}
}
}
return cnt;
},
htmlspecialchars_decode: function (string, quote_style) {
var optTemp = 0,
i = 0,
noquotes = false;
if (typeof quote_style === 'undefined') {
quote_style = 2;
}
string = string.toString()
.replace(/</g, '<')
.replace(/>/g, '>');
var OPTS = {
'ENT_NOQUOTES': 0,
'ENT_HTML_QUOTE_SINGLE': 1,
'ENT_HTML_QUOTE_DOUBLE': 2,
'ENT_COMPAT': 2,
'ENT_QUOTES': 3,
'ENT_IGNORE': 4
};
if (quote_style === 0) {
noquotes = true;
}
if (typeof quote_style !== 'number') {
// Allow for a single string or an array of string flags
quote_style = [].concat(quote_style);
for (i = 0; i < quote_style.length; i++) {
// Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
if (OPTS[quote_style[i]] === 0) {
noquotes = true;
}
else if (OPTS[quote_style[i]]) {
optTemp = optTemp | OPTS[quote_style[i]];
}
}
quote_style = optTemp;
}
if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
string = string.replace(/�*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should
// string = string.replace(/'|�*27;/g, "'"); // This would also be useful here, but not a part of PHP
}
if (!noquotes) {
string = string.replace(/"/g, '"');
}
// Put this in last place to avoid escape being double-decoded
string = string.replace(/&/g, '&');
return string;
},
utf8_encode: function (argString) {
if (argString === null || typeof argString === 'undefined') {
return '';
}
// .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
var string = (argString + '');
var utftext = '',
start, end, stringl = 0;
start = end = 0;
stringl = string.length;
for (var n = 0; n < stringl; n++) {
var c1 = string.charCodeAt(n);
var enc = null;
if (c1 < 128) {
end++;
}
else if (c1 > 127 && c1 < 2048) {
enc = String.fromCharCode(
(c1 >> 6) | 192, (c1 & 63) | 128
);
}
else if ((c1 & 0xF800) != 0xD800) {
enc = String.fromCharCode(
(c1 >> 12) | 224, ((c1 >> 6) & 63) | 128, (c1 & 63) | 128
);
}
else {
// surrogate pairs
if ((c1 & 0xFC00) != 0xD800) {
throw new RangeError('Unmatched trail surrogate at ' + n);
}
var c2 = string.charCodeAt(++n);
if ((c2 & 0xFC00) != 0xDC00) {
throw new RangeError('Unmatched lead surrogate at ' + (n - 1));
}
c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000;
enc = String.fromCharCode(
(c1 >> 18) | 240, ((c1 >> 12) & 63) | 128, ((c1 >> 6) & 63) | 128, (c1 & 63) | 128
);
}
if (enc !== null) {
if (end > start) {
utftext += string.slice(start, end);
}
utftext += enc;
start = end = n + 1;
}
}
if (end > start) {
utftext += string.slice(start, stringl);
}
return utftext;
},
md5: function (str) {
var xl;
var rotateLeft = function (lValue, iShiftBits) {
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
};
var addUnsigned = function (lX, lY) {
var lX4, lY4, lX8, lY8, lResult;
lX8 = (lX & 0x80000000);
lY8 = (lY & 0x80000000);
lX4 = (lX & 0x40000000);
lY4 = (lY & 0x40000000);
lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
if (lX4 & lY4) {
return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
}
if (lX4 | lY4) {
if (lResult & 0x40000000) {
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
}
else {
return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
}
}
else {
return (lResult ^ lX8 ^ lY8);
}
};
var _F = function (x, y, z) {
return (x & y) | ((~x) & z);
};
var _G = function (x, y, z) {
return (x & z) | (y & (~z));
};
var _H = function (x, y, z) {
return (x ^ y ^ z);
};
var _I = function (x, y, z) {
return (y ^ (x | (~z)));
};
var _FF = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_F(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var _GG = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_G(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var _HH = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_H(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var _II = function (a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(_I(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var convertToWordArray = function (str) {
var lWordCount;
var lMessageLength = str.length;
var lNumberOfWords_temp1 = lMessageLength + 8;
var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
var lWordArray = new Array(lNumberOfWords - 1);
var lBytePosition = 0;
var lByteCount = 0;
while (lByteCount < lMessageLength) {
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
lBytePosition = (lByteCount % 4) * 8;
lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount) << lBytePosition));
lByteCount++;
}
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
lBytePosition = (lByteCount % 4) * 8;
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
return lWordArray;
};
var wordToHex = function (lValue) {
var wordToHexValue = '',
wordToHexValue_temp = '',
lByte, lCount;
for (lCount = 0; lCount
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序websocket聊天 (160个子文件)
iconfont.css 3KB
iconfont.eot 3KB
nodata.jpg 7KB
qiandao.jpg 5KB
adatabox.jpg 5KB
3.jpg 4KB
toupiao.jpg 4KB
2.jpg 4KB
zhuanpan.jpg 4KB
1.jpg 3KB
logo.jpg 3KB
tongce.jpg 3KB
xingpei.jpg 3KB
dyp.jpg 3KB
3.jpg 3KB
1.jpg 3KB
shimiao.jpg 3KB
2.jpg 3KB
tomessage.jpg 3KB
key.jpg 3KB
ys3.jpg 3KB
ys2.jpg 3KB
share.jpg 3KB
1.jpg 2KB
2.jpg 2KB
yaoshi.jpg 2KB
zhuli.jpg 2KB
5.jpg 2KB
6.jpg 2KB
4.jpg 2KB
3.jpg 2KB
4.jpg 2KB
9.jpg 2KB
ficon.jpg 2KB
8.jpg 2KB
5.jpg 2KB
ys1.jpg 2KB
7.jpg 2KB
changetime.jpg 2KB
write.jpg 1KB
underscore.mixin.js 68KB
underscore.js 60KB
base.js 15KB
question.js 12KB
select_area.js 4KB
app.js 3KB
swipe.js 2KB
util.js 472B
project.config.json 643B
app.json 384B
question.json 2B
topipei.png 7KB
tafan.png 6KB
24.png 6KB
save.png 6KB
xx1.png 6KB
12_ac.png 6KB
lianjie.png 6KB
xx.png 6KB
suo.png 5KB
arrowb.png 5KB
handb.png 5KB
unlike.png 5KB
like.png 5KB
likeicon1.png 5KB
larrow.png 5KB
66.png 5KB
byun.png 5KB
tayao.png 5KB
lock.png 4KB
11_ac.png 4KB
likeicon.png 4KB
tafen.png 4KB
lingdai.png 4KB
warn.png 4KB
77.png 4KB
r-1.png 4KB
12.png 4KB
r1.png 4KB
shareicon.png 3KB
yaoshi.png 3KB
11.png 3KB
t_bg.png 3KB
hand.png 3KB
r2.png 3KB
6.png 3KB
star2.png 3KB
star1.png 3KB
share_blue_bc.png 3KB
star4.png 3KB
key.png 3KB
3.png 3KB
6.png 3KB
star3.png 3KB
4.png 3KB
copy.png 3KB
r3.png 3KB
2.png 3KB
r0.png 3KB
5.png 3KB
共 160 条
- 1
- 2
资源评论
- michelleliumei12292019-05-28根本不能用,没有socket的功能。只是一个聊天界面的实现
小程序照片合成
- 粉丝: 36
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功