Authored by 毕凯

load js 调整

... ... @@ -128,97 +128,21 @@
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
{{/wechatShare}}
{{#if devEnv}}
<!-- <script>
<script>
var STATIC_RESOURCE_HASH = '{{startTime}}';
var STATIC_RESOURCE_PATH = '//{{devHost}}:{{port}}';
window.jsFiles = [
{{#loadJsBefore}}
'{{src}}',
{{/loadJsBefore}}
'//{{devHost}}:{{port}}/libs.js?t={{startTime}}',
'//{{devHost}}:{{port}}/{{module}}.{{page}}.js?t={{startTime}}'
{{#loadJs}}
,'{{src}}'
{{/loadJs}}
];
</script> -->
</script>
<script src="//{{devHost}}:{{port}}/libs.js?t={{startTime}}"></script>
<script src="//{{devHost}}:{{port}}/{{module}}.{{page}}.js?t={{startTime}}"></script>
{{^}}
<!-- <script>
<script>
var STATIC_RESOURCE_HASH = '{{startTime}}';
var STATIC_RESOURCE_PATH = '//cdn.yoho.cn/yohobuywap-node/{{version}}';
window.jsFiles = [
{{#loadJsBefore}}
'{{src}}',
{{/loadJsBefore}}
'//cdn.yoho.cn/yohobuywap-node/{{version}}/libs.js?t={{startTime}}',
'//cdn.yoho.cn/yohobuywap-node/{{version}}/{{module}}.{{page}}.js?t={{startTime}}'
{{#loadJs}}
,'{{src}}'
{{/loadJs}}
];
</script> -->
</script>
<script src="//cdn.yoho.cn/yohobuywap-node/{{version}}/libs.js?t={{startTime}}"></script>
<script src="//cdn.yoho.cn/yohobuywap-node/{{version}}/{{module}}.{{page}}.js?t={{startTime}}"></script>
{{/if}}
<!-- <script>
(function() {
function addOnload(node, callback) {
var supportOnload = 'onload' in node;
if (supportOnload) {
node.onload = callback;
} else {
node.onreadystatechange = function() {
if (/loaded|complete/.test(node.readyState)) {
return callback();
}
};
}
}
function loadJS(src, retryMode) {
var ref = document.getElementsByTagName('script')[ 0 ];
var script = document.createElement('script');
var scriptSrc;
if (retryMode) {
scriptSrc = src;
} else {
scriptSrc = window.jsFiles.shift();
}
if (!scriptSrc) {
return;
}
script.src = scriptSrc;
script.crossorigin = 'anonymous';
if (!retryMode) {
script.onerror = function() {
if (script.parentNode) {
script.parentNode.removeChild(script);
}
script.onerror = script.onreadystatechange = null;
loadJS(script.src, true);
};
}
addOnload(script, function() {
script.onload = script.onreadystatechange = null;
loadJS();
});
ref.parentNode.insertBefore(script, ref);
return script;
}
loadJS();
}());
</script> -->
{{#unless devEnv}}
{{> analysis}}
{{/unless}}
... ...