Forked from unarist/pixiv-replace-pawoo-with-webmastodon.user.js
Last active
May 25, 2018 16:19
-
-
Save pacochi/30007cd93754d6e45e7942f0139a59da to your computer and use it in GitHub Desktop.
Pixiv - Replace "Pawooでシェア" with web+mastodon button(+ #R-18 → #R18)
This file contains hidden or 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 - Replace "Pawooでシェア" with web+mastodon button | |
// @namespace hen.acho.co | |
// @version 0.3.180526 | |
// @conrtibutor unarist https://gist.github.com/unarist/79068e361c8cf69af4b7a520914e1259 | |
// @downloadURL https://gist.github.com/pacochi/30007cd93754d6e45e7942f0139a59da/raw/pixiv-replace-pawoo-with-webmastodon.user.js | |
// @match https://www.pixiv.net/bookmark_add.php?* | |
// @match https://www.pixiv.net/member_illust.php?* | |
// @match https://www.pixiv.net/novel/bookmark_add.php?* | |
// @match https://www.pixiv.net/novel/show.php?* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const button = document.querySelector('._share-links .pawoo a'); | |
if (button) { | |
button.href = button.href.replace('https://pawoo.net/intent/statuses/new', 'web+mastodon://share').replace(/%23R-(\d+G?)%20/gi, '%23R$1%20'); | |
const img = button.querySelector('img'); | |
// based on https://github.com/tootsuite/mastodon/blob/v2.2.0/app/javascript/images/logo.svg | |
img.src = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='-3.633 -3.03 24 24'%3E%3Cpath fill='%233088D4' d='M16.378 10.755c-.246 1.266-2.203 2.649-4.451 2.919-1.172.14-2.326.268-3.557.212-2.012-.093-3.6-.481-3.6-.481 0 .196.012.384.036.558.262 1.986 1.97 2.105 3.587 2.161 1.632.055 3.086-.402 3.086-.402l.066 1.476s-1.142.614-3.176.726c-1.122.063-2.515-.027-4.137-.457C.712 16.536.107 12.784.015 8.979c-.028-1.13-.01-2.196-.01-3.087C.005 2 2.555.86 2.555.86 3.841.267 6.047.019 8.341 0h.056c2.293.019 4.5.267 5.787.858 0 0 2.55 1.14 2.55 5.032-.001 0 .032 2.871-.356 4.865'/%3E%3Cpath fill='%23FFF' d='M13.726 6.192v4.712h-1.867V6.331c0-.964-.405-1.454-1.217-1.454-.896 0-1.348.58-1.348 1.729v2.503H7.439V6.605c0-1.148-.45-1.729-1.347-1.729-.812 0-1.217.49-1.217 1.454v4.573H3.008V6.192c0-.963.245-1.729.738-2.294.508-.566 1.173-.856 1.999-.856.956 0 1.679.367 2.157 1.102l.465.78.466-.78c.477-.734 1.201-1.102 2.157-1.102.825 0 1.49.29 1.999.856.491.565.737 1.331.737 2.294'/%3E%3C/svg%3E"; | |
img.dataset.tooltip = 'Mastodon'; | |
button.querySelector('.label').textContent = 'Mastodonでシェア'; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment