Bobby's Pixiv Utils

Compatible with mobile. "Edit bookmark" and "Toggle bookmarked" buttons, publish dates conversion, block AI-generated works, block by Pixiv tags, UTags integration, and more!

< 脚本 Bobby's Pixiv Utils 的反馈

评价:好评 - 脚本运行良好

§
发布于:2025-04-04

Block artist on mobile

Since mobile layout doesn't display artist name, utags doesn't run.

First we have to make a script to display artist:

// ==UserScript==
// @name        Pixiv add user id to /tags
// @namespace   Violentmonkey Scripts
// @match       https://www.pixiv.net/tags/*
// @grant       none
// @version     1.0
// @author      -
// @description 4/4/2025, 4:41:39 PM
// @inject-into page
// @require     https://raw.githack.com/kubetail-org/sentineljs/refs/heads/master/dist/sentinel.min.js
// ==/UserScript==

{
  sentinel.on(".works-item-illust:not(:has(a[href*=users])):has(.thumb:not([src^=data]))", el => {
    const userId = el.__vue__._props.item.user_id;
    const a = document.createElement("a");
    a.href = `https://www.pixiv.net/users/${userId}`;
    a.textContent = el.__vue__._props.item.author_details.user_name;
    el.append(a);
  });
}

Then, we have to extend the SELECTORS_IMAGE variable of Bobby's Pixiv Utils by editing the script storage, so it can detect images on mobile:

{
  "SELECTORS_IMAGE": ".works-item-illust"
}
§
发布于:2025-04-04

BTW in Tampermonkey, the storage is not editable unless a value has been set: https://stackoverflow.com/questions/56918239/where-is-tampermonkeys-storage-tab-to-edit-the-storage-content

It might be a good idea to write some initial values after installation.

BobbyWibowo作者
§
发布于:2025-04-05
编辑于:2025-04-05

Thanks for the feedback!

Once I have the spare time, I'll look into better support of the mobile site with the next release (it was indeed never tested there). Thanks for the codes excerpts too.

In the meantime, v1.4.7 will now pre-populate its storage with default values for better Tampermonkey support.

BobbyWibowo作者
§
发布于:2025-04-06

As of v1.5.1, blocking artists on mobile is now built into the script 👍

Also, I switched to using sentineljs for everything while I was at it, it's pretty neat

发布留言

登录以发布留言。