TBT

Resizes the thumbnails to make them easier to see

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

QingJ © 2025

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