Youtube Reintegration

Make sure to hit that subscribe button!

  1. // ==UserScript==
  2. // @name Youtube Reintegration
  3. // @icon https://pixelplace.io/img/youtube-icon.svg
  4. // @namespace http://tampermonkey.net/
  5. // @version 1.0
  6. // @description Make sure to hit that subscribe button!
  7. // @author guildedbird
  8. // @match https://pixelplace.io/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function add() {
  17. let linked = document.querySelectorAll('#modals .box > .box-content[data-id=account]');
  18. linked.forEach(account => {
  19. let firstChild = account.firstElementChild;
  20. if (firstChild) {
  21. let div = document.createElement('div');
  22. div.className = 'linked-account';
  23. div.setAttribute('data-id', '4');
  24. div.innerHTML = `
  25. <div data-value="youtube">
  26. <img src="/img/youtube-icon.svg" width="24">
  27. </div>
  28. <span></span>
  29. <a href="https://pixelplace.io/api/sso.php?type=4&amp;action=remove" title="Disconnect Youtube account?" class="link-remove">Disconnect?</a>
  30. <a href="https://pixelplace.io/api/sso.php?type=4&amp;action=login" title="Connect your Youtubw account" class="link-add" style="display: none;">Connect your Youtube account</a>
  31. `;
  32. let children = firstChild.children;
  33. if (children.length >= 4) {
  34. firstChild.insertBefore(div, children[4]);
  35. } else {
  36. firstChild.appendChild(div);
  37. }
  38. }
  39. });
  40. }
  41.  
  42. function style() {
  43. let youtube = document.querySelector('#modals .box > .box-content div .margin-bottom a.sso[data-value="youtube"]');
  44. if (youtube) {
  45. youtube.style = 'block';
  46. }
  47. }
  48.  
  49. window.addEventListener('load', () => {
  50. add();
  51. style();
  52. });
  53.  
  54. const image = 'https://support.discord.com/hc/user_images/PRywUXcqg0v5DD6s7C3LyQ.jpeg';
  55.  
  56. function replace() {
  57. document.querySelectorAll('img[src*="discordapp-tile.svg"]').forEach(img => {
  58. img.src = image;
  59. img.style.borderRadius = '7px';
  60. });
  61. }
  62.  
  63. replace();
  64.  
  65. const observer = new MutationObserver(replace);
  66. observer.observe(document.body, { childList: true, subtree: true });
  67. })();