(src)
| 1885 | } |
| 1886 | // 翻页类型 6(通过 iframe 获取下一页动态加载内容,只有一个娃) |
| 1887 | function insIframe_(src) { |
| 1888 | // 暂停翻页 |
| 1889 | if (!pausePage) return |
| 1890 | pausePage = false |
| 1891 | |
| 1892 | //console.log('000',src) |
| 1893 | // 如果不存在,则创建一个 iframe |
| 1894 | let iframe = document.getElementById('Autopage_iframe'); |
| 1895 | if (!iframe) { |
| 1896 | iframe = document.createElement('iframe'); |
| 1897 | //iframe.sandbox = 'allow-same-origin allow-scripts allow-popups allow-forms'; |
| 1898 | iframe.id = 'Autopage_iframe'; |
| 1899 | iframe.src = src.replace(/#.+$/,''); |
| 1900 | |
| 1901 | document.documentElement.appendChild(document.createElement('style')).textContent = 'iframe#Autopage_iframe {position: absolute !important; top: -9999px !important; left: -9999px !important; width: 100% !important; height: 100% !important; border: none !important; z-index: -999 !important;}'; |
| 1902 | } |
| 1903 | |
| 1904 | // 加载完成后才继续 |
| 1905 | iframe.onload = function() { |
| 1906 | if (!curSite.pager.loadTime) curSite.pager.loadTime = 300; // 默认 300ms |
| 1907 | let time1 = 0 ,time2 = setInterval(function(){ |
| 1908 | let scrollHeight = (iframe.contentWindow.document.documentElement.scrollHeight || iframe.contentWindow.document.body.scrollHeight)/10 |
| 1909 | iframe.contentWindow.scrollTo(0, 999999); |
| 1910 | iframe.contentWindow.scrollTo(0, scrollHeight*time1); |
| 1911 | if (++time1 == 12) { |
| 1912 | clearInterval(time2); |
| 1913 | processElems(iframe.contentWindow.document); // 插入/替换元素等 |
| 1914 | pausePage = true; // 恢复翻页 |
| 1915 | } |
| 1916 | }, curSite.pager.loadTime/10) |
| 1917 | } |
| 1918 | |
| 1919 | // 插入 iframe(如果已存在则直接改 src) |
| 1920 | if (document.getElementById('Autopage_iframe')) { |
| 1921 | iframe.src = src.replace(/#.+$/,''); |
| 1922 | } else { |
| 1923 | document.documentElement.appendChild(iframe); |
| 1924 | } |
| 1925 | } |
| 1926 | |
| 1927 | |
| 1928 | // XHR 后处理结果,插入、替换元素等(适用于翻页类型 1/3/6) |
nothing calls this directly
no test coverage detected