IMVU Product Minimal Revision Viewer

Adds a CFL revision dropdown next to the creator's name on IMVU product pages, styled with better spacing and size.

  1. // ==UserScript==
  2. // @name IMVU Product Minimal Revision Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  5. // @description Adds a CFL revision dropdown next to the creator's name on IMVU product pages, styled with better spacing and size.
  6. // @author heapsofjoy
  7. // @match *://*.imvu.com/shop/product.php?products_id=*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. const urlParams = new URLSearchParams(window.location.search);
  15. const productId = urlParams.get('products_id');
  16. if (!productId) return;
  17.  
  18. const baseUrl = `https://userimages-akm.imvu.com/productdata/${productId}`;
  19. const authorElement = document.querySelector('h2 a[href*="manufacturers_id"]');
  20. if (!authorElement) return;
  21.  
  22. const wrapper = document.createElement('div');
  23. wrapper.style.display = 'flex';
  24. wrapper.style.flexDirection = 'column';
  25. wrapper.style.marginTop = '6px';
  26.  
  27. const toggleButton = document.createElement('button');
  28. toggleButton.textContent = 'contents.json';
  29. toggleButton.style.background = '#eee';
  30. toggleButton.style.border = '1px solid #ccc';
  31. toggleButton.style.borderRadius = '3px';
  32. toggleButton.style.padding = '4px 8px';
  33. toggleButton.style.fontSize = '12px';
  34. toggleButton.style.cursor = 'pointer';
  35. toggleButton.style.alignSelf = 'flex-start';
  36.  
  37. const dropdown = document.createElement('div');
  38. dropdown.style.display = 'none';
  39. dropdown.style.position = 'absolute';
  40. dropdown.style.background = '#fff';
  41. dropdown.style.border = '1px solid #ccc';
  42. dropdown.style.padding = '8px';
  43. dropdown.style.borderRadius = '4px';
  44. dropdown.style.boxShadow = '0 2px 8px rgba(0,0,0,0.15)';
  45. dropdown.style.maxHeight = '240px';
  46. dropdown.style.overflowY = 'auto';
  47. dropdown.style.fontSize = '13px';
  48. dropdown.style.minWidth = '85px';
  49. dropdown.style.zIndex = '999';
  50.  
  51. toggleButton.addEventListener('click', () => {
  52. dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
  53. });
  54.  
  55. function checkRevision(revision, misses = 0, maxMisses = 10) {
  56. const url = `${baseUrl}/${revision}/_contents.json`;
  57. fetch(url, { method: 'HEAD' })
  58. .then((response) => {
  59. if (response.ok) {
  60. const link = document.createElement('a');
  61. link.href = url;
  62. link.textContent = `Revision ${revision}`;
  63. link.target = '_blank';
  64. link.style.display = 'block';
  65. link.style.color = '#007bff';
  66. link.style.textDecoration = 'none';
  67. link.style.margin = '6px 0';
  68. link.style.padding = '4px 6px';
  69. link.style.borderRadius = '3px';
  70. link.addEventListener('mouseover', () => link.style.background = '#f0f0f0');
  71. link.addEventListener('mouseout', () => link.style.background = 'transparent');
  72. dropdown.appendChild(link);
  73. checkRevision(revision + 1, 0, maxMisses);
  74. } else {
  75. if (misses < maxMisses) {
  76. checkRevision(revision + 1, misses + 1, maxMisses);
  77. }
  78. }
  79. })
  80. .catch(() => {
  81. if (misses < maxMisses) {
  82. checkRevision(revision + 1, misses + 1, maxMisses);
  83. }
  84. });
  85. }
  86.  
  87. checkRevision(1, 0, 10);
  88.  
  89. setTimeout(() => {
  90. if (dropdown.children.length === 0) {
  91. const msg = document.createElement('div');
  92. msg.textContent = 'No revisions found.';
  93. msg.style.color = '#666';
  94. dropdown.appendChild(msg);
  95. }
  96. }, 2000);
  97.  
  98. const container = document.createElement('div');
  99. container.style.position = 'relative';
  100. container.appendChild(toggleButton);
  101. container.appendChild(dropdown);
  102.  
  103. wrapper.appendChild(container);
  104. authorElement.parentNode.appendChild(wrapper);
  105. })();

QingJ © 2025

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