MCPcopy Index your code
hub / github.com/XIU2/UserScript / discuz_

Function discuz_

Autopage.user.js:1326–1399  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1324 if (curSite.SiteTypeID !== 0 && location.hostname === 'keylol.com') {curSite.history = false; urlC = true;}
1325 }
1326 function discuz_() {
1327 if (getCSS('body[id="nv_forum"][class^="pg_"][onkeydown*="27"]')) {
1328 switch (getCSS('body[id="nv_forum"][class^="pg_"][onkeydown*="27"]').className) {
1329 case 'pg_forumdisplay': // < 各版块帖子列表 >
1330 discuzForum(); break;
1331 case 'pg_viewthread': // < 帖子内 >
1332 curSite = DBSite.discuz_thread; break;
1333 case 'pg_guide': // < 导读帖子列表等 >
1334 curSite = DBSite.discuz_guide; break;
1335 case 'pg_collection': // < 淘贴列表 >
1336 curSite = DBSite.discuz_collection; break;
1337 }
1338 }
1339 // 如果上面没有匹配的则继续 < 搜索结果 >
1340 if (curSite.SiteTypeID === 0) {
1341 if (indexOF('search') || getCSS('body[id="nv_search"][onkeydown*="27"]')) {
1342 if (indexOF('mobile=2', 's')) { // 手机版页面
1343 curSite = DBSite.discuz_m; curSite.pager.pageE = '.threadlist > ul > li'; urlC = true;
1344 } else {
1345 curSite = DBSite.discuz_search;
1346 }
1347 }
1348 }
1349 // 如果上面没有匹配的则继续
1350 if (curSite.SiteTypeID === 0) {
1351 if (indexOF('.html')) { // 判断是不是静态网页(.html 结尾)
1352 if (indexOF('/forum-')) { // < 各版块帖子列表 >
1353 if (getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
1354 discuzForum('m');
1355 } else {
1356 discuzForum();
1357 }
1358 } else if (indexOF('/thread-')) { // < 帖子内 >
1359 if (getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
1360 discuzThreadM();
1361 } else {
1362 curSite = DBSite.discuz_thread;
1363 }
1364 }
1365 }
1366 if (indexOF('/archiver/')) { // < 归档页 >
1367 curSite = DBSite.discuz_archiver;
1368 }
1369 }
1370 // 如果上面没有匹配的则继续
1371 if (curSite.SiteTypeID === 0) {
1372 if (indexOF('mod=forumdisplay', 's') || indexOF('forumdisplay.php')) { // < 各版块帖子列表 >
1373 if (indexOF('mobile=2', 's') || indexOF('mobile=yes', 's') || getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
1374 discuzForum('m');
1375 } else {
1376 discuzForum();
1377 }
1378 } else if (indexOF('mod=viewthread', 's') || indexOF('viewthread.php')) { // < 帖子内 >
1379 if (indexOF('mobile=2', 's') || getXpath('//head/meta[@name="applicable-device" and @content="mobile"] | //head/title[contains(text(), "手机版")] | //head/link[contains(@href, "/mobile/")] | //head/script[contains(@src, "/mobile/")]')) { // 手机版页面
1380 discuzThreadM();
1381 } else {
1382 curSite = DBSite.discuz_thread;
1383 }

Callers 2

webTypeIfFunction · 0.85
Autopage.user.jsFile · 0.85

Calls 6

getCSSFunction · 0.85
discuzForumFunction · 0.85
indexOFFunction · 0.85
discuzThreadMFunction · 0.85
isMobileFunction · 0.85
getXpathFunction · 0.70

Tested by

no test coverage detected