GC - Kad Fed Notification

Displays a notification when youve fed a kad

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         GC - Kad Fed Notification
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Displays a notification when youve fed a kad
// @author       Dani (but really mandi)
// @match        https://www.grundos.cafe/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none

// @require      http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==

// get the current page since we use this a lot
const CURRENT_PAGE = window.location.pathname;

const THEME2004 = $('img[src*="/04/"]').length > 0 ? true : false;

 let currentUser = THEME2004 ? $('td.tl a[href^="/userlookup/?"]').text() : $('td.tt a[href^="/userlookup/?"]').text();
(function() {

    'use strict';
    // show message at the top of the page if you've already fed a kad
    if ('/games/kadoatery/' == CURRENT_PAGE) {
        let kad = $('p:contains("Thanks, ' + currentUser + '!")');
        if ( kad.length > 0) {
            let kadName = kad.parent().find('b:first-of-type').text();
            kadName = kadName.split(currentUser)[0]
            $('b:contains("The Kadoatery")').parent().parent().prepend(`<div id="alreadyFedKad" style="padding:5px;background-color:pink;"><center>You already fed "${kadName}"</center></div>`);
        }
    }
    // Your code here...
})();