FIMFiction UserScripts 383 members · 0 stories
Comments ( 17 )
  • Viewing 1 - 50 of 17
arcum42
Group Admin

Just a fairly simple userscript that I thought I’d post.

This script simply makes it so that clicking on the Groups button now takes you to the recent threads page, which is where you want to go 90% of the time anyways. In addition, it replaces the "Recent Threads" link with "All Groups", and removes the now unnecessary divider.

This one requires greasemonkey or tampermonkey to install, and is located here.

Here's the current version:

// ==UserScript==
// @name         Fimfiction - Group Button Shows Recent Threads
// @namespace    arcum42
// @version      0.2
// @description  Changes the Group button to default to the Recent Threads page.
// @author       arcum42
// @match        https://www.fimfiction.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    
    // Text plus group icon
    var allGroupsText = `<i class="fa fa-group"></i>All Groups`;

    // Grab the first match for all of the following buttons with css.
    var mainGroup = document.querySelector(".user_toolbar a[href='/groups']");
    var groupThreads = document.querySelector(".user_toolbar a[href='/groups/threads']");
    var groupDiv = document.querySelector(".user_toolbar li.divider");

    // Swap the urls for the buttons in question.
    mainGroup.href = "/groups/threads";
    groupThreads.href = "/groups";

    // Remove the divider to make it look nicer, and rename "Recent Threads" to "All Groups" with an appropriate icon.
    groupDiv.remove();
    groupThreads.innerHTML = allGroupsText;

})();

--arcum42

arcum42
Group Admin

5980083
I’ve accidentally clicked on the wrong button so many times now...

--arcum42

5980085
Exactly. I never saw the point of having the groups button take you anywhere else. You click on it because you want to see the threads for the groups you’re in.

arcum42
Group Admin

5980087
Yeah, and if you click on “My Groups”, you can just change “joined” on the right to “-”, hit search, and you are back at the main groups page, so you don’t really need a second button for it. I was thinking of also adding another item to the menu for it, but I’m not sure it’s necessary.

--arcum42

5980088
Yup. Though, I was still hoping that by loading the old CSS file in, I’d be able to quickly revert the entire site. Unfortunately, enough of the main HTML seems to have been changed anyways. :ajsleepy:

arcum42
Group Admin

5980089
I’m actually good with a lot of things on the site post update. The biggest things for me were that the navigation bar looked better in green and mixed case for me, the group button, and the changes to the tags. I’d prefer them being mixed colors, and I don’t really like the character tags being run together with the genre tags.

I like having a banned list, the codeblocks (though the code color formatting keeps breaking), the much better word count, being able to paste rich text into the comments and having it reformat as bbcode, the speed increase, etc. Overall, I’m positive about the update, there are were just a bunch of little things detracting from it...

But then, fixing all those little things to your satisfaction is what userscripts are all about. :pinkiehappy:

--arcum42

5980081
You got me to put Tampermonkey/Greasemonkey back in. Kudos.

arcum42
Group Admin

5980125
Thanks! This update basically got me to start back up with tampermonkey and stylish, since I hadn’t bothered to reinstall any scripts in quite a while.

--arcum42

knighty
Site Owner

I came here to say “don’t forget you can put a language for code blocks” which lead me to putting it on yours and then spending the next hour fixing a bug with the highlighting stuff...

So uh...don’t forget you can put a language for code blocks!

You might want to change the selector to:

.user_toolbar a[href='/groups']
arcum42
Group Admin

5980206
Yeah, I’ll admit I actually put javascript in for the language originally, then took it off when it didn’t display properly. Otherwise, I do like the syntax highlighting and would have used it. (Is there a list of languages it accepts anywhere?)

I’ll see if I can change the selector. I’m trying to see if I can avoid jquery, and I doubt getElementsByClassName would accept that. I’m feeling a bit rusty of javascript and css at the moment. Of course, actually using them is usually the best fix for that...

--arcum42

5981126
Dusted off my javascript skills (ie I googled a bunch) and made some improvements, including repurposing the (now duplicate) recent threads button to go to the all groups page.

I did have to kludge it a bit as it was picking up some of the hidden mobile site elements and there was no easy way to discern between them and the desktop elements.

// ==UserScript==
// @name         Fimfiction - Group Button Shows Recent Threads
// @namespace    arcum42
// @version      0.2
// @description  Changes the Group button to default to the Recent Threads page.
// @author       You
// @match        https://www.fimfiction.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

//select buttons
var anchors = document.getElementsByTagName('A');
var groupsButtons = [], threadsButtons = [];
var groupsPattern = /:\/\/[^\/]*\/groups$/i;
var threadsPattern = /\/groups\/threads$/i;
for (var i = 0; i < anchors.length; i++) {
  if (groupsPattern.test(anchors[i].href)) {
    groupsButtons.push(anchors[i]);
  }
  if (threadsPattern.test(anchors[i].href)) {
    threadsButtons.push(anchors[i]);
  }
}
//swap buttons
for(i = 0; i < groupsButtons.length; i++) {
  groupsButtons[i].href = "/groups/threads";
}
for(i = 0; i< threadsButtons.length; i++) {
  threadsButtons[i].href = "/groups";
  for (var j = 0; j < threadsButtons[i].childNodes.length; j++) {
    if(threadsButtons[i].childNodes[j].nodeType == Node.TEXT_NODE) {
      threadsButtons[i].childNodes[j].nodeValue = "All Groups";
    }
  }
}
})();[/code]
arcum42
Group Admin

5981184

I'm planning on taking a look at this, but keep getting distracted. The change overall sounds good, but I'll want to mess with it for a bit. I'd rather get it to point more specifically at the buttons and links in question, for example, if I can figure out a way.

--arcum42

arcum42
Group Admin

5981184
As it happens, I ended up just rewriting my version instead. :scootangel:

See the first post for the current version, which also redoes the Recent Threads link to be All Groups, and uses the selector 5980206 mentioned, now that I know how to select by css instead of element names without jQuery.

--arcum42

5985737

Ooh, nice. That's much more elegant.

arcum42
Group Admin

5985742
Thanks. My original version, I'd pretty much thrown together based on a code example, and hadn't even bothered to rename the variable. :unsuresweetie:

Using "for (x in tags)" would've looked better for looking through a collection, honestly. I poked around and found I can use querySelector and querySelectorAll to find what I need by css, and since in this case, I really only need the first result, I just went with querySelector, though.

I also wanted to make sure I got the icon swap in there. Of course, I could potentially have just deleted the whole menu and rebuilt it. I'll admit playing with this stuff almost makes me want to add a new menu just for fun. I've got no idea what I'd want to add, otherwise I'd think about it.

One thing that did help is that I'm not very worried about breaking old browsers, since they probably wouldn't be able to display fimfiction these days anyways...

--arcum42

  • Viewing 1 - 50 of 17