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

Function getPageE_

Autopage.user.js:1756–1807  ·  view source on GitHub ↗
(url, type = '', method = 'GET', data = '', type2)

Source from the content-addressed store, hash-verified

1754
1755 // 翻页类型 4
1756 function getPageE_(url, type = '', method = 'GET', data = '', type2) {
1757 let mimeType,accept;
1758 switch (type) {
1759 case 'json':
1760 accept = 'application/json'; mimeType = 'application/json; charset=' + (document.characterSet||document.charset||document.inputEncoding); break;
1761 case 'text':
1762 accept = 'text/plain'; mimeType = 'text/plain; charset=' + (document.characterSet||document.charset||document.inputEncoding); break;
1763 default:
1764 accept = 'text/html,application/xhtml+xml,application/xml'; mimeType = 'text/html; charset=' + (document.characterSet||document.charset||document.inputEncoding);
1765 }
1766
1767 GM_xmlhttpRequest({
1768 url: url,
1769 method: method,
1770 data: data,
1771 responseType: type,
1772 overrideMimeType: mimeType,
1773 headers: {
1774 'Referer': (curSite.noReferer === true) ? null:location.href,
1775 'Content-Type': (method === 'POST') ? 'application/x-www-form-urlencoded':'',
1776 'Accept': accept
1777 },
1778 timeout: 5000,
1779 onload: function (response) {
1780 try {
1781 //console.log('最终 URL:' + response.finalUrl, '返回内容:' + response.responseText)
1782 switch (type) {
1783 case 'json':
1784 curSite.pager.insertE(response.response, type2);
1785 break;
1786 case 'text':
1787 curSite.pager.insertE(response.responseText, type2)
1788 break;
1789 default:
1790 curSite.pager.insertE(createDocumentByString(response.responseText), type2)
1791 }
1792 } catch (e) {
1793 console.log(e);
1794 }
1795 },
1796 onerror: function (response) {
1797 setTimeout(function(){curSite.pageUrl = '';}, 3000)
1798 console.log('URL:' + url, response)
1799 GM_notification({text: '❌ 获取下一页失败,可 3 秒后再次滚动网页重试(或尝试刷新网页)...', timeout: 5000});
1800 },
1801 ontimeout: function (response) {
1802 setTimeout(function(){curSite.pageUrl = '';}, 3000)
1803 console.log('URL:' + url, response)
1804 GM_notification({text: '❌ 获取下一页超时,可 3 秒后再次滚动网页重试(或尝试刷新网页)...', timeout: 5000});
1805 }
1806 });
1807 }
1808 // 翻页类型 5(插入 iframe 方式加载下一页,无限套娃)
1809 function insIframe(src) {
1810 // 停用当前页面翻页

Callers 4

mangabz_nextLFunction · 0.85
dm5_nextLFunction · 0.85
xmanhua_nextLFunction · 0.85
pageLoadingFunction · 0.85

Calls 1

createDocumentByStringFunction · 0.85

Tested by

no test coverage detected