Authored by 梁志锋

gulp ge文件提交

@@ -1702,9 +1702,12 @@ var $ = require("jquery"), @@ -1702,9 +1702,12 @@ var $ = require("jquery"),
1702 var start = 0, 1702 var start = 0,
1703 swiperClass, 1703 swiperClass,
1704 $logotrans = $('.home-header .logo'), 1704 $logotrans = $('.home-header .logo'),
  1705 + $choseArea = $('.side-nav .first'),
1705 openSideNav = false, 1706 openSideNav = false,
1706 isen = true; 1707 isen = true;
1707 1708
  1709 +var innerScroll = require("js/plugin/inner-scroll");
  1710 +
1708 lazyLoad($('img.lazy')); 1711 lazyLoad($('img.lazy'));
1709 1712
1710 $('.nav-btn').on('touchstart', function(event) { 1713 $('.nav-btn').on('touchstart', function(event) {
@@ -1718,6 +1721,8 @@ $('.nav-btn').on('touchstart', function(event) { @@ -1718,6 +1721,8 @@ $('.nav-btn').on('touchstart', function(event) {
1718 $sideNav.css('pointer-events', 'auto'); 1721 $sideNav.css('pointer-events', 'auto');
1719 }, 400); 1722 }, 400);
1720 1723
  1724 + innerScroll.disableScroll($choseArea);
  1725 +
1721 return false; 1726 return false;
1722 }); 1727 });
1723 1728
@@ -1732,16 +1737,13 @@ function hideSideBar() { @@ -1732,16 +1737,13 @@ function hideSideBar() {
1732 } 1737 }
1733 1738
1734 $('.overlay').on('touchstart', function(e) { 1739 $('.overlay').on('touchstart', function(e) {
  1740 + innerScroll.enableScroll($choseArea);
1735 hideSideBar(); 1741 hideSideBar();
1736 return false; 1742 return false;
1737 }); 1743 });
1738 1744
1739 -$sideNav.on('touchmove', function(e) {  
1740 - return false;  
1741 -});  
1742 -  
1743 -//点击一级导航,弹出二级导航  
1744 -$sideNav.on('touchstart', 'li', function(e) { 1745 +// 点击一级导航,弹出二级导航
  1746 +$sideNav.on('touchend', 'li', function(e) {
1745 if ($(this).find('.sub-nav').size() > 0) { 1747 if ($(this).find('.sub-nav').size() > 0) {
1746 $('.sub-nav').removeClass('show'); 1748 $('.sub-nav').removeClass('show');
1747 $(this).find('.sub-nav').addClass('show'); 1749 $(this).find('.sub-nav').addClass('show');
@@ -1753,7 +1755,7 @@ $sideNav.on('touchstart', 'li', function(e) { @@ -1753,7 +1755,7 @@ $sideNav.on('touchstart', 'li', function(e) {
1753 } 1755 }
1754 }); 1756 });
1755 1757
1756 -//返回一级导航,收起二级导航 1758 +// 返回一级导航,收起二级导航
1757 $subNav.each(function() { 1759 $subNav.each(function() {
1758 $(this).find('li').eq(0).on('touchend', function() { 1760 $(this).find('li').eq(0).on('touchend', function() {
1759 $sideNav.css('pointer-events', 'none'); 1761 $sideNav.css('pointer-events', 'none');
@@ -1782,7 +1784,7 @@ highlight($sideNav); @@ -1782,7 +1784,7 @@ highlight($sideNav);
1782 highlight($subNav); 1784 highlight($subNav);
1783 1785
1784 1786
1785 -//头部banner轮播 1787 +// 头部banner轮播
1786 if ($('.banner-swiper').find('li').size() > 1) { 1788 if ($('.banner-swiper').find('li').size() > 1) {
1787 bannerSwiper = new Swiper('.banner-swiper', { 1789 bannerSwiper = new Swiper('.banner-swiper', {
1788 lazyLoading: true, 1790 lazyLoading: true,
@@ -1796,7 +1798,7 @@ if ($('.banner-swiper').find('li').size() > 1) { @@ -1796,7 +1798,7 @@ if ($('.banner-swiper').find('li').size() > 1) {
1796 }); 1798 });
1797 } 1799 }
1798 1800
1799 -//热门品牌滑动 1801 +// 热门品牌滑动
1800 hotBrandsSwiper = new Swiper('.brands-swiper', { 1802 hotBrandsSwiper = new Swiper('.brands-swiper', {
1801 grabCursor: true, 1803 grabCursor: true,
1802 slidesPerView: 'auto', 1804 slidesPerView: 'auto',
@@ -1804,7 +1806,7 @@ hotBrandsSwiper = new Swiper('.brands-swiper', { @@ -1804,7 +1806,7 @@ hotBrandsSwiper = new Swiper('.brands-swiper', {
1804 slideElement: 'li' 1806 slideElement: 'li'
1805 }); 1807 });
1806 1808
1807 -//推荐搭配滑动 1809 +// 推荐搭配滑动
1808 recommendSwiper = new Swiper('.recommend-swiper', { 1810 recommendSwiper = new Swiper('.recommend-swiper', {
1809 grabCursor: true, 1811 grabCursor: true,
1810 slidesPerView: 'auto', 1812 slidesPerView: 'auto',
@@ -1812,7 +1814,7 @@ recommendSwiper = new Swiper('.recommend-swiper', { @@ -1812,7 +1814,7 @@ recommendSwiper = new Swiper('.recommend-swiper', {
1812 slideElement: 'li' 1814 slideElement: 'li'
1813 }); 1815 });
1814 1816
1815 -//潮品话题轮播 1817 +// 潮品话题轮播
1816 if ($('.trend-topic-swiper').find('li').size() > 1) { 1818 if ($('.trend-topic-swiper').find('li').size() > 1) {
1817 trendTopicSwiper = new Swiper('.trend-topic-swiper', { 1819 trendTopicSwiper = new Swiper('.trend-topic-swiper', {
1818 loop: true, 1820 loop: true,
@@ -1824,7 +1826,7 @@ if ($('.trend-topic-swiper').find('li').size() > 1) { @@ -1824,7 +1826,7 @@ if ($('.trend-topic-swiper').find('li').size() > 1) {
1824 }); 1826 });
1825 } 1827 }
1826 1828
1827 -//潮流上装/经典裤装等轮播 1829 +// 潮流上装/经典裤装等轮播
1828 $('.category-swiper').each(function(i, index) { 1830 $('.category-swiper').each(function(i, index) {
1829 swiperClass = 'category-swiper' + i; 1831 swiperClass = 'category-swiper' + i;
1830 $(this).addClass(swiperClass); 1832 $(this).addClass(swiperClass);
@@ -1840,7 +1842,7 @@ $('.category-swiper').each(function(i, index) { @@ -1840,7 +1842,7 @@ $('.category-swiper').each(function(i, index) {
1840 } 1842 }
1841 }); 1843 });
1842 1844
1843 -//logo动画 1845 +// logo动画
1844 function tsAnimate() { 1846 function tsAnimate() {
1845 start = start + 10; 1847 start = start + 10;
1846 $logotrans.css({ 1848 $logotrans.css({
@@ -1879,7 +1881,7 @@ $('.home-header .iconfont').on('touchstart', function() { @@ -1879,7 +1881,7 @@ $('.home-header .iconfont').on('touchstart', function() {
1879 // 底部留出tab 的高度 1881 // 底部留出tab 的高度
1880 window.reMarginFooter('.footer-tab'); 1882 window.reMarginFooter('.footer-tab');
1881 1883
1882 -//set cookie 1884 +// set cookie
1883 exports.set = function(c) { 1885 exports.set = function(c) {
1884 window.setCookie('_Channel', c, { 1886 window.setCookie('_Channel', c, {
1885 expires: 365, 1887 expires: 365,
@@ -1890,6 +1892,111 @@ exports.set = function(c) { @@ -1890,6 +1892,111 @@ exports.set = function(c) {
1890 require("js/home/maybe-like")(); 1892 require("js/home/maybe-like")();
1891 1893
1892 }); 1894 });
  1895 +define("js/plugin/inner-scroll", ["jquery"], function(require, exports, module){
  1896 +/**
  1897 + * 弹出层可以滚动,遮盖层禁止滚动插件
  1898 + *
  1899 + * @author liangzhifeng<zhifeng.liang@yoho.cn>
  1900 + * @date: 2016/02/22
  1901 + */
  1902 +
  1903 +var $ = require("jquery");
  1904 +
  1905 +function preventDefault(e) {
  1906 + e = e || window.event;
  1907 + e.preventDefault && e.preventDefault();
  1908 + e.returnValue = false;
  1909 +}
  1910 +
  1911 +function stopPropagation(e) {
  1912 + e = e || window.event;
  1913 + e.stopPropagation && e.stopPropagation();
  1914 + e.cancelBubble = false;
  1915 +}
  1916 +
  1917 +function innerScroll(e) {
  1918 + var delta = e.wheelDelta || e.originalEvent.wheelDelta || e.detail || 0,
  1919 + box = $(this).get(0);
  1920 +
  1921 + // 阻止冒泡到document
  1922 + // document上已经preventDefault
  1923 + stopPropagation(e);
  1924 +
  1925 +
  1926 + if ($(box).height() + box.scrollTop >= box.scrollHeight) {
  1927 + if (delta < 0) {
  1928 + preventDefault(e);
  1929 + return false;
  1930 + }
  1931 + }
  1932 + if (box.scrollTop === 0) {
  1933 + if (delta > 0) {
  1934 + preventDefault(e);
  1935 + return false;
  1936 + }
  1937 + }
  1938 +}
  1939 +
  1940 +function disableScroll($choseArea) {
  1941 + var startX, startY;
  1942 +
  1943 + // 内部可滚
  1944 + $choseArea.on('mousewheel', innerScroll);
  1945 +
  1946 + // 移动端touch重写
  1947 + $choseArea.on('touchstart', function(e) {
  1948 + startX = e.originalEvent.changedTouches[0].pageX;
  1949 + startY = e.originalEvent.changedTouches[0].pageY;
  1950 + });
  1951 +
  1952 + // 仿innerScroll方法
  1953 + $choseArea.on('touchmove', function(e) {
  1954 + var deltaX = e.originalEvent.changedTouches[0].pageX - startX,
  1955 + deltaY = e.originalEvent.changedTouches[0].pageY - startY;
  1956 +
  1957 + var box = $(this).get(0);
  1958 +
  1959 + e.stopPropagation();
  1960 +
  1961 +
  1962 + // 只能纵向滚
  1963 + if (Math.abs(deltaY) < Math.abs(deltaX)) {
  1964 + e.preventDefault();
  1965 + return false;
  1966 + }
  1967 +
  1968 +
  1969 + if ($(box).height() + box.scrollTop >= box.scrollHeight) {
  1970 + if (deltaY < 0) {
  1971 + e.preventDefault();
  1972 + return false;
  1973 + }
  1974 + }
  1975 + if (box.scrollTop === 0) {
  1976 + if (deltaY > 0) {
  1977 + e.preventDefault();
  1978 + return false;
  1979 + }
  1980 + }
  1981 + });
  1982 +
  1983 + $(document).on('mousewheel', preventDefault);
  1984 + $(document).on('touchmove', preventDefault);
  1985 +}
  1986 +
  1987 +function enableScroll($choseArea) {
  1988 +
  1989 + $choseArea.off('touchstart');
  1990 + $choseArea.off('touchmove');
  1991 + $choseArea.off('mousewheel');
  1992 +
  1993 + $(document).off('mousewheel', preventDefault);
  1994 + $(document).off('touchmove', preventDefault);
  1995 +}
  1996 +
  1997 +exports.enableScroll = enableScroll;
  1998 +exports.disableScroll = disableScroll;
  1999 +});
1893 define("js/home/maybe-like", ["jquery","hammer","lazyload"], function(require, exports, module){ 2000 define("js/home/maybe-like", ["jquery","hammer","lazyload"], function(require, exports, module){
1894 /** 2001 /**
1895 * “你可能喜欢”模块JS 2002 * “你可能喜欢”模块JS
@@ -3564,10 +3671,10 @@ function getInstance() { @@ -3564,10 +3671,10 @@ function getInstance() {
3564 '{{# hasFooter}}' + 3671 '{{# hasFooter}}' +
3565 '<div class="dialog-footer">' + 3672 '<div class="dialog-footer">' +
3566 '{{# leftBtnText}}' + 3673 '{{# leftBtnText}}' +
3567 - '<span class="dialog-left-btn">{{.}}</span>' + 3674 + '<span class="dialog-left-btn tap-hightlight">{{.}}</span>' +
3568 '{{/ leftBtnText}}' + 3675 '{{/ leftBtnText}}' +
3569 '{{# rightBtnText}}' + 3676 '{{# rightBtnText}}' +
3570 - '<span class="dialog-right-btn">{{.}}</span>' + 3677 + '<span class="dialog-right-btn tap-hightlight">{{.}}</span>' +
3571 '{{/ rightBtnText}}' + 3678 '{{/ rightBtnText}}' +
3572 '</div>' + 3679 '</div>' +
3573 '{{/ hasFooter}}' + 3680 '{{/ hasFooter}}' +
@@ -5438,6 +5545,8 @@ var $ = require("jquery"), @@ -5438,6 +5545,8 @@ var $ = require("jquery"),
5438 tip = require("js/plugin/tip"), 5545 tip = require("js/plugin/tip"),
5439 loading = require("js/plugin/loading"); 5546 loading = require("js/plugin/loading");
5440 5547
  5548 +var innerScroll = require("js/plugin/inner-scroll");
  5549 +
5441 var $chosePanel = $('#chose-panel'), 5550 var $chosePanel = $('#chose-panel'),
5442 $num, 5551 $num,
5443 $chosed, 5552 $chosed,
@@ -5456,6 +5565,7 @@ var $chosePanel = $('#chose-panel'), @@ -5456,6 +5565,7 @@ var $chosePanel = $('#chose-panel'),
5456 cbFn, 5565 cbFn,
5457 $allChoseItems, 5566 $allChoseItems,
5458 queryString, 5567 queryString,
  5568 + $choseArea,
5459 $soonSoldOut = $('.soonSoldOut-tag'), 5569 $soonSoldOut = $('.soonSoldOut-tag'),
5460 $yohoPage = $('.yoho-page'); 5570 $yohoPage = $('.yoho-page');
5461 5571
@@ -5471,6 +5581,7 @@ function init() { @@ -5471,6 +5581,7 @@ function init() {
5471 $curSizeBlock = null; 5581 $curSizeBlock = null;
5472 queryString = $.queryString(); 5582 queryString = $.queryString();
5473 $imgsThumb = $('.chose-panel').find('.thumb'); 5583 $imgsThumb = $('.chose-panel').find('.thumb');
  5584 + $choseArea = $('.chose-panel .main .chose-items');
5474 $allChoseItems = $('.chose-items'); 5585 $allChoseItems = $('.chose-items');
5475 $sizeRowList = $('.size-list ul'); 5586 $sizeRowList = $('.size-list ul');
5476 $colorRowList = $('.color-list ul'); 5587 $colorRowList = $('.color-list ul');
@@ -5537,20 +5648,6 @@ function disableNumEdit() { @@ -5537,20 +5648,6 @@ function disableNumEdit() {
5537 5648
5538 5649
5539 function show(html, cb) { 5650 function show(html, cb) {
5540 - var $html = $('html, body');  
5541 -  
5542 - /*var scrollPosition = [  
5543 - document.documentElement.scrollLeft || document.body.scrollLeft,  
5544 - document.documentElement.scrollTop || document.body.scrollTop  
5545 - ],  
5546 - $html = $('html, body'); // it would make more sense to apply this to body, but IE7 won't have that  
5547 -  
5548 - $html.data('scroll-position', scrollPosition);  
5549 - $html.data('previous-overflow', $html.css('overflow'));  
5550 - $html.css('overflow', 'hidden');  
5551 - $html.css('height', '100%');  
5552 - window.scrollTo(scrollPosition[0], scrollPosition[1]);*/  
5553 -  
5554 if (html) { 5651 if (html) {
5555 $chosePanel.html(html); 5652 $chosePanel.html(html);
5556 if ($('#promotionId').val() !== '') { 5653 if ($('#promotionId').val() !== '') {
@@ -5558,23 +5655,19 @@ function show(html, cb) { @@ -5558,23 +5655,19 @@ function show(html, cb) {
5558 } 5655 }
5559 init(); 5656 init();
5560 } 5657 }
  5658 +
5561 $('.chose-panel').show(); 5659 $('.chose-panel').show();
5562 $num = $('#good-num'); 5660 $num = $('#good-num');
5563 cbFn = cb; 5661 cbFn = cb;
  5662 +
  5663 +
  5664 + innerScroll.disableScroll($choseArea);
5564 } 5665 }
5565 5666
5566 //隐藏当前Panel 5667 //隐藏当前Panel
5567 function hide() { 5668 function hide() {
5568 - $html = $('html, body');  
5569 -  
5570 - /*var $html = $('html, body'),  
5571 - scrollPosition = $html.data('scroll-position');  
5572 -  
5573 - // un-lock scroll position  
5574 - $html.css('overflow', $html.data('previous-overflow'));  
5575 - $html.css('height', 'auto');  
5576 - window.scrollTo(scrollPosition[0], scrollPosition[1]);*/  
5577 $('.chose-panel').hide(); 5669 $('.chose-panel').hide();
  5670 + innerScroll.enableScroll($choseArea);
5578 } 5671 }
5579 5672
5580 //修改加入购物车的文字和背景 5673 //修改加入购物车的文字和背景
@@ -5656,6 +5749,7 @@ function changeColorChosed(newColorIndex) { @@ -5656,6 +5749,7 @@ function changeColorChosed(newColorIndex) {
5656 5749
5657 init(); 5750 init();
5658 5751
  5752 +
5659 $yohoPage.on('touchstart', '.chose-panel', function(e) { 5753 $yohoPage.on('touchstart', '.chose-panel', function(e) {
5660 var $cur = $(e.target); 5754 var $cur = $(e.target);
5661 5755
@@ -5666,6 +5760,8 @@ $yohoPage.on('touchstart', '.chose-panel', function(e) { @@ -5666,6 +5760,8 @@ $yohoPage.on('touchstart', '.chose-panel', function(e) {
5666 //点击蒙版消失 5760 //点击蒙版消失
5667 hide(); 5761 hide();
5668 5762
  5763 + enableScroll();
  5764 +
5669 return false; 5765 return false;
5670 }); 5766 });
5671 5767
@@ -9574,7 +9670,7 @@ $('.down').on('touchend', function() { @@ -9574,7 +9670,7 @@ $('.down').on('touchend', function() {
9574 }); 9670 });
9575 9671
9576 }); 9672 });
9577 -define("js/cart/gift-advance", ["jquery","lazyload","hammer"], function(require, exports, module){ 9673 +define("js/cart/gift-advance", ["jquery","mlellipsis","lazyload","hammer"], function(require, exports, module){
9578 /** 9674 /**
9579 * 赠品/加价购 9675 * 赠品/加价购
9580 * @author: xuqi<qi.xu@yoho.cn> 9676 * @author: xuqi<qi.xu@yoho.cn>
@@ -9582,6 +9678,7 @@ define("js/cart/gift-advance", ["jquery","lazyload","hammer"], function(require, @@ -9582,6 +9678,7 @@ define("js/cart/gift-advance", ["jquery","lazyload","hammer"], function(require,
9582 */ 9678 */
9583 9679
9584 var $ = require("jquery"), 9680 var $ = require("jquery"),
  9681 + ellipsis = require("mlellipsis"),
9585 lazyLoad = require("lazyload"), 9682 lazyLoad = require("lazyload"),
9586 Hammer = require("hammer"), 9683 Hammer = require("hammer"),
9587 tip = require("js/plugin/tip"), 9684 tip = require("js/plugin/tip"),
@@ -9594,6 +9691,7 @@ var $page = $('.gift-advance-page'), @@ -9594,6 +9691,7 @@ var $page = $('.gift-advance-page'),
9594 require("js/common"); 9691 require("js/common");
9595 9692
9596 lazyLoad($('.lazy')); 9693 lazyLoad($('.lazy'));
  9694 +ellipsis.init();
9597 9695
9598 function getProductInfo(skn, promotionId) { 9696 function getProductInfo(skn, promotionId) {
9599 loading.showLoadingMask(); 9697 loading.showLoadingMask();
@@ -9627,13 +9725,11 @@ $page.find('.chose').each(function(i, elem) { @@ -9627,13 +9725,11 @@ $page.find('.chose').each(function(i, elem) {
9627 }); 9725 });
9628 }); 9726 });
9629 9727
9630 -// $page.on('touchend', '.chose', function() {  
9631 -// var $this = $(this),  
9632 -// id = $this.closest('.gift-advance-good').data('id'),  
9633 -// promotionId = $this.closest('.advance-block').data('promotion-id');  
9634 -//  
9635 -// getProductInfo(id, promotionId);  
9636 -// }); 9728 +setTimeout(function() {
  9729 + $('.gift-advance-good .name').each(function() {
  9730 + this.mlellipsis(2);
  9731 + });
  9732 +}, 0);
9637 9733
9638 }); 9734 });
9639 define("js/cart/order-ensure", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){ 9735 define("js/cart/order-ensure", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 { 1 {
2 "name": "yohobuy", 2 "name": "yohobuy",
3 - "version": "1.3.7", 3 + "version": "1.3.8",
4 "description": "yohobuy statics", 4 "description": "yohobuy statics",
5 "keywords": [], 5 "keywords": [],
6 "homepage": "", 6 "homepage": "",