1
1
// ==UserScript==
2
2
// @name UnityForumFixer
3
3
// @namespace https://unitycoder.com/
4
- // @version 0.4 (24.08.2024)
4
+ // @version 0.41 (24.08.2024)
5
5
// @description Fixes For Unity Forums - https://github.com/unitycoder/UnityForumFixer
6
6
// @author unitycoder.com
7
7
// @match https://discussions.unity.com/*
21
21
TopicsViewShowOriginalPosterInfo ( ) ; // TODO needs some css adjustments for name location
22
22
FixPostActivityTime ( ) ;
23
23
PostViewShowOriginalPosterInfo ( ) ;
24
-
24
+ TopicsViewCombineViewAndReplyCounts ( ) ;
25
25
setTimeout ( OnUpdate , 1000 ) ; // run loop to update activity times (since some script changes them back to original..)
26
26
} ) ;
27
27
} ) ( ) ;
@@ -49,8 +49,14 @@ function AppendCustomCSS()
49
49
50
50
#main-outlet {width:auto !important;} /* smaller main forum width */
51
51
52
- html .heatmap-med,html .heatmap-med a,html .heatmap-med .d-icon,html .heatmap-med {color: inherit !important;} /* replies/views: heatmap colors */
53
- html .heatmap-high,html .heatmap-high a,html .heatmap-high .d-icon,html .heatmap-high {color: inherit !important; font-weight:inherit !important;} /* replies/views: heatmap colors */
52
+ /* replies/views: heatmap colors */
53
+ html .heatmap-med,html .heatmap-med a,html .heatmap-med .d-icon,html .heatmap-med {color: inherit !important;}
54
+ html .heatmap-high,html .heatmap-high a,html .heatmap-high .d-icon,html .heatmap-high {color: inherit !important; font-weight:inherit !important;}
55
+
56
+ /* post titles */
57
+ .title.raw-link.raw-topic-link:link {font: bold 11pt 'Inter', sans-serif;}
58
+ .title.raw-link.raw-topic-link:hover {color: rgb(82,132,189) !important; text-decoration: underline !important;}
59
+ body .main-link .title.raw-link.raw-topic-link:visited { font:normal !important; color: var(--primary) !important}
54
60
55
61
.wrap.custom-search-banner-wrap h1 {display: none;} /* hide welcome banner */
56
62
.wrap.custom-search-banner-wrap {padding:0px;} /* remove search bar padding */
@@ -65,10 +71,13 @@ function AppendCustomCSS()
65
71
.is-solved-label.solved {font-weight: normal !important; font-size: 12px !important; padding: 1px !important; user-select: text !important; float: right !important; } /* resolved tag, initial fixes */
66
72
.badge-category__icon {display: none !important;} /* hide badge category icon for now, since most of them seem to be unity logos */
67
73
.is-solved-label {display: none !important;} /* hide unresolved span, since all are unresolved, unless marked solved? */
68
- .title.raw-link.raw-topic-link {font: bold 14px/1.231 arial,helvetica,clean,sans-serif !important;} /* post title: orig forum has 13px, might use that later */
69
- .title.raw-link.raw-topic-link:hover {color: rgb(82,132,189) !important; text-decoration: underline !important;} /*post title hover */
70
74
.topic-list .topic-list-data:first-of-type {padding-left: 8px !important;} /* post topic rows, half the padding */
71
75
.discourse-tags {font-size: 0.8em !important;} /* tags below post title, smaller */
76
+ .discourse-tag.simple {border: 1px solid rgba(var(--primary-rgb), 0.05) !important;}
77
+
78
+ /* if want to hide all question tags */
79
+ /* a[data-tag-name="question"] { display: none !important; }*/
80
+
72
81
.relative-date {font-size: 0.9em !important; color: rgb(150, 150, 150) !important;}
73
82
.ember-view.bread-crumbs-left-outlet.breadcrumb-label {display: none !important;} /* "… or filter the topics via" */
74
83
.navigation-container {--nav-space: 0 !important; padding-bottom: 6px;} /* navbar adjustments */
@@ -104,11 +113,17 @@ function AppendCustomCSS()
104
113
.unity-footer-menu.unity-footer-menu-legal.processed li { margin: 0 10px; }
105
114
106
115
107
- /* custom added fields */
108
- .original-poster-span {font: 13px/1.231 arial,helvetica,clean, sans-serif; color: rgb(150, 150, 150); } /* original poster below post title */
109
- .latest-poster-span { display: block; word-break: break-all; max-width: 100%; } /* activity, latest poster */
116
+ /* added custom fields */
117
+ .original-poster-span {font: 13px 'Inter', sans-serif !important ; color: rgb(150, 150, 150); } /* original poster below post title */
118
+ .latest-poster-span { display: block; word-break: break-all; max-width: 100%; font: 14px 'Inter', sans-serif !important; } /* activity, latest poster */
110
119
111
- ` ;
120
+ .combined-views-container {display: flex;justify-content: space-between;width: 100%;white-space: nowrap; font-size:13px;}
121
+ .combined-views-label {color: rgb(150, 150, 150); text-align: left;}
122
+ .combined-views-number {color: var(--primary); margin-left: auto;text-align: right;}
123
+
124
+
125
+
126
+ ` ;
112
127
document . head . appendChild ( style ) ;
113
128
}
114
129
@@ -213,6 +228,52 @@ function TopicsViewShowOriginalPosterInfo()
213
228
} ) ;
214
229
}
215
230
231
+ function TopicsViewCombineViewAndReplyCounts ( )
232
+ {
233
+ // Select all rows in the topic list
234
+ const rows = document . querySelectorAll ( 'tr.topic-list-item' ) ;
235
+
236
+ // Iterate through each row
237
+ rows . forEach ( row => {
238
+ // Get the "Replies" and "Views" cells
239
+ const repliesCell = row . querySelector ( 'td.posts' ) ;
240
+ const viewsCell = row . querySelector ( 'td.views' ) ;
241
+
242
+ // Check if both cells are present
243
+ if ( repliesCell && viewsCell ) {
244
+ // Create a new cell to combine the information
245
+ const combinedCell = document . createElement ( 'td' ) ;
246
+ combinedCell . className = 'num topic-list-data combined-views' ; // Add class for styling if needed
247
+
248
+ combinedCell . innerHTML = `
249
+ <div class="combined-views-container">
250
+ <span class="combined-views-label">Views:</span>
251
+ <span class="combined-views-number">${ viewsCell . innerText } </span>
252
+ </div>
253
+ <div class="combined-views-container">
254
+ <span class="combined-views-label">Replies:</span>
255
+ <span class="combined-views-number">${ repliesCell . innerText } </span>
256
+ </div>
257
+ ` ;
258
+
259
+ // Insert the combined cell after the Replies cell
260
+ repliesCell . parentNode . insertBefore ( combinedCell , repliesCell ) ;
261
+
262
+ // Remove the original "Replies" and "Views" cells
263
+ repliesCell . remove ( ) ;
264
+ viewsCell . remove ( ) ;
265
+ }
266
+ } ) ;
267
+
268
+ // Modify the header to have a single "Views" column
269
+ const repliesHeader = document . querySelector ( 'th.posts' ) ;
270
+ const viewsHeader = document . querySelector ( 'th.views' ) ;
271
+ if ( repliesHeader && viewsHeader ) {
272
+ repliesHeader . textContent = 'Views' ; // Set the new header title
273
+ viewsHeader . remove ( ) ; // Remove the "Views" header
274
+ }
275
+ }
276
+
216
277
function FixPostActivityTime ( )
217
278
{
218
279
document . querySelectorAll ( '.relative-date' ) . forEach ( function ( el )
0 commit comments