Greasy Fork

Fimfiction - Group Button Shows Recent Threads

Changes the Group button to default to the Recent Threads page.

目前为 2017-06-13 提交的版本。查看 最新版本

// ==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 dividor to make it look nicer, and rename "Recent Threads" to "All Groups" with an appropriate icon.
    groupDiv.remove();
    groupThreads.innerHTML = allGroupsText;

})();