From aba36446a1d7cbdd70c95f240a35d485e3221203 Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Sun, 30 Sep 2018 12:24:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4wap=E4=B8=8B=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/wap/crmeb/js/base.js | 104 -- public/wap/crmeb/module/cart.js | 127 -- public/wap/crmeb/module/refund-reason.js | 54 - public/wap/crmeb/module/store.js | 477 ----- public/wap/crmeb/module/store/scroll-load.js | 15 - public/wap/crmeb/module/store/seckill-card.js | 187 -- public/wap/crmeb/module/store/shop-card.js | 144 -- public/wap/crmeb/module/store/use-address.js | 96 -- public/wap/crmeb/module/store/use-coupon.js | 77 - .../store_service/jquery.touchSwipe.min.js | 1 - .../wap/crmeb/module/store_service/mobile.js | 1533 ----------------- .../crmeb/module/store_service/moment.min.js | 6 - public/wap/crmeb/module/store_service/msn.js | 531 ------ .../crmeb/module/store_service/unslider.js | 195 --- 14 files changed, 3547 deletions(-) delete mode 100644 public/wap/crmeb/js/base.js delete mode 100644 public/wap/crmeb/module/cart.js delete mode 100644 public/wap/crmeb/module/refund-reason.js delete mode 100644 public/wap/crmeb/module/store.js delete mode 100644 public/wap/crmeb/module/store/scroll-load.js delete mode 100644 public/wap/crmeb/module/store/seckill-card.js delete mode 100644 public/wap/crmeb/module/store/shop-card.js delete mode 100644 public/wap/crmeb/module/store/use-address.js delete mode 100644 public/wap/crmeb/module/store/use-coupon.js delete mode 100644 public/wap/crmeb/module/store_service/jquery.touchSwipe.min.js delete mode 100644 public/wap/crmeb/module/store_service/mobile.js delete mode 100644 public/wap/crmeb/module/store_service/moment.min.js delete mode 100644 public/wap/crmeb/module/store_service/msn.js delete mode 100644 public/wap/crmeb/module/store_service/unslider.js diff --git a/public/wap/crmeb/js/base.js b/public/wap/crmeb/js/base.js deleted file mode 100644 index e3b9ea24..00000000 --- a/public/wap/crmeb/js/base.js +++ /dev/null @@ -1,104 +0,0 @@ - -function Base64() { - - // private property - _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - // public method for encoding - this.encode = function (input) { - var output = ""; - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; - var i = 0; - input = _utf8_encode(input); - while (i < input.length) { - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - output = output + - _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + - _keyStr.charAt(enc3) + _keyStr.charAt(enc4); - } - return output; - } - - // public method for decoding - this.decode = function (input) { - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - while (i < input.length) { - enc1 = _keyStr.indexOf(input.charAt(i++)); - enc2 = _keyStr.indexOf(input.charAt(i++)); - enc3 = _keyStr.indexOf(input.charAt(i++)); - enc4 = _keyStr.indexOf(input.charAt(i++)); - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - output = output + String.fromCharCode(chr1); - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - } - output = _utf8_decode(output); - return output; - } - - // private method for UTF-8 encoding - _utf8_encode = function (string) { - string = string.replace(/\r\n/g,"\n"); - var utftext = ""; - for (var n = 0; n < string.length; n++) { - var c = string.charCodeAt(n); - if (c < 128) { - utftext += String.fromCharCode(c); - } else if((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } - - } - return utftext; - } - - // private method for UTF-8 decoding - _utf8_decode = function (utftext) { - var string = ""; - var i = 0; - var c = c1 = c2 = 0; - while ( i < utftext.length ) { - c = utftext.charCodeAt(i); - if (c < 128) { - string += String.fromCharCode(c); - i++; - } else if((c > 191) && (c < 224)) { - c2 = utftext.charCodeAt(i+1); - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = utftext.charCodeAt(i+1); - c3 = utftext.charCodeAt(i+2); - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - return string; - } -} \ No newline at end of file diff --git a/public/wap/crmeb/module/cart.js b/public/wap/crmeb/module/cart.js deleted file mode 100644 index 198d1c9f..00000000 --- a/public/wap/crmeb/module/cart.js +++ /dev/null @@ -1,127 +0,0 @@ -requirejs(['vue','store','helper'],function(Vue,storeApi,$h){ - new Vue({ - el:"#store-cart", - data:{ - validCartList:[], - invalidCartList:[], - totalPrice:0, - checkedAll:true, - changeStatus:false, - loading:false - }, - watch:{ - validCartList:{ - handler:function(){ - this.getTotalPrice(); - }, - deep:true - } - }, - methods:{ - cartNumTotal:function(){ - return this.validCartList.reduce(function(total,cart){ - return total+=cart.cart_num; - },0); - }, - getStoreUrl:function (cart) { - return $h.U({ - c:'store', - a:'detail', - p:{id:cart.productInfo.id} - }); - }, - cartCount:function(){ - return this.getCheckedCart().reduce(function(total,cart){ - return total+=cart.cart_num; - },0); - }, - checkedAllCart:function(){ - var that = this; - var validCartList = this.validCartList.map(function(cart){ - if(cart.is_del !== true) cart.checked = that.checkedAll; - }); - }, - checkedCart:function(cart){ - this.checkedAllStatus(); - }, - checkedAllStatus:function(){ - this.checkedAll = this.validCartList.length > 0 && this.getCheckedCart().length == this.validCartList.length; - }, - getCheckedCart:function(){ - return this.validCartList.filter(function(cart){ - return cart.is_del != true && cart.checked == true; - }); - }, - getTotalPrice:function(){ - this.totalPrice = this.getCheckedCart().reduce(function(total,cart){ - return $h.Add(total,$h.Mul(cart.cart_num,cart.truePrice)); - },0); - - }, - getCartList:function(){ - var that = this; - storeApi.getCartList(function(cartGroup){ - cartGroup.valid.map(function(cart){ - cart.checked = true; - cart.is_del = false; - }); - that.checkedAll = cartGroup.valid.length > 0; - that.validCartList = cartGroup.valid; - that.invalidCartList = cartGroup.invalid; - that.loading = true; - }); - }, - getAttrValues:function (cart) { - return cart.productInfo.attrInfo == undefined ? '' : '属性:'+cart.productInfo.attrInfo.suk; - }, - changeCartNum:function(cart,index,changeNum){ - var num = +cart.cart_num + changeNum; - if(num <= 0) num = 1; - if(num > cart.trueStock){ - $h.pushMsgOnce('该商品库存不足'+num); - num = cart.trueStock; - } - if(cart.cart_num != num){ - storeApi.changeCartNum(cart.id,num); - cart.cart_num = num; - this.$set(this.validCartList,index,cart); - } - }, - removeCart:function(){ - var ids = [],validCartList = []; - this.validCartList.map(function(cart){ - if(cart.checked){ - cart.is_del = true; - ids.push(cart.id); - }else{ - validCartList.push(cart); - } - }); - if(ids.length) storeApi.removeCart(ids); - this.$set(this,'validCartList',validCartList); - this.$nextTick(function(){ - this.checkedAllStatus(); - this.changeStatus = false; - }); - }, - submitCart:function(){ - var ids = this.getCheckedCart().map(function(cart){ - return cart.id; - }); - if(!ids.length) return false; - location.href = $h.U({ - c:'store', - a:'confirm_order', - p:{cartId:ids} - }); - }, - removeInvalidCart:function(cart,index){ - storeApi.removeCart([cart.id]); - this.invalidCartList.splice(index,1); - } - }, - mounted:function(){ - this.getCartList(); - } - }) -}); \ No newline at end of file diff --git a/public/wap/crmeb/module/refund-reason.js b/public/wap/crmeb/module/refund-reason.js deleted file mode 100644 index f9f741c5..00000000 --- a/public/wap/crmeb/module/refund-reason.js +++ /dev/null @@ -1,54 +0,0 @@ -(function(global,factory){ - typeof define == 'function' && define([],factory); -})(this,function() { - return { - style:'.tmp-wrapper .tmp-container{z-index:99;position:fixed;left:0;bottom:0;width:100%;background-color:#fff;-webkit-transform:translate3d(0,110%,0);transform:translate3d(0,110%,0);-webkit-transition:all .5s ease;transition:all .5s ease}.tmp-wrapper .tmp-container .title{height: 1.06rem;line-height: 1.06rem;color:#1d1d1d;font-size:.26rem;text-align:center;border-bottom:1px solid #eee}.tmp-wrapper .tmp-container .title span{color: #666;font-size: .2rem;}.tmp-wrapper .tmp-container .tmp-main .item{position:relative;padding:0 .2rem;height:.75rem;border-bottom:1px solid #eee;-webkit-box-pack:justify;-o-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-o-box-align:center;-ms-flex-align:center;align-items:center}.tmp-wrapper .tmp-container .tmp-main .item .input-box{width:4.2rem}.tmp-wrapper .tmp-container .tmp-main .item .input-box input::-webkit-input-placeholder{color:#ccc}.tmp-wrapper .tmp-container .tmp-main .item .address-icon{position:absolute;right:.2rem;top:50%;display:inline-block;width:.25rem;height:.35rem;margin-top:-.175rem;background-image:url(../images/add-icon.png);background-size:100% 100%}.tmp-wrapper .tmp-container .tmp-main .item .selected{position:relative;height:100%}.tmp-wrapper .tmp-container .tmp-main .item .selected input{display:none}.tmp-wrapper .tmp-container .tmp-main .item .selected .icon{position:absolute;left:-.16rem;top:50%;margin:-.18rem 0 0 -.18rem;display:inline-block;width:18px;height:18px;border:1px solid #cdcdcd;border-radius:50%}.tmp-wrapper .tmp-container .submit-btn{width:100%;height:.77rem;margin-top:.3rem}.tmp-wrapper .tmp-container .submit-btn button{display:block;width:100%;height:100%;color:#fff;background-color:#e3383e}.tmp-wrapper .tmp-container.up{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.tmp-container .tmp-main .item.on{background-image: url(/public/wap/crmeb/images/enter01.png);color: #e52800;background-size: .22rem auto;background-repeat: no-repeat;background-position: 95% center;}.tmp-wrapper .close{position: absolute;right: .2rem;top: .2rem;background-image: url(/public/wap/sx/images/mtw-close.png);width: .3rem;height: .3rem;background-size: 100% 100%;}', - template:'

请选择退款原因

{{msg}}
', - install:function (Vue) { - this.factory(Vue); - }, - factory:function (Vue) { - var that = this; - $f = Vue.extend({ - template:this.template, - data:function () { - return { - show:false, - reason:[ - '收货地址填错了', - '大小尺寸与描述不符', - '颜色、款式、图案描述不符合', - '尺寸拍错不喜欢、效果不好', - '收到商品破损', - '未按约定时间发货', - '商品质量问题' - ], - selectIndex:-1, - selectFn:function(){} - }; - }, - watch:{ - show:function (n) { - if(!n)this.selectIndex = -1; - } - }, - methods:{ - select:function () { - if(this.selectIndex < 0) return false; - this.selectFn && this.selectFn(this.reason[this.selectIndex]); - this.show = false; - } - } - }); - $vm = new $f().$mount(); - document.body.appendChild($vm.$el); - var styleDom = document.createElement('style'); - styleDom.innerHTML = that.style; - document.head.appendChild(styleDom); - Vue.prototype.$orderRefundReason = function (opt) { - $vm.show = true; - if(opt !== undefined) $vm.selectFn = opt; - } - } - } -}); diff --git a/public/wap/crmeb/module/store.js b/public/wap/crmeb/module/store.js deleted file mode 100644 index f3310271..00000000 --- a/public/wap/crmeb/module/store.js +++ /dev/null @@ -1,477 +0,0 @@ -(function(global,factory){ - typeof define == 'function' && define('store',['axios','helper'],factory); -})(this,function(axios,$h){ - axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; - axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - return { - baseGet:function(url,successCallback,errorCallback){ - axios.get(url).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res); - }else{ - var err = res.data.msg || '请求失败!'; - errorCallback && errorCallback(err); - $h.pushMsgOnce(err) - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsgOnce(err) - }); - }, - basePost:function(url,data,successCallback,errorCallback){ - axios.post(url,data).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res); - }else{ - var err = res.data.msg || '请求失败!'; - errorCallback && errorCallback(err); - $h.pushMsgOnce(err) - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsgOnce(err) - }); - }, - setCart:function(opt,successCallback,errorCallback){ - axios.get($h.U({ - c:"auth_api", - a:"set_cart", - p:opt - })).then(function(res){ - if(res.status == 200 && res.data.code == 200) - successCallback && successCallback(); - else{ - var error = res.data.msg || '加入购物车失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err); - }); - }, - goBuy:function(opt,successCallback,errorCallback){ - axios.get($h.U({ - c:"auth_api", - a:"now_buy", - p:opt - })).then(function(res){ - if(res.status == 200 && res.data.code == 200) - successCallback && successCallback(res.data.data.cartId); - else{ - var error = res.data.msg || '订单生成失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err); - }); - }, - addBargainShare:function(opt,successCallback,errorCallback){ - axios.get($h.U({ - c:"auth_api", - a:"add_bargain_share", - p:opt - })).then(function(res){ - - }).catch(function(err){ - - }); - }, - likeProduct:function(productId,category,successCallback,errorCallback) { - axios.get($h.U({ - c:"auth_api", - a:"like_product", - p:{productId:productId,category:category} - })).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res.data); - }else{ - var error = res.data.msg || '点赞失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err) - }); - }, - bargainFriends:function(bargain,successCallback,errorCallback){ - this.basePost($h.U({ - c:'auth_api', - a:'set_bargain_help' - }),bargain,successCallback,errorCallback) - }, - unlikeProduct:function(productId,category,successCallback,errorCallback) { - axios.get($h.U({ - c:"auth_api", - a:"unlike_product", - p:{productId:productId,category:category} - })).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res.data); - }else{ - var error = res.data.msg || '取消点赞失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err) - }); - }, - collectProduct(productId,category,successCallback,errorCallback){ - axios.get($h.U({ - c:'auth_api', - a:'collect_product', - p:{productId:productId,category:category} - })).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res.data); - }else{ - var error = res.data.msg || '收藏失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err) - }); - }, - unCollectProduct(productId,category,successCallback,errorCallback){ - axios.get($h.U({ - c:'auth_api', - a:'uncollect_product', - p:{productId:productId,category:category} - })).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res.data); - }else{ - var error = res.data.msg || '取消收藏失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err) - }); - }, - getCartNum:function(callback){ - axios.get($h.U({ - c:'auth_api', - a:'get_cart_num' - })).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - callback && callback(res.data.data); - }else{ - callback && callback(0); - } - }).catch(function(){ - callback && callback(0); - }); - }, - changeCartNum:function(cartId,cartNum,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'change_cart_num', - p:{cartId:cartId,cartNum:cartNum} - }),successCallback,errorCallback); - }, - getCartList:function(successCallback,errorCallback){ - axios.get($h.U({ - c:'auth_api', - a:'get_cart_list' - })).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res.data.data,res.data); - }else{ - var error = res.data.msg || '获取购物车数据失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err) - }); - }, - removeCart:function(cartId,successCallback,errorCallback){ - axios.get($h.U({ - c:'auth_api', - a:'remove_cart', - p:{ids:cartId} - })).then(function(res){ - if(res.status == 200 && res.data.code == 200){ - successCallback && successCallback(res.data.data,res.data); - }else{ - var error = res.data.msg || '删除失败!'; - errorCallback && errorCallback(error); - $h.pushMsg(error); - } - }).catch(function(err){ - errorCallback && errorCallback(err); - $h.pushMsg(err) - }); - }, - getUseCoupon:function(successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'get_use_coupon' - }),successCallback,errorCallback); - }, - getArticleList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'public_api', - a:'get_cid_article', - p:p - }),successCallback,errorCallback) - }, - getVideoList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'public_api', - a:'get_video_list', - p:p - }),successCallback,errorCallback) - }, - getCollectProduct:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'get_user_collect_product', - p:p - }),successCallback,errorCallback) - }, - removeCollectProduct:function(productId,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'remove_user_collect_product', - p:{productId:productId} - }),successCallback,errorCallback) - }, - editUserAddress:function(addressInfo,successCallback,errorCallback){ - this.basePost($h.U({ - c:'auth_api', - a:'edit_user_address' - }),addressInfo,successCallback,errorCallback) - }, - getUserDefaultAddress:function(successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'user_default_address' - }),successCallback,errorCallback) - }, - setUserDefaultAddress:function(addressId,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'set_user_default_address', - p:{addressId:addressId} - }),successCallback,errorCallback) - }, - removeUserAddress:function(addressId,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'remove_user_address', - p:{addressId:addressId} - }),successCallback,errorCallback) - }, - submitOrder:function(key,order,successCallback,errorCallback){ - this.basePost($h.U({ - c:'auth_api', - a:'create_order', - p:{key:key} - }),order,successCallback,errorCallback) - }, - getUserOrderList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'get_user_order_list', - p:p - }),successCallback,errorCallback); - }, - removeUserOrder:function(uni,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'user_remove_order', - p:{uni:uni} - }),successCallback,errorCallback); - }, - payOrder:function(uni,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'pay_order', - p:{uni:uni} - }),successCallback,errorCallback); - }, - orderApplyRefund:function(uni,text,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'apply_order_refund', - p:{uni:uni,text:text} - }),successCallback,errorCallback); - }, - orderDetails:function(uni,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'order_details', - p:{uni:uni} - }),successCallback,errorCallback); - }, - userTakeOrder:function(uni,successCallback,errorCallback) { - this.baseGet($h.U({ - c:'auth_api', - a:'user_take_order', - p:{uni:uni} - }),successCallback,errorCallback); - }, - getProductCategory:function(successCallback,errorCallback) { - this.baseGet($h.U({ - c:'auth_api', - a:'get_product_category' - }),successCallback,errorCallback); - }, - userCommentProduct:function(unique,data,successCallback,errorCallback){ - this.basePost($h.U({ - c:'auth_api', - a:'user_comment_product', - p:{unique:unique} - }),data,successCallback,errorCallback) - }, - getSpreadList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'get_spread_list', - p:p - }),successCallback,errorCallback); - }, - getProductList:function(search,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'get_product_list', - p:search - }),successCallback,errorCallback); - }, - getUserBalanceList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'user_balance_list', - p:p - }),successCallback,errorCallback); - }, - getUserIntegralList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'user_integral_list', - p:p - }),successCallback,errorCallback); - }, - getProductReply:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'product_reply_list', - p:p - }),successCallback,errorCallback); - }, - getUserAddress:function(successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'user_address_list' - }),successCallback,errorCallback); - }, - getProductAttr:function(productId,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'product_attr_detail', - p:{productId:productId} - }),successCallback,errorCallback); - }, - userWechatRecharge:function(price,successCallback,errorCallback) { - this.baseGet($h.U({ - c:'auth_api', - a:'user_wechat_recharge', - p:{price:price} - }),successCallback,errorCallback); - }, - getNoticeList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'get_notice_list', - p:p - }),successCallback,errorCallback); - }, - seeNotice: function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'see_notice', - p:p - }),successCallback,errorCallback); - }, - getIssueCouponList:function(limit,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'get_issue_coupon_list', - p:{limit:limit} - }),successCallback,errorCallback); - }, - getCategoryProductList:function(limit,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'public_api', - a:'get_category_product_list', - p:{limit:limit} - }),successCallback,errorCallback); - }, - getBestProductList:function(p,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'public_api', - a:'get_best_product_list', - p:p - }),successCallback,errorCallback); - }, - userGetCoupon:function(couponId,successCallback,errorCallback){ - this.baseGet($h.U({ - c:'auth_api', - a:'user_get_coupon', - p:{couponId:couponId} - }),successCallback,errorCallback); - }, - isLogin:function(){ - return $h.getCookie('is_login') == 1; - }, - goLogin:function(){ - if(!this.isLogin()){ - $h.pushMsg('未登录,立即登陆',function(){ - location.href = $h.U({ - c:'login', - a:'index', - p:{ref:window.btoa(unescape(encodeURIComponent( location.href )))} - }); - }); - return false; - } - return true; - }, - wechatUploadImg:function(wxApi,count,successCallback,errorCallback){ - wxApi.chooseImage({count:count,sizeType:['compressed']},function(localIds){ - $h.prompt('图片上传中...'); - wxApi.uploadImage(localIds,function(serverIds){ - axios.get($h.U({ - c:"public_api", - a:"wechat_media_id_by_image", - p:{mediaIds:serverIds} - })).then(function(result){ - $h.promptClear(); - if(result.status == 200 && result.data.code == 200) - return Promise.resolve(result.data.data); - else - return Promise.reject('上传失败!'); - }).then(function(picList){ - if(!picList) return Promise.reject('请选择上传图片!'); - successCallback && successCallback(picList); - }).catch(function(err){ - $h.promptClear(); - $h.pushMsgOnce(err); - errorCallback && errorCallback(err); - }); - }) - }); - } - } -}); \ No newline at end of file diff --git a/public/wap/crmeb/module/store/scroll-load.js b/public/wap/crmeb/module/store/scroll-load.js deleted file mode 100644 index df1e39c2..00000000 --- a/public/wap/crmeb/module/store/scroll-load.js +++ /dev/null @@ -1,15 +0,0 @@ -(function(global,factory){ - typeof define == 'function' && define(['better-scroll'],factory) -})(this,function(BScroll){ - return { - install:function(Vue){ - Vue.prototype.$scrollLoad = function(dom,loadFn){ - var scroll = new BScroll(dom,{click:true,probeType:1,cancelable:false,deceleration:0.005,snapThreshold:0.01}); - scroll.on('pullingUp',function(){ - loadFn && loadFn(scroll.finishPullUp,scroll.refresh); - }); - return scroll; - }; - } - } -}); \ No newline at end of file diff --git a/public/wap/crmeb/module/store/seckill-card.js b/public/wap/crmeb/module/store/seckill-card.js deleted file mode 100644 index 2756ccf5..00000000 --- a/public/wap/crmeb/module/store/seckill-card.js +++ /dev/null @@ -1,187 +0,0 @@ -(function (global,factory) { - typeof define && define.amd && define(['vue'],factory); -})(this,function(Vue){ - var template = '
' + - '
' + - '
' + - '
' + - '
' + - '
' + - '' + - '
' + - '
' + - '

' + - '¥' + - '

' + - '' + - '库存' + - '件' + - '
' + - '
' + - '
' + - '
购买数量
' + - '
' + - '
-
' + - '' + - '
+
' + - '
' + - '
' + - '' + - '
' + - '
' + - '
' + - '
'; - - var shopCard = Vue.extend({ - template:template, - props:{ - onShow:Function, - onClose:Function, - onChange:Function, - onBuy:Function, - onCart:Function, - cart:{ - type:Boolean, - default:true - }, - buy:{ - type:Boolean, - default:true - }, - product:{ - type:Object, - default:function(){ - return { - image:'', - price:'', - stock:0 - } - } - }, - attrList:{ - type:Array, - default:function (){ - return []; - } - }, - show:Boolean - }, - data:function(){ - return { - cartNum:1 - } - }, - watch:{ - cartNum:function(v){ - if(this.product.stock <= 0) this.cartNum = 0; - else if(v > this.product.stock) this.cartNum = this.product.stock; - else if(v < 1) this.cartNum = 1; - }, - attrList:{ - handler:function (v) { - this.$nextTick(function(){ - this.onChange && this.onChange(this.getCheckedValue()); - }) - }, - deep:true - }, - product:function(){ - this.cartNum = 1; - } - }, - methods:{ - changeProduct:function(product){ - this.product = product; - }, - getCheckedValue:function(){ - return this.attrList.map(function(attr){ - return attr.checked; - }); - }, - close:function(){ - this.show = false; - this.onClose && this.onClose(); - }, - active:function(){ - this.show = true; - this.onShow && this.onShow(); - }, - incCartNum:function(){ - if(this.product.num <= this.cartNum){ - $h.pushMsg('每次购买数量不能超过'+this.product.num+'个') - this.cartNum = this.product.num; - }else{ - this.cartNum+=1; - } - }, - descCartNum:function(){ - this.cartNum-=1; - }, - changeChecked:function(value,attr,index){ - attr.checked = value; - this.$set(this.attrList,index,attr); - }, - goCart:function(){ - if(this.cartNum > this.product.stock || this.cartNum <= 0) return false; - this.onCart && this.onCart(this.getCheckedValue(),this.cartNum,this.product) == true && this.init(); - }, - goBuy:function(){ - if(this.cartNum > this.product.stock || this.cartNum <= 0) return false; - this.onBuy && this.onBuy(this.getCheckedValue(),this.cartNum,this.product) == true && this.init(); - }, - init:function(){ - var that = this; - this.attrList.map(function(attr,index){ - attr.checked = attr.attr_values[0]; - that.$set(that.attrList,index,attr); - }); - this.cartNum = this.product.stock >=1 ? 1 : 0; - }, - _setData:function(opt){ - this.product = opt.product; - this.attrList = opt.attrList == undefined ? [] : opt.attrList; - this.onChange = opt.onChange; - this.onClose = opt.onClose; - this.onCart = opt.onCart; - this.onBuy = opt.onBuy; - this.cart = opt.cart == undefined ? true : opt.cart; - this.buy = opt.buy == undefined ? true : opt.buy; - this.init(); - } - }, - mounted:function(){ - var that = this; - this.init(); - this.$el.reload = function(){ - that.init(); - }; - - } - }); - - shopCard.install = function(Vue){ - Vue.prototype.$shopCard = function(opt){ - var $vm = new shopCard().$mount(),$el = $vm.$el; - document.body.appendChild($el); - $vm._setData(opt); - $vm.remove = function(){ - document.body.removeChild($el); - }; - this.$nextTick(function(){ - setTimeout(function(){ - opt.show == true && $vm.active(); - },0); - }); - return $vm; - }; - }; - - return shopCard; -}); \ No newline at end of file diff --git a/public/wap/crmeb/module/store/shop-card.js b/public/wap/crmeb/module/store/shop-card.js deleted file mode 100644 index ad9e11ba..00000000 --- a/public/wap/crmeb/module/store/shop-card.js +++ /dev/null @@ -1,144 +0,0 @@ -(function (global,factory) { - typeof define && define.amd && define(['vue'],factory); -})(this,function(Vue){ - var template = '

库存

请选择属性

{{attr.attr_name}}

{{value}}
购买数量
-
+
'; - - var shopCard = Vue.extend({ - template:template, - props:{ - onShow:Function, - onClose:Function, - onChange:Function, - onBuy:Function, - onCart:Function, - cart:{ - type:Boolean, - default:true - }, - buy:{ - type:Boolean, - default:true - }, - product:{ - type:Object, - default:function(){ - return { - image:'', - price:'', - stock:0 - } - } - }, - attrList:{ - type:Array, - default:function (){ - return []; - } - }, - show:Boolean - }, - data:function(){ - return { - cartNum:1 - } - }, - watch:{ - cartNum:function(v){ - if(this.product.stock <= 0) this.cartNum = 0; - else if(v > this.product.stock) this.cartNum = this.product.stock; - else if(v < 1) this.cartNum = 1; - }, - attrList:{ - handler:function (v) { - this.$nextTick(function(){ - this.onChange && this.onChange(this.getCheckedValue()); - }) - }, - deep:true - }, - product:function(){ - this.cartNum = 1; - } - }, - methods:{ - changeProduct:function(product){ - this.product = product; - }, - getCheckedValue:function(){ - return this.attrList.map(function(attr){ - return attr.checked; - }); - }, - close:function(){ - this.show = false; - this.onClose && this.onClose(); - }, - active:function(){ - this.show = true; - this.onShow && this.onShow(); - }, - incCartNum:function(){ - this.cartNum+=1; - }, - descCartNum:function(){ - this.cartNum-=1; - }, - changeChecked:function(value,attr,index){ - attr.checked = value; - this.$set(this.attrList,index,attr); - }, - goCart:function(){ - if(this.cartNum > this.product.stock || this.cartNum <= 0) return false; - this.onCart && this.onCart(this.getCheckedValue(),this.cartNum,this.product) == true && this.init(); - }, - goBuy:function(){ - if(this.cartNum > this.product.stock || this.cartNum <= 0) return false; - this.onBuy && this.onBuy(this.getCheckedValue(),this.cartNum,this.product) == true && this.init(); - }, - init:function(){ - var that = this; - this.attrList.map(function(attr,index){ - attr.checked = attr.attr_values[0]; - that.$set(that.attrList,index,attr); - }); - this.cartNum = this.product.stock >=1 ? 1 : 0; - }, - _setData:function(opt){ - this.product = opt.product; - this.attrList = opt.attrList == undefined ? [] : opt.attrList; - this.onChange = opt.onChange; - this.onClose = opt.onClose; - this.onCart = opt.onCart; - this.onBuy = opt.onBuy; - this.cart = opt.cart == undefined ? true : opt.cart; - this.buy = opt.buy == undefined ? true : opt.buy; - this.init(); - } - }, - mounted:function(){ - var that = this; - this.init(); - this.$el.reload = function(){ - that.init(); - }; - - } - }); - - shopCard.install = function(Vue){ - Vue.prototype.$shopCard = function(opt){ - var $vm = new shopCard().$mount(),$el = $vm.$el; - document.body.appendChild($el); - $vm._setData(opt); - $vm.remove = function(){ - document.body.removeChild($el); - }; - setTimeout(function(){ - opt.show == true && $vm.active(); - },300); - return $vm; - }; - }; - - return shopCard; -}); \ No newline at end of file diff --git a/public/wap/crmeb/module/store/use-address.js b/public/wap/crmeb/module/store/use-address.js deleted file mode 100644 index a6f84e87..00000000 --- a/public/wap/crmeb/module/store/use-address.js +++ /dev/null @@ -1,96 +0,0 @@ -(function(global,factory){ - typeof define == 'function' && define(['store','helper'],factory); -})(this,function(storeApi,$h){ - var template = '
收货地址

 

'; - - return { - factory:function(Vue){ - return Vue.extend({ - template:template, - props:{ - checkedAddressId:{ - type:Number, - default:function(){return 0;} - }, - onSelect:{ - type:Function - }, - onClose:{ - type:Function - }, - onShow:{ - type:Function - }, - show:Boolean - }, - data:function(){ - return { - addressList:[] - } - }, - methods:{ - goEdit:function(addressId){ - location.href = $h.U({ - c:'my', - a:'edit_address', - p:{addressId:addressId} - }); - }, - goAdd:function(){ - location.href = $h.U({ - c:'my', - a:'edit_address' - }); - }, - getUserAddress:function(){ - var that = this; - storeApi.getUserAddress(function(res){ - that.addressList = res.data.data; - }); - }, - addressText:function(address){ - return address.province+address.city+address.district+address.detail - }, - close:function(){ - this.show = false; - this.onClose && this.onClose(); - }, - remove:function(){ - var that = this; - setTimeout(function(){ - that.$el.remove(); - },600); - }, - active:function(){ - this.show = true; - this.onShow && this.onShow(); - }, - selectAddress:function(address){ - this.close(); - this.onSelect && this.onSelect(address.id,address); - }, - init:function(opt){ - if(!opt) opt = {}; - if(typeof opt.onClose == 'function') this.onClose = opt.onClose; - if(typeof opt.onSelect == 'function') this.onSelect = opt.onSelect; - if(typeof opt.onShow == 'function') this.onShow = opt.onShow; - if(opt.checked != undefined) this.checkedAddressId = opt.checked; - } - }, - mounted:function(){ - vm = this; - this.getUserAddress(); - } - }); - }, - install:function(Vue){ - var useAddress = this.factory(Vue); - var $vm = new useAddress().$mount(),$el = $vm.$el; - document.body.appendChild($el); - Vue.prototype.$useAddress = function(opt){ - $vm.init(opt); - $vm.active(); - }; - } - } -}); \ No newline at end of file diff --git a/public/wap/crmeb/module/store/use-coupon.js b/public/wap/crmeb/module/store/use-coupon.js deleted file mode 100644 index 460ac972..00000000 --- a/public/wap/crmeb/module/store/use-coupon.js +++ /dev/null @@ -1,77 +0,0 @@ -(function(global,factory){ - typeof define == 'function' && define(['store'],factory); -})(this,function(storeApi){ - var template = '
请选择优惠劵

暂无可用优惠劵

'; - - return { - factory:function(Vue){ - return Vue.extend({ - name:'use-coupon', - template:template, - props:{ - onClose:Function, - onSelect:Function, - onShow:Function, - }, - data:function(){ - return { - couponList:[], - isShow:false, - minPrice:0 - }; - }, - methods:{ - getCouponList:function(){ - var that = this; - storeApi.getUseCoupon(function(res){ - that.couponList = res.data.data; - }); - }, - select:function(coupon){ - if(this.minPrice < coupon.use_min_price) return ; - this.onSelect && this.onSelect(coupon); - this.close(); - }, - active:function(){ - this.isShow = true; - this.onShow && this.onShow(); - }, - close:function(){ - this.isShow = false; - this.onClose && this.onClose(); - }, - init:function(minPrice,opt){ - if(!opt) opt = {}; - if(!minPrice) minPrice = 0; - if(typeof opt.onClose == 'function') this.onClose = opt.onClose; - if(typeof opt.onSelect == 'function') this.onSelect = opt.onSelect; - if(typeof opt.onShow == 'function') this.onShow = opt.onShow; - this.minPrice = minPrice; - } - }, - mounted:function(){ - this.getCouponList(); - } - }); - }, - install:function(Vue){ - var that = this; - Vue.prototype.$useCoupon = function(minPrice,opt){ - var useCoupon = that.factory(Vue); - var $vm = new useCoupon().$mount(),$el = $vm.$el; - document.body.appendChild($el); - $vm.init(minPrice,opt); - $vm.remove = function(){ - setTimeout(function(){ - document.body.removeChild($el); - },600); - }; - return { - remove:$vm.remove, - active:$vm.active, - close:$vm.close - }; - }; - } - } -}); \ No newline at end of file diff --git a/public/wap/crmeb/module/store_service/jquery.touchSwipe.min.js b/public/wap/crmeb/module/store_service/jquery.touchSwipe.min.js deleted file mode 100644 index 750c2466..00000000 --- a/public/wap/crmeb/module/store_service/jquery.touchSwipe.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(d){var l="left",k="right",c="up",r="down",b="in",s="out",i="none",o="auto",u="horizontal",p="vertical",f="all",e="start",h="move",g="end",m="cancel",a="ontouchstart" in window,t="TouchSwipe";var j={fingers:1,threshold:75,maxTimeThreshold:null,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,triggerOnTouchEnd:true,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"button, input, select, textarea, a, .noSwipe"};d.fn.swipe=function(x){var w=d(this),v=w.data(t);if(v&&typeof x==="string"){if(v[x]){return v[x].apply(this,Array.prototype.slice.call(arguments,1))}else{d.error("Method "+x+" does not exist on jQuery.swipe")}}else{if(!v&&(typeof x==="object"||!x)){return q.apply(this,arguments)}}return w};d.fn.swipe.defaults=j;d.fn.swipe.phases={PHASE_START:e,PHASE_MOVE:h,PHASE_END:g,PHASE_CANCEL:m};d.fn.swipe.directions={LEFT:l,RIGHT:k,UP:c,DOWN:r,IN:b,OUT:s};d.fn.swipe.pageScroll={NONE:i,HORIZONTAL:u,VERTICAL:p,AUTO:o};d.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:f};function q(v){if(v&&(v.allowPageScroll===undefined&&(v.swipe!==undefined||v.swipeStatus!==undefined))){v.allowPageScroll=i}if(!v){v={}}v=d.extend({},d.fn.swipe.defaults,v);return this.each(function(){var x=d(this);var w=x.data(t);if(!w){w=new n(this,v);x.data(t,w)}})}function n(J,R){var aj=(a||!R.fallbackToMouseEvents),ae=aj?"touchstart":"mousedown",K=aj?"touchmove":"mousemove",ac=aj?"touchend":"mouseup",I="touchcancel";var P=0;var E=null;var S=0;var af=0;var w=0;var U=1;var ak=0;var A=d(J);var F="start";var ai=0;var T=null;var B=0;var M=0;try{A.bind(ae,aa);A.bind(I,D)}catch(ag){d.error("events not supported "+ae+","+I+" on jQuery.swipe")}this.enable=function(){A.bind(ae,aa);A.bind(I,D);return A};this.disable=function(){H();return A};this.destroy=function(){H();A.data(t,null);return A};function aa(ao){if(L()){return}if(d(ao.target).closest(R.excludedElements,A).length>0){return}var ap=ao.originalEvent;var an,am=a?ap.touches[0]:ap;F=e;if(a){ai=ap.touches.length}else{ao.preventDefault()}P=0;E=null;ak=null;S=0;af=0;w=0;U=1;T=al();if(!a||(ai===R.fingers||R.fingers===f)||W()){T[0].start.x=T[0].end.x=am.pageX;T[0].start.y=T[0].end.y=am.pageY;B=x();if(ai==2){T[1].start.x=T[1].end.x=ap.touches[1].pageX;T[1].start.y=T[1].end.y=ap.touches[1].pageY;af=w=N(T[0].start,T[1].start)}if(R.swipeStatus||R.pinchStatus){an=ah(ap,F)}}else{D(ap);an=false}if(an===false){F=m;ah(ap,F);return an}else{V(true);A.bind(K,G);A.bind(ac,O)}}function G(ao){var aq=ao.originalEvent;if(F===g||F===m){return}var an,am=a?aq.touches[0]:aq;T[0].end.x=a?aq.touches[0].pageX:am.pageX;T[0].end.y=a?aq.touches[0].pageY:am.pageY;M=x();E=Z(T[0].start,T[0].end);if(a){ai=aq.touches.length}F=h;if(ai==2){if(af==0){T[1].start.x=aq.touches[1].pageX;T[1].start.y=aq.touches[1].pageY;af=w=N(T[0].start,T[1].start)}else{T[1].end.x=aq.touches[1].pageX;T[1].end.y=aq.touches[1].pageY;w=N(T[0].end,T[1].end);ak=X(T[0].end,T[1].end)}U=v(af,w)}if((ai===R.fingers||R.fingers===f)||!a){y(ao,E);P=z(T[0].start,T[0].end);S=C(T[0].start,T[0].end);if(R.swipeStatus||R.pinchStatus){an=ah(aq,F)}if(!R.triggerOnTouchEnd){var ap=!Y();if(Q()===true){F=g;an=ah(aq,F)}else{if(ap){F=m;ah(aq,F)}}}}else{F=m;ah(aq,F)}if(an===false){F=m;ah(aq,F)}}function O(ao){var au=ao.originalEvent;if(au.touches&&au.touches.length>0){return true}ao.preventDefault();M=x();if(af!=0){w=N(T[0].end,T[1].end);U=v(af,w);ak=X(T[0].end,T[1].end)}P=z(T[0].start,T[0].end);E=Z(T[0].start,T[0].end);S=C();if(R.triggerOnTouchEnd||(R.triggerOnTouchEnd===false&&F===h)){F=g;var aq=ad()||!W();var an=((ai===R.fingers||R.fingers===f)||!a);var am=T[0].end.x!==0;var ap=(an&&am&&aq);if(ap){var ar=Y();var at=Q();if((at===true||at===null)&&ar){ah(au,F)}else{if(!ar||at===false){F=m;ah(au,F)}}}else{F=m;ah(au,F)}}else{if(F===h){F=m;ah(au,F)}}A.unbind(K,G,false);A.unbind(ac,O,false);V(false)}function D(){ai=0;M=0;B=0;af=0;w=0;U=1;V(false)}function ah(ao,am){var an=undefined;if(R.swipeStatus){an=R.swipeStatus.call(A,ao,am,E||null,P||0,S||0,ai)}if(R.pinchStatus&&ad()){an=R.pinchStatus.call(A,ao,am,ak||null,w||0,S||0,ai,U)}if(am===m){if(R.click&&(ai===1||!a)&&(isNaN(P)||P===0)){an=R.click.call(A,ao,ao.target)}}if(am==g){if(R.swipe){an=R.swipe.call(A,ao,E,P,S,ai)}switch(E){case l:if(R.swipeLeft){an=R.swipeLeft.call(A,ao,E,P,S,ai)}break;case k:if(R.swipeRight){an=R.swipeRight.call(A,ao,E,P,S,ai)}break;case c:if(R.swipeUp){an=R.swipeUp.call(A,ao,E,P,S,ai)}break;case r:if(R.swipeDown){an=R.swipeDown.call(A,ao,E,P,S,ai)}break}switch(ak){case b:if(R.pinchIn){an=R.pinchIn.call(A,ao,ak||null,w||0,S||0,ai,U)}break;case s:if(R.pinchOut){an=R.pinchOut.call(A,ao,ak||null,w||0,S||0,ai,U)}break}}if(am===m||am===g){D(ao)}return an}function Q(){if(R.threshold!==null){return P>=R.threshold}return null}function Y(){var am;if(R.maxTimeThreshold){if(S>=R.maxTimeThreshold){am=false}else{am=true}}else{am=true}return am}function y(am,an){if(R.allowPageScroll===i||W()){am.preventDefault()}else{var ao=R.allowPageScroll===o;switch(an){case l:if((R.swipeLeft&&ao)||(!ao&&R.allowPageScroll!=u)){am.preventDefault()}break;case k:if((R.swipeRight&&ao)||(!ao&&R.allowPageScroll!=u)){am.preventDefault()}break;case c:if((R.swipeUp&&ao)||(!ao&&R.allowPageScroll!=p)){am.preventDefault()}break;case r:if((R.swipeDown&&ao)||(!ao&&R.allowPageScroll!=p)){am.preventDefault()}break}}}function C(){return M-B}function N(ap,ao){var an=Math.abs(ap.x-ao.x);var am=Math.abs(ap.y-ao.y);return Math.round(Math.sqrt(an*an+am*am))}function v(am,an){var ao=(an/am)*1;return ao.toFixed(2)}function X(){if(U<1){return s}else{return b}}function z(an,am){return Math.round(Math.sqrt(Math.pow(am.x-an.x,2)+Math.pow(am.y-an.y,2)))}function ab(ap,an){var am=ap.x-an.x;var ar=an.y-ap.y;var ao=Math.atan2(ar,am);var aq=Math.round(ao*180/Math.PI);if(aq<0){aq=360-Math.abs(aq)}return aq}function Z(an,am){var ao=ab(an,am);if((ao<=45)&&(ao>=0)){return l}else{if((ao<=360)&&(ao>=315)){return l}else{if((ao>=135)&&(ao<=225)){return k}else{if((ao>45)&&(ao<135)){return r}else{return c}}}}}function x(){var am=new Date();return am.getTime()}function H(){A.unbind(ae,aa);A.unbind(I,D);A.unbind(K,G);A.unbind(ac,O);V(false)}function W(){return R.pinchStatus||R.pinchIn||R.pinchOut}function ad(){return ak&&W()}function L(){return A.data(t+"_intouch")===true?true:false}function V(am){am=am===true?true:false;A.data(t+"_intouch",am)}function al(){var am=[];for(var an=0;an<=5;an++){am.push({start:{x:0,y:0},end:{x:0,y:0},delta:{x:0,y:0}})}return am}}})(jQuery); \ No newline at end of file diff --git a/public/wap/crmeb/module/store_service/mobile.js b/public/wap/crmeb/module/store_service/mobile.js deleted file mode 100644 index 95ccca6e..00000000 --- a/public/wap/crmeb/module/store_service/mobile.js +++ /dev/null @@ -1,1533 +0,0 @@ -/*jslint undef: true, browser: true, continue: true, eqeq: true, vars: true, forin: true, white: true, newcap: false, nomen: true, plusplus: true, maxerr: 50, indent: 4 */ - -/** - * jGestures: a jQuery plugin for gesture events - * Copyright 2010-2011 Neue Digitale / Razorfish GmbH - * Copyright 2011-2012, Razorfish GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @fileOverview - * Razorfish GmbH javascript library: add touch events such as 'pinch', - * 'rotate', 'swipe', 'tap' and 'orientationchange' on capable user agents. - * For incapable devices there's a basic event substitution: a "tapone" event - * can be triggered by "clicking", a "swipeone" by performing a swipe-ish - * gesture using the mouse (buttondown - mousemove - buttonup). - * - * This is still a beta version, bugfixes and improvements appreciated. - * - * @author martin.krause@razorfish.de - * @version 0.90-shake - * - * @requires - * jQuery JavaScript Library v1.4.2 - http://jquery.com/ - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * @example jQuery('#swipe').bind('swipeone',eventHandler); - * - * Notification on native events: - * On every native touchstart, touchend, gesturestart and gestureend-event, - * jgestures triggers a corresponding custom event - * ('jGestures.touchstart', 'jGestures.touchend;start', 'jGestures.touchend;processed', - * 'jGestures.gesturestart', 'jGestures.gestureend;start', 'jGestures.gestureend;processed') on the event-element. - * The eventhandler's second argument represents the original touch event (yes: including all touchpoints). - * Use this if you need very detailed control e.g. kinetic scrolling or implementing additional gestures. - * - * Every jGesture-eventhandler receives a custom object as second argument - * containing the original event (originalEvent property) and processed - * information (such as delta values and timesptamp). - * Example:{ - * type: eventtype e.g. "swipe","pinch", - * originalEvent: {DOM-Event}, - * // default: just one entry on the delta-array - the first touchpoint - * // the first touchpoint is the reference point for every gesture, - * // because moving touchpoints in various directions would result in - * // a gesture. - * // delta and direction details are just provided for touch not for gesture / motion events - * delta : [ - * { - * lastX:{Number} , // x-axis: relative to the last touchevent (e.g. touchmove!) - * lastY:{Number}, // y-axis: relative to the last touchevent (e.g. touchmove!) - * moved: {Number}, // distance: relative to the original touchpoint - * startX: {Number} , // relative to the original touchpoint - * startY: {Number} ,// relative to the original touchpoint - * } ], - * // based on the first touchpoint - * direction : { // relative to the last touchevent (e.g. touchmove!) - * vector: {Number}, // -1|+1, indicates the direction if necessary(pinch/rotate) - * orientation: {Number} // window.orientation: -90,0,90,180 || null (window.orienntation) - * lastX : {Number}, // -1,0,+1 || null (orientationchange) // relative to the last touchevent (e.g. touchmove!) - * lastY : {Number}, // -1,0,+1 || null (orientationchange)// relative to the last touchevent (e.g. touchmove!) - * startX: {Number} , // relative to the original touchpoint - * startY: {Number} ,// relative to the original touchpoint - * }, - * rotation: {Number} || null, // gestureonly: amount of rotation relative to the current position NOT the original - * scale: {Number} || null, // gestureonly: amount of scaling relative to the current position NOT the original - * duration: {Number}, // ms: relative to the original touchpoint - * description : {String} // details as String: {TYPE *}:{TOUCHES 1|2|3|4}:{X-AXIS 'right'|'left'|'steady'}:{Y-AXIS 'down'|'up'|'steady'} e.g. "swipe:1:left:steady" relative to the last touchpoint - * }; - * - * Available jGesture-events can be grouped into: - * - * - * Device events: - * The jGesture-Events in this group are triggered by the device. - * - * @event 'orientationchange' - * The device is turned clockwise or counterclockwise. This event is triggered - * by the device and might use an internal gyroscope. - * obj.description: - * orientationchange:landscape:clockwise:-90 - * orientationchange:portrait:default:0 - * orientationchange:landscape:counterclockwise|portrait:90 - * orientationchange:portrait:upsidedown:180 - * - * - * Move events: - * The jGesture-Events in this group are triggered during the touch/gesture - * execution whenever a touchpoint changes. - * In contrast to touchend/gestureend-events which are triggered after - * the touch/gesture has completed. - * - * @event 'pinch' - * Is triggered during a pinch gesture (two fingers moving away from or - * towards each other). - * obj.description: - * pinch:-1:close - * pinch:+1:open - * - * @event 'rotate' - * Is triggered during a rotation gesture (two fingers rotating clockwise - * or counterclockwise). - * obj.description: - * rotate:-1:counterclockwise - * rotate:+1:+clockwise - * - * @event 'swipemove' - * Is triggered during a swipe move gesture (finger(s) being moved around - * the device, e.g. dragging) - * obj.description: - * swipemove:1:left:down - * swipemove:1:left:up - * swipemove:1:left:steady - * swipemove:1:right:down - * swipemove:1:right:up - * swipemove:1:right:steady - * swipemove:2:left:down - * swipemove:2:left:up - * swipemove:2:left:steady - * swipemove:2:right:down - * swipemove:2:right:up - * swipemove:2:right:steady - * swipemove:2:left:down - * swipemove:3:left:up - * swipemove:3:left:steady - * swipemove:3:right:down - * swipemove:3:right:up - * swipemove:3:right:steady - * swipemove:3:left:down - * swipemove:4:left:up - * swipemove:4:left:steady - * swipemove:4:right:down - * swipemove:4:right:up - * swipemove:4:right:steady - * - * - * Toucheend events: - * The jGesture-Events in this group are triggered after the touch/gesture - * has completed. - * In contrast to touchmove-events which are triggered during the touch/gesture - * execution whenever a touchpoint changes. - * - * @event 'swipeone' - * Is triggered after a swipe move gesture with one touchpoint (one finger - * was moved around the device) - * obj.description: - * swipeone:1:left:down - * swipeone:1:left:up - * swipeone:1:left:steady - * swipeone:1:right:down - * swipeone:1:right:up - * swipeone:1:right:steady - * - * @event 'swipetwo' - * Is triggered after a swipe move gesture with two touchpoints (two fingers - * were moved around the device) - * obj.description: - * swipetwo:2:left:down - * swipetwo:2:left:up - * swipetwo:2:left:steady - * swipetwo:2:right:down - * swipetwo:2:right:up - * swipetwo:2:right:steady - * - * @event 'swipethree' - * Is triggered after a swipe move gesture with three touchpoints (three - * fingers were moved around the device) - * obj.description: - * swipethree:3:left:down - * swipethree:3:left:up - * swipethree:3:left:steady - * swipethree:3:right:down - * swipethree:3:right:up - * swipethree:3:right:steady - * - * @event 'swipefour' - * Is triggered after a swipe move gesture with four touchpoints (four - * fingers were moved around the device) - * obj.description: - * swipefour:4:left:down - * swipefour:4:left:up - * swipefour:4:left:steady - * swipefour:4:right:down - * swipefour:4:right:up - * swipefour:4:right:steady - * - * - * @event 'swipeup' - * Is triggered after an strict upwards swipe move gesture - * obj.description: - * swipe:1:steady:up - * swipe:2:steady:up - * swipe:3:steady:up - * swipe:4:steady:up - * - * @event 'swiperightup' - * Is triggered after a rightwards and upwards swipe move gesture - * obj.description: - * swipe:1:right:up - * swipe:2:right:up - * swipe:3:right:up - * swipe:4:right:up - * - * @event 'swiperight' - * Is triggered after a strict rightwards swipe move gesture - * obj.description: - * swipe:1:right:steady - * swipe:2:right:steady - * swipe:3:right:steady - * swipe:4:right:steady - * - * @event 'swiperightdown' - * Is triggered after a rightwards and downwards swipe move gesture - * obj.description: - * swipe:1:right:down - * swipe:2:right:down - * swipe:3:right:down - * swipe:4:right:down - * - * @event 'swipedown' - * Is triggered after a strict downwards swipe move gesture - * obj.description: - * swipe:1:steady:down - * swipe:2:steady:down - * swipe:3:steady:down - * swipe:4:steady:down - * - * @event 'swipeleftdown' - * Is triggered after a leftwards and downwards swipe move gesture - * obj.description: - * swipe:1:left:down - * swipe:2:left:down - * swipe:3:left:down - * swipe:4:left:down - * - * @event 'swipeleft' - * Is triggered after a strict leftwards swipe move gesture - * obj.description: - * swipe:1:left:steady - * swipe:2:left:steady - * swipe:3:left:steady - * swipe:4:left:steady - * - * @event 'swipeleftup' - * Is triggered after a leftwards and upwards swipe move gesture - * obj.description: - * swipe:1:left:up - * swipe:2:left:up - * swipe:3:left:up - * swipe:4:left:up - * - * @event 'tapone' - * Is triggered after a single (one finger) tap gesture - * obj.description: - * tapone - * - * @event 'taptwo' - * Is triggered after a double (two finger) tap gesture - * obj.description: - * taptwo - * * - * @event 'tapthree' - * Is triggered after a tripple (three finger) tap gesture - * obj.description: - * tapthree - * - * - * Gestureend events: - * A gesture is an interpretation of different touchpoints. - * The jGesture-Events in this group are triggered when a gesture has finished - * and the touchpoints are removed from the device. - * - * @event 'pinchopen' - * Is triggered when a pinchopen gesture (two fingers moving away from each - * other) occured and the touchpoints (fingers) are removed the device. - * obj.description: - * pinch:+1:open - * - * @event 'pinchclose' - * Is triggered when a pinchclose gesture (two fingers moving towards each - * other) occured and the touchpoints (fingers) are removed the device. - * obj.description: - * pinch:-1:close - * - * @event 'rotatecw' - * Is triggered when a clockwise rotation gesture (two fingers rotating - * clockwise) occured and the touchpoints (fingers) are removed the device. - * obj.description: - * rotate:+1:+clockwise - * - * @event 'rotateccw' - * Is triggered when a counterclockwise rotation gesture (two fingers - * rotating counterclockwise) occured and the touchpoints (fingers) are - * removed the device. - * obj.description: - * rotate:-1:+counterclockwise - * - * - * Motion events: - * A "motion event" is an interpretation of changes in space, e.g. a "shaking motion" - * consists of a specified number of acceleration changes in a given interval. - * For understanding "directions", place your mobile device on a table with the bottom - * (home button) close to you: - * - x-axis: horizontal left / right - * - y-axis: horizontal front / back (through the home button) - * - z-axis: vertical through your device - * - * Note: Devicemotion / deviceorientation don't send custom event (such as: jGestures.touchstart). - * Note: Devicemotion should be bound on the "window-element" - because the whole device moves - * - * @event 'shake' - * Is triggered when a shaking motion is detected - * obj.description: - * shake:leftright:x-axisfrontback:y-axis:updown:z-axis - * - * @event 'shakefrontback' - * Is triggered when a shaking motion is detected and the gesture can be interpreted as a mainly front-back movement. - * obj.description: - * shakefrontback:shakefrontback:y-axis - * - * @event 'shakeleftright' - * Is triggered when a shaking motion is detected and the gesture can be interpreted as a mainly left-right movement. - * Additional major movements are mentioned in the obj.description. - * obj.description: - * shakeleftright:leftright:x-axis - * - * @event 'shakeupdown' - * Is triggered when a shaking motion is detected and the gesture can be interpreted as a mainly up-down movement. - * Additional major movements are mentioned in the obj.description. - * obj.description: - * shake:shakeupdown:updown:z-axis - * - * @example - * .bind( eventType, [ eventData ], handler(eventObject) ) - * jQuery('body').bind('tapone',function(){alert(arguments[1].description);}) - * - */ - - (function($) { - - /** - * General thresholds. - */ - // @TODO: move to $...defaults - // @TODO: shake to defaults freeze etc - // change of x deg in y ms - - - $.jGestures = {}; - $.jGestures.defaults = {}; - $.jGestures.defaults.thresholdShake = { - requiredShakes : 10, - freezeShakes: 100, - frontback : { - sensitivity: 10 - }, - leftright : { - sensitivity: 10 - }, - updown : { - sensitivity: 10 - } - }; - - $.jGestures.defaults.thresholdPinchopen = 0.05; - $.jGestures.defaults.thresholdPinchmove = 0.05; - $.jGestures.defaults.thresholdPinch = 0.05; - $.jGestures.defaults.thresholdPinchclose = 0.05; - $.jGestures.defaults.thresholdRotatecw = 5; //deg - $.jGestures.defaults.thresholdRotateccw = 5; // deg - // a tap becomes a swipe if x/y values changes are above this threshold - $.jGestures.defaults.thresholdMove = 20; - $.jGestures.defaults.thresholdSwipe = 100; - // get capable user agents - $.jGestures.data = {}; - $.jGestures.data.capableDevicesInUserAgentString = ['iPad','iPhone','iPod','Mobile Safari']; // basic functionality such as swipe, pinch, rotate, tap should work on every mobile safari, e.g. GalaxyTab - $.jGestures.data.hasGestures = (function () { var _i; for(_i = 0; _i < $.jGestures.data.capableDevicesInUserAgentString.length; _i++ ) { if (navigator.userAgent.indexOf($.jGestures.data.capableDevicesInUserAgentString[_i]) !== -1 ) {return true;} } return false; } )(); - $.hasGestures = $.jGestures.data.hasGestures; - $.jGestures.events = { - touchstart : 'jGestures.touchstart', - touchendStart: 'jGestures.touchend;start', - touchendProcessed: 'jGestures.touchend;processed', - gesturestart: 'jGestures.gesturestart', - gestureendStart: 'jGestures.gestureend;start', - gestureendProcessed: 'jGestures.gestureend;processed' - }; - - jQuery - .each({ - // "first domevent necessary"_"touch event+counter" : "exposed as" - // event: orientationchange - orientationchange_orientationchange01: "orientationchange", - // event: gestures - gestureend_pinchopen01: "pinchopen", - gestureend_pinchclose01: "pinchclose", - gestureend_rotatecw01 : 'rotatecw', - gestureend_rotateccw01 : 'rotateccw', - // move events - gesturechange_pinch01: 'pinch', - gesturechange_rotate01: 'rotate', - touchstart_swipe13: 'swipemove', - // event: touches - touchstart_swipe01: "swipeone", - touchstart_swipe02: "swipetwo", - touchstart_swipe03: "swipethree", - touchstart_swipe04: "swipefour", - touchstart_swipe05: 'swipeup', - touchstart_swipe06: 'swiperightup', - touchstart_swipe07: 'swiperight', - touchstart_swipe08: 'swiperightdown', - touchstart_swipe09: 'swipedown', - touchstart_swipe10: 'swipeleftdown', - touchstart_swipe11: 'swipeleft', - touchstart_swipe12: 'swipeleftup', - touchstart_tap01: 'tapone', - touchstart_tap02: 'taptwo', - touchstart_tap03: 'tapthree', - touchstart_tap04: 'tapfour', - - devicemotion_shake01: 'shake', - devicemotion_shake02: 'shakefrontback', - devicemotion_shake03: 'shakeleftright', - devicemotion_shake04: 'shakeupdown' - - }, - - /** - * Add gesture events inside the jQuery.event.special namespace - */ - function( sInternal_, sPublicFN_ ) { - - // add as funciton to jQuery.event.special.sPublicFN_ - jQuery.event.special[ sPublicFN_ ] = { - - /** - * When the first event handler is bound, jQuery executes the setup function. - * This plugin just uses one eventhandler per element, regardless of the number of bound events. - * All Events are stored internally as properties on the dom-element using the $.data api. - * The setup-function adds the eventlistener, acting as a proxy function for the internal events. - * $.data.ojQueryGestures[_sDOMEvent ('tap') ] = {Boolean} - * @return {Void} - */ - setup: function () { - // split the arguments to necessary controll arguements - var _aSplit = sInternal_.split('_'); - var _sDOMEvent = _aSplit[0]; // - // get the associated gesture event and strip the counter: necessary for distinguisihng similliar events such as tapone-tapfour - var _sGestureEvent = _aSplit[1].slice(0,_aSplit[1].length-2); - var _$element = jQuery(this); - var _oDatajQueryGestures ; - var oObj; - // bind the event handler on the first $.bind() for a gestureend-event, set marker - if (!_$element.data('ojQueryGestures') || !_$element.data('ojQueryGestures')[_sDOMEvent]) { - // setup pseudo event - _oDatajQueryGestures = _$element.data('ojQueryGestures') || {}; - oObj = {}; - // marker for: domEvent being set on this element - // e.g.: $.data.oGestureInternals['touchstart'] = true; - // since they're grouped, i'm just marking the first one being added - oObj[_sDOMEvent] = true; - $.extend(true,_oDatajQueryGestures,oObj); - _$element.data('ojQueryGestures' ,_oDatajQueryGestures); - // add gesture events - if($.hasGestures) { - switch(_sGestureEvent) { - - // event: orientationchange - case 'orientationchange': - _$element.get(0).addEventListener('orientationchange', _onOrientationchange, false); - break; - - // event: - // - shake - // - tilt - case 'shake': - case 'shakefrontback': - case 'shakeleftright': - case 'shakeupdown': - case 'tilt': - //$.hasGyroscope = true //!window.DeviceOrientationEvent; - //_$element.get(0).addEventListener('devicemotion', _onDevicemotion, false); - //_$element.get(0).addEventListener('deviceorientation', _onDeviceorientation, false); - _$element.get(0).addEventListener('devicemotion', _onDevicemotion, false); - break; - - // event: - // - touchstart - // - touchmove - // - touchend - case 'tap': - case 'swipe': - case 'swipeup': - case 'swiperightup': - case 'swiperight': - case 'swiperightdown': - case 'swipedown': - case 'swipeleftdown': - case 'swipeleft': - _$element.get(0).addEventListener('touchstart', _onTouchstart, false); - break; - - // event: gestureend - case 'pinchopen': - case 'pinchclose' : - case 'rotatecw' : - case 'rotateccw' : - _$element.get(0).addEventListener('gesturestart', _onGesturestart, false); - _$element.get(0).addEventListener('gestureend', _onGestureend, false); - break; - - // event: gesturechange - case 'pinch': - case 'rotate': - _$element.get(0).addEventListener('gesturestart', _onGesturestart, false); - _$element.get(0).addEventListener('gesturechange', _onGesturechange, false); - break; - } - } - // create substitute for gesture events - else { - switch(_sGestureEvent) { - // event substitutes: - // - touchstart: mousedown - // - touchmove: none - // - touchend: mouseup - case 'tap': - case 'swipe': - // _$element.get(0).addEventListener('mousedown', _onTouchstart, false); - _$element.bind('mousedown', _onTouchstart); - break; - - // no substitution - case 'orientationchange': - case 'pinchopen': - case 'pinchclose' : - case 'rotatecw' : - case 'rotateccw' : - case 'pinch': - case 'rotate': - case 'shake': - case 'tilt': - - break; - } - } - - } - return false; - }, - - /** - * For every $.bind(GESTURE) the add-function will be called. - * Instead of binding an actual eventlister, the event is stored as $.data on the element. - * The handler will be triggered using $.triggerHandler(GESTURE) if the internal - * eventhandler (proxy being bound on setup()) detects a GESTURE event - * @param {Object} event_ jQuery-Event-Object being passed by $.bind() - * @return {Void} - */ - add : function(event_) { - // add pseudo event: properties on $.data - var _$element = jQuery(this); - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); -// _oDatajQueryGestures[event_.type] = { 'originalType' : event_.type , 'threshold' : event_.data.threshold, 'preventDefault' : event_.data.preventDefault } ; - _oDatajQueryGestures[event_.type] = { 'originalType' : event_.type } ; - return false; - }, - - /** - * For every $.unbind(GESTURE) the remove-function will be called. - * Instead of removing the actual eventlister, the event is removed from $.data on the element. - * @param {Object} event_ jQuery-Event-Object being passed by $.bind() - * @return {Void} - */ - remove : function(event_) { - // remove pseudo event: properties on $.data - var _$element = jQuery(this); - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - _oDatajQueryGestures[event_.type] = false; - _$element.data('ojQueryGestures' ,_oDatajQueryGestures ); - return false; - }, - - /** - * The last $.unbind()-call on the domElement triggers the teardown function - * removing the eventlistener - * @return {Void} - */ - // @TODO: maybe rework teardown to work with event type?! - teardown : function() { - // split the arguments to necessary controll arguements - var _aSplit = sInternal_.split('_'); - var _sDOMEvent = _aSplit[0]; // - // get the associated gesture event and strip the counter: necessary for distinguisihng similliar events such as tapone-tapfour - var _sGestureEvent = _aSplit[1].slice(0,_aSplit[1].length-2); - var _$element = jQuery(this); - var _oDatajQueryGestures; - var oObj; - // bind the event handler on the first $.bind() for a gestureend-event, set marker - if (!_$element.data('ojQueryGestures') || !_$element.data('ojQueryGestures')[_sDOMEvent]) { - // setup pseudo event - _oDatajQueryGestures = _$element.data('ojQueryGestures') || {}; - oObj = {}; - // remove marker for: domEvent being set on this element - oObj[_sDOMEvent] = false; - $.extend(true,_oDatajQueryGestures,oObj); - _$element.data('ojQueryGestures' ,_oDatajQueryGestures); - - // remove gesture events - if($.hasGestures) { - switch(_sGestureEvent) { - - // event: orientationchange - case 'orientationchange': - _$element.get(0).removeEventListener('orientationchange', _onOrientationchange, false); - break; - - case 'shake': - case 'shakefrontback': - case 'shakeleftright': - case 'shakeupdown': - case 'tilt': - _$element.get(0).removeEventListener('devicemotion', _onDevicemotion, false); - break; - - // event : - // - touchstart - // - touchmove - // - touchend - case 'tap': - case 'swipe': - case 'swipeup': - case 'swiperightup': - case 'swiperight': - case 'swiperightdown': - case 'swipedown': - case 'swipeleftdown': - case 'swipeleft': - case 'swipeleftup': - _$element.get(0).removeEventListener('touchstart', _onTouchstart, false); - _$element.get(0).removeEventListener('touchmove', _onTouchmove, false); - _$element.get(0).removeEventListener('touchend', _onTouchend, false); - break; - - // event: gestureend - case 'pinchopen': - case 'pinchclose' : - case 'rotatecw' : - case 'rotateccw' : - _$element.get(0).removeEventListener('gesturestart', _onGesturestart, false); - _$element.get(0).removeEventListener('gestureend', _onGestureend, false); - break; - - // event: gesturechange - case 'pinch': - case 'rotate': - _$element.get(0).removeEventListener('gesturestart', _onGesturestart, false); - _$element.get(0).removeEventListener('gesturechange', _onGesturechange, false); - break; - } - } - // remove substitute for gesture events - else { - switch(_sGestureEvent) { - // event substitutes: - // - touchstart: mousedown - // - touchmove: none - // - touchend: mouseup - case 'tap': - case 'swipe': -// _$element.get(0).removeEventListener('mousedown', _onTouchstart, false); -// _$element.get(0).removeEventListener('mousemove', _onTouchmove, false); -// _$element.get(0).removeEventListener('mouseup', _onTouchend, false); - _$element.unbind('mousedown', _onTouchstart); - _$element.unbind('mousemove', _onTouchmove); - _$element.unbind('mouseup', _onTouchend); - break; - - // no substitution - case 'orientationchange': - case 'pinchopen': - case 'pinchclose' : - case 'rotatecw' : - case 'rotateccw' : - case 'pinch': - case 'rotate': - case 'shake': - case 'tilt': - - break; - } - } - - } - return false; - } - - }; - }); - - /** - * Creates the object that ist passed as second argument to the $element.triggerHandler function. - * This object contains detailed informations about the gesture event. - * @param {Object} oOptions_ {type: {String}, touches: {String}, deltaY: {String},deltaX : {String}, startMove: {Object}, event:{DOM-Event}, timestamp:{String},vector: {Number}} - * @example _createOptions ( - * { - * type: 'swipemove', - * touches: '1', - * deltaY: _iDeltaY, - * deltaX : _iDeltaX, - * startMove: _oDatajQueryGestures.oStartTouch, - * event:event_, - * timestamp:_oEventData.timestamp, - * vector: -1 - * } - * ); - * @returns {Object} - * { - * type: eventtype e.g. "swipe","pinch", - * originalEvent: {DOM-Event}, - * // default: just one entry on the delta-array - the first touchpoint - * // the first touchpoint is the reference point for every gesture, - * // because moving touchpoints in various directions would result in - * // a gesture. - * // delta and direction details are just provided for touch not for gesture / motion events - * delta : [ - * { - * lastX:{Number} , // x-axis: relative to the last touchevent (e.g. touchmove!) - * lastY:{Number}, // y-axis: relative to the last touchevent (e.g. touchmove!) - * moved: {Number}, // distance: relative to the original touchpoint - * startX: {Number} , // relative to the original touchpoint - * startY: {Number} ,// relative to the original touchpoint - * } ], - * // based on the first touchpoint - * direction : { // relative to the last touchevent (e.g. touchmove!) - * vector: {Number}, // -1|+1, indicates the direction if necessary(pinch/rotate) - * orientation: {Number} // window.orientation: -90,0,90,180 || null (window.orienntation) - * lastX : {Number}, // -1,0,+1 relative to the last touchevent (e.g. touchmove!) - * lastY : {Number}, // -1,0,+1 relative to the last touchevent (e.g. touchmove!) - * startX: {Number} , //-1,0,+1 relative to the original touchpoint - * startY: {Number} ,// -1,0,+1 relative to the original touchpoint - * }, - * rotation: {Number} || null, // gestureonly: amount of rotation relative to the current position NOT the original - * scale: {Number} || null, // gestureonly: amount of scaling relative to the current position NOT the original - * duration: {Number}, // ms: relative to the original touchpoint - * description : {String} // details as String: {TYPE *}:{TOUCHES 1|2|3|4}:{X-AXIS 'right'|'left'|'steady'}:{Y-AXIS 'down'|'up'|'steady'} e.g. "swipe:1:left:steady" relative to the last touchpoint - * }; - */ - function _createOptions(oOptions_) { - // force properties - oOptions_.startMove = (oOptions_.startMove) ? oOptions_.startMove : {startX: null,startY:null,timestamp:null} ; - var _iNow = new Date().getTime(); - var _oDirection; - var _oDelta; - // calculate touch differences - if (oOptions_.touches) { - // store delta values - _oDelta = [ - { - lastX: oOptions_.deltaX , - lastY: oOptions_.deltaY, - moved: null, - startX: oOptions_.screenX - oOptions_.startMove.screenX , - startY: oOptions_.screenY - oOptions_.startMove.screenY - } - ]; - - _oDirection = { - vector: oOptions_.vector || null, - orientation : window.orientation || null, - lastX : ((_oDelta[0].lastX > 0) ? +1 : ( (_oDelta[0].lastX < 0) ? -1 : 0 ) ), - lastY : ((_oDelta[0].lastY > 0) ? +1 : ( (_oDelta[0].lastY < 0) ? -1 : 0 ) ), - startX : ((_oDelta[0].startX > 0) ? +1 : ( (_oDelta[0].startX < 0) ? -1 : 0 ) ), - startY : ((_oDelta[0].startY > 0) ? +1 : ( (_oDelta[0].startY < 0) ? -1 : 0 ) ) - }; - - // calculate distance traveled using the pythagorean theorem - _oDelta[0].moved = Math.sqrt(Math.pow(Math.abs(_oDelta[0].startX), 2) + Math.pow(Math.abs(_oDelta[0].startY), 2)); - - } - return { - type: oOptions_.type || null, - originalEvent: oOptions_.event || null, - delta : _oDelta || null, - direction : _oDirection || { orientation : window.orientation || null, vector: oOptions_.vector || null}, - duration: (oOptions_.duration) ? oOptions_.duration : ( oOptions_.startMove.timestamp ) ? _iNow - oOptions_.timestamp : null, - rotation: oOptions_.rotation || null, - scale: oOptions_.scale || null, - description : oOptions_.description || [ - oOptions_.type, - ':', - oOptions_.touches, - ':', - ((_oDelta[0].lastX != 0) ? ((_oDelta[0].lastX > 0) ? 'right' : 'left') : 'steady'), - ':', - ((_oDelta[0].lastY != 0) ? ( (_oDelta[0].lastY > 0) ? 'down' : 'up') :'steady') - ].join('') - }; - - } - - - - /** - * DOM-event handlers - */ - - /** - * Handler: orientationchange - * Triggers the bound orientationchange handler on the window element - * The "orientationchange" handler will receive an object with additional information - * about the event. - * { - * direction : { - * orientation: {-90|0|90|180} - * }, - * description : [ - * 'orientationchange:{landscape:clockwise:|portrait:default|landscape:counterclockwise|portrait:upsidedown}:{-90|0|90|180}' // e.g. 'orientation:landscape:clockwise:-90 - * } - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onOrientationchange(event_) { - - // window.orientation: -90,0,90,180 - var _aDict = ['landscape:clockwise:','portrait:default:','landscape:counterclockwise:','portrait:upsidedown:']; - - $(window).triggerHandler('orientationchange', - { - direction : {orientation: window.orientation}, - description : [ - 'orientationchange:', - _aDict[( (window.orientation / 90) +1)], - window.orientation - ].join('') - }); - } - - - /** - * Handler: devicemotion - * Calculates "motion events" such as shake, tilt, wiggle by observing "changes in space" - * For understanding "directions", place your mobile device on a table with the bottom - * (home button) close to you: - * - x-axis: horizontal left / right - * - y-axis: horizontal front / back (through the home button) - * - z-axis: vertical through your device - * @param {DOM-Event} event_ - * @returns {Object} - * { - * type: eventtype e.g. "shake", - * originalEvent: {DOM-Event}, - * // delta and direction details are just provided for touch not for gesture / motion events - * delta : null, - * direction :{ - * vector: null, - * orientation: -90,0,90,180 || null (window.orienntation) - * } - * rotation: {Number} , // amount of rotation relative to the current position NOT the original - * scale: {Number} , // amount of scaling relative to the current position NOT the original - * duration: {Number}, // ms: duration of the motion - * description : {String} // details as String: pinch:{'close'|'open'} e.g. "pinch:-1:close" || rotate:{'counterclockwise'|'clockwise'} e.g. "rotate:-1:counterclockwise" - * }; - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onDevicemotion(event_) { - - var _sType; - var _$element = jQuery(window); - //var _bHasGyroscope = $.hasGyroscope; - - // skip custom notification: devicemotion is triggered every 0.05s regardlesse of any gesture - - // get options - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - - var _oThreshold = $.jGestures.defaults.thresholdShake; - - // get last position or set initital values - var _oLastDevicePosition = _oDatajQueryGestures.oDeviceMotionLastDevicePosition || { - accelerationIncludingGravity : { - x: 0, - y: 0, - z: 0 - }, - shake : { - eventCount: 0, - intervalsPassed: 0, - intervalsFreeze: 0 - }, - shakeleftright : { - eventCount: 0, - intervalsPassed: 0, - intervalsFreeze: 0 - }, - shakefrontback : { - eventCount: 0, - intervalsPassed: 0, - intervalsFreeze: 0 - }, - shakeupdown : { - eventCount: 0, - intervalsPassed: 0, - intervalsFreeze: 0 - } - }; - - // cache current values - var _oCurrentDevicePosition = { - accelerationIncludingGravity : { - x: event_.accelerationIncludingGravity.x, - y: event_.accelerationIncludingGravity.y, - z: event_.accelerationIncludingGravity.z - }, - shake: { - eventCount: _oLastDevicePosition.shake.eventCount, - intervalsPassed: _oLastDevicePosition.shake.intervalsPassed, - intervalsFreeze: _oLastDevicePosition.shake.intervalsFreeze - }, - shakeleftright: { - eventCount: _oLastDevicePosition.shakeleftright.eventCount, - intervalsPassed: _oLastDevicePosition.shakeleftright.intervalsPassed, - intervalsFreeze: _oLastDevicePosition.shakeleftright.intervalsFreeze - }, - shakefrontback: { - eventCount: _oLastDevicePosition.shakefrontback.eventCount, - intervalsPassed: _oLastDevicePosition.shakefrontback.intervalsPassed, - intervalsFreeze: _oLastDevicePosition.shakefrontback.intervalsFreeze - }, - shakeupdown: { - eventCount: _oLastDevicePosition.shakeupdown.eventCount, - intervalsPassed: _oLastDevicePosition.shakeupdown.intervalsPassed, - intervalsFreeze: _oLastDevicePosition.shakeupdown.intervalsFreeze - } - - }; - - - // options - var _aType; - var _aDescription; - var _oObj; - - - // trigger events for all bound pseudo events on this element - for (_sType in _oDatajQueryGestures) { - // get current pseudo event - - - // trigger bound events on this element - switch(_sType) { - - case 'shake': - case 'shakeleftright': - case 'shakefrontback': - case 'shakeupdown': - - // options - _aType = []; - _aDescription = []; - - _aType.push(_sType); - - // freeze shake - prevent multiple shake events on one shaking motion (user won't stop shaking immediately) - if (++_oCurrentDevicePosition[_sType].intervalsFreeze > _oThreshold.freezeShakes && _oCurrentDevicePosition[_sType].intervalsFreeze < (2*_oThreshold.freezeShakes) ) { break; } - - // set control values - _oCurrentDevicePosition[_sType].intervalsFreeze = 0; - _oCurrentDevicePosition[_sType].intervalsPassed++; - - // check for shaking motions: massive acceleration changes in every direction - if ( ( _sType === 'shake' ||_sType === 'shakeleftright' ) && ( _oCurrentDevicePosition.accelerationIncludingGravity.x > _oThreshold.leftright.sensitivity || _oCurrentDevicePosition.accelerationIncludingGravity.x < (-1* _oThreshold.leftright.sensitivity) ) ) { - _aType.push('leftright'); - _aType.push('x-axis'); - } - - if ( ( _sType === 'shake' ||_sType === 'shakefrontback' ) && (_oCurrentDevicePosition.accelerationIncludingGravity.y > _oThreshold.frontback.sensitivity || _oCurrentDevicePosition.accelerationIncludingGravity.y < (-1 * _oThreshold.frontback.sensitivity) ) ) { - _aType.push('frontback'); - _aType.push('y-axis'); - } - - if ( ( _sType === 'shake' ||_sType === 'shakeupdown' ) && ( _oCurrentDevicePosition.accelerationIncludingGravity.z+9.81 > _oThreshold.updown.sensitivity || _oCurrentDevicePosition.accelerationIncludingGravity.z+9.81 < (-1 * _oThreshold.updown.sensitivity) ) ) { - _aType.push('updown'); - _aType.push('z-axis'); - } - - // at least one successful shaking event - if (_aType.length > 1) { - // minimum number of shaking motions during the defined "time" (messured by events - device event interval: 0.05s) - if (++_oCurrentDevicePosition[_sType].eventCount == _oThreshold.requiredShakes && (_oCurrentDevicePosition[_sType].intervalsPassed) < _oThreshold.freezeShakes ) { - // send event - _$element.triggerHandler(_sType, _createOptions ({type: _sType, description: _aType.join(':'), event:event_,duration:_oCurrentDevicePosition[_sType].intervalsPassed*5 }) ); - // reset - _oCurrentDevicePosition[_sType].eventCount = 0; - _oCurrentDevicePosition[_sType].intervalsPassed = 0; - // freeze shake - _oCurrentDevicePosition[_sType].intervalsFreeze = _oThreshold.freezeShakes+1; - } - // too slow, reset - else if (_oCurrentDevicePosition[_sType].eventCount == _oThreshold.requiredShakes && (_oCurrentDevicePosition[_sType].intervalsPassed) > _oThreshold.freezeShakes ) { - _oCurrentDevicePosition[_sType].eventCount = 0 ; - _oCurrentDevicePosition[_sType].intervalsPassed = 0; - } - } - break; - - } - - // refresh pseudo events - _oObj = {}; - _oObj.oDeviceMotionLastDevicePosition = _oCurrentDevicePosition; - _$element.data('ojQueryGestures',$.extend(true,_oDatajQueryGestures,_oObj)); - - } - } - - - /** - * Handler: touchstart or mousedown - * Setup pseudo-event by storing initial values such as : - * screenX : {Number} - * screenY : {Number} - * timestamp: {Number} - * on the pseudo gesture event and - * sets up additional eventlisteners for handling touchmove events. - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onTouchstart(event_) { - - // ignore bubbled handlers - // if ( event_.currentTarget !== event_.target ) { return; } - - var _$element = jQuery(event_.currentTarget); - // var _$element = jQuery(event_.target); - - // trigger custom notification - _$element.triggerHandler($.jGestures.events.touchstart,event_); - - - // set the necessary touch events - if($.hasGestures) { - event_.currentTarget.addEventListener('touchmove', _onTouchmove, false); - event_.currentTarget.addEventListener('touchend', _onTouchend, false); - } - // event substitution - else { -// event_.currentTarget.addEventListener('mousemove', _onTouchmove, false); -// event_.currentTarget.addEventListener('mouseup', _onTouchend, false); - _$element.bind('mousemove', _onTouchmove); - _$element.bind('mouseup', _onTouchend); - } - - // get stored pseudo event - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - - // var _oEventData = _oDatajQueryGestures[_sType]; - var _eventBase = (event_.touches) ? event_.touches[0] : event_; - // store current values for calculating relative values (changes between touchmoveevents) - var _oObj = {}; - _oObj.oLastSwipemove = { screenX : _eventBase.screenX, screenY : _eventBase.screenY, timestamp:new Date().getTime()}; - _oObj.oStartTouch = { screenX : _eventBase.screenX, screenY : _eventBase.screenY, timestamp:new Date().getTime()}; - - _$element.data('ojQueryGestures',$.extend(true,_oDatajQueryGestures,_oObj)); - } - - - /** - * Handler: touchmove or mousemove - * Calculates the x/y changes since the last event, - * compares it to $.jGestures.defaults.thresholdMove and triggers - * an swipemove event if the distance exceed the - * threshold. - * Custom-event argument object: - * {Object} - * { - * type: e.g. 'swipemove', - * : {DOM-Event}, - * // default: just one entry on the delta-array - the first touchpoint - * // the first touchpoint is the reference point for every gesture, - * // because moving touchpoints in various directions would result in - * // a gesture. - * // delta and direction details are just provided for touch not for gesture / motion events - * delta : [ - * { - * lastX:{Number} , // x-axis: relative to the last touchevent (e.g. touchmove!) - * lastY:{Number}, // y-axis: relative to the last touchevent (e.g. touchmove!) - * moved: {Number}, // distance: relative to the original touchpoint - * startX: {Number} , // relative to the original touchpoint - * startY: {Number} ,// relative to the original touchpoint - * } ], - * // based on the first touchpoint - * direction : { // relative to the last touchevent (e.g. touchmove!) - * vector: {Number}, // -1|+1, indicates the direction if necessary(pinch/rotate) - * orientation: {Number} // window.orientation: -90,0,90,180 || null (window.orienntation) - * lastX : {Number}, // -1,0,+1 relative to the last touchevent (e.g. touchmove!) - * lastY : {Number}, // -1,0,+1 relative to the last touchevent (e.g. touchmove!) - * startX: {Number} , //-1,0,+1 relative to the original touchpoint - * startY: {Number} ,// -1,0,+1 relative to the original touchpoint - * }, - * rotation: null, // gestureonly: amount of rotation relative to the current position NOT the original - * scale: null, // gestureonly: amount of scaling relative to the current position NOT the original - * duration: {Number}, // ms: relative to the original touchpoint - * description : {String} // details as String: {TYPE *}:{TOUCHES 1|2|3|4}:{X-AXIS 'right'|'left'|'steady'}:{Y-AXIS 'down'|'up'|'steady'} e.g. "swipe:1:left:steady" relative to the last touchpoint - * }; - * - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onTouchmove(event_) { - - var _$element = jQuery(event_.currentTarget); - // var _$element = jQuery(event_.target); - - // get stored pseudo event - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - - var _bHasTouches = !!event_.touches; - var _iScreenX = (_bHasTouches) ? event_.changedTouches[0].screenX : event_.screenX; - var _iScreenY = (_bHasTouches) ? event_.changedTouches[0].screenY : event_.screenY; - - //relative to the last event - var _oEventData = _oDatajQueryGestures.oLastSwipemove; - var _iDeltaX = _iScreenX - _oEventData.screenX ; - var _iDeltaY = _iScreenY - _oEventData.screenY; - - var _oDetails; - - // there's a swipemove set (not the first occurance), trigger event - if (!!_oDatajQueryGestures.oLastSwipemove) { - // check - _oDetails = _createOptions({type: 'swipemove', touches: (_bHasTouches) ? event_.touches.length: '1', screenY: _iScreenY,screenX:_iScreenX ,deltaY: _iDeltaY,deltaX : _iDeltaX, startMove:_oEventData, event:event_, timestamp:_oEventData.timestamp}); - _$element.triggerHandler(_oDetails.type,_oDetails); - } - // store the new values - var _oObj = {}; - var _eventBase = (event_.touches) ? event_.touches[0] : event_; - _oObj.oLastSwipemove = { screenX : _eventBase.screenX, screenY : _eventBase.screenY, timestamp:new Date().getTime()}; - _$element.data('ojQueryGestures',$.extend(true,_oDatajQueryGestures,_oObj)); - } - - - /** - * Handler: touchend or mouseup - * Removes the additional handlers (move/end) - * Calculates the x/y changes since the touchstart event - * not in relation to the last move event. - * Triggers the - * swipeone|swipetwo|swipethree|swipefour| - * swipeup|swiperightup|swiperight|swiperightdown|swipedown| - * swipeleftdown|swipeleft|swipeleftup| - * tapone|taptwo|tapthree|tapfour - * event. - * {Object} - * { - * type: eventtype e.g. "swipeone","swipeleftdown", - * originalEvent: {DOM-Event}, - * // default: just one entry on the delta-array - the first touchpoint - * // the first touchpoint is the reference point for every gesture, - * // because moving touchpoints in various directions would result in - * // a gesture. - * // delta and direction details are just provided for touch not for gesture / motion events - * delta : [ - * { - * lastX:{Number} , // x-axis: relative to the last touchevent (e.g. touchmove!) - * lastY:{Number}, // y-axis: relative to the last touchevent (e.g. touchmove!) - * moved: {Number}, // distance: relative to the original touchpoint - * startX: {Number} , // relative to the original touchpoint - * startY: {Number} ,// relative to the original touchpoint - * } ], - * // based on the first touchpoint - * direction : { // relative to the last touchevent (e.g. touchmove!) - * vector: {Number}, // -1|+1, indicates the direction if necessary(pinch/rotate) - * orientation: {Number} // window.orientation: -90,0,90,180 || null (window.orienntation) - * lastX : {Number}, // -1,0,+1 relative to the last touchevent (e.g. touchmove!) - * lastY : {Number}, // -1,0,+1 relative to the last touchevent (e.g. touchmove!) - * startX: {Number} , //-1,0,+1 relative to the original touchpoint - * startY: {Number} ,// -1,0,+1 relative to the original touchpoint - * }, - * rotation: null, - * scale: null , - * duration: {Number}, // ms: relative to the original touchpoint - * description : {String} // details as String: {TYPE *}:{TOUCHES 1|2|3|4}:{X-AXIS 'right'|'left'|'steady'}:{Y-AXIS 'down'|'up'|'steady'} e.g. "swipe:1:left:steady" relative to the last touchpoint - * }; - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onTouchend(event_) { - - // ignore bubbled handlers - // if ( event_.currentTarget !== event_.target ) { return; } - - var _$element = jQuery(event_.currentTarget); - var _bHasTouches = !!event_.changedTouches; - var _iTouches = (_bHasTouches) ? event_.changedTouches.length : '1'; - var _iScreenX = (_bHasTouches) ? event_.changedTouches[0].screenX : event_.screenX; - var _iScreenY = (_bHasTouches) ? event_.changedTouches[0].screenY : event_.screenY; - - // trigger custom notification - _$element.triggerHandler($.jGestures.events.touchendStart,event_); - - // var _$element = jQuery(event_.target); - // remove events - if($.hasGestures) { - event_.currentTarget.removeEventListener('touchmove', _onTouchmove, false); - event_.currentTarget.removeEventListener('touchend', _onTouchend, false); - } - // event substitution - else { -// event_.currentTarget.removeEventListener('mousemove', _onTouchmove, false); -// event_.currentTarget.removeEventListener('mouseup', _onTouchend, false); - _$element.unbind('mousemove', _onTouchmove); - _$element.unbind('mouseup', _onTouchend); - } - // get all bound pseudo events - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - - // if the current change on the x/y position is above the defined threshold for moving an element set the moved flag - // to distinguish between a moving gesture and a shaking finger trying to tap - var _bHasMoved = ( - Math.abs(_oDatajQueryGestures.oStartTouch.screenX - _iScreenX) > $.jGestures.defaults.thresholdMove || - Math.abs(_oDatajQueryGestures.oStartTouch.screenY - _iScreenY) > $.jGestures.defaults.thresholdMove - ) ? true : false; - - // if the current change on the x/y position is above the defined threshold for swiping set the moved flag - // to indicate we're dealing with a swipe gesture - var _bHasSwipeGesture = ( - Math.abs(_oDatajQueryGestures.oStartTouch.screenX - _iScreenX) > $.jGestures.defaults.thresholdSwipe || - Math.abs(_oDatajQueryGestures.oStartTouch.screenY - _iScreenY) > $.jGestures.defaults.thresholdSwipe - ) ? true : false; - - - var _sType; - var _oEventData ; - - var _oDelta; - - // calculate distances in relation to the touchstart position not the last touchmove event! - var _iDeltaX; - var _iDeltaY; - var _oDetails; - - var _aDict = ['zero','one','two','three','four']; - - // swipe marker - var _bIsSwipe; - - - // trigger events for all bound pseudo events on this element - for (_sType in _oDatajQueryGestures) { - - // get current pseudo event - _oEventData = _oDatajQueryGestures.oStartTouch; - - _oDelta = {}; - _iScreenX = (_bHasTouches) ? event_.changedTouches[0].screenX : event_.screenX; - _iScreenY = (_bHasTouches) ? event_.changedTouches[0].screenY : event_.screenY; - // calculate distances in relation to the touchstart position not the last touchmove event! - _iDeltaX = _iScreenX - _oEventData.screenX ; - _iDeltaY = _iScreenY - _oEventData.screenY; - _oDetails = _createOptions({type: 'swipe', touches: _iTouches, screenY: _iScreenY,screenX:_iScreenX ,deltaY: _iDeltaY,deltaX : _iDeltaX, startMove:_oEventData, event:event_, timestamp: _oEventData.timestamp }); - - - // swipe marker - _bIsSwipe = false; - - // trigger bound events on this element - switch(_sType) { - case 'swipeone': - - if( _bHasTouches === false && _iTouches == 1 && _bHasMoved === false){ - // trigger tapone! - break; - } - if (_bHasTouches===false || ( _iTouches == 1 && _bHasMoved === true && _bHasSwipeGesture===true)) { - _bIsSwipe = true; - - _oDetails.type = ['swipe',_aDict[_iTouches]].join(''); - _$element.triggerHandler(_oDetails.type,_oDetails); - } - break; - - case 'swipetwo': - if (( _bHasTouches && _iTouches== 2 && _bHasMoved === true && _bHasSwipeGesture===true)) { - _bIsSwipe = true; - _oDetails.type = ['swipe',_aDict[_iTouches]].join(''); - _$element.triggerHandler(_oDetails.type,_oDetails); - } - break; - - case 'swipethree': - if ( ( _bHasTouches && _iTouches == 3 && _bHasMoved === true && _bHasSwipeGesture===true)) { - _bIsSwipe = true; - _oDetails.type = ['swipe',_aDict[_iTouches]].join(''); - _$element.triggerHandler(_oDetails.type,_oDetails); - } - break; - - case 'swipefour': - if ( ( _bHasTouches && _iTouches == 4 && _bHasMoved === true && _bHasSwipeGesture===true)) { - _bIsSwipe = true; - _oDetails.type = ['swipe',_aDict[_iTouches]].join(''); - _$element.triggerHandler(_oDetails.type,_oDetails); - } - break; - - case 'swipeup': - case 'swiperightup': - case 'swiperight': - case 'swiperightdown': - case 'swipedown': - case 'swipeleftdown': - case 'swipeleft': - case 'swipeleftup': - if ( _bHasTouches && _bHasMoved === true && _bHasSwipeGesture===true) { - _bIsSwipe = true; - _oDetails.type = [ - 'swipe', - ((_oDetails.delta[0].lastX != 0) ? ((_oDetails.delta[0].lastX > 0) ? 'right' : 'left') : ''), - ((_oDetails.delta[0].lastY != 0) ? ((_oDetails.delta[0].lastY > 0) ? 'down' : 'up') :'') - ].join(''); - _$element.triggerHandler(_oDetails.type, _oDetails); - } - break; - - case 'tapone': - case 'taptwo': - case 'tapthree': - case 'tapfour': - if (( /* _bHasTouches && */ _bHasMoved !== true && _bIsSwipe !==true) && (_aDict[_iTouches] ==_sType.slice(3)) ) { - _oDetails.description = ['tap',_aDict[_iTouches]].join(''); - _oDetails.type = ['tap',_aDict[_iTouches]].join(''); - _$element.triggerHandler(_oDetails.type,_oDetails); - } - break; - - } - - // refresh pseudo events - var _oObj = {}; -// _oObj[_sType] = false; -// _oObj.hasTouchmoved = false; - _$element.data('ojQueryGestures',$.extend(true,_oDatajQueryGestures,_oObj)); - _$element.data('ojQueryGestures',$.extend(true,_oDatajQueryGestures,_oObj)); - - } - _$element.triggerHandler($.jGestures.events.touchendProcessed,event_); - } - - - /** - * Handler: gesturestart - * Setup pseudo-event by storing initial values such as : - * timestamp: {Number} - * on the pseudo gesture event - * Since the gesture-event doesn't supply event.touches no tuchpoints will be calculated - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onGesturestart(event_) { - - // ignore bubbled handlers - // if ( event_.currentTarget !== event_.target ) { return; } - - var _$element = jQuery(event_.currentTarget); - // var _$element = jQuery(event_.target); - - // trigger custom notification - _$element.triggerHandler($.jGestures.events.gesturestart,event_); - - - // get stored pseudo event - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - - // var _oEventData = _oDatajQueryGestures[_sType]; - // store current values for calculating relative values (changes between touchmoveevents) - var _oObj = {}; - _oObj.oStartTouch = {timestamp:new Date().getTime()}; - _$element.data('ojQueryGestures',$.extend(true,_oDatajQueryGestures,_oObj)); - } - - /** - * Handler: gesturechange - * Read the event_.scale / event_.rotate values, - * an triggers a pinch|rotate event if necessary. - * Since the gesture-event doesn't supply event.touches no tuchpoints will be calculated - * @returns {Object} - * { - * type: eventtype e.g. "pinch","rotate", - * originalEvent: {DOM-Event}, - * // delta and direction details are just provided for touch not for gesture / motion events - * delta : null, - * direction : { - * vector: {Number}, // -1|+1, indicates the direction if necessary(pinch/rotate) - * orientation: {Number} // window.orientation: -90,0,90,180 || null (window.orienntation) - * }, - * rotation: {Number} , // amount of rotation relative to the current position NOT the original - * scale: {Number} , // amount of scaling relative to the current position NOT the original - * duration: {Number}, // ms: relative to the original touchpoint - * description : {String} // details as String: pinch:{'close'|'open'} e.g. "pinch:-1:close" || rotate:{'counterclockwise'|'clockwise'} e.g. "rotate:-1:counterclockwise" - * }; - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onGesturechange(event_) { - - // ignore bubbled handlers - // if ( event_.currentTarget !== event_.target ) { return; } - - var _$element = jQuery(event_.currentTarget); - // var _$element = jQuery(event_.target); - var _iDelta,_iDirection,_sDesc,_oDetails; - // get all pseudo events - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - - // trigger events for all bound pseudo events on this element - var _sType; - for (_sType in _oDatajQueryGestures) { - - // trigger a specific bound event - switch(_sType) { - - case 'pinch': - _iDelta = event_.scale; - if ( ( ( _iDelta < 1 ) && (_iDelta % 1) < (1 - $.jGestures.defaults.thresholdPinchclose) ) || ( ( _iDelta > 1 ) && (_iDelta % 1) > ($.jGestures.defaults.thresholdPinchopen) ) ) { - _iDirection = (_iDelta < 1 ) ? -1 : +1 ; - _oDetails = _createOptions({type: 'pinch', scale: _iDelta, touches: null,startMove:_oDatajQueryGestures.oStartTouch, event:event_, timestamp: _oDatajQueryGestures.oStartTouch.timestamp, vector:_iDirection, description: ['pinch:',_iDirection,':' , ( (_iDelta < 1 ) ? 'close' : 'open' )].join('') }); - _$element.triggerHandler(_oDetails.type, _oDetails); - } - break; - - case 'rotate': - _iDelta = event_.rotation; - if ( ( ( _iDelta < 1 ) && ( -1*(_iDelta) > $.jGestures.defaults.thresholdRotateccw ) ) || ( ( _iDelta > 1 ) && (_iDelta > $.jGestures.defaults.thresholdRotatecw) ) ) { - _iDirection = (_iDelta < 1 ) ? -1 : +1 ; - _oDetails = _createOptions({type: 'rotate', rotation: _iDelta, touches: null, startMove:_oDatajQueryGestures.oStartTouch, event:event_, timestamp: _oDatajQueryGestures.oStartTouch.timestamp, vector:_iDirection, description: ['rotate:',_iDirection,':' , ( (_iDelta < 1 ) ? 'counterclockwise' : 'clockwise' )].join('') }); - _$element.triggerHandler(_oDetails.type, _oDetails); - } - break; - - } - } - - } - - - /** - * Handler: gestureend - * Read the event_.scale / event_.rotate values, - * compares it to $.jGestures.defaults.threshold* and triggers - * a pinchclose|pinchclose|rotatecw|rotateccw event if the distance exceed the - * Since the gesture-event doesn't supply event.touches no tuchpoints will be calculated - * * Custom-event argument object: - * @returns {Object} - * { - * type: eventtype e.g. "pinchclose","pinchopen", "rotatecw", "rotateccw", - * originalEvent: {DOM-Event}, - * // delta and direction details are just provided for touch not for gesture / motion events - * delta : null, - * // based on the first touchpoint - * direction : { - * vector: {Number}, // -1|+1, indicates the direction if necessary(pinch/rotate) - * orientation: {Number} // window.orientation: -90,0,90,180 || null (window.orienntation) - * }, - * rotation: {Number} , // amount of rotation relative to the current position NOT the original - * scale: {Number} , // amount of scaling relative to the current position NOT the original - * duration: {Number}, // ms: relative to the original touchpoint - * description : {String} // details as String: pinch:{'close'|'open'} e.g. "pinch:-1:close" || rotate:{'counterclockwise'|'clockwise'} e.g. "rotate:-1:counterclockwise" - * }; - * @param {DOM-Event} event_ - * @return {Void} - */ - function _onGestureend(event_) { - // ignore bubbled handlers - // if ( event_.currentTarget !== event_.target ) { return; } - - var _$element = jQuery(event_.currentTarget); - // var _$element = jQuery(event_.target); - - // trigger custom notification - _$element.triggerHandler($.jGestures.events.gestureendStart,event_); - - var _iDelta; - var _oDatajQueryGestures = _$element.data('ojQueryGestures'); - - // trigger handler for every bound event - var _sType; - for (_sType in _oDatajQueryGestures) { - - switch(_sType) { - - case 'pinchclose': - _iDelta = event_.scale; - if (( _iDelta < 1 ) && (_iDelta % 1) < (1 - $.jGestures.defaults.thresholdPinchclose)) { - _$element.triggerHandler('pinchclose', _createOptions ({type: 'pinchclose', scale:_iDelta, vector: -1, touches: null, startMove: _oDatajQueryGestures.oStartTouch, event:event_, timestamp:_oDatajQueryGestures.oStartTouch.timestamp,description: 'pinch:-1:close' }) ); - } - break; - - case 'pinchopen': - _iDelta = event_.scale; - if ( ( _iDelta > 1 ) && (_iDelta % 1) > ($.jGestures.defaults.thresholdPinchopen) ) { - _$element.triggerHandler('pinchopen', _createOptions ({type: 'pinchopen', scale:_iDelta, vector: +1, touches: null, startMove: _oDatajQueryGestures.oStartTouch, event:event_, timestamp:_oDatajQueryGestures.oStartTouch.timestamp,description: 'pinch:+1:open'}) ); - } - break; - - case 'rotatecw': - _iDelta = event_.rotation; - if ( ( _iDelta > 1 ) && (_iDelta > $.jGestures.defaults.thresholdRotatecw) ) { - _$element.triggerHandler('rotatecw', _createOptions ({type: 'rotatecw', rotation:_iDelta, vector: +1, touches: null, startMove: _oDatajQueryGestures.oStartTouch, event:event_, timestamp:_oDatajQueryGestures.oStartTouch.timestamp,description: 'rotate:+1:clockwise'}) ); - } - break; - - case 'rotateccw': - _iDelta = event_.rotation; - if ( ( _iDelta < 1 ) && ( -1*(_iDelta) > $.jGestures.defaults.thresholdRotateccw ) ) { - _$element.triggerHandler('rotateccw', _createOptions ({type: 'rotateccw', rotation:_iDelta, vector: -1, touches: null, startMove: _oDatajQueryGestures.oStartTouch, event:event_, timestamp:_oDatajQueryGestures.oStartTouch.timestamp,description: 'rotate:-1:counterclockwise'}) ); - } - break; - - } - } - _$element.triggerHandler($.jGestures.events.gestureendProcessed,event_); - } - } -)(jQuery); diff --git a/public/wap/crmeb/module/store_service/moment.min.js b/public/wap/crmeb/module/store_service/moment.min.js deleted file mode 100644 index 4e8497a9..00000000 --- a/public/wap/crmeb/module/store_service/moment.min.js +++ /dev/null @@ -1,6 +0,0 @@ -// moment.js -// version : 2.0.0 -// author : Tim Wood -// license : MIT -// momentjs.com -(function(e){function O(e,t){return function(n){return j(e.call(this,n),t)}}function M(e){return function(t){return this.lang().ordinal(e.call(this,t))}}function _(){}function D(e){H(this,e)}function P(e){var t=this._data={},n=e.years||e.year||e.y||0,r=e.months||e.month||e.M||0,i=e.weeks||e.week||e.w||0,s=e.days||e.day||e.d||0,o=e.hours||e.hour||e.h||0,u=e.minutes||e.minute||e.m||0,a=e.seconds||e.second||e.s||0,f=e.milliseconds||e.millisecond||e.ms||0;this._milliseconds=f+a*1e3+u*6e4+o*36e5,this._days=s+i*7,this._months=r+n*12,t.milliseconds=f%1e3,a+=B(f/1e3),t.seconds=a%60,u+=B(a/60),t.minutes=u%60,o+=B(u/60),t.hours=o%24,s+=B(o/24),s+=i*7,t.days=s%30,r+=B(s/30),t.months=r%12,n+=B(r/12),t.years=n}function H(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function B(e){return e<0?Math.ceil(e):Math.floor(e)}function j(e,t){var n=e+"";while(n.length68?1900:2e3);break;case"YYYY":case"YYYYY":s[0]=~~t;break;case"a":case"A":n._isPm=(t+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":s[3]=~~t;break;case"m":case"mm":s[4]=~~t;break;case"s":case"ss":s[5]=~~t;break;case"S":case"SS":case"SSS":s[6]=~~(("0."+t)*1e3);break;case"X":n._d=new Date(parseFloat(t)*1e3);break;case"Z":case"ZZ":n._useUTC=!0,r=(t+"").match(x),r&&r[1]&&(n._tzh=~~r[1]),r&&r[2]&&(n._tzm=~~r[2]),r&&r[0]==="+"&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}t==null&&(n._isValid=!1)}function J(e){var t,n,r=[];if(e._d)return;for(t=0;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];r[3]+=e._tzh||0,r[4]+=e._tzm||0,n=new Date(0),e._useUTC?(n.setUTCFullYear(r[0],r[1],r[2]),n.setUTCHours(r[3],r[4],r[5],r[6])):(n.setFullYear(r[0],r[1],r[2]),n.setHours(r[3],r[4],r[5],r[6])),e._d=n}function K(e){var t=e._f.match(a),n=e._i,r,i;e._a=[];for(r=0;r0,f[4]=n,Z.apply({},f)}function tt(e,n,r){var i=r-n,s=r-e.day();return s>i&&(s-=7),s11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var n=this._calendar[e];return typeof n=="function"?n.apply(t):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,n,r){var i=this._relativeTime[n];return typeof i=="function"?i(e,t,n,r):i.replace(/%d/i,e)},pastFuture:function(e,t){var n=this._relativeTime[e>0?"future":"past"];return typeof n=="function"?n(t):n.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return tt(e,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},t=function(e,t,n){return nt({_i:e,_f:t,_l:n,_isUTC:!1})},t.utc=function(e,t,n){return nt({_useUTC:!0,_isUTC:!0,_l:n,_i:e,_f:t})},t.unix=function(e){return t(e*1e3)},t.duration=function(e,n){var r=t.isDuration(e),i=typeof e=="number",s=r?e._data:i?{}:e,o;return i&&(n?s[n]=e:s.milliseconds=e),o=new P(s),r&&e.hasOwnProperty("_lang")&&(o._lang=e._lang),o},t.version=n,t.defaultFormat=E,t.lang=function(e,n){var r;if(!e)return t.fn._lang._abbr;n?R(e,n):s[e]||U(e),t.duration.fn._lang=t.fn._lang=U(e)},t.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),U(e)},t.isMoment=function(e){return e instanceof D},t.isDuration=function(e){return e instanceof P},t.fn=D.prototype={clone:function(){return t(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return t.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return this._isValid==null&&(this._a?this._isValid=!q(this._a,(this._isUTC?t.utc(this._a):t(this._a)).toArray()):this._isValid=!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(e){var n=X(this,e||t.defaultFormat);return this.lang().postformat(n)},add:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,1),this},subtract:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,-1),this},diff:function(e,n,r){var i=this._isUTC?t(e).utc():t(e).local(),s=(this.zone()-i.zone())*6e4,o,u;return n&&(n=n.replace(/s$/,"")),n==="year"||n==="month"?(o=(this.daysInMonth()+i.daysInMonth())*432e5,u=(this.year()-i.year())*12+(this.month()-i.month()),u+=(this-t(this).startOf("month")-(i-t(i).startOf("month")))/o,n==="year"&&(u/=12)):(o=this-i-s,u=n==="second"?o/1e3:n==="minute"?o/6e4:n==="hour"?o/36e5:n==="day"?o/864e5:n==="week"?o/6048e5:o),r?u:B(u)},from:function(e,n){return t.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!n)},fromNow:function(e){return this.from(t(),e)},calendar:function(){var e=this.diff(t().startOf("day"),"days",!0),n=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(n,this))},isLeapYear:function(){var e=this.year();return e%4===0&&e%100!==0||e%400===0},isDST:function(){return this.zone()+t(e).startOf(n)},isBefore:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)<+t(e).startOf(n)},isSame:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)===+t(e).startOf(n)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return t.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(e){var n=r((t(this).startOf("day")-t(this).startOf("year"))/864e5)+1;return e==null?n:this.add("d",e-n)},isoWeek:function(e){var t=tt(this,1,4);return e==null?t:this.add("d",(e-t)*7)},week:function(e){var t=this.lang().week(this);return e==null?t:this.add("d",(e-t)*7)},lang:function(t){return t===e?this._lang:(this._lang=U(t),this)}};for(i=0;i"+to_unickname+"的记录"); - var query = new Object(); - query.uid = uid; - query.to_uid = to_uid; - query.page = page; - query.mer_id = mer_id; - $.ajax({ - type:"post", - url:"/wap/auth_api/get_msn", - data:query, - dataType:"json", - async:true, - success: function(data){ - if(data.code == 200 && data.data.length > 0){ - //取原高度 - jili=$(".kj").height(); - - html = moban_msn(data.data); - $(".duihua").prepend(html); - - //更新滚动距离 - conter(jili); - }else{ - load_over = true; - } - //关闭提示框 - ts_no(); - } - }); - } - - //发送添加消息 - function add_msn(msn,type){ - var query = new Object(); - query.uid = uid; - query.to_uid = to_uid; - query.msn = msn; - query.type = type; - query.mer_id = mer_id; - $.ajax({ - type:"post", - url:"/wap/auth_api/add_msn", - data:query, - dataType:"json", - async:true, - success: function(data){ - //合成我的消息 - if(type == "html") - json_msn(msn); - else - json_msn($('
').text(msn).html()); - } - }); - } - - //页面刷新消息显示 - function refresh_msn(){ - var query = new Object(); - query.uid = uid; - query.to_uid = to_uid; - query.mer_id = mer_id; - $.ajax({ - type:"post", - url:"/wap/auth_api/refresh_msn", - data:query, - dataType:"json", - async:true, - success: function(data){ - if(data.code == 200 && data.data.length > 0){ - html = moban_msn(data.data); - $(".duihua").append(html); - bottom(); - } - } - }); - } - - //聊天显示时间处理 - function timedate(sdate,type){ - //取今天0点时间戳 - today = new Date(); - today.setHours(0); - today.setMinutes(0); - today.setSeconds(0); - today.setMilliseconds(0); - today=Date.parse(today); - //时间戳计算 - var oneday = 1000 * 60 * 60 * 24; - //取昨天0点 - tooday=today-oneday; - //取前天0点 - toooday=today-oneday*2; - //取7天0点 - tooooday=today-oneday*7; - //js的时间戳和php的时间戳少4位 - sdate=parseInt(sdate)*1000; - d=new Date(sdate); - if(sdate > today){//判断是否在今天内 - res = moment(d).format('ah:mm'); - } - - if(sdate < today){//判断是否是昨天 - res = moment(d).format('昨天 ah:mm'); - if(type == 1) - res="昨天"; - } - - if(sdate < tooday){//判断是否昨天前 显示前天 - res = moment(d).format('前天 ah:mm'); - if(type == 1) - res="前天"; - } - - if(sdate < toooday){//判断是否前天前 显示星期 - res = moment(d).format('dddd ah:mm'); - if(type == 1) - res=moment(d).format('dddd'); - } - - if(sdate < tooooday){//判断是否7天前 - res = moment(d).format('YYYY年M月D日 ah:mm'); - if(type == 1) - res=moment(d).format('YY/M/D'); - } - res =res.replace("am", "上午"); - res =res.replace("pm", "下午"); - res =res.replace("Sunday", "星期天"); - res =res.replace("Saturday", "星期六"); - res =res.replace("Monday", "星期一"); - res =res.replace("Tuesday", "星期二"); - res =res.replace("Wednesday", "星期三"); - res =res.replace("Thursday", "星期四"); - res =res.replace("Friday", "星期五"); - return res; - } - /******************全局方法*********************/ - - - //点击发送消息 - function msn_add(){ - if($("#msn").val() != ""){ - //取消息 - msn=$("#msn").val(); - - //编辑框清空 - $("#msn").val(""); - - //添加信息 - add_msn(msn,"auto"); - } - } - - //合成我的消息json - function json_msn(msn){ - msn=msn.replace(/(^\s*)|(\s*$)/g,""); - if(msn !== ""){ - var obj = new Object(); - obj.my = "my"; - obj.msn = msn; - obj.add_time = moment().format('X'); - data = "["+JSON.stringify(obj)+"]"; - // data='[{"my":"my","msn":"'+msn+'","add_time":"'+moment().format('X')+'"}]'; - html = moban_msn(JSON.parse(data)); - $(".duihua").append(html); - bottom(); - } - } - - //表情替换模版 - function moban_bq(name){ - jc=0; - var moj = new Array(); - moj['阿'] = 1; - moj['唉'] = 2; - moj['拜拜'] = 3; - moj['板砖拍你'] = 4; - moj['暴走'] = 5; - moj['悲伤'] = 6; - moj['鼻出血'] = 7; - moj['别逼我'] = 8; - moj['不高兴'] = 9; - moj['崇拜'] = 10; - moj['出发'] = 11; - moj['打你'] = 12; - moj['打肿'] = 13 ; - moj['大哭'] = 14 ; - moj['大喷血'] = 15; - moj['大笑'] =16 ; - moj['发呆'] =17 ; - moj['愤怒'] = 18; - moj['感觉真好'] = 19; - moj['哈哈'] = 20; - moj['害羞'] = 21; - moj['好困'] = 22; - moj['好冷'] = 23; - moj['好美'] =24 ; - moj['好色'] = 25; - moj['黑客'] =26 ; - moj['怀疑'] =27 ; - moj['坏淫'] =28 ; - moj['惊讶'] = 29; - moj['可爱'] = 30; - moj['可怜'] =31 ; - moj['老大'] =32 ; - moj['流口水'] = 33; - moj['妈呀'] =34 ; - moj['你懂得'] =35 ; - moj['牛B'] = 36; - moj['亲亲'] =37 ; - moj['确定'] = 38; - moj['塞饭'] = 39; - moj['神阿'] = 40; - moj['生气'] =41 ; - moj['受伤'] = 42; - moj['说唱'] = 43; - moj['偷看'] =44 ; - moj['投降'] =45 ; - moj['无奈'] = 46; - moj['咽气'] =47 ; - moj['郁闷'] =48 ; - moj['找炮轰'] = 49; - moj[ '真臭'] =50; - moj['蜘蛛侠'] = 51; - moj['自信'] = 52; - moj['做梦'] = 53; - while(jc==0){ - shou=name.indexOf("["); - wei=name.indexOf("]"); - if(shou > -1 && wei > -1){ - temp=name.substring(shou,wei+1); - bq_name=temp.replace("[", ""); - bq_name=bq_name.replace("]", ""); - - html=''; - name=name.replace(temp,html); - }else{ - jc=1; - } - } - return name; - } - - //对话窗口模版 - function moban_duihua(){ - if(mer_id > 0) - $(".kj").html('
'); - else - $(".kj").html('
'); - var html= '
'+ - '
'+ - ''+ - ''+ - '发送'+ - ''+ - ''+ - ''+ - '
'+ - '
'+ - '
    '+ - '
  • '+ - ''+ - '
    '+moban_bq("[大笑]")+'
    '+ - '
    '+moban_bq("[哈哈]")+'
    '+ - '
    '+moban_bq("[感觉真好]")+'
    '+ - '
    '+moban_bq("[拜拜]")+'
    '+ - '
    '+moban_bq("[害羞]")+'
    '+ - '
    '+moban_bq("[亲亲]")+'
    '+ - '
    '+moban_bq("[可爱]")+'
    '+ - '
    '+moban_bq("[阿]")+'
    '+ - '
    '+moban_bq("[唉]")+'
    '+ - '
    '+moban_bq("[悲伤]")+'
    '+ - '
    '+moban_bq("[鼻出血]")+'
    '+ - '
    '+moban_bq("[别逼我]")+'
    '+ - '
    '+moban_bq("[不高兴]")+'
    '+ - '
    '+moban_bq("[崇拜]")+'
    '+ - '
    '+moban_bq("[出发]")+'
    '+ - '
    '+moban_bq("[打你]")+'
    '+ - '
    '+moban_bq("[打肿]")+'
    '+ - '
    '+moban_bq("[大哭]")+'
    '+ - '
    '+moban_bq("[大喷血]")+'
    '+ - '
    '+moban_bq("[发呆]")+'
    '+ - '
    '+moban_bq("[愤怒]")+'
    '+ - '
    '+ - '
  • '+ - '
  • '+ - ''+ - '
    '+moban_bq("[好困]")+'
    '+ - '
    '+moban_bq("[好冷]")+'
    '+ - '
    '+moban_bq("[好美]")+'
    '+ - '
    '+moban_bq("[好色]")+'
    '+ - '
    '+moban_bq("[黑客]")+'
    '+ - '
    '+moban_bq("[怀疑]")+'
    '+ - '
    '+moban_bq("[坏淫]")+'
    '+ - '
    '+moban_bq("[惊讶]")+'
    '+ - '
    '+moban_bq("[可怜]")+'
    '+ - '
    '+moban_bq("[老大]")+'
    '+ - '
    '+moban_bq("[流口水]")+'
    '+ - '
    '+moban_bq("[妈呀]")+'
    '+ - '
    '+moban_bq("[你懂得]")+'
    '+ - '
    '+moban_bq("[牛B]")+'
    '+ - '
    '+moban_bq("[确定]")+'
    '+ - '
    '+moban_bq("[塞饭]")+'
    '+ - '
    '+moban_bq("[神阿]")+'
    '+ - '
    '+moban_bq("[生气]")+'
    '+ - '
    '+moban_bq("[受伤]")+'
    '+ - '
    '+moban_bq("[投降]")+'
    '+ - '
    '+moban_bq("[偷看]")+'
    '+ - '
    '+ - '
  • '+ - '
  • '+ - ''+ - '
    '+moban_bq("[无奈]")+'
    '+ - '
    '+moban_bq("[咽气]")+'
    '+ - '
    '+moban_bq("[郁闷]")+'
    '+ - '
    '+moban_bq("[找炮轰]")+'
    '+ - '
    '+moban_bq("[真臭]")+'
    '+ - '
    '+moban_bq("[做梦]")+'
    '+ - '
    '+moban_bq("[自信]")+'
    '+ - '
    '+moban_bq("[暴走]")+'
    '+ - '
    '+moban_bq("[板砖拍你]")+'
    '+ - '
    '+moban_bq("[说唱]")+'
    '+ - '
    '+moban_bq("[蜘蛛侠]")+'
    '+ - '
    '+ - '
  • '+ - '
'+ - '
'+ - '
'; - $(".kj").after(html); - if(mer_id > 0){ - var html = '
'; - html += ''; - html += '
'+mer_name+'
'; - html += '进店'; - html += '
'; - $(".kj").before(html); - } - } - - //对话窗口所用的js - function moban_duihua_js(){ - //当按下回车时,发送消息 - $("#msn").keyup(function(){ - if(event.keyCode == 13){ - $(".msn_k b").trigger("click"); - } - }); - - //打开表情窗口 - $(".msn i.express_icon").click(function(){ - $(".biaoqing").show(); - $(".duihua").css("padding-bottom","190px"); - bottom(); - }); - - //当点击其它区域时 关闭表情窗口 - $("#msn,.msn_k b,.duihua").click(function(){ - $(".biaoqing").hide(); - $(".duihua").css("padding-bottom","60px"); - }) - - //表情轮播 - var slidey=$('.biaoqing').unslider({ - delay: false, - dots: true - }); - sliden = slidey.data('unslider'); - - //表情滑动 - $(".biaoqing ul").swipe({ - swipeStatus:function(event, phase, direction, distance, duration,fingerCount) { - if(direction == "left")//手指按住向左 表情跟随 - $(this).css({"margin-left":"-"+distance+"px"}); - if(direction == "right")//手指按住向右 表情跟随 - $(this).css({"margin-left":distance+"px"}); - - if(phase == "cancel" || phase == "end"){//停止时 - if(distance > 50){//滑动像素大于 30 - $(this).css({"margin-left":"0"}); - if(direction == "left") //向左滑动 - sliden.next(); - if(direction == "right") //向右滑动 - sliden.prev(); - } - else{ - $(this).animate({marginLeft:"0"},300); - } - } - }, - }); - - //表情滑动 - $(".biaoqing ul").swipe({ - swipeStatus:function(event, phase, direction, distance, duration,fingerCount) { - if(direction == "left")//手指按住向左 表情跟随 - $(this).css({"margin-left":"-"+distance+"px"}); - if(direction == "right")//手指按住向右 表情跟随 - $(this).css({"margin-left":distance+"px"}); - - if(phase == "cancel" || phase == "end"){//停止时 - if(distance > 50){//滑动像素大于 30 - $(this).css({"margin-left":"0"}); - if(direction == "left") //向左滑动 - sliden.next(); - if(direction == "right") //向右滑动 - sliden.prev(); - } - else{ - $(this).animate({marginLeft:"0"},300); - } - } - }, - }); - - //表情滑动 - $(".biaoqing ul").swipe({ - swipeStatus:function(event, phase, direction, distance, duration,fingerCount) { - if(direction == "left")//手指按住向左 表情跟随 - $(this).css({"margin-left":"-"+distance+"px"}); - if(direction == "right")//手指按住向右 表情跟随 - $(this).css({"margin-left":distance+"px"}); - - if(phase == "cancel" || phase == "end"){//停止时 - if(distance > 50){//滑动像素大于 30 - $(this).css({"margin-left":"0"}); - if(direction == "left")//向左滑动 - sliden.next(); - if(direction == "right")//向右滑动 - sliden.prev(); - } - else{ - $(this).animate({marginLeft:"0"},300); - } - } - }, - }); - - //点击表情添加 - $(".biaoqing ul li span div img").swipe({ - click:function(){ - title=$(this).attr("title");//取在title标签中的内容 - $("#msn").val($("#msn").val()+"["+title+"]"); - } - }); - - page=1; //初始化分页 - ajax_get_list(page); //首次加载聊天记录 - $(window).scroll(function() { - //console.log($(window).scrollTop()); - if ($(window).scrollTop() <= 0 && !load_over) { - page++;//更新分页 - ajax_get_list(page);//加载此分页聊天记录 - } - }); - // $(".duihua").bind('swipeone',function(){ - // alert("zhixing!"); - // if ($(window).scrollTop() <= 0) { - // page++;//更新分页 - // ajax_get_list(page);//加载此分页聊天记录 - // } - // }); - } - - - - //消息模版 - function moban_msn(data){ - var html = ""; - for(var i=0;i 60){ - html +='

'+timedate(data[i].add_time,0)+'

'; - - //更新全局时间戳 - moban_time=data[i].add_time; - } - //模版开始 - html +='
'+ - '
'+ - ''+ - '
'+ - ''+ - '
'+moban_bq(data[i].msn)+'
'+ - '
'; - } - return html; - } - - - - //滚动到底部 - function bottom(){ - $('html,body').animate({scrollTop:$(".kj").height()}, 500); - } - - //顶上有新记录时,要滚动到以前的顶部距离 - function conter(jili){ - //取没更新的距离 减更新过的距离,就是要滚动到的高度 - $conter_jili=$(".kj").height()-jili - $(document).scrollTop($conter_jili); - - } diff --git a/public/wap/crmeb/module/store_service/unslider.js b/public/wap/crmeb/module/store_service/unslider.js deleted file mode 100644 index ad8828e3..00000000 --- a/public/wap/crmeb/module/store_service/unslider.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Unslider by @idiot - */ - -(function($, f) { - // If there's no jQuery, Unslider can't work, so kill the operation. - if(!$) return f; - - var Unslider = function() { - // Set up our elements - this.el = f; - this.items = f; - - // Dimensions - this.sizes = []; - this.max = [0,0]; - - // Current inded - this.current = 0; - - // Start/stop timer - this.interval = f; - - // Set some options - this.opts = { - speed: 500, - delay: 3000, // f for no autoplay - complete: f, // when a slide's finished - keys: !f, // keyboard shortcuts - disable if it breaks things - dots: f, // display ••••o• pagination - fluid: f // is it a percentage width?, - }; - - // Create a deep clone for methods where context changes - var _ = this; - - this.init = function(el, opts) { - this.el = el; - this.ul = el.children('ul'); - this.max = [el.outerWidth(), el.outerHeight()]; - this.items = this.ul.children('li').each(this.calculate); - - // Check whether we're passing any options in to Unslider - this.opts = $.extend(this.opts, opts); - - // Set up the Unslider - this.setup(); - - return this; - }; - - // Get the width for an element - // Pass a jQuery element as the context with .call(), and the index as a parameter: Unslider.calculate.call($('li:first'), 0) - this.calculate = function(index) { - var me = $(this), - width = me.outerWidth(), height = me.outerHeight(); - - // Add it to the sizes list - _.sizes[index] = [width, height]; - - // Set the max values - if(width > _.max[0]) _.max[0] = width; - if(height > _.max[1]) _.max[1] = height; - }; - - // Work out what methods need calling - this.setup = function() { - // Set the main element - this.el.css({ - overflow: 'hidden', - width: _.max[0], - height: this.items.first().outerHeight() - }); - - // Set the relative widths - this.ul.css({width: (this.items.length * 100) + '%', position: 'relative'}); - this.items.css('width', (100 / this.items.length) + '%'); - - if(this.opts.delay !== f) { - this.start(); - this.el.hover(this.stop, this.start); - } - - // Custom keyboard support - this.opts.keys && $(document).keydown(this.keys); - - // Dot pagination - this.opts.dots && this.dots(); - - // Little patch for fluid-width sliders. Screw those guys. - if(this.opts.fluid) { - var resize = function() { - _.el.css('width', Math.min(Math.round((_.el.outerWidth() / _.el.parent().outerWidth()) * 100), 100) + '%'); - }; - - resize(); - $(window).resize(resize); - } - - if(this.opts.arrows) { - this.el.parent().append('

') - .find('.arrows span').click(function() { - $.isFunction(_[this.className]) && _[this.className](); - }); - }; - - // Swipe support - if($.event.swipe) { - this.el.on('swipeleft', _.prev).on('swiperight', _.next); - } - }; - - // Move Unslider to a slide index - this.move = function(index, cb) { - // If it's out of bounds, go to the first slide - if(!this.items.eq(index).length) index = 0; - if(index < 0) index = (this.items.length - 1); - - var target = this.items.eq(index); - var obj = {height: target.outerHeight()}; - var speed = cb ? 5 : this.opts.speed; - - if(!this.ul.is(':animated')) { - // Handle those pesky dots - _.el.find('.dot:eq(' + index + ')').addClass('active').siblings().removeClass('active'); - - this.el.animate(obj, speed) && this.ul.animate($.extend({left: '-' + index + '00%'}, obj), speed, function(data) { - _.current = index; - $.isFunction(_.opts.complete) && !cb && _.opts.complete(_.el); - }); - } - }; - - // Autoplay functionality - this.start = function() { - _.interval = setInterval(function() { - _.move(_.current + 1); - }, _.opts.delay); - }; - - // Stop autoplay - this.stop = function() { - _.interval = clearInterval(_.interval); - return _; - }; - - // Keypresses - this.keys = function(e) { - var key = e.which; - var map = { - // Prev/next - 37: _.prev, - 39: _.next, - - // Esc - 27: _.stop - }; - - if($.isFunction(map[key])) { - map[key](); - } - }; - - // Arrow navigation - this.next = function() { return _.stop().move(_.current + 1) }; - this.prev = function() { return _.stop().move(_.current - 1) }; - - this.dots = function() { - // Create the HTML - var html = '
    '; - $.each(this.items, function(index) { html += '
  1. ' + (index + 1) + '
  2. '; }); - html += '
'; - - // Add it to the Unslider - this.el.addClass('has-dots').append(html).find('.dot').click(function() { - _.move($(this).index()); - }); - }; - }; - - // Create a jQuery plugin - $.fn.unslider = function(o) { - var len = this.length; - - // Enable multiple-slider support - return this.each(function(index) { - // Cache a copy of $(this), so it - var me = $(this); - var instance = (new Unslider).init(me, o); - - // Invoke an Unslider instance - me.data('unslider' + (len > 1 ? '-' + (index + 1) : ''), instance); - }); - }; -})(window.jQuery, false); \ No newline at end of file