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

發表回覆

登入以回覆