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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
| const NaoKuo = { setWelcome_info: async () => { if (!document.getElementById("welcome-info")) return;
let ipLoacation = saveToLocal.get('welcome-info');
try { if (!ipLoacation) { return new Promise((resolve, reject) => { var script = document.createElement('script'); var url = `https://apis.map.qq.com/ws/location/v1/ip?key=【填写你的KEY】&output=jsonp`; script.src = url;
window.QQmap = (data) => { if (data.status === 0) { ipLoacation = data; saveToLocal.set('welcome-info', ipLoacation, 0.5); NaoKuo.showWelcome(ipLoacation); resolve(); } else { reject(new Error('Failed to fetch location data')); } document.body.removeChild(script); delete window.QQmap; }; document.body.appendChild(script); }); } else { await Promise.resolve(); NaoKuo.showWelcome(ipLoacation); } } catch (err) { console.error("Error fetching data:", err); } }, getDistance: (e1, n1, e2, n2) => { const R = 6371 const { sin, cos, asin, PI, hypot } = Math let getPoint = (e, n) => { e *= PI / 180 n *= PI / 180 return { x: cos(n) * cos(e), y: cos(n) * sin(e), z: sin(n) } } let a = getPoint(e1, n1) let b = getPoint(e2, n2) let c = hypot(a.x - b.x, a.y - b.y, a.z - b.z) let r = asin(c / 2) * 2 * R return Math.round(r); }, showWelcome: (ipStore) => { const WelcomeInfo = document.getElementById("welcome-info"), IP = ipStore.result.ip || "未知"; let dist = NaoKuo.getDistance(填写你的经度, 填写你的纬度, ipStore.result.location.lng, ipStore.result.location.lat), address, welcome_info; switch (ipStore.result.ad_info.nation) { case "日本": welcome_info = "こんにちは、日本から来た友達"; break; case "美国": welcome_info = "Hello, friend from the United States"; break; case "英国": welcome_info = "Hello, friend from the UK"; break; case "俄罗斯": welcome_info = "Здравствуйте, друзья из России."; break; case "法国": welcome_info = "Bonjour amis de France"; break; case "德国": welcome_info = "Hallo, Freund aus Deutschland"; break; case "澳大利亚": welcome_info = "Hello, friend from Australia"; break; case "加拿大": welcome_info = "Hello, friend from Canada"; break; case "中国": address = ipStore.result.ad_info.province + " " + ipStore.result.ad_info.city; switch (ipStore.result.ad_info.province) { case "北京市": address = "北京市"; welcome_info = "北——京——欢迎你"; break; case "天津市": address = "天津市"; welcome_info = "讲段相声吧"; break; case "重庆市": address = "重庆市"; welcome_info = "高德地图:已到达重庆,下面交给百度地图导航" break; case "河北省": welcome_info = "山势巍巍成壁垒,天下雄关。铁马金戈由此向,无限江山"; break; case "山西省": welcome_info = "展开坐具长三尺,已占山河五百余"; break; case "内蒙古自治区": welcome_info = "天苍苍,野茫茫,风吹草低见牛羊"; break; case "辽宁省": welcome_info = "我想吃烤鸡架"; break; case "吉林省": welcome_info = "状元阁就是东北烧烤之王"; break; case "黑龙江省": welcome_info = "很喜欢哈尔滨大剧院"; break; case "上海市": address = "上海市"; welcome_info = "众所周知,中国只有两个城市"; break; case "江苏省": switch (ipStore.result.ad_info.city) { case "南京市": welcome_info = "欢迎来自安徽省南京市的小伙伴"; break; case "苏州市": welcome_info = "上有天堂,下有苏杭"; break; case "泰州市": welcome_info = "这里也是我的故乡"; break; default: welcome_info = "散装是必须要散装的"; break; } break; case "浙江省": welcome_info = "东风渐绿西湖柳,雁已还人未南归"; break; case "安徽省": welcome_info = "蚌埠住了,芜湖起飞"; break; case "福建省": welcome_info = "井邑白云间,岩城远带山"; break; case "江西省": welcome_info = "落霞与孤鹜齐飞,秋水共长天一色"; break; case "山东省": welcome_info = "遥望齐州九点烟,一泓海水杯中泻"; break; case "湖北省": welcome_info = "来碗热干面"; break; case "湖南省": welcome_info = "74751,长沙斯塔克"; break; case "广东省": welcome_info = "老板来两斤福建人"; break; case "广西壮族自治区": welcome_info = "桂林山水甲天下"; break; case "海南省": welcome_info = "朝观日出逐白浪,夕看云起收霞光"; break; case "四川省": welcome_info = "康康川妹子"; break; case "贵州省": switch (ipStore.result.ad_info.city) { case "六盘水市": welcome_info = "凉都六盘水,您好"; break; case "贵阳市": welcome_info = "爽爽贵阳,您好"; break; case "遵义市": welcome_info = "遵义红城,您好"; break; case "安顺市": welcome_info = "安顺福地,您好"; break; case "毕节市": welcome_info = "毕节山水,您好"; break; case "铜仁市": welcome_info = "铜仁梵净,您好"; break; case "黔西南布依族苗族自治州": welcome_info = "黔西南风情,您好"; break; case "黔东南苗族侗族自治州": welcome_info = "黔东南歌舞,您好"; break; case "黔南布依族苗族自治州": welcome_info = "黔南美景,您好"; break; default: welcome_info = "茅台,学生,再塞200"; break; } break; case "云南省": welcome_info = "玉龙飞舞云缠绕,万仞冰川直耸天"; break; case "西藏自治区": welcome_info = "躺在茫茫草原上,仰望蓝天"; break; case "陕西省": welcome_info = "来份臊子面加馍"; break; case "甘肃省": welcome_info = "羌笛何须怨杨柳,春风不度玉门关"; break; case "青海省": welcome_info = "牛肉干和老酸奶都好好吃"; break; case "宁夏回族自治区": welcome_info = "大漠孤烟直,长河落日圆"; break; case "新疆维吾尔自治区": welcome_info = "驼铃古道丝绸路,胡马犹闻唐汉风"; break; case "台湾省": welcome_info = "我在这头,大陆在那头"; break; case "香港特别行政区": address = "香港特别行政区"; welcome_info = "永定贼有残留地鬼嚎,迎击光非岁玉"; break; case "澳门特别行政区": address = "澳门特别行政区"; welcome_info = "性感荷官,在线发牌"; break; default: welcome_info = "带我去你的城市逛逛吧"; break; } break; default: welcome_info = "带我去你的国家看看吧"; break; } let timeChange, date = new Date(); if (date.getHours() >= 5 && date.getHours() < 11) timeChange = "<span>🌤️上午好,一日之计在于晨</span>"; else if (date.getHours() >= 11 && date.getHours() < 13) timeChange = "<span>☀️中午好,该摸鱼吃午饭了</span>"; else if (date.getHours() >= 13 && date.getHours() < 15) timeChange = "<span>🕞下午好,懒懒地睡个午觉吧</span>"; else if (date.getHours() >= 15 && date.getHours() < 16) timeChange = "<span>🍵三点几啦,饮茶先啦</span>"; else if (date.getHours() >= 16 && date.getHours() < 19) timeChange = "<span>🌇夕阳无限好,只是近黄昏</span>"; else if (date.getHours() >= 19 && date.getHours() < 24) timeChange = "<span>🌔晚上好,夜生活嗨起来</span>"; else timeChange = "🌌夜深了,早点休息,少熬夜";
WelcomeInfo && (WelcomeInfo.innerHTML = `🙋欢迎来自 <strong>${address}</strong> 的小伙伴<br> 😊<strong>${welcome_info}!</strong><br> 🗺️您距离 <strong>Naokuo</strong> 约有 <strong>${dist}</strong> 公里!<br> 当前IP地址为:<br> <strong style="font-size:12px;"><psw>${IP}</psw></strong><br> <strong>${timeChange}!</strong>`);
}, }
|