Created
May 26, 2019 07:41
-
-
Save b2ox/dd25054bf922173f7855386545e4ea7a to your computer and use it in GitHub Desktop.
Pixivのブックマーク編集ページで"あなたのブックマークタグ"の並びを"名前順↑"にする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Pixiv fix bookmark-tag sort | |
// @namespace https://www.pixiv.net/ | |
// @version 0.1 | |
// @description ブックマークタグの並びを名前順↑にする | |
// @author b2ox | |
// @match https://www.pixiv.net/bookmark_add.php* | |
// @grant none | |
// ==/UserScript== | |
'use strict'; | |
const sleep = msec => new Promise(resolve => setTimeout(resolve, msec)); | |
const waitCond = async (mes, timeOut, f) => { | |
console.log(`wait ${mes}...`); | |
timeOut *= 1000; | |
const n = Date.now(); | |
while (Date.now() - n < timeOut) { | |
if (f()) return true; | |
await sleep(100); | |
} | |
console.log(`wait ${mes} timeout.`); | |
return false; | |
} | |
(async () => { | |
const sn = '._clickable:contains("名前順")'; | |
if (!await waitCond('tag-sort', 10, () => $(sn).length > 0)) return; | |
const e = $(sn); | |
if (e.text() == '名前順') e.trigger('click').trigger('click'); | |
else if (e.text() == '名前順↓') e.trigger('click'); | |
console.log('sort: 名前順↑'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
久々にPixivのタグ編集したらブックマークタグのデフォルトソートが件数になってる上に設定を覚えてくれないクソ仕様になりはてていたので、
Tampermonkeyで名前順↑に変えるスクリプトを書いた。