修复 编码GBK网页乱码的问题; 优化 Firefox 浏览器下编码 GBK 网页乱码的处理方案

This commit is contained in:
xiu2
2026-01-21 20:39:46 +08:00
parent ddcd406b96
commit 691ef41616
+6 -4
View File
@@ -3,7 +3,7 @@
// @name:zh-CN 自动无缝翻页
// @name:zh-TW 自動無縫翻頁
// @name:ru Автостраничник
// @version 6.6.68
// @version 6.6.69
// @author X.I.U
// @description ⭐Append the next page content to the bottom seamlessly (like a waterfall, Unlimited scrolling, no need to manually click on the next page) ⭐, support various forums, social networking, games, comics, novels, academics, search engines (Google, Bing, Yahoo...) and other websites~
// @description:zh-CN ⭐无缝加载 下一页内容 至网页底部(类似瀑布流,无限滚动,无需手动点击下一页)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、MyBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、NGA、V2EX、起点中文、千图网、千库网、Pixabay、Pixiv、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、RuTracker、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、小众软件、【动漫狂、动漫屋、漫画猫、漫画屋、漫画 DB、HiComic、Mangabz、Xmanhua 等漫画网站...】、PubMed、Z-Library、GreasyFork、Github、StackOverflow(以上仅一小部分常见网站,更多的写不下了...
@@ -1695,6 +1695,7 @@ function: {
url: url,
method: 'GET',
//overrideMimeType: 'text/html; charset=' + (document.characterSet||document.charset||document.inputEncoding),
responseType: 'arraybuffer', // Firefox 浏览器下 Tampermonkey 访问 GBK 网站时会乱码,只能改为 TextDecoder 手动转换编码
headers: {
'x-requested-with': (curSite.xRequestedWith === true) ? 'XMLHttpRequest':null,
'Referer': (curSite.noReferer === true) ? null:location.href,
@@ -1706,8 +1707,9 @@ function: {
timeout: 5000,
onload: function (response) {
try {
//console.log('URL' + url, '最终 URL' + response.finalUrl, '返回内容:' + response.responseText)
processElems(createDocumentByString(response.responseText));
//console.log('URL' + url, '最终 URL' + response.finalUrl, '返回内容:' + response.responseText, response)
processElems(createDocumentByString((new TextDecoder((document.characterSet||document.charset||document.inputEncoding))).decode(response.response)));
//processElems(createDocumentByString(response.responseText));
} catch (e) {
console.error('[自动无缝翻页] - 处理获取到的下一页内容时出现问题,请检查!\n', e, '\nURL' + url, '\n最终 URL' + response.finalUrl, '\n返回状态:' + response.statusText, '\n返回内容:' + response.responseText);
}
@@ -1725,7 +1727,7 @@ function: {
} else {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
//xhr.overrideMimeType('text/html; charset=' + (document.characterSet||document.charset||document.inputEncoding));
xhr.overrideMimeType('text/html; charset=' + (document.characterSet||document.charset||document.inputEncoding));
if (curSite.xRequestedWith === true) {xhr.setRequestHeader('x-requested-with', 'XMLHttpRequest')}
//(curSite.noReferer === true) ? xhr.setRequestHeader('Referer', ''):xhr.setRequestHeader('Referer', location.href)