VivePort new links

Some minor tweaks to VivePort.com, to enable browsing to experiences while not losing your position in the search results (opening pages in new windows/tabs).

  1. // ==UserScript==
  2. // @name VivePort new links
  3. // @namespace http://tampermonkey.net/
  4. // @version 2025-06-06
  5. // @description Some minor tweaks to VivePort.com, to enable browsing to experiences while not losing your position in the search results (opening pages in new windows/tabs).
  6. // @author Steve64B
  7. // @match https://www.viveport.com/filter-page*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=viveport.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. // Function to create links for product cards
  17. function createLinks() {
  18. let productCards = document.querySelectorAll("div#productCard");
  19. productCards.forEach(card => {
  20. // Check if the link has already been added
  21. if (!card.querySelector("a#customlink")) {
  22. let img = card.querySelector("img.card_image");
  23. if (img) {
  24. let src = img.src;
  25. let basename = src.split('/').pop(); // Get the last part of the URL
  26. let id = basename.split('.')[0]; // Get the string before the first dot
  27. let link = document.createElement("a");
  28. link.target = "_blank";
  29. link.href = "https://www.viveport.com/apps/" + id;
  30. link.id = "customlink";
  31. link.textContent = "Go to product page";
  32. link.addEventListener("click", function (event) {
  33. event.stopPropagation(); // Prevent click event from bubbling
  34. });
  35. card.appendChild(link);
  36. } else {
  37. console.warn("No image with class 'card_image' found in one of the productCards.");
  38. }
  39. }
  40. });
  41. // Update all <p> elements with the 'chakra-text' class
  42. let textElements = document.querySelectorAll("p.chakra-text");
  43. textElements.forEach(p => {
  44. p.setAttribute("title", p.textContent.trim());
  45. });
  46. }
  47.  
  48. // Set up a MutationObserver to watch for changes in the DOM
  49. const observer = new MutationObserver((mutations) => {
  50. mutations.forEach((mutation) => {
  51. if (mutation.type === "childList" || mutation.type === "subtree") {
  52. createLinks(); // Recreate links when the DOM changes
  53. }
  54. });
  55. });
  56.  
  57. // Start observing the body for changes
  58. const config = { childList: true, subtree: true };
  59. observer.observe(document.body, config);
  60.  
  61. // Initial call to create links for already loaded content
  62. createLinks();
  63.  
  64. })();

QingJ © 2025

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