Model Lookup

Adds a magnifying glass button to search models on Simpcity.su from any website.

  1. // ==UserScript==
  2. // @name Model Lookup
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description Adds a magnifying glass button to search models on Simpcity.su from any website.
  6. // @match *://*/*
  7. // @grant GM_openInTab
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. function addStyles() {
  14. const style = document.createElement('style');
  15. style.innerHTML = `
  16. .lookup-button {
  17. position: fixed;
  18. top: 50px;
  19. right: 50px;
  20. z-index: 9999;
  21. font-size: 30px;
  22. background-color: #fff;
  23. border: 1px solid #ccc;
  24. border-radius: 50%;
  25. padding: 10px;
  26. cursor: pointer;
  27. box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  28. transition: all 0.3s ease;
  29. }
  30. .lookup-button:hover {
  31. transform: scale(1.1);
  32. box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  33. }
  34. .search-container {
  35. position: fixed;
  36. top: 50%;
  37. left: 50%;
  38. transform: translate(-50%, -50%);
  39. z-index: 10000;
  40. background-color: #fff;
  41. border: 1px solid #ccc;
  42. border-radius: 5px;
  43. padding: 20px;
  44. box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  45. }
  46. .search-container input {
  47. margin-right: 10px;
  48. padding: 5px;
  49. font-size: 14px;
  50. }
  51. .search-container button {
  52. padding: 5px 10px;
  53. cursor: pointer;
  54. font-size: 14px;
  55. }
  56. `;
  57. document.head.appendChild(style);
  58. }
  59.  
  60. function createLookupButton() {
  61. const button = document.createElement('div');
  62. button.classList.add('lookup-button');
  63. button.innerHTML = '<i class="fa fa-search" style="font-size: 30px;"></i>';
  64. button.addEventListener('click', showSearchInput);
  65.  
  66. document.body.appendChild(button);
  67. }
  68.  
  69. function showSearchInput() {
  70. const searchContainer = document.createElement('div');
  71. searchContainer.classList.add('search-container');
  72.  
  73. const searchInput = document.createElement('input');
  74. searchInput.placeholder = 'Enter model name';
  75.  
  76. const searchButton = document.createElement('button');
  77. searchButton.textContent = 'Search';
  78. searchButton.addEventListener('click', () => {
  79. const modelName = searchInput.value.trim();
  80. if (modelName) {
  81. openSimpcitySite(modelName);
  82. document.body.removeChild(searchContainer);
  83. }
  84. });
  85.  
  86. searchContainer.appendChild(searchInput);
  87. searchContainer.appendChild(searchButton);
  88. document.body.appendChild(searchContainer);
  89. }
  90.  
  91. function openSimpcitySite(modelName) {
  92. const url = `https://simpcity.su/search/14138808/?q=${encodeURIComponent(modelName)}&o=date`;
  93. GM_openInTab(url, { active: true });
  94. }
  95.  
  96. // Add styles and the magnifying glass button to the page
  97. addStyles();
  98. createLookupButton();
  99. })();