layout.hbs 17.4 KB
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>{{title}}</title>
        <meta name="keywords" content="{{keywords}}">
        <meta name="description" content="{{description}}">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
        <meta http-equiv="cleartype" content="on">
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <meta content="telephone=no" name="format-detection" />
        <meta content="email=no" name="format-detection" />
        <meta name="referrer" content="always">
        <link rel="manifest" href="/manifest.json">
        <meta name="theme-color" content="#414141"/>
        {{# canonical}}
        <meta name="applicable-device" content="mobile">
        <link rel="canonical" href="{{currentHref}}">
        {{/ canonical}}
        {{#if miphtml}}
        <link rel="miphtml" href="{{miphtml}}">
        {{/if}}
        {{#dnsPrefetch.hosts}}
            <link rel="dns-prefetch" href="{{this}}">
        {{/dnsPrefetch.hosts}}

        <script>
            {{#ifand isProduction wap.open.bughd}}
            window._timeStart = new Date().getTime();
            window._yohoAppName = 'yohobuywap-node';
            window._router = '{{_router}}';

            !function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};t.m=e,t.c=r,t.p="",t(0)}({0:function(e,t,r){String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")});var n=r(16),o=r(19);n.init(),o.init()},1:function(e,t){e.exports=function(e,t,r){if(void 0===t){var n=null;if(document.cookie)for(var o=document.cookie.split(";"),i=0;i<o.length;i++){var a=(o[i]||"").trim();if(a.substring(0,e.length+1)==e+"="){n=decodeURIComponent(a.substring(e.length+1));break}}return n}r=r||{},null===t&&(t="",r.expires=-1);var d="";if(r.expires&&("number"==typeof r.expires||r.expires.toUTCString)){var u;"number"==typeof r.expires?(u=new Date,u.setTime(u.getTime()+24*r.expires*60*60*1e3)):u=r.expires,d="; expires="+u.toUTCString()}var c=r.path?"; path="+r.path:"",p=r.domain?"; domain="+r.domain:"",s=r.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(t),d,c,p,s].join("")}},2:function(e,t,r){var n=r(1),o=window._yohoAppName||"unknown",i={config:{reportUrl:"//badjs.yoho.cn/apm/yas2.gif"},stringify:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],o=[];for(var i in n)n.hasOwnProperty(i)&&o.push(i+"::"+n[i]);t.push(o.join("$$"))}return t.join("**")},report:function(e,t){if(e){(new Image).src=this.config.reportUrl+"?s="+o+"&l="+e+"&t="+(new Date).getTime(),t&&t()}},getUdid:function(){return n("udid")||""||0},getUid:function(){return(n("_UID")||"").split("::")[1]||0},getReqId:function(){return n("docreqid")||0},getRoute:function(){return window._router||""}};e.exports=i},3:function(e,t){e.exports=function(e,t){if(void 0===t){var t=null;return window.localStorage&&(t=window.localStorage.getItem(e)),t}window.localStorage&&window.localStorage.setItem(e,t)}},16:function(e,t,r){var n=r(3),o=r(2),i="_errLog",a={writeError:function(e,t,r,a,d){var u=JSON.parse(n(i)||"[]");u.push({tp:"err",msg:e,sc:t,ln:r,cn:a,pt:encodeURIComponent(location.href),u:o.getUid(),ud:o.getUdid(),rid:o.getReqId(),st:JSON.stringify(d&&d.stack),r:o.getRoute()}),n(i,JSON.stringify(u)),u.length>=3&&this.reportError()},clearError:function(){n(i,"[]")},reportError:function(){var e=this,t=JSON.parse(n(i)||"[]"),r=o.stringify(t);o.report(r,function(){e.clearError()})},init:function(){var e=this;window.onerror=function(t,r,n,o,i){e.writeError(t,r,n,o,i)},this.reportError()}};e.exports=a},19:function(e,t,r){function n(e){var t=e.offsetTop;return null!==e.offsetParent&&(t+=n(e.offsetParent)),t}var o=r(2),i=window.screen.height,a=[],d=!1,u=!1,c=0,p=setInterval(function(){var e,t;if(d){if(a.length)for(e=0;e<a.length;e++){if(t=a[e],!t.complete){u=!1;break}u=!0}else u=!0;u&&(c=(new Date).getTime()-_timeStart,clearInterval(p))}else{var r=document.body&&document.body.querySelectorAll("img")||[];for(e=0;e<r.length;e++){t=r[e];var o=n(t);if(o>i){d=!0;break}o<=i&&!t.hasPushed&&(t.hasPushed=1,a.push(t))}}},0),s={reportTime:function(e){var t=o.stringify(e);o.report(t)},addEvent:function(){var e=this,t=[],r=encodeURIComponent(location.href),n=o.getUid(),i=o.getUdid(),a=o.getReqId(),s=window.performance&&window.performance.timing.navigationStart||0,f=o.getRoute();_timeStart=window._timeStart||0,document.addEventListener&&document.addEventListener("DOMContentLoaded",function(e){t.push({tp:"dcl",t:(new Date).getTime()-_timeStart,pt:r,u:n,ud:i,rid:a,r:f}),(document.body&&document.body.querySelectorAll("img")||[]).length||(d=!0)},!1),window.addEventListener&&window.addEventListener("load",function(o){t.push({tp:"ld",t:(new Date).getTime()-_timeStart,pt:r,u:n,ud:i,rid:a,r:f}),u=!0,d=!0,p&&clearInterval(p),c&&t.push({tp:"fs",t:c,pt:r,u:n,ud:i,rid:a,r:f}),t.push({tp:"pf",dcl:(window.performance&&window.performance.timing.domComplete||0)-s,ld:(window.performance&&window.performance.timing.loadEventStart||0)-s,pt:r,u:n,ud:i,rid:a,r:f}),e.reportTime(t)},!1)},init:function(){this.addEvent()}};e.exports=s}});
            {{/ifand}}
        </script>

        <script>
            {{#ifand isProduction wap.open.webperf}}

            !function(t){function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var e={};n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){var r=e(3),i=e(2),o="_perfLog",a=e(17),c=e(18);({init:function(t){this.debug=t,this.dataList=[],this.isRunning=!1,a.init(this.debug),c.init(this.debug),this.report();var n=this;window.addEventListener&&window.addEventListener("load",function(){setTimeout(function(){n.collect()},0)})},collect:function(){try{var t=c.collect(),n=a.collect();this.chunkWrite(t);for(var e=0;e<n.length;e++)this.chunkWrite(n[e])}catch(t){this.debug&&console.log(t)}},getMeta:function(){return{pt:encodeURIComponent(window.location.href),u:i.getUid(),ud:i.getUdid(),rid:i.getReqId(),r:i.getRoute()}},jsonConcat:function(t,n){for(var e in n)t[e]=n[e];return t},write:function(t){this.jsonConcat(t,this.getMeta());var n=JSON.parse(r(o)||"[]");n.push(t),r(o,JSON.stringify(n)),n.length>=3&&this.report()},report:function(){var t=this,n=JSON.parse(r(o)||"[]"),e=i.stringify(n);i.report(e,function(){t.clear()})},clear:function(){r(o,"[]")},chunkWrite:function(t){function n(){if(0!==e.dataList.length){var t=e.dataList.shift();e.write(t),setTimeout(n,10)}}var e=this;this.dataList.push(t),this.isRunning||(this.isRunning=!0,n())}}).init()},function(t,n){t.exports=function(t,n,e){if(void 0===n){var r=null;if(document.cookie)for(var i=document.cookie.split(";"),o=0;o<i.length;o++){var a=(i[o]||"").trim();if(a.substring(0,t.length+1)==t+"="){r=decodeURIComponent(a.substring(t.length+1));break}}return r}e=e||{},null===n&&(n="",e.expires=-1);var c="";if(e.expires&&("number"==typeof e.expires||e.expires.toUTCString)){var u;"number"==typeof e.expires?(u=new Date,u.setTime(u.getTime()+24*e.expires*60*60*1e3)):u=e.expires,c="; expires="+u.toUTCString()}var s=e.path?"; path="+e.path:"",f=e.domain?"; domain="+e.domain:"",d=e.secure?"; secure":"";document.cookie=[t,"=",encodeURIComponent(n),c,s,f,d].join("")}},function(t,n,e){var r=e(1),i=window._yohoAppName||"unknown",o={config:{reportUrl:"//badjs.yoho.cn/apm/yas2.gif"},stringify:function(t){for(var n=[],e=0;e<t.length;e++){var r=t[e],i=[];for(var o in r)r.hasOwnProperty(o)&&i.push(o+"::"+r[o]);n.push(i.join("$$"))}return n.join("**")},report:function(t,n){if(t){(new Image).src=this.config.reportUrl+"?s="+i+"&l="+t+"&t="+(new Date).getTime(),n&&n()}},getUdid:function(){return r("udid")||""||0},getUid:function(){return(r("_UID")||"").split("::")[1]||0},getReqId:function(){return r("docreqid")||0},getRoute:function(){return window._router||""}};t.exports=o},function(t,n){t.exports=function(t,n){if(void 0===n){var n=null;return window.localStorage&&(n=window.localStorage.getItem(t)),n}window.localStorage&&window.localStorage.setItem(t,n)}},,,,,,,,,,,,,,function(t,n){var e={init:function(t){if(this.enable=!0,this.debug=t,!("performance"in window&&"getEntriesByType"in window.performance&&window.performance.getEntriesByType("resource")instanceof Array))return void(this.enable=!1);this.whiteList=[/\/\/img\d*.static.yhbimg.com/,/\/\/cdn.yoho.cn/]},print:function(){var t=document.getElementById("debug"),n=this.formatDebugInfo();if(t)t.innerHTML+=n;else{var e=document.createElement("div");e.id="debug",e.innerHTML=n,document.body.appendChild(e)}},formatDebugInfo:function(){for(var t="<p>resource object: <br/>",n=this.getData(),e=0;e<n.length;e++)t+=JSON.stringify(n[e],null,2)+"<br/>";return t+="</p>"},filter:function(t){for(var n=0;n<this.whiteList.length;n++)if(this.whiteList[n].test(t))return!0;return!1},getData:function(){var t=window.performance.getEntriesByType("resource"),n=[],e={};for(var r in t){var i=t[r];if(this.filter(i.name)){var o={tp:"resource",mtp:i.initiatorType||"unknown",id:i.name||"unknown",dt:Math.floor(i.domainLookupEnd-i.domainLookupStart||0),tt:Math.floor(i.connectEnd-i.connectStart||0),rt:Math.floor(i.responseEnd-i.responseStart||0),rrt:Math.floor(i.responseEnd-i.fetchStart||0)};i.initiatorType in e?e[i.initiatorType].push(o):e[i.initiatorType]=[o]}}for(var a in e){for(var c=e[a],u=c.length,s={tp:"rs",mtp:a,dt:0,tt:0,rt:0,rrt:0},f=0;f<c.length;f++){var d=c[f];s.dt+=d.dt,s.tt+=d.tt,s.rt+=d.rt,s.rrt+=d.rrt}s.dt=Math.floor(s.dt/u),s.tt=Math.floor(s.tt/u),s.rt=Math.floor(s.rt/u),s.rrt=Math.floor(s.rrt/u),n.push(s)}return n},collect:function(){return this.enable?(this.debug&&this.print(),this.getData()):[]}};t.exports=e},function(t,n){var e=function(){function t(){return{tp:"tm",mtp:"html",dt:Math.floor(n),tt:Math.floor(e),rt:Math.floor(r),domt:Math.floor(o),et:Math.floor(i),ot:Math.floor(a),rtt:Math.floor(c),sw:screen.width||1,sh:screen.height||1,pf:navigator.platform||"unknown"}}var n=performance.timing.domainLookupEnd-(performance.timing.domainLookupStart||0),e=performance.timing.connectEnd-(performance.timing.connectStart||0),r=performance.timing.responseEnd-(performance.timing.responseStart||0),i=performance.timing.responseStart-(performance.timing.navigationStart||0),o=performance.timing.domContentLoadedEventEnd-(performance.timing.domLoading||0),a=performance.timing.domContentLoadedEventEnd-(performance.timing.navigationStart||0),c=(performance.timing.loadEventEnd||performance.timing.domComplete)-(performance.timing.navigationStart||0);return{collect:function(){return t()},print:function(){var t=document.getElementById("debug"),n=this.formatDebugInfo();if(t)t.innerHTML+=n;else{var e=document.createElement("div");e.id="debug",e.innerHTML=n,document.body.appendChild(e)}},formatDebugInfo:function(){var t="<p>";return t+="timing object : "+JSON.stringify(this.collect(),null,2)+"<br/>",t+="url: "+decodeURIComponent(window.location.href)+"<br/>",t+="</p>"}}},r={init:function(t){if(this.enable=!0,this.debug=t,!("performance"in window))return void(this.enable=!1)},collect:function(){if(this.enable){var t=e(),n=t.collect();return this.debug&&t.print(),n}}};t.exports=r}]);

            {{/ifand}}
        </script>

        {{!-- Android机器页面不再受到用户字体缩放强制改变大小 'http://m.blog.csdn.net/article/details?id=51275080' --}}
        <script type="text/javascript">
            var isWechat = /micromessenger/i.test(navigator.userAgent || '');
            if (isWechat) {
                document.title =document.title.replace(' | Yoho!Buy有货 | 潮流购物逛不停', '');
                (function(){function setWechatSize(){if(typeof WeixinJSBridge!=="undefined"&&WeixinJSBridge.invoke){WeixinJSBridge.invoke("setFontSizeCallback",{fontSize:0},function(){})}}if(typeof WeixinJSBridge!=="undefined"){setTimeout(setWechatSize,0)}else{document.addEventListener("WeixinJSBridgeReady",function(){setTimeout(setWechatSize,0)})};}());
            }
        </script>

        {{#if width750}}
        <script type="text/javascript">
            (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=750){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/750)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
        </script>
        {{^}}
        <script type="text/javascript">
            (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
        </script>
        {{/if}}

        {{#if devEnv}}
            {{#if localCss }}
                <link rel="stylesheet" media="all" href="//{{devHost}}:{{port}}/common.css?t={{startTime}}">
            {{/if}}

            {{#if isFeature}}
                <link rel="stylesheet" media="all" href="//{{devHost}}:{{port}}/feature.css?t={{startTime}}">
            {{else}}
                {{#ifor localCss vue}}
                <link rel="stylesheet" media="all" href="//{{devHost}}:{{port}}/{{module}}.{{page}}.css?t={{startTime}}">
                {{^}}
                <link rel="stylesheet" media="all" href="//{{devHost}}:{{port}}/index.css?t={{startTime}}">
                {{/ifor}}
            {{/if}}
        {{else}}
            {{#if localCss }}
                <link rel="stylesheet" media="all" href="//cdn.yoho.cn/yohobuywap-node/{{version}}/common.css?t={{startTime}}">
            {{/if}}

            {{#if isFeature}}
                <link rel="stylesheet" media="all" href="//cdn.yoho.cn/yohobuywap-node/{{version}}/feature.css?t={{startTime}}">
            {{else}}
                {{#ifor localCss vue}}
                <link rel="stylesheet" media="all" href="//cdn.yoho.cn/yohobuywap-node/{{version}}/{{module}}.{{page}}.css?t={{startTime}}">
                {{^}}
                <link rel="stylesheet" media="all" href="//cdn.yoho.cn/yohobuywap-node/{{version}}/index.css?t={{startTime}}">
                {{/ifor}}
            {{/if}}
        {{/if}}

        <link rel="apple-touch-icon-precomposed" href="http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png">
        <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6p.png" media="screen and (min-device-width: 1126px) and (max-device-width: 1242px)">
        <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-x.png" media="screen and (min-device-width: 751px) and (max-device-width: 1125px)">
        <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6.png" media="screen and (min-device-width: 641px) and (max-device-width: 750px)">
        <link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-5.png" media="screen and (max-device-width: 640px)">
    </head>
    <body class="{{pageStyle}}{{#if isWechat}} wechat-body{{/if}}{{#if width750}} width750{{/if}}{{#if isPassportPage}} passport-body{{/if}}{{#if isStarIndexPage}} star-index-bg{{/if}}{{#if isStarDetailPage}} star-class-body{{/if}}{{#if isInstallmentPage}}{{#unless notOpen}} installment-body{{/unless}}{{/if}}{{#if @root.isMarsApp}} is-mars-app{{/if}}{{#if @root.isNowApp}} is-now-app{{/if}}">
    <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}} {{#if miniPath}}data-miniPath='{{{miniPath}}}'{{/if}} {{#if @root.wap.wechat.backDownload}}data-backDownload='{{@root.wap.wechat.backDownload}}'{{/if}}>
            {{#if systemUpdate}}
                {{> updata}}
            {{/if}}

            {{#if showHeader}}
                {{#unless isApp}}
                    {{> header}}
                {{/unless}}
            {{/if}}

            {{{body}}}

            {{#unless isApp}}
                {{> footer}}
            {{/unless}}
        </div>
        {{#if nodownload}}
            <input type="hidden" id="no-download" value="no-download">
        {{/if}}
        {{#wechatShare}}
            <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
        {{/wechatShare}}
        {{#loadJsBefore}}
            <script src="{{src}}"></script>
        {{/loadJsBefore}}
        {{#if devEnv}}
           <script>
                var STATIC_RESOURCE_HASH = '{{startTime}}';
                var STATIC_RESOURCE_PATH = '//{{devHost}}:{{port}}';
            </script>
            <script src="//{{devHost}}:{{port}}/libs.js?t={{startTime}}" crossorigin="anonymous"></script>
            <script src="//{{devHost}}:{{port}}/{{module}}.{{page}}.js?t={{startTime}}" crossorigin="anonymous"></script>
        {{^}}
            <script>
                var STATIC_RESOURCE_HASH = '{{startTime}}';
                var STATIC_RESOURCE_PATH = '//cdn.yoho.cn/yohobuywap-node/{{version}}';
            </script>
            <script src="//cdn.yoho.cn/yohobuywap-node/{{version}}/libs.js?t={{startTime}}" crossorigin="anonymous"></script>
            <script src="//cdn.yoho.cn/yohobuywap-node/{{version}}/{{module}}.{{page}}.js?t={{startTime}}" crossorigin="anonymous"></script>
        {{/if}}
        {{#loadJs}}
        <script src="{{src}}"></script>
        {{/loadJs}}
        {{#unless devEnv}}
        {{> analysis}}
        {{/unless}}
    </body>
</html>