Furaffinity Open Selected

Adds a button for open all selected submissiuns

  1. // ==UserScript==
  2. // @name Furaffinity Open Selected
  3. // @namespace https://gf.qytechs.cn/ru/users/303426-титан
  4. // @version 1.3
  5. // @description Adds a button for open all selected submissiuns
  6. // @author Титан
  7. // @match https://www.furaffinity.net/msg/submissions/*
  8. // @require https://gf.qytechs.cn/scripts/21927-arrive-js/code/arrivejs.js
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=furaffinity.net
  10. // @grant GM.setValue
  11. // @grant GM.getValue
  12. // @grant GM_registerMenuCommand
  13. // @grant GM_unregisterMenuCommand
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19. let openDelay; // increase timeout to get less often 503 error. Or set to 0 and install "503 reload" script
  20. let coloredButtons;
  21. const css = `
  22. button[class="standard remove-checked"] {
  23. background-color:#ff000021
  24. }
  25. button[class="standard invert-selection"] {
  26. filter: invert(1) hue-rotate(180deg);
  27. }
  28. button[class="standard open-selected"] {
  29. background-color:#0803
  30. }
  31. `
  32.  
  33. var arriveOptions = {
  34. fireOnAttributesModification: false,
  35. onceOnly: true,
  36. existing: true
  37. };
  38.  
  39. document.arrive(".section-options.actions", arriveOptions, function (newElem) {CreateButton(newElem)});
  40. let menuCommand_ColoredButtons;
  41. let menuCommand_OpenDelay;
  42. RegisterMenuCommands().then(() => {
  43. ApplyColoredButtons();
  44. });
  45.  
  46. async function RegisterMenuCommands() {
  47. coloredButtons = await GM.getValue('coloredButtons', true)
  48. openDelay = await GM.getValue('openDelay', 30);
  49. menuCommand_ColoredButtons = GM_registerMenuCommand( `Colored Buttons ${(coloredButtons? "✅":"❎")}`, async () => {
  50. coloredButtons = !coloredButtons;
  51. await GM.setValue('coloredButtons', coloredButtons);
  52. ApplyColoredButtons()
  53. ReInitializeMenuCommands();
  54. });
  55. menuCommand_OpenDelay = GM_registerMenuCommand( `Change Open Delay [${openDelay} ms]`, async () => {
  56. let delay = prompt("Set Open Delay (ms)", await openDelay);
  57. if (delay) {
  58. delay = parseInt(delay);
  59. if (isNaN(delay)) {
  60. alert("Invalid input. Please enter a valid number.");
  61. return;
  62. }
  63. openDelay = delay;
  64. await GM.setValue('openDelay', openDelay);
  65. }
  66.  
  67. ReInitializeMenuCommands();
  68. });
  69. }
  70.  
  71. function ApplyColoredButtons() {
  72. if (coloredButtons)
  73. ApplyCss();
  74. else
  75. RemoveCss();
  76. }
  77.  
  78. function ReInitializeMenuCommands() {
  79. GM_unregisterMenuCommand(menuCommand_ColoredButtons);
  80. GM_unregisterMenuCommand(menuCommand_OpenDelay);
  81. RegisterMenuCommands();
  82. }
  83.  
  84. function ApplyCss() {
  85. const style = document.createElement("style");
  86. style.textContent = css;
  87. style.id = "coloredButtons";
  88. document.head.appendChild(style);
  89. }
  90. function RemoveCss() {
  91. let style = document.getElementById("coloredButtons");
  92. if (style) {
  93. style.remove();
  94. }
  95. }
  96.  
  97. openDelay = GM.getValue('openDelay', 30);
  98.  
  99.  
  100. function CreateButton(Panel) {
  101. let galleries = document.querySelectorAll(".gallery");
  102. if(galleries) {
  103. let newButton = document.createElement('button');
  104. newButton.classList.add('standard');
  105. newButton.classList.add('open-checked');
  106. newButton.setAttribute('type','button');
  107. newButton.onclick = function() {
  108. let i = 0;
  109. for(let gallery of galleries) {
  110. for (let figure of gallery.children) {
  111. if (figure.classList.contains('checked')) {
  112. setTimeout(function () {
  113. window.open(figure.firstElementChild.firstElementChild.firstElementChild.href)
  114. }, openDelay * i++);
  115. }
  116. }
  117. }
  118. window.focus();
  119. }
  120. newButton.append(document.createTextNode("Open Selected"));
  121. newButton.className = "standard open-selected";
  122. Panel.lastElementChild.previousSibling.previousSibling.before(newButton)
  123. }
  124. }
  125.  
  126.  
  127. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址