Code Monkey home page Code Monkey logo

tampermonkey's Introduction

Greasy Fork

Greasy Fork脚本集合

1、函数在页面中点击执行

在脚本中定义函数function abc(){ alert("helloWorld"); },注入onclick事件<a id="a" onclick="abc();">HelloWorld</a>。 爆出函数未定义的错误Function is not defined。 在mozillazine了解到Tampermonkey的js脚本是在sandbox中的,在html中访问不到。 使用下面的例子可以完成这个功能

unsafeWindow.abc = function(msg) {
  alert(msg);
};
document.getElementById("a").onclick = "window.abc('helloWorld')";

2、跨域访问

http://m.imooc.com/video/14388中底部写死了mp4url,判断依据是禁用js仍然在html源代码中发现了这个url。 课程所在位置是http://www.imooc.com/learn/814。属于跨域访问的问题,使用GM_xmlhttpRequest可以解决。

3、模拟事件

来自stackoverflow,原生js实现的模拟点击事件. trigger对非JQuery绑定的事件无效。

$('#downTip').click(function(){
	//$('#js-signin-btn').trigger('click');
    var clickEvent  = document.createEvent ('MouseEvents');
    clickEvent.initEvent ('click', true, true);
    document.getElementById('js-signin-btn').dispatchEvent (clickEvent);
});

4、拦截Ajax请求的url路径

(function (open) {
    XMLHttpRequest.prototype.open = function () {
        this.addEventListener("readystatechange", function () {
            if (this.responseURL.indexOf('.hxk') >= 0) {
                console.log(this.responseURL);
            }

        }, false);
        open.apply(this, arguments);
    };
})(XMLHttpRequest.prototype.open);

5、Ajax跨域请求多图并压缩为Zip

依赖JSZipFileSaver, 具体实现参考Pixiv-增强

var zip = new JSZip();
for (var i = 0; i < 16; i++) {
    (function (index) {
        var url = 'https://i.pximg.net/img-master/img' + param + '_p' + index + '_master1200.jpg';
        GM_xmlhttpRequest({
            method: 'GET',
            headers: {referer: 'https://www.pixiv.net/'}, // pixiv加了防盗链referer
            overrideMimeType: 'text/plain; charset=x-user-defined',
            url: url,
            onload: function (xhr) {
                var r = xhr.responseText, data = new Uint8Array(r.length), i = 0;
                while (i < r.length) {
                    data[i] = r.charCodeAt(i);
                    i++;
                }
                var blob = new Blob([data], {type: 'image/jpeg'}); // 转为Blob类型

                zip.file('pic_' + index + '.jpg', blob, {binary: true}); // 压入zip中
            }
        });
    })(i);
}

// 注意GM_xmlhttpRequest的ajax请求不是同步的
$('按钮').click(function(){
    zip.generateAsync({type: "blob", base64: true}).then(function (content) {
        // see FileSaver.js'
        saveAs(content, "pic.zip");
    });
});

tampermonkey's People

Contributors

ahaochan avatar catyue avatar crazyboyqcd avatar dreista avatar halowang avatar hongyey avatar nep-timeline avatar sunfkny 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tampermonkey's Issues

非常感谢

非常感谢,但是发现慕课网收费的实战的项目不能下载。

Popular Pictures Sort Not working

脚本的名称及greasyfork链接

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅greasyfork的反馈区, 以及github的issue, 均为发现相似问题

预期行为

Thank you for making this script. It is very helpful.
I noticed sorting by "popular pictures" is not working.
What is the expected behavior?

I am not using greasemonkey. I am using violentmonkey with Waterfox. Violentmonkey should be almost the same as greasemonkey.

网站顶部的空白字段

我认为这是你在没有此主题的情况下将做出的最接近的修复,但以防万一。
由于其他按钮均已及时移至左侧菜单,因此我认为这只是一个遗漏。
image
哦,我认为还有另一个与校长的评论有关的错误 https://www.pixiv.net/artworks/77557336?comment_id=96661042 - 下 =(

也许做一个单独的设置 向上移动 “<div class = _2BF9Y8h” 那很方便...
image

  • 具体来说,此功能是在设置中激活的,而不是默认情况下。

非常感谢您的工作! 未经您的许可,我不知道如何使用该网站,哈哈
这是不好的,pixiv现在看起来像一个谷歌服务

Pixiv增强 旧版GM API问题

由于我使用的是火狐上的暴力猴,目前还无法支持GM4的API,脚本用到了https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js来适配旧版GM API,我看到https://www.greasespot.net/2017/09/greasemonkey-4-for-script-authors.html里面说的,适配GM4和GM3需要同时grant新旧API
但是脚本grant元数据只列出了GM4的API,导致暴力猴无法正常工作,麻烦增加下旧版API的grant

使用Pixiv增强时很容易触发403错误

基本信息

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

能正常加载图片

实际行为

加载图片的错误率变高,在控制台看到报大量失败,直接访问图片地址报403.关闭脚本后正常。

重现步骤

  1. 安装Edge(chromium内核)
  2. 安装Tampermonkey
  3. 安装脚本
  4. 访问一些pixiv页面

其他信息

不确定是否网络相关,我这里贴下我网络信息,50M电信宽带,ss用的jms,附加obfs,但pac对pixiv图片地址不启用,确认直连能正确解析到pixiv图片服务器ip,浏览器控制台显示的加载错误内容类型全为png或svg

.png格式图片的zip包解压出的图片无法打开

脚本的名称及greasyfork链接

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅greasyfork的反馈区, 以及github的issue, 均未发现相似问题

预期行为

解压出的图片可以打开

实际行为

无法打开

重现步骤

  1. 多张图片打包成zip包下载
  2. 解压zip包(用的是winrar,提示存在安全隐患)
  3. 图片文件无法打开,损坏

其他信息

可能是打包出了问题

download/preview enhancement request

  1. Can you consider making the file names in the zip downloaded by this script like {pid}-{i}.png be the same with downloaded by right-clicking on one of the original size images like its original name or {pid}-p{i}.png?
    And the file timestamp didn't use local time zone info.
  2. also in the multi-image artwork pages, for slower connection, it's sometimes very slow to load all images. Can you consider adding a preview window on the page with the smaller image links in src of their image tag in like other scripts to help instantly know what the rest of the images are?

Thanks!

单张图片无法下载

基本信息

我确认我已经完成以下步骤

  • [] 我确认除了此脚本外, 其他任意脚本能正常运行
  • [] 我确认此脚本是最新版本
  • [] 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

实际行为

重现步骤

其他信息

pixiv打开多图会卡死无法使用

脚本的名称及greasyfork链接

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅greasyfork的反馈区, 以及github的issue, 均未发现相似问题

预期行为打开多图时应该能正常浏览的

实际行为现在一旦打开多图就加载不出来,并且网页会卡死

重现步骤

其他信息

Feature request for Pixiv Plus

我觉得有几个功能自己很想要,而且也可以帮忙实现(如果可行的话)。
1."See all" button直接在当前页面展示所有图片。两个设计:1a. 直接按顺序排下去 1b.保持原来大小,做个内嵌的滚动。
2. 一键添加/去除bookmark。这个功能可能不适合所有用户,不知道有没有办法加个preference。
3. 在看大图的模式加个向左和向右按键直接翻页。

想听一下你的意见,以及如果需要帮助的话给一些pointers.

Pixiv增强无法通过更改设置关闭图片尺寸显示

基本信息

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

在用户设置-pixiv增强设置选项内去掉显示图片尺寸大小的勾选后,刷新图片页面不会再在右上角显示尺寸。

实际行为

在用户设置-pixiv增强设置选项内去掉显示图片尺寸大小的勾选后,刷新图片页面依旧在右上角显示尺寸。

重现步骤

  1. 进入pixiv用户设置。
  2. 取消勾选显示图片尺寸大小,并点击保存。
  3. 刷新图片页,仍在右上角显示尺寸。

其他信息

Width Overflow / 网页宽度溢出

基本信息

  • 版本号:
  • 所用浏览器及版本号:
    • [] Chrome
    • [] Firefox
    • Other (是 Chromium 84.0.522.44 的 Edge,我觉得这应该能优化一下吧)
  • 插件扩展:
  • 屏幕分辨率 -
    2736×1824 (200 % 缩放)(Surface Pro 6)

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

实际行为

网页宽度超出边界(出现横向滚动条),此时我已经将浏览器窗口最大化
我尝试禁用了其他所有插件和脚本,但是这个问题依然存在

重现步骤

其他信息

image

Recommended followers list no longer working (not sure if site update is the reason or not)

基本信息

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题 X

预期行为 The expected behavior should be shown recommended artists after following a new artist. Not sure if this is a pixiv site update issue or github extension issue

实际行为 When following an artist, nothing else happens afterwards. It doesn't display a box of recommended artists.

重现步骤

  1. Follow an artist
  2. No "suggestions" artists tab shows up afterwords

其他信息 I only have the pixiv plus extension running on Pixiv. No other extensions are running on that website.

问卷星地址https://www.wjx.cn/jq/79564363.aspx 想要实现最后一个问题多行文本框默认填”无“

基本信息

我确认我已经完成以下步骤

  • [] 我确认除了此脚本外, 其他任意脚本能正常运行
  • [] 我确认此脚本是最新版本
  • [] 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

实际行为

重现步骤

其他信息

关于 Pixiv增强 的建议

建议加一个开关显示尺寸的功能, 有些图右上角显示尺寸很碍眼. 我尝试过删除相关代码, 但是因为看不懂, 删掉之后脚本的其它功能也没了.

使用新版edge,其他插件可用,使用此插件编辑pixiv收藏会出现bug,显示多个收藏图片并且实际上无法编辑

基本信息

我确认我已经完成以下步骤

  • [] 我确认除了此脚本外, 其他任意脚本能正常运行
  • [] 我确认此脚本是最新版本
  • [] 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

实际行为

重现步骤

其他信息

CDN切换

CloudFlare incredibly slow since its nodes are too far from Asia. In addition, the Japan-America optical highways are still heavily congested.
I want to go to the original Japanese ip. From a neighboring project I learned that the address public-api.secure.pixiv.net leads to jp ip 210.140.131.220, I wery want to take all the traffic of the site directly as before octabr 2020.
fanbox works on ip 210.140.131.200 and from here the pictures are loaded much faster - the whole problem is in the orange monster
image

gif下载的时间轴不对

基本信息

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

下载的gif时间轴应该和网页显示效果一致

实际行为

gif下载的时间轴不对,网页上的gif不同帧有不同时长,下载后所有帧时长都相同了

重现步骤

  1. 打开https://www.pixiv.net/artworks/49319675
  2. 点击gif下载

其他信息

P站更新了图片的网址格式,求插件更新

基本信息

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

实际行为

https://www.pixiv.net/artworks/76967940
p站更新了每个图片的网站格式,现在看图片插件好像就不奏效了QAQ

重现步骤

其他信息

Download Ugoira as Animated PNG (APNG)?

GIF is limited to 256 colors.

But APNG effectively has no color limit (16bit per channel, so 64bit per pixel including alpha channel or 48bit per pixel without alpha)

And APNG now has very good web browser support: https://caniuse.com/#feat=apng

(the only thing is that an unoptimized APNG can have quite a large file size, and I don't know how realistic it is to support the sort of lossless inter-frame optimization that software like "APNG Optimizer" implements)

Pixiv搜索页部分信息缺失

脚本的名称及greasyfork链接

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅greasyfork的反馈区, 以及github的issue, 均未发现相似问题

预期行为

开启脚本前:
pixiv 2018 10 19

实际行为

开启脚本后:
pixiv 2018 10 19 02

重现步骤

确认只是脚本问题,并没有uBlock Origin的干扰。

其他信息

浏览器:Chrome 70.0.3538.67

当进入到pixiv的画师页面时,画师介绍的话语会多出来一条。

基本信息

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

画师对自己的介绍只有一行且后面的灰字可以点击,可以找到画师对自己的简单介绍。

实际行为

画师介绍的话语会多出来一条,且可以确认上面的介绍的灰字不可点击,证明位于上面的介绍是错误的地方。

重现步骤

  1. 在油猴插件里开启脚本
  2. 打开pixiv,来到任意画师的主页
  3. 此问题出现。

其他信息

不使用脚本时
image

使用脚本时
image

Recommended followers list no longer working (not sure if site update is the reason or not)

基本信息

我确认我已经完成以下步骤

  • 我确认除了此脚本外, 其他任意脚本能正常运行
  • 我确认此脚本是最新版本
  • 我确认已经翻阅GreasyFork的反馈区, 以及GitHub的Issue, 均未发现相似问题

预期行为

The expected behavior should be shown recommended artists after following a new artist. Not sure if this is a pixiv site update issue or github extension issue

实际行为

When following a new artist, nothing else happens afterwards. It doesn't display a box of recommended artists when it should.

重现步骤

  1. Follow an artist
  2. No "suggestions" artists tab shows up afterwords

其他信息

I only have the pixiv plus extension running on Pixiv. No other extensions are running on that website. I did not run into this issue until after the site updated.

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.