machsix / Super-preloader

Userscript to enable autopagerizing as well as preloading
https://machsix.github.io/Super-preloader/Super_preloaderPlus_one_New.user.js
GNU General Public License v3.0
575 stars 83 forks source link

TypeError: SITEINFO_D.autopager is undefined #120

Closed yfdyh000 closed 4 years ago

yfdyh000 commented 4 years ago

[求助] Super_preloaderPlus_one的谷歌搜索自动翻页

https://greasyfork.org/zh-CN/scripts/33522-super-preloaderplus-one-new/diff?v2=748523&v1=748247 v6.8.0正常,v6.8.4和v6.8.7(最新)异常。

  loadSetting: function loadSetting() {
   var a_enable = SITEINFO_D.autopager.enable;

   if (a_enable !== undefined) {
     SITEINFO_D.autopager.enable = a_enable;
   }

SITEINFO_D 09:44:58.447 "{\"enable\":true,\"useiframe\":false,\"viewcontent\":false,\"autopager\":{\"enable\":true,\"force_enable\":false,\"manualA\":false,\"useiframe\":false,\"iloaded\":false,\"itimeout\":0,\"newIframe\":false,\"remain\":1,\"maxpage\":99,\"ipages\":[false,2],\"separator\":true,\"separatorReal\":true,\"reload\":false,\"sandbox\":false},\"numOfRule\":4538}" 09:46:21.042 typeof SITEINFO_D 09:46:21.129 "string"

yfdyh000 commented 4 years ago

刚看到 https://greasyfork.org/zh-CN/forum/discussion/65983/x 有过讨论。

全新配置装Tampermonkey+脚本是正常的。 脚本中加debugger;然后控制台typeof SITEINFO_D

"object"

machsix commented 4 years ago

无法重现

v6.8.3以前的版本,我是直接判断数据类型https://github.com/machsix/Super-preloader/blob/b74fad81a22116d85ef4faa556101740667d0f64/src/index.js#L1834-L1837

然后根据旧版本号重写脚本管理器存储https://github.com/machsix/Super-preloader/blob/192780a86d5418fd2aa1f93c5d96bac1a290a6fa/src/index.js#L1872-L1885

v6.8.3以后的版本,我是根据旧版本号觉定是否要用JSON parse和重写https://github.com/machsix/Super-preloader/blob/a2fa1d440a1022d809e9bfcba8b2bac27ecc4ed7/src/index.js#L1849-L1853

https://github.com/machsix/Super-preloader/blob/a2fa1d440a1022d809e9bfcba8b2bac27ecc4ed7/src/index.js#L1884-L1897

因此,脚本应该能顺利实现过渡。