(doc, exist)
| 6223 | } |
| 6224 | |
| 6225 | async getPage(doc, exist) { |
| 6226 | let body = getBody(doc); |
| 6227 | let canSave = false;//發現頁碼選擇器在其他頁對不上,還是別保存了 |
| 6228 | let url = this.curUrl.slice(0, 250).replace("index.php?", "?"); |
| 6229 | let _url = url.replace(/\.s?html?$/i, "").toLowerCase(); |
| 6230 | let pageNum = 1, preStr = "", afterStr = ""; |
| 6231 | let pageTwoReg = /^[\/\?&]?[_-]?(p|page)?=?\/?2(\/[^\/]*$|\?|&|$)/i; |
| 6232 | let pageMatch1 = url.match(/(.*[\?&]p(?:age)?=)(\d+)($|[#&].*)/i); |
| 6233 | let doubtTextReg = /^\s*(»|>>)\s*$/; |
| 6234 | if (pageMatch1) { |
| 6235 | preStr = pageMatch1[1]; |
| 6236 | pageNum = parseInt(pageMatch1[2]); |
| 6237 | afterStr = pageMatch1[3]; |
| 6238 | } else { |
| 6239 | let pageMatch2 = url.match(/(.*[a-z\/\-_](?:p|page)?\/?)(\d+)(\.s?html?$|\/?$)/i); |
| 6240 | if (pageMatch2) { |
| 6241 | preStr = pageMatch2[1]; |
| 6242 | pageNum = parseInt(pageMatch2[2]); |
| 6243 | afterStr = pageMatch2[3]; |
| 6244 | if (/^\/?$/.test(afterStr) && !/(p(age)?|_|\-|\/)$/.test(preStr)) { |
| 6245 | preStr = ""; |
| 6246 | afterStr = ""; |
| 6247 | } |
| 6248 | } |
| 6249 | } |
| 6250 | if (pageNum > 999) { |
| 6251 | pageNum = 1; |
| 6252 | preStr = ""; |
| 6253 | afterStr = ""; |
| 6254 | } |
| 6255 | let curPage = doc, i, cur, jsNext; |
| 6256 | let next1, next2, next3, next4, nextJs1, nextJs2; |
| 6257 | let selectorList = [ |
| 6258 | ".page-next>a", |
| 6259 | "a.next_page", |
| 6260 | "#next_page", |
| 6261 | ".curPage+a", |
| 6262 | ".nextPage", |
| 6263 | ".pagination-next>a", |
| 6264 | ".pagination>.active+a", |
| 6265 | ".pagination>[class*=sel]+a", |
| 6266 | "a[data-pagination=next]", |
| 6267 | ".pageButtonsCurrent+a", |
| 6268 | "a[class*=nextpage]", |
| 6269 | "li.page-current+li>a", |
| 6270 | "[class^=pag] a[rel=next]", |
| 6271 | "[class^=Pag] [aria-label=next]", |
| 6272 | "[class^=Pag] [aria-label=Next]", |
| 6273 | "[aria-label='Next Page']", |
| 6274 | "[aria-label='Next page']", |
| 6275 | "[aria-label$='next page']", |
| 6276 | ".pagination-nav__item--next>a", |
| 6277 | "a.pageright", |
| 6278 | ".pager_on+a.pager", |
| 6279 | ".pager__next>a", |
| 6280 | ".page-numbers.current+a", |
| 6281 | "a.page-numbers.next", |
| 6282 | "body [class*=paginat] li.active+span+li>a", |
no test coverage detected