• The site has now migrated to Xenforo 2. If you see any issues with the forum operation, please post them in the feedback thread.
  • Due to issues with external spam filters, QQ is currently unable to send any mail to Microsoft E-mail addresses. This includes any account at live.com, hotmail.com or msn.com. Signing up to the forum with one of these addresses will result in your verification E-mail never arriving. For best results, please use a different E-mail provider for your QQ address.
  • For prospective new members, a word of warning: don't use common names like Dennis, Simon, or Kenny if you decide to create an account. Spammers have used them all before you and gotten those names flagged in the anti-spam databases. Your account registration will be rejected because of it.
  • Since it has happened MULTIPLE times now, I want to be very clear about this. You do not get to abandon an account and create a new one. You do not get to pass an account to someone else and create a new one. If you do so anyway, you will be banned for creating sockpuppets.
  • Due to the actions of particularly persistent spammers and trolls, we will be banning disposable email addresses from today onward.
  • The rules regarding NSFW links have been updated. See here for details.

SB/SV/QQ Thread-Starter Highlighter Userscript

Imagination

Getting some practice in, huh?
Joined
Aug 25, 2014
Messages
7
Likes received
11
Hey guys. I don't come around here all too often, and when I do I pretty much just lurk, but given the shift to XenForo from the mess we had before I had the idea to modify ElDani's userscript to work over here too.

Here's the link, just click the green "Install this script" button and it should be added to your browser. You'll need Greasemonkey or Tampermonkey (or something similar) to run it.

To change the highlight colour, change the hexidecimal values from lines 46-69 as desired. Here's a good colour-picker to help you get the right codes and colours. (I recommended customising those to your preference)
These lines specify the colour used for each theme.
Code:
var highlightColor = new Array();
highlightColor[0] = new Array();
highlightColor[0][2] = "#152E18"; // SB: SpaceBattles.com
highlightColor[0][4] = "#152E18"; // SB: Flexile Dark Standalone
highlightColor[0][6] = "#F5F6CE"; // SB: XenForo Default Style
highlightColor[1] = new Array();
highlightColor[1][1] = "#F5F6CE"; // SV: Default Style
highlightColor[1][2] = "#152E18"; // SV: Flexile Dark
highlightColor[1][3] = "#152E18"; // SV: Flexile Gold
highlightColor[1][5] = "#152E18"; // SV: Dark Wide
highlightColor[1][6] = "#152E18"; // SV: Gold Fixed
highlightColor[1][7] = "#424242"; // SV: Space
highlightColor[1][11] = "#152E18"; // SV: FlexileSpace
highlightColor[2] = new Array();
highlightColor[2][1] = "#F5F6CE"; // QQ: XenForo Default Style
highlightColor[2][2] = "#152E18"; // QQ: Blackend
highlightColor[2][3] = "#152E18"; // QQ: Blackend-Blue
highlightColor[2][4] = "#152E18"; // QQ: Blackend-Green
highlightColor[2][5] = "#152E18"; // QQ: Blackend-Purple
highlightColor[2][8] = "#152E18"; // QQ: Flexile Dark
highlightColor[2][9] = "#152E18"; // QQ: Dark Responsive (Green)
highlightColor[2][10] = "#152E18"; // QQ: Dark Responsive High Contrast
highlightColor[2][14] = "#F5F6CE"; // QQ: Light Responsive
highlightColor[2][18] = "#152E18"; // QQ: UI.X Dark
highlightColor[2][20] = "#152E18"; // QQ: UI.X Dark (Mobile)
highlightColor[2][21] = "#F5F6CE"; // QQ: UI.X Light

To change the highlight colour of the xenforo default style, you would go to this line
Code:
highlightColor[2][1] = "#F5F6CE"; // QQ: XenForo Default Style
and change the "#F5F6CE" to a different value. This is a hexidecimal value, so remember to keep the #.
I personally use "#080808", a very dark grey—almost black—for a more subtle effect, but I felt that I should keep the original colours intact.

His original thread is here and the description is shown below, and still holds.
ElDani said:
Hey guys,
I've been a long-time lurker over at SB and my daily contribution was clicking half a dozen likes on posts in the creative writing forums. Since finding the story bits in long threads without an index is quite a bit of work - the previous suggestion was to use the browser-search for the username of the thread-starter - I had created a userscript for my own use, which would not only inform me of any posts by the thread-starter/author on each page, but also highlight his or her posts.
If you want to know what I'm talking about, you can see what the script does in screengrabs I have made of a random SpaceBattles.com and SufficientVelocity.com forum thread. Once the page has finished loading, the script displays a line "x number of posts by the thread starter on this page" or alternatively that there were none. It also changes the background-color of those posts to one that is recognizable when scrolling through.

The userscript, called SB/SV Thread-Starter Highlighter, can be installed with a click on the "Install" button on the top right of the linked userscripts.org page. I've tested it in the latest Firefox with the latest Greasemonkey and the latest Chrome with the latest Tampermonkey. It is uncomplicated enough, that it should work on virtually all configurations of browsers which support userscripts.

Instructions for changing the highlight color: open the script file (in Greasemonkey this works by right-clicking on the script - and clicking edit, if you're doing it from the management tab), go to lines 40-50 and change the HTML color code for each style on SB or SV.

Note: this script works entirely on the client-side and doesn't impact the forum integrity in any way. It doesn't add any HTTP requests, it doesn't sniff out any of your data and it is in no way dangerous to use. While I don't think that there are any bugs left, don't hesitate to ask for a fix. Furthermore, this script should in theory work on all forums using XenForo, with likely only minimal adjustments (see site variable and possibly the one regular expression). If you want to port this script to another forum you have not only my blessing but the right to do so due to the license chosen.
Code:
// ==UserScript==
// @name SB/SV/QQ Thread-Starter Highlighter
// @namespace http://userscripts.org:8080/users/196962
// @description This is a userscript which highlights subsequent posts by the thread-starter in the SpaceBattles, Sufficient Velocity and Questionable Questing forums. It also displays a short information at the top of each page if a post by the thread-starter can be found on the current page.
// @author ElDani
// @contributor ApatheticImagination
// @version 1.1
// @license Creative Commons BY-NC-SA
// @include http*://forums.sufficientvelocity.com/threads/*
// @include http*://forums.spacebattles.com/threads/*
// @include http*://forum.questionablequesting.com/threads/*
// @encoding utf-8
// @grant none
// @history 1.0.6 added HTTPS support for SB and full support for Questionable Questing forum (ApatheticImagination)
// @history 1.0.5 added HTTPS support for SV (thanks NuitTombee)
// @history 1.0.4 fixed small bug, where wrong posts could be highlighted due to error in partial user name matching
// @history 1.0.3 added support for SV FlexileSpace style
// @history 1.0.2 fixed bug, where posts by staff on SB would not be highlighted
// @history 1.0.1 added option to choose highlight color by active forum style
// @history 1.0 initial public version
// ==/UserScript==
function LocalMain () {
if (window.top != window.self) {
//don't run on iFrames
return;
}
var site = -1;
if (document.URL.indexOf("spacebattles.com") > -1) site=0;
if (document.URL.indexOf("sufficientvelocity.com") > -1) site=1;
if (document.URL.indexOf("questionablequesting.com") > -1) site=2;
if (site == -1) return;
 
var style;
var rgxp_style = /<link.*?href="css.php\?css=xenforo,form,public&amp;style=(\d+)&amp;/i
var match = rgxp_style.exec(document.documentElement.outerHTML);
if (match != null) {
style = match[1];
} else {
return;
}
 
var highlightColor = new Array();
highlightColor[0] = new Array();
highlightColor[0][2] = "#152E18"; // SB: SpaceBattles.com
highlightColor[0][4] = "#152E18"; // SB: Flexile Dark Standalone
highlightColor[0][6] = "#F5F6CE"; // SB: XenForo Default Style
highlightColor[1] = new Array();
highlightColor[1][1] = "#F5F6CE"; // SV: Default Style
highlightColor[1][2] = "#152E18"; // SV: Flexile Dark
highlightColor[1][3] = "#152E18"; // SV: Flexile Gold
highlightColor[1][5] = "#152E18"; // SV: Dark Wide
highlightColor[1][6] = "#152E18"; // SV: Gold Fixed
highlightColor[1][7] = "#424242"; // SV: Space
highlightColor[1][11] = "#152E18"; // SV: FlexileSpace
highlightColor[2] = new Array();
highlightColor[2][1] = "#F5F6CE"; // QQ: XenForo Default Style
highlightColor[2][2] = "#152E18"; // QQ: Blackend
highlightColor[2][3] = "#152E18"; // QQ: Blackend-Blue
highlightColor[2][4] = "#152E18"; // QQ: Blackend-Green
highlightColor[2][5] = "#152E18"; // QQ: Blackend-Purple
highlightColor[2][8] = "#152E18"; // QQ: Flexile Dark
highlightColor[2][9] = "#152E18"; // QQ: Dark Responsive (Green)
highlightColor[2][10] = "#152E18"; // QQ: Dark Responsive High Contrast
highlightColor[2][14] = "#F5F6CE"; // QQ: Light Responsive
highlightColor[2][18] = "#152E18"; // QQ: UI.X Dark
highlightColor[2][20] = "#152E18"; // QQ: UI.X Dark (Mobile)
highlightColor[2][21] = "#F5F6CE"; // QQ: UI.X Light
 
 
var starter;
var rgxp_starter = /started by <a href="(.*?)" class="username".*?>(.*?)<\/a>/i
var match = rgxp_starter.exec(document.documentElement.outerHTML);
if (match != null) {
starter = match[2];
} else {
return;
}
var messageList = document.getElementsByClassName("messageList");
var messages = messageList[0].getElementsByTagName("LI");
var nr_messages = messages.length;
var username;
var starter_posts = 0;
for(var i=0; i<nr_messages; i++) {
username = messages[i].getElementsByClassName("username");
if(username[0] && (starter == username[0].innerHTML || username[0].innerHTML.indexOf('>'+starter+'<') > -1)) {
messages[i].style.backgroundColor=highlightColor[site][style];
messages[i].getElementsByClassName("primaryContent")[0].style.backgroundColor=highlightColor[site][style];
if(messages[i].getElementsByClassName("secondaryContent").length>0) {
messages[i].getElementsByClassName("secondaryContent")[0].style.backgroundColor=highlightColor[site][style];
}
starter_posts++;
}
}
var add_html = document.getElementById("pageDescription").innerHTML;
if(starter_posts>0) {
add_html = add_html+" <strong>"+starter_posts+"</strong> post(s) by thread starter on this page!";
} else {
add_html = add_html+" No posts by thread starter on this page.";
}
document.getElementById("pageDescription").innerHTML = add_html;
}
window.addEventListener ("load", LocalMain, false);

If you find anything wrong, or any bugs, tell me here and I'll try to fix 'em up.
 
The script has since been updated to be compatible with the new themes from SB, SV, and here. Download link remains the same: SB/SV/QQ Thread-Starter Highlighter

One user reported that the script doesn't seem to work for non-UI themes over here, but that's a bug I couldn't replicate on my end. If anyone else is still experiencing that, leave a comment here with info and I'll see if I can get to the bottom of it.
 

Users who are viewing this thread

Back
Top