Authored by 周少峰

Merge branch 'gray'

{
"name": "yohobuy-node",
"version": "5.6.12",
"version": "5.6.16",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -12,6 +12,8 @@ var $ = require('yoho-jquery'), // eslint-disable-line
var $cartnewTips = $('.cartnew-tips'),
$cartListWrap = $('#Y_CartListWrap');
require('../common/function');
// 关闭温馨提示
$cartnewTips.find('.btn-close').click(function() {
$cartnewTips.fadeOut();
... ...
/* eslint-disable */
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== "function") {
return;
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof fNOP && oThis ? this: oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
/* eslint-ensable */
... ...
... ... @@ -4,14 +4,14 @@
* @Last Modified by: Targaryen
* @Last Modified time: 2017-05-22 16:53:18
*/
let stringHandle = {
var stringHandle = {
/**
* 汉字相当于两个字符的字符串长度计算
* @param {*} str
*/
chinese2(str) {
let total = 0,
chinese2: function(str) {
var total = 0,
charCode,
i,
len;
... ... @@ -32,16 +32,16 @@ let stringHandle = {
* @param {*} str
* @param {*} n
*/
sub_chinese2(str, n) {
let r = /[\u4E00-\u9FA5]/g;
sub_chinese2: function(str, n) {
var r = /[\u4E00-\u9FA5]/g;
var m = Math.floor(n / 2);
var i;
if (str.replace(r, 'mm').length <= n) {
return str;
}
let m = Math.floor(n / 2);
for (let i = m; i < str.length; i++) {
for (i = m; i < str.length; i++) {
if (str.substr(0, i).replace(r, 'mm').length >= n) {
return str.substr(0, i);
}
... ...