Quicker Backloggd log

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();
    });
})();