TBT

Resizes the thumbnails to make them easier to see

  1. // ==UserScript==
  2. // @name TBT
  3. // @namespace https://github.com/runisco
  4. // @version 2.4.1
  5. // @supportURL https://github.com/Runisco/TBT/issues
  6. // @description Resizes the thumbnails to make them easier to see
  7. // @author Runisco
  8. // @match https://simpcity.su/*
  9. // @match https://simpcity.su/search/*
  10. // @match https://simpcity.su/search-forums/trending/
  11. // @match https://simpcity.su/whats-new/*
  12. // @match https://simpcity.su/tags/*
  13. // @exclude https://simpcity.su/forums/helping-the-community.35/
  14. // @match https://simpcity.cr/*
  15. // @match https://simpcity.cr/search/*
  16. // @match https://simpcity.cr/search-forums/trending/
  17. // @match https://simpcity.cr/whats-new/*
  18. // @exclude https://simpcity.cr/forums/helping-the-community.35/
  19. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAACXBIWXMAAAsSAAALEgHS3X78AAACZFBMVEVHcEyiIDaiIDaiIDaiIDaiIDaiHzWiHjSiHjSiIDaiIDaiIDajITeiIDaiIDaiIDajITeiIDaiIDaiIDaiIDaiIDajIDaiIDaiHzWiHzWiIDaiHzWiHzWiIDaiHzWiHzWiIDaiIDaiIDaiIDajITeiIDaiIDaiIDaiIDaiHzWiIDahHjSiHzaiIDaiIDaiIDaiIDahHTSiIDaiIDaiIDaiIDaiIDaiIDaiIDaiHzWiHzWiIDaiIDaiIDajITeiHzWiHzWiIDaiIDaiIDaiHzWiIDaiIDaiIDaiIDaiIDahHjWiHzWiIDaiHjSiIDaiHzWiIDaiIDaiHzaiHjSiIDaiIDaiIDaiHjSiIDaiIDajIDajITaiHjWiIDaiIDaiIDaiHzaiIDaiIDahHTOiHzWhHjSiIDaiIDaiIDaiHzWiIDaiIDaiIDaiIDaiIDaiIDaiHjShHDKiIDaiIDaiIDaiIDaiIDaiIDaiIDaiHzWiIDaiIDaiIDaiIDaiIDWiHzaiIDaiHzWiIDaiIDaiHzWkIjeiIDaiHzWhHjSjITeiIDaiIDaiIDai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z1YggKR0pa2jkVDAWrirexbN+2+8hO5kR/y0pTb+SwDLeq0BcS0d2+lyUtLjLWVMOTQVEBNUGlqu/ecdhiTWlj8lKQQMq0ODnUZMUhuDP7pIllJSh/6GWpq0fZAyMIGSyzPrhre9PGdTplpja2Wvn6XfIoiV+Moa5EWW89wxQbVusqUSH+dE4f9CTlu7pwQ7MZa7ltw/Yj+3ZtM3JASQ5gYH5q92kjY+HqplpR2xU2HJgZo65mc6PVpswtwLivX1uPkAEACEupA1nO9yMAAAAASUVORK5CYII=
  20. // @require https://code.jquery.com/jquery-3.3.1.min.js
  21. // @require https://openuserjs.org/src/libs/sizzle/GM_config.js
  22. // @grant GM_getValue
  23. // @grant GM_setValue
  24. // @grant GM_deleteValue
  25. // ==/UserScript==
  26.  
  27. /* globals $, GM_config */
  28.  
  29. var debug = true
  30.  
  31. var iconData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAPZJREFUWEftlrENwjAQRb8bWppzSQcN9AwArAEVHQPQUdAxAAuQNYCGGWABRJWrYIBDQbYUgiESSpzm0sa+e3r37cSg4cc03B8KoAbUgBowzLwHMC65kB4AFiLSM8YsAbQC619riCjJ3jHzGUC/pO7tYwQOaJgv5oukabp2ACcimuSLu4ad0L4cUBvAjIiOfm9lAL/gogKISGKtnRfVO0P1GXANQESD0NyrBgiFMOt7iQUQCqE/TYdiQKNkgJmnALYA7sWkxwIYAdi5+b8dtVgA3sA1lIOqQ/jtIuqKyMZau6r7GJZexX8DxP5J1c+xGlADaqBxA0+67ujJ2qrzbQAAAABJRU5ErkJggg=='
  32. var menuIcon = $('<a href="#" id="tbtConfig" class="p-navgroup-link u-ripple p-navgroup-link--iconic p-navgroup-link--conversations js-badge--conversations badgeContainer rippleButton"><img width="23" height="5" src="' + iconData + '"></img></a>')
  33. menuIcon.insertAfter($('.p-navgroup-link--alerts'))
  34. $('#tbtConfig').click(function(e){
  35. e.preventDefault();
  36. GM_config.open();
  37. })
  38.  
  39. GM_config.init(
  40. {
  41. 'id': 'TBThumbnailResize',
  42. 'title': 'TBThumbnailResize Config',
  43. 'fields':
  44. {
  45. 'tbtThumbnailEnable':
  46. {
  47. 'section': 'Features',
  48. 'label': 'Enable thumbnail resize',
  49. 'type': 'checkbox',
  50. 'title': 'Check to enable thumbnail resize',
  51. 'default': false
  52. },
  53. 'tbtGenreSelection':
  54. {
  55. 'type': 'checkbox',
  56. 'label': 'Genre shortcuts',
  57. 'title': 'Check to enable the genre shortcuts',
  58. 'default': false
  59. },
  60. 'tbtWidth':
  61. {
  62. 'section': 'Image Size',
  63. 'label': 'Width',
  64. 'labelPos': 'Left',
  65. 'type': 'int',
  66. 'default': 300
  67. },
  68. 'tbtHeight':
  69. {
  70. 'label': 'Height',
  71. 'type': 'int',
  72. 'default': 200
  73. },
  74. 'resizeDefault':
  75. {
  76. 'label': 'Resize default',
  77. 'type': 'checkbox',
  78. 'title': 'Should default thumbnails (no image) be resized to keep titles flush with eachother?',
  79. 'default': true
  80. },
  81.  
  82. },
  83. 'events': // Callback functions object
  84. {
  85. 'save': function() {reloadOptionsOnSave()},
  86. 'open': function(){
  87. var config_ui = this.frame;
  88. config_ui.style.height = '30%';
  89. config_ui.style.margin = 'auto';
  90. config_ui.style.width = '20%';
  91. config_ui.style.left = '40%';
  92. }
  93. },
  94. 'css':'#TBThumbnailResize_field_tbtWidth{width: 10%} #TBThumbnailResize_field_tbtHeight{width: 10%}'
  95. });
  96.  
  97. function resizeThumbnails(reset=false){
  98. let newWidth = GM_config.get('tbtWidth');
  99. let newHeight = GM_config.get('tbtHeight');
  100. let resizeDefault = GM_config.get('resizeDefault');
  101. //console.log("newWidth: " + newWidth)
  102. //console.log("newHeight: " + newHeight)
  103. //console.log("reset default? :" + GM_config.get('resizeDefault'))
  104. var regular = true
  105. var blockbody = false
  106. var structitemcontainer = false
  107.  
  108. if (['/trending/'].some(v => String(window.location.href).includes(v)) && !['/search-forums/'].some(v => String(window.location.href).includes(v))){
  109. regular = false
  110. if (debug){console.log("resizeThumbnails func: alternate page type found. regular set to false, jumping.")}
  111. } else if (["/whats-new/posts/", "/watched/", "/find-threads/", "/search-forums/"].some(v => String(window.location.href).includes(v))){
  112. regular = false
  113. structitemcontainer = true
  114. if (debug){console.log("resizeThumbnails func: structitemcontainer page type found. structitemcontainer set to true, jumping.")}
  115. }else if (["/search/", "/whats-new/", "/tags/"].some(v => String(window.location.href).includes(v))){
  116. regular = false
  117. blockbody = true
  118. if (debug){console.log("resizeThumbnails func: blockbody page type found. blockbody set to true, jumping.")}
  119. }
  120. // if (debug){console.log("Regular: " + regular + "\nSearch: " + search)}
  121.  
  122. if (regular){
  123. $('.js-threadList').find('a.dcThumbnail').each(function(index){
  124. if (debug){console.log("resizeThumnails func: Attempted to go through each a.dcThumbnail in .js-threadList")}
  125. let thumbUrl = $(this).find('img').attr('style')
  126. if(reset){
  127. $(this).parent().parent().attr('style','width: calc(75px + 19px); height: calc(50px + 5px);')
  128. $(this).attr('style','width: 75px; height: 50px; border-radius: 4px')
  129. }else if(!thumbUrl.includes('-Default-Thumbnail.png')){
  130. $(this).parent().parent().attr('style','width: calc(' + newWidth + 'px + 19px); height: calc(' + newHeight + 'px + 5px);')
  131. $(this).attr('style','width: ' + newWidth + 'px; height: ' + newHeight + 'px; border-radius: 4px')
  132. } else {
  133. if (resizeDefault){
  134. $(this).parent().parent().attr('style','width: calc(' + newWidth + 'px + 19px); height: calc(50px + 5px);')
  135. $(this).attr('style','width: ' + newWidth + 'px; height: 50; border-radius: 4px')
  136. } else {
  137. $(this).parent().parent().attr('style','width: calc(75px + 19px); height: calc(50px + 5px);')
  138. $(this).attr('style','width: 75px; height: 50; border-radius: 4px')
  139. }
  140. }
  141. //
  142. // Below code is before the migration after crash in july 2024, saved just in case.
  143. //
  144.  
  145. // $('.js-threadList').find('a.DC_ThreadThumbnail_image').each(function(index){
  146. // let thumbUrl = $(this).find('img').attr('style')
  147. // console.log(thumbUrl)
  148. // if(reset){
  149. // $(this).attr('style','width: 75px; height: 50px;')
  150. // }else if(!thumbUrl.includes('-Default-Thumbnail.png')){
  151. // $(this).attr('style','width: ' + newWidth + 'px; height: ' + newHeight + 'px;')
  152. // } else {
  153. // if (resizeDefault){
  154. // $(this).attr('style','width: ' + newWidth + 'px; height: 50;')
  155. // } else {
  156. // $(this).attr('style','width: 75px; height: 50;')
  157. // }
  158. // }
  159. // });
  160. });
  161. } else if(structitemcontainer){
  162. if (debug){console.log("resizeThumnails func: Landed inside alternate method")}
  163. $('.structItemContainer').find('a.dcThumbnail').each(function(index){
  164. let thumbUrl = $(this).find('img').attr('style')
  165. if(reset){
  166. $(this).parent().parent().attr('style','width: calc(75px + 19px); height: calc(50px + 5px);')
  167. $(this).attr('style','width: 75px; height: 50px; border-radius: 4px')
  168. }else if(!thumbUrl.includes('-Default-Thumbnail.png')){
  169. $(this).parent().parent().attr('style','width: calc(' + newWidth + 'px + 19px); height: calc(' + newHeight + 'px + 5px);')
  170. $(this).attr('style','width: ' + newWidth + 'px; height: ' + newHeight + 'px; border-radius: 4px')
  171. } else {
  172. if (resizeDefault){
  173. $(this).parent().parent().attr('style','width: calc(' + newWidth + 'px + 19px); height: calc(50px + 5px);')
  174. $(this).attr('style','width: ' + newWidth + 'px; height: 50; border-radius: 4px')
  175. } else {
  176. $(this).parent().parent().attr('style','width: calc(75px + 19px); height: calc(50px + 5px);')
  177. $(this).attr('style','width: 75px; height: 50; border-radius: 4px')
  178. }
  179. }
  180. });
  181.  
  182. } else if(blockbody){
  183. if (debug){console.log("resizeThumnails func: Landed inside search method")}
  184. $('.block-body').find('a.dcThumbnail').each(function(index){
  185. let thumbUrl = $(this).find('img').attr('style')
  186. if(reset){
  187. $(this).parent().parent().attr('style','width: calc(75px + 19px); height: calc(50px + 5px);')
  188. $(this).attr('style','width: 75px; height: 50px; border-radius: 4px')
  189. }else if(!thumbUrl.includes('-Default-Thumbnail.png')){
  190. $(this).parent().parent().attr('style','width: calc(' + newWidth + 'px + 19px); height: calc(' + newHeight + 'px + 5px);')
  191. $(this).attr('style','width: ' + newWidth + 'px; height: ' + newHeight + 'px; border-radius: 4px')
  192. } else {
  193. if (resizeDefault){
  194. $(this).parent().parent().attr('style','width: calc(' + newWidth + 'px + 19px); height: calc(50px + 5px);')
  195. $(this).attr('style','width: ' + newWidth + 'px; height: 50; border-radius: 4px')
  196. } else {
  197. $(this).parent().parent().attr('style','width: calc(75px + 19px); height: calc(50px + 5px);')
  198. $(this).attr('style','width: 75px; height: 50; border-radius: 4px')
  199. }
  200. }
  201. });
  202. }
  203.  
  204.  
  205.  
  206. if (['whats-new', 'watched/threads'].some(v => String(window.location.href).includes(v))){
  207. $('.structItemContainer').find('a.avatar.DC_ThreadThumbnail_image ').each(function(index){
  208. let thumbUrl = $(this).find('img').attr('style')
  209. if(reset){
  210. $(this).attr('style','width: 75px; height: 50px;')
  211. }else if(!thumbUrl.includes('-Default-Thumbnail.png')){
  212. $(this).attr('style','width: ' + newWidth + 'px; height: ' + newHeight + 'px;')
  213. } else {
  214. if (resizeDefault){
  215. $(this).attr('style','width: ' + newWidth + 'px; height: 50;')
  216. } else {
  217. $(this).attr('style','width: 75px; height: 50;')
  218. }
  219. };
  220. });
  221. };
  222. }
  223.  
  224.  
  225. function genreSelection(reset=false){
  226. var entryPoint = $("[data-widget-definition='members_online']")
  227. var genreBlock = $(`
  228. <div class="block" id="genreSelection" data-widget-section="genreBlock" data-widget-id="117" data-widget-key="forum_overview_select_genre" data-widget-definition="genre_selection">
  229. <div class="block-container">
  230. <h3 class="block-minorHeader">Select Genre</h3>
  231. <div class="block-body">
  232. <div class="block-row block-row--minor">
  233. <ul class="listInline listInline--comma">
  234.  
  235.  
  236. <li><a href="?prefix_id[0]=3" class="labelLink" rel="nofollow"><span class="label label--onlyfans" dir="auto">Onlyfans</span></a></li>
  237. <li><a href="?prefix_id[0]=39" class="labelLink" rel="nofollow"><span class="label label--fansly" dir="auto">Fansly</span></a></li>
  238. <li><a href="?prefix_id[0]=12" class="labelLink" rel="nofollow"><span class="label label--asian" dir="auto">Asian</span></a></li>
  239. <li><a href="?prefix_id[0]=13" class="labelLink" rel="nofollow"><span class="label label--thicc" dir="auto">T.H.I.C.C</span></a></li>
  240. <li><a href="?prefix_id[0]=14" class="labelLink" rel="nofollow"><span class="label label--teen" dir="auto">Teen</span></a></li>
  241. <li><a href="?prefix_id[0]=15" class="labelLink" rel="nofollow"><span class="label label--brazil" dir="auto">Brazil</span></a></li>
  242. <li><a href="?prefix_id[0]=16" class="labelLink" rel="nofollow"><span class="label label--celeb" dir="auto">Celeb</span></a></li>
  243. <li><a href="?prefix_id[0]=18" class="labelLink" rel="nofollow"><span class="label label--cosplay" dir="auto">Cosplay</span></a></li>
  244. <li><a href="?prefix_id[0]=19" class="labelLink" rel="nofollow"><span class="label label--trans" dir="auto">Trans</span></a></li>
  245. <li><a href="?prefix_id[0]=43" class="labelLink" rel="nofollow"><span class="label label--bbw" dir="auto">BBW</span></a></li>
  246. <li><a href="?prefix_id[0]=44" class="labelLink" rel="nofollow"><span class="label label--asmr" dir="auto">ASMR</span></a></li>
  247. <li><a href="?prefix_id[0]=46" class="labelLink" rel="nofollow"><span class="label label--milf" dir="auto">MILF</span></a></li>
  248. <li><a href="?prefix_id[0]=47" class="labelLink" rel="nofollow"><span class="label label--petite" dir="auto">Petite</span></a></li>
  249. <li><a href="?prefix_id[0]=48" class="labelLink" rel="nofollow"><span class="label label--feet" dir="auto">Feet</span></a></li>
  250. <li><a href="?prefix_id[0]=49" class="labelLink" rel="nofollow"><span class="label label--latina" dir="auto">Latina</span></a></li>
  251. <li><a href="?prefix_id[0]=50" class="labelLink" rel="nofollow"><span class="label label--ebony" dir="auto">Ebony</span></a></li>
  252. <li><a href="?prefix_id[0]=86" class="labelLink" rel="nofollow"><span class="label label--indian" dir="auto">Indian</span></a></li>
  253. <li><a href="?prefix_id[0]=87" class="labelLink" rel="nofollow"><span class="label label--ftm" dir="auto">FtM</span></a></li>
  254.  
  255. </ul>
  256. </div>
  257. </div>
  258. </div>
  259. </div>`)
  260. if (reset){
  261. $('#genreSelection').remove()
  262. } else {
  263. genreBlock.insertAfter(entryPoint)
  264. };
  265. }
  266.  
  267. function reloadOptionsOnSave(){
  268. if(GM_config.get('tbtThumbnailEnable')){
  269. resizeThumbnails();
  270. } else {
  271. resizeThumbnails(true);
  272. };
  273. if(GM_config.get('tbtGenreSelection')){
  274. genreSelection();
  275. } else {
  276. genreSelection(true);
  277. };
  278. }
  279.  
  280. $(document).ready(function(){
  281. if (debug){console.log("Main document ready")}
  282. if(GM_config.get('tbtThumbnailEnable')){
  283. resizeThumbnails()
  284. if (debug){console.log("main document ready: attempted resize on thumnails")}
  285. }
  286. if(GM_config.get('tbtGenreSelection')){
  287. genreSelection()
  288. if (debug){console.log("main document ready: added genre selection box")}
  289. }
  290. })

QingJ © 2025

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