Authored by 沈志敏

增加 fontsize判断

... ... @@ -218,6 +218,21 @@ exports.getMktcBySeo = function() {
return mktc;
}
exports.setFontSize = function() {
var e = document.documentElement;
if (!e.style.fontSize) {
var f = e.clientWidth;
if (!f) {
return
}
if (f >= 640) {
e.style.fontSize = "40px";
} else {
e.style.fontSize = 40 * (f / 640) + "px";
}
}
}
exports.getDownloadStr = function(isWechat, mktc) {
var str = '<div class="top-downloadbar" id="top-downloadbar"><a href="javascript:void(0);" class="download-close" id="download-close"></a>\
<span class="download-icon"></span><span class="download-text">Yoho!Buy有货</span>';
... ...
... ... @@ -355,7 +355,7 @@ function getMktc() {
}
function setUnionType() {
var mktc = window.qs.mkt_code || window.qs.union_type;
var mktc = window.qs.mkt_code || window.qs.union_type || util.getMktcBySeo();
if (mktc) {
var aDom = document.getElementsByTagName("a"); //获取页面所有a标签
for (var i = 0; i < aDom.length; i++) {
... ... @@ -368,12 +368,13 @@ function setUnionType() {
}
function setDownloadBar() {
var nodownload = document.getElementById('no-download'); // 页面不需要下载条
var downBar = document.getElementById('top-downloadbar');
var blackCheck = downloadBlackLst.some(function(url) {
return new RegExp(url, 'i').test(location.href);
});
if (downBar || blackCheck) {
if (nodownload || downBar || blackCheck) {
return;
}
... ... @@ -388,6 +389,9 @@ function setDownloadBar() {
return;
}
// 设定fontsize
util.setFontSize();
var css = require('../css/download.css')
var downloadDom = document.createElement("div");
downloadDom.innerHTML = util.getDownloadStr(isWechat);
... ...