Quicker Backloggd log

Replaces the Backlog button with the Edit Log button when you are on your own profile.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Quicker Backloggd log
// @namespace    NormalDream
// @version      0.1
// @description  Replaces the Backlog button with the Edit Log button when you are on your own profile.
// @author       Normal Dream
// @copyright    2023 Normal Dream
// @license      MIT
// @match        https://www.backloggd.com/*
// @icon         https://www.backloggd.com/favicon.ico
// @grant        none
// @run-at       document-start
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';

    function runScript() {
        var profileAddress = "";
        $("a:contains('Profile')").filter(function() { return $(this).text() === "Profile"; }).each(function() { profileAddress = this.href; })

        if (window.location.href.startsWith(profileAddress)) {
            $('.quick-access-bar').each(function() {
                //var game_id = this.getAttribute('game_id');

                var container = this.getElementsByClassName('backlog-btn-container')[0];
                container.classList.remove('backlog-btn-container');
                container.removeAttribute('id');

                var button = container.getElementsByTagName('button')[0];
                button.classList.replace('mx-auto', 'quick-journal');
                button.dataset.tippyContent = "Edit Log";

                var icon = button.getElementsByTagName('i')[0];
                icon.classList.replace('fa-books', 'fa-book-open');

                button.replaceWith(button.cloneNode(true));
            });

            onmount();
        }
    }

    // Backloggd uses turbolinks, so the script is only called when the first page
    // is loaded. We use events to call it whenever we change page.
    document.addEventListener('turbolinks:load', function() {
        runScript();
    });
    document.addEventListener('load', function() {
        runScript();
    });
})();