Giter VIP home page Giter VIP logo

super-preloader's Introduction

icon

workflow Buy Me a Coffee

Super-preloader

Installation and Document

Document Installation
Github Page Github Page
Vercel Vercel
Github Raw
JS Delivr

Compatibility

Firefox + violentmonkey/greasemonkey
Firefox + Violentmonkey/Greasemonkey 4
Chrome / Microsoft Edge Dev+ violentmonkey
Chrome/Microsoft Edge Dev + Tampermonkey
Microsoft Edge Dev+ greasemonkey
Waterfox + Greasemonkey 3/4
Geasymonkey+ Stay2
Safari for IOS + Stay
Firefox > ESR Chrome > 45 , Edge Dev Channel Latest
  • Script is tested under:

    • Firefox latest + Violentmonkey (Recommended combination)
    • Microsoft Edge Dev + Tampermonkey
    • Waterfox 56.3 + Greasemonkey 4.9
    • Chrome 48 + Tampermonkey

Introduction

A userscript for auto loading paginated web pages. It will join pages together based on the rules.

The script is forked from https://greasyfork.org/en/scripts/10433-super-preloaderplus-one. However, it is refactored since v6.8.xx. Now we are embracing new techniques (features of ES6) and webpackrollup to pack the script.

Thanks to

Thanks to 红叶舞秋山, who introduced the history of the script to me

ywzhaiqi 也不是原创,这是个很久远的故事啊!还记得很多年以前,那时候我们还用 Opera 的旧版,总拿着它看小说之类的。然后在当年的 Opera **官方论坛,NLF 开始写这么个脚本的最初版,开始叫 Preloader 还是 PreloaderPlus 有点儿记不起来了!我们帮着测试,大家一起顺便也写写规则之类的。当年好像还有个简化版,只能预读不能拼接的,后来还有 Firefox 版,Chrome 版等等,甚至自己还考虑过自己写个外接可定制网页的 GUI...。开始时候这东西没啥按钮 Debug 什么的,都是一点点加的,还记得当年为了找个函数翻 Xml 等等文档翻了两天终于搞定的日子。后来基本功能有了,也没啥人维护了,大部分都是遇到问题自己写个规则用了。。。再后来 Opera **论坛也散了,很久之后 ywzhaiqi 接手改了个 Super_preloader,然后 Super_preloader one 的合一版他到

Please leave feedback at Greasefork page or Github issue

Development Guide

I appreciate anyone who is interested in devoting their time to the development. You can contribute by either writing rules or improving the script.

To write rules

  1. Check the Document and learn the structure of the rule
  2. Modify file dist/mydata.json for simple json rules
  3. Modify file src/rules/jsSiteRule.js for complex js rules

To modify document

  1. Modify content in docs/

To improve the script

  1. Clone the whole repo and install modules by npm install
  2. Make your modifications with your favoriate IDE. You IDE should support eslint and prettier to ease your life.
  3. Run npm run check to do a static check with eslint and prettier
  4. Run npm run test to test the script on certain websites with puppeteer
  5. Run npm run dev to launch the dev server and install the script from http://localhost:8081/Super_preloaderPlus_one_New.user.js. Test it on the website your added
  6. Only if all previous tests pass, you can now run npm run publish:patch to bump up the version and build the script. The file dist/Super_preloaderPlus_one_New.user.js will be updated.
  7. Commit all the changes you make and submit a pull request.

Note:

  1. You shouldn't commit changes of package.json, package-lock.json, and .eslintrc.json unless you have a good reason to do that.
  2. I won't check the PR until travis ci test passes. You can simulate travis ci test locally by running npm run check and npm run test.

Check more at Document

Known issues:

  • Firefox + Tampermonkey won't send cookie with GM_xmlhttpRequest. Unless this issue is resolved, I can do nothing with special websites. -Dec 31th 2019
  • Violentmonkey doesn't inject the scripts correctly on https://nhentai.org. Check this issue The new release candidate v2.12.8 may fix the issuse.

Donation

It takes time and patiency to maintain the project (beacure there are 👎 websites like JD). If you like my work, a donation is welcomed. This will keep my passion to continue developing. 😆

Buy Me a Coffee

Thanks to the following donors:

  • loveqianool (1st donor)

License

GPLv3

This program is licensed under GNU General Public License Version 3 or later.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Howver you need to acknowledge the author machsix before redistribute the source code, databases and bundled script. Reposting the code anywhere without the author's permission is regarded as infringement. The author preserves the right to sue the infringer.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

super-preloader's People

Contributors

alexolog avatar brian6932 avatar cordear avatar cyriltaylor avatar dependabot-preview[bot] avatar dependabot[bot] avatar github-actions[bot] avatar glasslion avatar heroboy avatar ivysrono avatar kidonng avatar loveqianool avatar lurkerhub avatar machsix avatar ndavidow avatar renovate-bot avatar renovate[bot] avatar suchunchen avatar yfdyh000 avatar yusichun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

super-preloader's Issues

Are the global rules super buggy, or what?

As soon as I scrolled a bit on this page on MDN, I see CPU skyrocket. Open up devtools to see what's up, and notice SPL has decided to fetch like a dozen pages at once.

I've seen the same on certain sites where I was trying to make rules, and just figured I had configured it wrong or something. This wasn't some possibly buggy rule I made though. Seems like this is something it just does sometimes by default.

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/automerged_updates/0' contains additional properties ["dependency_type", "update_type"] outside of the schema when none are allowed
The property '#/update_configs/0/automerged_updates/0/match' of type null did not match the following type: object. Is the following line indented correctly?
The property '#/update_configs/0/ignored_updates/0' contains additional properties ["dependency_name"] outside of the schema when none are allowed
The property '#/update_configs/0/ignored_updates/0/match' of type null did not match the following type: object. Is the following line indented correctly?

Please update the config file to conform with Dependabot's specification using our docs and online validator.

无限翻页问题

建议在Greasyfork的页面的第6200行下面加上
a_ipages_1 = a_ipages_1 == "" ? 0 : a_ipages_1 ;

差不多这样改一下就可以了吧....大概(大雾)

Please add rule34.xxx [NSFW]

The following did not work:

{
  "name": "rule34",
  "exampleUrl": "https://rule34.xxx/index.php?page=post&s=list&tags=3d",
  "url": "https://rule34\\.xxx/index\\.php",
  "pageElement": "div[@class=content]/div[1]",
  "nextLink": "a[@alt='next']"
}

新版 6.6.33,添加 WordPress 强制规则后的bug

由于 WordPress 的规则, 高级规则没有匹配会强制给出下一页的连接(xxxx/page/2)。

{
name: "WordPress",
url: "^https?://[^/]+(/page/\\d+)?",
nextLink: function(doc, win, _cplink) {
const cplink = _cplink.replace(/^(.*)(#[^\/]*)?$/, "$1");
if (cplink.slice(cplink.length - 5, cplink.length) === ".html") {
return undefined;
}
if (cplink.slice(cplink.length - 4, cplink.length) === ".htm") {
return undefined;
}
const a = /^(https?:\/\/.*?)(\/page\/\d+\/?)?$/.exec(cplink);
if (a[2]) {
const b = Number(/\/page\/(\d+)/.exec(a[2])[1]) + 1;
return cplink.replace(/^(https?:\/\/.*?\/page\/)\d+(.*)$/, "$1" + String(b) + "$2");
} else {
return cplink.replace(/^(.*?)\/?$/, "$1") + "/page/2";
}
},

导致这里直接绑定左右键的快捷键。

const superPreloader = {
go: function() {
if (nextlink) window.location.href = nextlink;
},
back: function() {
if (!prelink) getElement("auto;");
if (prelink) window.location.href = prelink;
}
};

疑问:

  • 1.WordPress 到底是为了匹配什么页面,麻烦补充下 exampleUrl。或者补充下注释,说明那段强制返回的原因。
  • 2.修复方案(2选一):
  1. 修改 WordPress 规则,
  2. 检测到 nextlink 的 pageElement 没有值得时候,清空 nextlink的值。
    https://github.com/suchunchen/Super-preloader/blob/8a5d0c399ea07eb75824f0082a6ae98bba1baaa5/Super_preloaderPlus_one_New.user.js#L7569-L7570

脚本兼容性

这个脚本不能通过AdGuard管理,可以查找一下不兼容的原因吗?

Thumbnails missing on Google Reverse Image Search results

When doing a reverse image search on Google, the results are displayed in groups of 10 per page, with a small thumbnail next to each representing the image found. The thumbnail is important since sometimes Google finds images that are slightly different.

the script does not display the thumbnails on any page after the 1st:

83284617-e82d0c00-a1aa-11ea-9d77-5b6521ceae00

An old AutoPager extension does display the thumbnails on loaded pages:

83284731-1ad70480-a1ab-11ea-90ca-9b6121422adf

Please fix.

Custom rule not working

The built-in rule rule img-hentai isn't very good.

I am trying to override it with a custom rule, but the built-in rule is still getting invoked on the exampleUrl.

Why?

{
  "name": "hentai-img",
  "exampleUrl": "https://hentai-img.com/image/jaycee-knight-bloomin-faeries-ongoing-1/page/1/",
  "url": "https://([^.]+\\.)?hentai-img\\.com/image/",
  "pageElement": "div[@id='display_image_detail']",
  "nextLink": "//div[@id='paginator']/span/a[(text()='Next>')]"
}

newIframe entry in custom rules not applied

So I set craigslist to use iframes because pics weren't loading, which worked, but some images are slideshows when hovered, which weren't working.

newIframe doc says "in some cases there is a miracle", which is true, because clicking the checkbox in settings, makes these little slide image elements functional. Clicking the checkbox only sets local storage, so I tried to set it in custom settings, but it's like it doesn't register.

Tested in a clean profile this time. Maybe I'm doing something wrong though. Is there a syntax issue?

[
  {
    "name": "craigslist",
    "url": "^https?://(.*\\.)?craigslist\\.org.*",
    "pageElement": "css;ul.rows",
    "exampleUrl": "https://newyork.craigslist.org/search/zip",
    "useiframe": true,
    "newIframe": true,
    "nextLink": "css;.bottom .next"
  }
]

ES6化: 函数库

  • 重写http request函数, axios是用common js写的, 尽管可以加adapter但是逻辑变得特别混乱。目标是直接写一个接口类似 got 但是底层是用GM.xmlHttpRequest的
    Status: in progress, Assign: Machsix
  • 重写成es6, 比如modules.export => export。 目前的commonjs用babel + core-js后有莫名其妙的兼容问题, 将browerlist设为chrome > 45后, chrome 48可以正常运行,但是waterfox+tampermonkey又崩了。远景目标是用typescript重写整体
    Status: to do, Assign: Machsix
  • 封装xpath选择器为module,将js规则提取到单独的文件中
    Status: todo, Assign: Machsix

ES6: Todo

  • Add a mutationObserver before finding nextlink and finding pageElement in function findCurSiteInfo to allow more flexibility for lazy load website https://www.manhuagui.com/
  • Rewrite some promises in index.js by async/await. It seems async/await is compatible with IIEF https://anthonychu.ca/post/async-await-typescript-nodejs/

在非 debug 模式下,依然有日志在 console 输出

image

如图,在关闭了 debug 模式后,还是有日志输出,请问是正常的吗? 这对我有些干扰..
如果这是一个 bug 的话,我可以尝试提交一下 pr 修复(如果需要的话)

最后非常感谢你写的插件,非常好用 :D

Infinite paging on single page WordPress site

Site: https://www.myconan.net/
There's only a landing page on this site, but the script will keep loading the next page.
Pagination can be an identifier for this case, but it can vary from site to site.


This problem happens on GitHub Blog as well.


Well, this can happen anywhere, I can't number them all, so basically the best solution is to blacklist those sites?

Safari not working anymore

The User Script stopped working on Safari for mac, it worked well previously, yesterdday it stopped, the curious parts is: it still works with the Arrow Keys, but it does not stick the pages below anymore

SITEINFO_JSON

一个想法,每次匹配到一个站点并且运行成功后,把站点规则存到localStorage里
然后每次匹配规则先检测localStorage

  • 如果检测到就不把SITEINFO_JSON读到内存里了,直接运行
  • 如果检测到但脚本运行失败就清空localStorage重新匹配

但一个问题是更新完规则怎么办。。

Removing lazy-load img data-attribute can be problematic

Not sure if the reverse is true, but I wouldn't guess it would be. In some cases, apparently, when the site looks for the attribute, it rebreaks the src you just fixed.

Example: WSHH

Rule:

  {
    "name": "WSHH",
    "url": "^https?://(www\\.)?worldstarhiphop\\.com.*",
    "pageElement": "css;#main>section:not([class])",
    "exampleUrl": "https://worldstarhiphop.com/videos",
    "nextLink": "css;a.next"
  }

Deleting this line resolves the issue.

Great project, btw. =)

TypeError: SITEINFO_D.autopager is undefined

[求助] 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"

Script is loaded in every iframe that embeds videos

On forum threads running on an SMF platform, youtube videos are loaded in iframes. The script shows as loaded multiple times (for the main page and for each iframe)

I have manually excluded https://www.youtube.com/embed/* but I think it (and similar common embedding URLs) should be excluded by default since they have no "pages".

右上角的红绿灯又不见了

今天脚本自动更新了,还能自动翻页,但是右上角的红绿灯没了。
记得以前出过这个毛病,好像被大佬修复了,现在又不见了……
我把脚本删了,换成旧版6.6.6也不显示,原先用6.6.6好好的。好奇怪啊。囧
难道红绿灯按钮的图标依赖的不是本地文件?

火狐60 暴力猴 脚本版本6.6.78

ES6化:性能提升 ServiceWorker

只是设想,尚在研究、未确定可行性。
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker
https://caniuse.com/#search=ServiceWorker
https://github.com/GoogleChrome/samples/tree/gh-pages/service-worker

愿景是以此固定内置规则集(及在线规则集)的实例化,避免每个页面(iframe)都实例化json(消耗CPU)并存活于整个会话期(消耗内存)。
基本目标是内置规则集只初始化一次,然后用户脚本在各页面调用(注册,只需一次)、获取里面的对象。
远期目标是.js形成规则集文件,可以比较安全(或明确警告)的远程加载,以及用户自定义。托管可以用greasyfork.org、github、gitee.com等(可以检测而多个)。不过相比mydata.json,远端ServiceWorker的加载也许有很大的安全风险,待研究能否限制。

参考 https://stackoverflow.com/questions/38810002/how-can-i-load-a-shared-web-worker-with-a-user-script ,用户脚本加载非远程(内置)的ServiceWorker可能有难度。

乐见有人接手这个,或者告知不可行。

Error on bellingcat.com

Dear Developers,

First of all, thank you very much for developing this project!

There is a problem with it enabled globally and while viewing bellingcat.com (See the screenshot attached below)

I am using Firefox 76.0 with Tampermonkey v4.10.6112 and Super_preloaderPlus_one_New 6.13.2.

image

Can you please take a look? Thanks!

Best regards,

悬浮窗的小点存在bug

  1. 拖动的时候没有很好的跟随鼠标。
  2. 鼠标一抖移动到屏幕外面就永远的跑出去了,因为点的位置被保存下来了。

添加一个隐藏悬浮窗的选项

求问,能否添加一个隐藏悬浮窗的选项,或者告知修改哪部分代码?

ps:原版我是直接修改
floatWindow: false
新版我改为
floatWindow: !1,
然而貌似不起作用。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.