Skip to content

Commit

Permalink
【免测】同步 mip-custom noshell 逻辑 (#1347)
Browse files Browse the repository at this point in the history
* use standalone to add mip-custom noshell

* use mip2 standalone to check
  • Loading branch information
Brunoon authored Aug 27, 2019
1 parent 6fb4362 commit 5f076b7
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/mip-custom/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,31 @@ define(function (require) {
function inMipShell(element) {
var inMipShell = [true];
// 非结果页进入,不是mip-shell
if (!viewer.isIframed) {
inMipShell[0] = false;
inMipShell[1] = 'notIframed';
inMipShell[2] = encodeURIComponent(document.referrer);
inMipShell[3] = encodeURIComponent(location.href);
return inMipShell;
}
// if (!viewer.isIframed) {
// inMipShell[0] = false;
// inMipShell[1] = 'notIframed';
// inMipShell[2] = encodeURIComponent(document.referrer);
// inMipShell[3] = encodeURIComponent(location.href);
// return inMipShell;
// }
// 非百度、cache不在mip-shell中
if (!(data.regexs.domain.test(window.document.referrer) || util.fn.isCacheUrl(location.href))) {
// if (!(data.regexs.domain.test(window.document.referrer) || util.fn.isCacheUrl(location.href))) {
// inMipShell[0] = false;
// inMipShell[1] = 'notDomainOrCacheUrl';
// inMipShell[2] = encodeURIComponent(document.referrer);
// inMipShell[3] = encodeURIComponent(location.href);
// return inMipShell;
// }

// 这里直接用 mip2 核心的 standalone 判断,和 mip2 mip-custom 保持一致
if (MIP.standalone) {
inMipShell[0] = false;
inMipShell[1] = 'notDomainOrCacheUrl';
inMipShell[1] = 'notIframed';
inMipShell[2] = encodeURIComponent(document.referrer);
inMipShell[3] = encodeURIComponent(location.href);
return inMipShell;
}

return inMipShell;
};

Expand Down

0 comments on commit 5f076b7

Please sign in to comment.