🏠 Home 

Greasy Fork is available in English.

Phixiv Share

Add Phixiv Share button to pixiv


Installer dette script?
  1. // ==UserScript==
  2. // @name Phixiv Share
  3. // @namespace https://github.com/gjing/phixiv-share
  4. // @version 1.1.1
  5. // @description Add Phixiv Share button to pixiv
  6. // @author gjing
  7. // @match https://www.pixiv.net/*
  8. // @run-at document-idle
  9. // @license MIT
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. let url = location.href;
  14. document.body.addEventListener('click', ()=>{
  15. requestAnimationFrame(()=>{
  16. if (url!==location.href) {
  17. url = location.href;
  18. const element = document.getElementsByClassName("sc-181ts2x-0")[0].remove();
  19. wait_icon();
  20. }
  21. });
  22. }, true);
  23. function wait_icon() {
  24. const intv = setInterval(function() {
  25. const nav_bar = document.getElementsByClassName("sc-181ts2x-0");
  26. if (nav_bar.length == 0) {
  27. return false;
  28. }
  29. clearInterval(intv);
  30. load_icon();
  31. }, 100);
  32. }
  33. function load_icon() {
  34. const link = window.location.href.replace("pixiv", "phixiv");
  35. const element = document.getElementsByClassName("sc-181ts2x-0")[0];
  36. const div_string = '<div class="sc-181ts2x-7"><button type="button" class="y35SzDmKENoCKvur"><span class="Gi9zOhEDaI9fmUNA">PHIX</span></button></div>';
  37. const div = document.createElement('div');
  38. div.innerHTML = div_string;
  39. div.style.paddingRight = '10px';
  40. div.onclick = function() {
  41. navigator.clipboard.writeText(link);
  42. }
  43. element.appendChild(div);
  44. }
  45. wait_icon();
  46. })();