// ==UserScript== // @name Pixiv Show bookmark count // @name:zh-CN Pixiv 显示每个插图的书签数量 // @name:zh-TW Pixiv 顯示每個插圖的書籤數量 // @version 6.0.1 // @match https://www.pixiv.net/* // @namespace https://greasyfork.org/users/7945 // @description 検索ページ、作者作品一覧ページなどにて、各イラストのブックマーク数を表示します。 // @description:en Displays the number of bookmarks for each illustration on the search page, author work list page, etc. // @description:zh-CN 在搜索页面,作者工作列表页面等上显示每个插图的书签数量。 // @description:zh-TW 在搜索頁面,作者工作列表頁面等上顯示每個插圖的書籤數量。 // @downloadURL https://update.greasyfork.icu/scripts/7302/Pixiv%20Show%20bookmark%20count.user.js // @updateURL https://update.greasyfork.icu/scripts/7302/Pixiv%20Show%20bookmark%20count.meta.js // ==/UserScript== document.head.insertAdjacentHTML("beforeend", ''); const done = '.bmcount , .bookmark-count , a[href*="/bookmark_detail.php?illust_id="]'; new MutationObserver(() => { document.querySelectorAll('.sc-9y4be5-1.jtUPOE li:not([data-dummybmc]) , .sc-jgyytr-0.buukZm li:not([data-dummybmc]) , .sc-e6de33c8-0.buGhFj li:not([data-dummybmc]) , .ranking-item:not([data-dummybmc]) , .gtm-illust-recommend-zone[data-gtm-recommend-zone="discovery"] li:not([data-dummybmc])').forEach(async (Each) => { Each.dataset.dummybmc = ""; const id = /\d+/.exec(Each.querySelector('a[href*="/artworks/"]')?.href)?.[0]; if (!id || !Each.hasAttribute("data-dummybmc") || Each.querySelectorAll(done).length || Each.hasAttribute("data-bmcount")) return; const bmcount = (await (await fetch("https://www.pixiv.net/ajax/illust/" + id, { credentials: "omit" })).json()).body.bookmarkCount; if (bmcount && !Each.querySelectorAll(done).length && !Each.hasAttribute("data-bmcount")) Each.insertAdjacentHTML("beforeend", '
' + bmcount + "
"); Each.dataset.bmcount = bmcount; }); }).observe(document.body, { childList: true, subtree: true });