Greasy Fork is available in English.

Bobby's Pixiv Utils

7/2/2024, 8:37:14 PM

< Feedback on Bobby's Pixiv Utils

Review: Good - script works

§
Posted: 04.04.2025

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"
}
§
Posted: 04.04.2025

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.

BobbyWibowoAuthor
§
Posted: 05.04.2025
Edited: 05.04.2025

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.

BobbyWibowoAuthor
§
Posted: 06.04.2025

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

Post reply

Sign in to post a reply.