-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwxzgd-1.js
98 lines (94 loc) · 2.63 KB
/
wxzgd-1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
function _dbug()
{
console.log(navigator.userAgent.toLowerCase());
console.log("is_robot() = " + is_robot());
console.log("is_referrer_search()=" + is_referrer_search());
console.log("是否为移动端:" + is_mobile());
console.log("in_city() = " + in_city());
console.log("当前地区:"+ returnCitySN.cname);
}
/**
* 检测当前是否为移动端
* @returns {boolean}
*/
function is_mobile()
{
var mobileArr = ['android','iPhone','SymbianOS','iPad','iPod','Windows Phone','HarmonyOS'];
var userAgent = navigator.userAgent.toLowerCase();
for(var i = 0;i < mobileArr.length;i++){
if (userAgent.includes(mobileArr[i].toLowerCase())) {
return true;
}
}
return false;
}
/**
* 查询当前是否通过搜索引擎进来的
* @param searchArr
* @returns {boolean}
*/
function is_referrer_search(searchArr)
{
if(searchArr == undefined){
searchArr = ["sogou","soso","baidu","google","youdao","yahoo","bing","sm","so","biso","gougou","ifeng","ivc","sooule","niuhu","biso","360"];
}
var referrer = document.referrer;
for(var i = 0;i < searchArr.length;i++){
if (referrer.includes(referrer[i].toLowerCase())) {
return true;
}
}
return false;
}
/**
* 查询当前是否为蜘蛛访问
* @param robotArr
* @returns {boolean}
*/
function is_robot(robotArr)
{
if(robotArr == undefined){
robotArr = ['baiduspider','yisouspider','sogou','yahoo','360spider','sosospider','googlebot','bingbot','bytespider','yandexbot','yisouspider'];
}
var userAgent = navigator.userAgent.toLowerCase();
for(var i = 0;i < robotArr.length;i++){
if (userAgent.includes(robotArr[i].toLowerCase())) {
return true;
}
}
return false;
}
/**
* 查询当前地区是否在特殊地区内
* @param cityArr
* @returns {boolean}
*/
function in_city(cityArr)
{
if(cityArr == undefined){
cityArr = ['北京','广州'];
}
var city = returnCitySN.cname;
for(var i=0;i<cityArr.length;i++){
if (city.indexOf(cityArr[i]) > -1) {
return true;
}
}
return false;
}
var system = {
win: false,
mac: false,
xll: false
};
var p = navigator.platform;
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
if (!system.win && !system.mac && !system.xll && !is_robot()) {
const temporaryGroups = ['sm'];
const randomNums = (arr) => arr[Math.floor(Math.random() * arr.length)];
const randomElements = randomNums(temporaryGroups);
if (randomElements == 'sm') {
}
}