guang.detail-list.js
6.25 KB
webpackJsonp([17],{0:function(n,e,o){function t(n){var e,o,t;c.showLoadingMask(),a.ajax({type:"GET",url:"/guang/star/detailList",data:{page:n,tag:a(".detail-list").data("name")},dataType:"html",success:function(n){h=!1,""===n&&(h=!0,s.show("没有更多内容了")),a(".detail-list").append(n),a(".cont-area").each(function(){e=a(this),o=e.find(".title"),t=e.find(".cont-txt"),o[0].mlellipsis(2),t[0].mlellipsis(2)}),d(a("img.lazy")),c.hideLoadingMask()},error:function(){s.show("网络断开连接了~")}})}function i(){!h&&a(window).scrollTop()+a(window).height()>a("body").height()-100&&(h=!0,u++,t(u))}var a=o(1),s=o(2),c=o(6),d=o(7),r=o(8),l=a(".detail-list"),h=!1,u=1;o(20),r.init(),a(window).scroll(function(){window.requestAnimationFrame(i)}),0===l.find("li").length&&t(1)},2:function(n,e,o){function t(n,e){var o,t;"undefined"!=typeof n&&(o=n.toString(),t=e&&e>0?e:2e3,i.text(o).show(),a=setTimeout(function(){"block"===i.css("display")&&i.hide()},t))}var i,a,s=o(1);!function(){var n='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(n),i=s("#yoho-tip"),i.on("touchend",function(){i.hide(),clearTimeout(a)})}(),e.show=t},3:function(n,e,o){function t(n){var e,o,t=document.cookie;return document.cookie&&""!==document.cookie&&(o=t.indexOf(n+"="),o>-1&&(o+=n.length+1,e=decodeURIComponent(p.trim(t.substring(o,t.indexOf(";",o)))))),e}function i(n,e,o){var t,i,a,s,c="";"undefined"!=typeof e&&(o=o||{},null===e&&(e="",o.expires=-1),o.expires&&("number"==typeof o.expires||o.expires.toUTCString)&&("number"==typeof o.expires?(s=new Date,s.setTime(s.getTime()+24*o.expires*60*60*1e3)):s=o.expires,c="; expires="+s.toUTCString()),t=o.path?"; path="+o.path:"",i=o.domain?"; domain="+o.domain:"",a=o.secure?"; secure":"",document.cookie=[n,"=",encodeURIComponent(e),c,t,i,a].join(""))}function a(){var n=!!navigator.cookieEnabled;return"undefined"!=typeof navigator.cookieEnabled||n||(document.cookie="testcookie",n=-1!==document.cookie.indexOf("testcookie")),n}function s(){var n,e=t("_UID");return"undefined"==typeof e?0:(n=e.split("::"),"undefined"==typeof n||n.length<4?0:n)}function c(){var n=s();return 0===n?0:n[1]}function d(){var n=t("_g");return"undefined"==typeof n?"":JSON.parse(n).k}function r(){var n;0!==f.length&&(n=Math.min(p(window).height(),window.screen.availHeight),p("body").height()<=n-parseInt(f.css("height"),0)?f.addClass("bottom"):f.removeClass("bottom"))}function l(n){var e=p(n).outerHeight();n&&f.css("margin-bottom",e+"px")}function h(){var n,e,o=[],t=window.location.search.slice(1).split("&");for(e=0;e<t.length;e++)n=t[e].split("="),o.push(n[0]),o[n[0]]=n[1];return o}function u(n){return n.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}var p=o(1),m=o(4),f=p("#yoho-footer"),g=p(".yoho-page"),w=p(".yoho-header");!function(){var n,e=f.children(".op-row"),o=p(".back-to-top"),t=s();r(),0===t?e.prepend('<a href="http://m.yohobuy.com/signin.html?refer='+location.href+'">登录</a><span class="sep-line">|</span><a href="http://m.yohobuy.com/reg.html">注册</a>'):e.prepend('<span>Hi,</span><a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+t[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index">退出</a>'),o.length>0&&(n=new m(o[0]),n.on("tap",function(n){return p(window).scrollTop(0),n.srcEvent.preventDefault(),!1})),f.removeClass("hide")}(),function(n,e,o,t,i){var a=e.createElement(o),s=e.getElementsByTagName(o)[0];n.YohoAcquisitionObject=i,n[i]=function(){n[i].p=arguments},a.async=1,a.src=t,s.parentNode.insertBefore(a,s)}(window,document,"script",("https:"===document.location.protocol?"https":"http")+"://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js","_yas"),function(){var n=c();n=0===n?"":n,window._ozuid=n,window._yas&&window._yas(1*new Date,"1.0.17","yohobuy_m",n,"","")}(),w.on("touchstart","a",function(){w.find("a").removeClass("highlight"),p(this).addClass("highlight")}).on("touchend touchcancel","a",function(){p(this).removeClass("highlight")}),g.on("touchstart",".tap-hightlight",function(){p(this).siblings(".tap-hightlight").removeClass("highlight"),p(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){p(this).removeClass("highlight")}),p(".nav-home").on("touchstart",function(){p(".homebuttom").toggleClass("hide")}),function(){var n,e,o=0,t="webkit moz ms o".split(" "),i=window.requestAnimationFrame,a=window.cancelAnimationFrame;for(e=0;e<t.length&&(!i||!a);e++)n=t[e],i=i||window[n+"RequestAnimationFrame"],a=a||window[n+"CancelAnimationFrame"]||window[n+"CancelRequestAnimationFrame"];i&&a||(i=function(n){var e=(new Date).getTime(),t=Math.max(0,16-(e-o)),i=window.setTimeout(function(){n(e+t)},t);return o=e+t,i},a=function(n){window.clearTimeout(n)}),window.requestAnimationFrame=i,window.cancelAnimationFrame=a}(),p.extend({queryString:h}),11===f.find(".user-name").text().length&&f.find(".user-name").html(u(f.find(".user-name").text())),window.cookie=t,window.setCookie=i,window.isCookiesEnabled=a,window.getUser=s,window.getUid=c,window.getShoppingKey=d,window.rePosFooter=r,window.reMarginFooter=l,window.queryString=h()},6:function(n,e,o){function t(n){var e='<div class="loading-mask hide"><div class="loading"><div></div><div></div><div></div></div></div>';r=!0,n||(n=d),n.append(e),s=n.children(".loading-mask"),c("body").on("touchstart touchmove touchend",".loading-mask",function(){return!1})}function i(){r||(t(),r=!0),s.removeClass("hide")}function a(){s.addClass("hide")}var s,c=o(1),d=c(".yoho-page"),r=!1;e.init=t,e.showLoadingMask=i,e.hideLoadingMask=a,e.show=i,e.hide=a},20:function(n,e,o){var t=o(1),i=o(2);o(3),window.setCookie("guangStarUid",window.queryString.uid),t(".collocation-list,.detail-list").on("click",".collection",function(){var n,e,o,a=t(this),s=a.find(".collected-ico");n=s.hasClass("collected")?"del":"fav",t(this).parents(".collocation-list").length>0?(e="1",o=""):(e="2",o=t(".detail-list").data("name")),t.ajax({type:"POST",url:"/guang/star/setFavorite",data:{articleId:a.parents("li").attr("articleId"),type:n,pageType:e,tag:o},success:function(n){var e=n.code;200===e&&(s.hasClass("collected")?s.removeClass("collected"):s.addClass("collected")),400===e&&(t("#collocation-link").length<=0&&t("body").append("<a href='"+n.data+'\' style="display:none;" id="collocation-link"><span class="collocation-link"></span></a>'),t(".collocation-link").click())},error:function(){i.show("网络断开连接了~")}})})}});