layout.hbs 10.3 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">
        {{# cononical}}
        <meta name="applicable-device" content="mobile">
        <link rel="cononical" href="{{currentHref}}">
        {{/ cononical}}
        {{#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';
            !function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(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(13),i=r(14);n.init(),i.init()},function(e,t){e.exports=function(e,t,r){if("undefined"==typeof t){var n=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,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 s=r.path?"; path="+r.path:"",p=r.domain?"; domain="+r.domain:"",c=r.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(t),d,s,p,c].join("")}},,function(e,t,r){var n=r(1),i={config:{reportUrl:"//badjs.yoho.cn/apm/yas.gif"},stringify:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],i=[];for(var o in n)n.hasOwnProperty(o)&&i.push(o+"::"+n[o]);t.push(i.join("$$"))}return t.join("**")},report:function(e,t){if(e){var r=new Image;r.src=this.config.reportUrl+"?l="+e+"&t="+(new Date).getTime(),t&&t()}},getUdid:function(){var e=(n("yohobuy_session")||"").slice(2).split(".")[0];return e||0},getUid:function(){var e=(n("_UID")||"").split("::")[1];return e||0},getReqId:function(){return n("docreqid")||0}};e.exports=i},,,,,,,,,,function(e,t,r){var n=r(1),i=r(3),o="_errLog",a={writeError:function(e,t,r,a,d){var u=JSON.parse(n(o)||"[]");u.push({tp:"err",msg:e,sc:t,ln:r,cn:a,pt:location.href,u:i.getUid(),ud:i.getUdid(),rid:i.getReqId(),st:JSON.stringify(d&&d.stack)}),n(o,JSON.stringify(u)),u.length>=5&&this.reportError()},clearError:function(){n(o,"[]")},reportError:function(){var e=this,t=JSON.parse(n(o)||"[]"),r=i.stringify(t);i.report(r,function(){e.clearError()})},init:function(){var e=this;window.onerror=function(t,r,n,i,o){e.writeError(t,r,n,i,o)},this.reportError()}};e.exports=a},function(e,t,r){function n(e){var t=e.offsetTop;return null!==e.offsetParent&&(t+=n(e.offsetParent)),t}var i=r(3),o=window.screen.height,a=[],d=!1,u=!1,s=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&&(s=(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 i=n(t);if(i>o){d=!0;break}i<=o&&!t.hasPushed&&(t.hasPushed=1,a.push(t))}}},0),c={reportTime:function(e){var t=i.stringify(e);i.report(t)},addEvent:function(){var e=this,t=[],r=location.href,n=i.getUid(),o=i.getUdid(),a=i.getReqId(),c=window.performance&&window.performance.timing.navigationStart||0;_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:o,rid:a});var i=document.body&&document.body.querySelectorAll("img")||[];i.length||(d=!0)},!1),window.addEventListener&&window.addEventListener("load",function(i){t.push({tp:"ld",t:(new Date).getTime()-_timeStart,pt:r,u:n,ud:o,rid:a}),u=!0,d=!0,p&&clearInterval(p),s&&t.push({tp:"fs",t:s,pt:r,u:n,ud:o,rid:a}),t.push({tp:"pf",dcl:(window.performance&&window.performance.timing.domComplete||0)-c,ld:(window.performance&&window.performance.timing.loadEventStart||0)-c,pt:r,u:n,ud:o,rid:a}),e.reportTime(t)},!1)},init:function(){this.addEvent()}};e.exports=c}]);
            {{/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}}:5001/common.css?t={{startTime}}">
            {{/if}}

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

            {{#if isFeature}}
                <link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/feature.css?t={{startTime}}">
            {{else}}
                {{#ifor localCss vue}}
                    <link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/{{module}}.{{page}}.css?t={{startTime}}">
                {{^}}
                    <link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-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" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)">
        <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)">
    </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}} installment-body{{/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 systemUpdate}}
                {{> updata}}
            {{/if}}

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

            {{{body}}}

            {{#unless isApp}}
                {{> footer}}
            {{/unless}}
        </div>

        {{> download-app}}
        {{#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.1.0.js"></script>
        {{/wechatShare}}
        {{#if devEnv}}
            <script>var STATIC_RESOURCE_PATH = '//{{devHost}}:5001';</script>

            <script src="//{{devHost}}:5001/libs.js"></script>
            <script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script>
        {{^}}
            <script>var STATIC_RESOURCE_PATH = '//cdn.yoho.cn/m-yohobuy-node/assets';</script>
            <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/libs.js?t={{startTime}}" crossorigin="anonymous"></script>
            <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/{{module}}.{{page}}.js?t={{startTime}}" crossorigin="anonymous"></script>
        {{/if}}
        {{#loadJs}}
            <script type="text/javascript" src="{{src}}" crossorigin="anonymous"></script>
        {{/loadJs}}
        {{#unless devEnv}}
        {{> analysis}}
        {{/unless}}
    </body>
</html>