Skip to content

Commit

Permalink
医疗a区屏蔽链接增加白名单设置 (#1340)
Browse files Browse the repository at this point in the history
  • Loading branch information
ning5129 authored and Ricardo-Li committed Apr 26, 2019
1 parent c4795f8 commit b4cb0cb
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions src/mip-custom/mip-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,45 +176,10 @@ define(function () {
if (data.common) {
commonData = data.common;
}
var isForbidden = true;
// 医疗屏蔽A区跳转
if (commonData.product === 'medicine') {
var specialLink = [
// 寻医问药
'mip.imask.xywy.com',
// 宝宝知道
'baobao.baidu.com',
// 柠檬爱美
'lemon.baidu.com',
// 春雨医生
'm.chunyuyisheng.com',
// 好大夫
'mip.haodf.com',
// 百科名医
'm.baikemy.com'
];
for (var i = 0; i < specialLink.length; i++) {
if (commonData.originalUrl && commonData.originalUrl.indexOf(specialLink[i]) > -1) {
isForbidden = false;
break;
}
}

if (isForbidden) {
var alink = document.querySelectorAll('a');

for (var i = 0; i < alink.length; i++) {
if (alink[i].href.indexOf('author.baidu.com') < 0) {
alink[i].href = 'javascript:void(0)';
}
}
}

}

// 医疗屏蔽A区跳转
if (commonData.product === 'medicine') {
var isForbidden = commonData.isForbidden;
var isForbidden = commonData.isForbidden || '';
if (isForbidden) {
var alink = document.querySelectorAll('a');

Expand Down Expand Up @@ -524,4 +489,4 @@ define(function () {
};

return customElement;
});
});

0 comments on commit b4cb0cb

Please sign in to comment.