Authored by yyq

Merge branch 'release/1.0' of git.yoho.cn:fe/yoho-blk into release/1.0

/**
* Array indexof polyfill
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/8/8
* @source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
*/
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(searchElement, fromIndex) { // eslint-disable-line
var k;
var o;
var len;
var n;
if (this == null) { // eslint-disable-line
throw new TypeError('"this" is null or not defined');
}
o = Object(this);
len = o.length >>> 0;
if (len === 0) {
return -1;
}
n = +fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in o && o[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
... ...
... ... @@ -25,6 +25,7 @@ var editTpl = require('../../../tpl/shopping/edit-color-size.hbs');
var Cart;
require('yoho-jquery-dotdotdot');
require('../../common/indexof-polyfill'); // array indexof polyfill
function dotName() {
... ... @@ -207,7 +208,7 @@ Cart = {
if (products.length) {
dialog = new _confirm({
content: '您确定要从购物中删除该商品吗?',
content: '您确定要从购物中删除该商品吗?',
cb: function() {
dialog.close();
Util.ajax({
... ... @@ -292,14 +293,14 @@ Cart = {
* @params { Function } callback 移入收藏夹成功后回调
*/
sendToFavorite: function(products, callback) {
var msg = '<p>确定要将该商品从购物车中移入收藏吗?</p><p>移入收藏后该商品将不在购物车中显示</p>';
var msg = '<p>确定要将该商品从购物袋中移入收藏吗?</p><p>移入收藏后该商品将不在购物袋中显示</p>';
var dialog;
if (!products.length) {
new _alert('请至少选中一件商品!').show();
} else {
if (products.length > 1) {
msg = '<p>确定要将已选中的商品从购物车中移入收藏吗?</p><p>移入收藏后已选中的商品将不在购物车中显示</p>';
msg = '<p>确定要将已选中的商品从购物袋中移入收藏吗?</p><p>移入收藏后已选中的商品将不在购物袋中显示</p>';
}
// callback存在说明从删除模块收藏
... ...