Authored by 沈志敏

增加 fontsize判断

@@ -218,6 +218,21 @@ exports.getMktcBySeo = function() { @@ -218,6 +218,21 @@ exports.getMktcBySeo = function() {
218 return mktc; 218 return mktc;
219 } 219 }
220 220
  221 +exports.setFontSize = function() {
  222 + var e = document.documentElement;
  223 + if (!e.style.fontSize) {
  224 + var f = e.clientWidth;
  225 + if (!f) {
  226 + return
  227 + }
  228 + if (f >= 640) {
  229 + e.style.fontSize = "40px";
  230 + } else {
  231 + e.style.fontSize = 40 * (f / 640) + "px";
  232 + }
  233 + }
  234 +}
  235 +
221 exports.getDownloadStr = function(isWechat, mktc) { 236 exports.getDownloadStr = function(isWechat, mktc) {
222 var str = '<div class="top-downloadbar" id="top-downloadbar"><a href="javascript:void(0);" class="download-close" id="download-close"></a>\ 237 var str = '<div class="top-downloadbar" id="top-downloadbar"><a href="javascript:void(0);" class="download-close" id="download-close"></a>\
223 <span class="download-icon"></span><span class="download-text">Yoho!Buy有货</span>'; 238 <span class="download-icon"></span><span class="download-text">Yoho!Buy有货</span>';
@@ -355,7 +355,7 @@ function getMktc() { @@ -355,7 +355,7 @@ function getMktc() {
355 } 355 }
356 356
357 function setUnionType() { 357 function setUnionType() {
358 - var mktc = window.qs.mkt_code || window.qs.union_type; 358 + var mktc = window.qs.mkt_code || window.qs.union_type || util.getMktcBySeo();
359 if (mktc) { 359 if (mktc) {
360 var aDom = document.getElementsByTagName("a"); //获取页面所有a标签 360 var aDom = document.getElementsByTagName("a"); //获取页面所有a标签
361 for (var i = 0; i < aDom.length; i++) { 361 for (var i = 0; i < aDom.length; i++) {
@@ -368,12 +368,13 @@ function setUnionType() { @@ -368,12 +368,13 @@ function setUnionType() {
368 } 368 }
369 369
370 function setDownloadBar() { 370 function setDownloadBar() {
  371 + var nodownload = document.getElementById('no-download'); // 页面不需要下载条
371 var downBar = document.getElementById('top-downloadbar'); 372 var downBar = document.getElementById('top-downloadbar');
372 var blackCheck = downloadBlackLst.some(function(url) { 373 var blackCheck = downloadBlackLst.some(function(url) {
373 return new RegExp(url, 'i').test(location.href); 374 return new RegExp(url, 'i').test(location.href);
374 }); 375 });
375 376
376 - if (downBar || blackCheck) { 377 + if (nodownload || downBar || blackCheck) {
377 return; 378 return;
378 } 379 }
379 380
@@ -388,6 +389,9 @@ function setDownloadBar() { @@ -388,6 +389,9 @@ function setDownloadBar() {
388 return; 389 return;
389 } 390 }
390 391
  392 + // 设定fontsize
  393 + util.setFontSize();
  394 +
391 var css = require('../css/download.css') 395 var css = require('../css/download.css')
392 var downloadDom = document.createElement("div"); 396 var downloadDom = document.createElement("div");
393 downloadDom.innerHTML = util.getDownloadStr(isWechat); 397 downloadDom.innerHTML = util.getDownloadStr(isWechat);